mirror of
https://github.com/NixOS/nix
synced 2025-07-07 06:01:48 +02:00
Turn flake inputs into an attrset
Instead of a list, inputs are now an attrset like inputs = { nixpkgs.uri = github:NixOS/nixpkgs; }; If 'uri' is omitted, than the flake is a lookup in the flake registry, e.g. inputs = { nixpkgs = {}; }; but in that case, you can also just omit the input altogether and specify it as an argument to the 'outputs' function, as in outputs = { self, nixpkgs }: ... This also gets rid of 'nonFlakeInputs', which are now just a special kind of input that have a 'flake = false' attribute, e.g. inputs = { someRepo = { uri = github:example/repo; flake = false; }; };
This commit is contained in:
parent
0588d72286
commit
30ccf4e52d
7 changed files with 136 additions and 220 deletions
|
@ -240,10 +240,13 @@ cat > $flake3Dir/flake.nix <<EOF
|
|||
|
||||
edition = 201909;
|
||||
|
||||
inputs = [ "flake1" "flake2" ];
|
||||
|
||||
nonFlakeInputs = {
|
||||
nonFlake = "$nonFlakeDir";
|
||||
inputs = {
|
||||
flake1 = {};
|
||||
flake2 = {};
|
||||
nonFlake = {
|
||||
uri = "$nonFlakeDir";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
description = "Fnord";
|
||||
|
@ -306,23 +309,24 @@ cat > $flake3Dir/flake.nix <<EOF
|
|||
|
||||
edition = 201909;
|
||||
|
||||
inputs = [ "flake1" "flake2" ];
|
||||
|
||||
nonFlakeInputs = {
|
||||
nonFlake = "$nonFlakeDir";
|
||||
inputs = {
|
||||
nonFlake = {
|
||||
uri = "$nonFlakeDir";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
description = "Fnord";
|
||||
|
||||
outputs = inputs: rec {
|
||||
packages.sth = inputs.flake1.packages.foo;
|
||||
outputs = { self, flake1, flake2, nonFlake }: rec {
|
||||
packages.sth = flake1.packages.foo;
|
||||
packages.fnord =
|
||||
with import ./config.nix;
|
||||
mkDerivation {
|
||||
inherit system;
|
||||
name = "fnord";
|
||||
buildCommand = ''
|
||||
cat \${inputs.nonFlake}/README.md > \$out
|
||||
cat \${nonFlake}/README.md > \$out
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue