mach-nix/mach_nix/nix/deps-db-and-fetcher.nix

36 lines
1.1 KiB
Nix
Raw Normal View History

{
2020-10-19 15:45:49 +00:00
pkgs ? import (import ./nixpkgs-src.nix) {},
pypi_deps_db_commit ? ((import ./flake-inputs.nix) "pypi-deps-db").rev,
pypi_deps_db_sha256 ? ((import ./flake-inputs.nix) "pypi-deps-db").sha256,
deps_db_src ? fetchTarball {
name = "pypi-deps-db-src";
url = "https://github.com/DavHau/pypi-deps-db/tarball/${pypi_deps_db_commit}";
sha256 = "${pypi_deps_db_sha256}";
}
}:
with pkgs.lib;
let
2020-10-19 15:45:49 +00:00
pypi_fetcher_commit = removeSuffix "\n" (readFile "${deps_db_src}/PYPI_FETCHER_COMMIT");
pypi_fetcher_sha256 = removeSuffix "\n" (readFile "${deps_db_src}/PYPI_FETCHER_SHA256");
pypi_fetcher_src = fetchTarball {
name = "nix-pypi-fetcher-src";
url = "https://github.com/DavHau/nix-pypi-fetcher/tarball/${pypi_fetcher_commit}";
sha256 = "${pypi_fetcher_sha256}";
};
2020-10-07 18:50:34 +00:00
pypi_fetcher = import pypi_fetcher_src {
inherit pkgs;
};
in
2021-05-23 07:01:06 +00:00
{
2021-06-08 12:18:13 +00:00
# needs to be wrapped in a real derivation otherwise nix-build is not allowed,
# which is required for debugging
pypi_deps_db_src = pkgs.runCommand "pypi-deps-db" {} ''
ln -s ${deps_db_src} $out
'';
2021-05-23 07:01:06 +00:00
inherit
2020-10-19 15:45:49 +00:00
pypi_fetcher_src
pypi_fetcher_commit
pypi_fetcher_sha256
pypi_fetcher;
}