72 lines
1.7 KiB
Nix
72 lines
1.7 KiB
Nix
let
|
|
inherit
|
|
(builtins)
|
|
currentSystem
|
|
fromJSON
|
|
readFile
|
|
;
|
|
|
|
# Copied from https://github.com/edolstra/flake-compat/pull/44/files
|
|
fetchurl = {
|
|
url,
|
|
sha256,
|
|
}:
|
|
derivation {
|
|
builder = "builtin:fetchurl";
|
|
|
|
name = "source";
|
|
inherit url;
|
|
|
|
outputHash = sha256;
|
|
outputHashAlgo = "sha256";
|
|
outputHashMode = "recursive";
|
|
executable = false;
|
|
unpack = false;
|
|
|
|
system = "builtin";
|
|
|
|
# No need to double the amount of network traffic
|
|
preferLocalBuild = true;
|
|
|
|
impureEnvVars = [
|
|
# We borrow these environment variables from the caller to allow
|
|
# easy proxy configuration. This is impure, but a fixed-output
|
|
# derivation like fetchurl is allowed to do so since its result is
|
|
# by definition pure.
|
|
"http_proxy"
|
|
"https_proxy"
|
|
"ftp_proxy"
|
|
"all_proxy"
|
|
"no_proxy"
|
|
];
|
|
|
|
# To make "nix-prefetch-url" work.
|
|
urls = [url];
|
|
};
|
|
|
|
getFlake = name:
|
|
with (fromJSON (readFile ./flake.lock)).nodes.${name}.locked; {
|
|
inherit rev;
|
|
outPath = fetchTarball {
|
|
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
|
|
sha256 = narHash;
|
|
};
|
|
};
|
|
getRawFlake = name:
|
|
with (fromJSON (readFile ./flake.lock)).nodes.${name}.locked; {
|
|
inherit rev;
|
|
outPath = fetchurl {
|
|
inherit url;
|
|
sha256 = narHash;
|
|
};
|
|
};
|
|
in
|
|
{
|
|
system ? currentSystem,
|
|
pkgs ? import (getFlake "nixpkgs") {localSystem = {inherit system;};},
|
|
lib ? pkgs.lib,
|
|
fenix ? import (getFlake "fenix") {inherit pkgs;},
|
|
rust-manifest ? getRawFlake "rust-manifest",
|
|
}:
|
|
{} // import ./pkgs {inherit pkgs lib fenix rust-manifest;}
|