Fix 'nix flake init'

This commit is contained in:
Eelco Dolstra 2019-10-15 19:53:29 +02:00
parent 7d38060a0d
commit 14a89aa8cd
2 changed files with 9 additions and 8 deletions

View file

@ -1,15 +1,11 @@
{ {
name = "hello";
description = "A flake for building Hello World"; description = "A flake for building Hello World";
epoch = 201906; edition = 201909;
requires = [ "nixpkgs" ]; outputs = { self, nixpkgs }: {
provides = deps: rec { packages.x86_64-linux.hello = nixpkgs.packages.x86_64-linux.hello;
packages.hello = deps.nixpkgs.provides.packages.hello;
}; };
} }

View file

@ -36,6 +36,9 @@ cat > $flake1Dir/flake.nix <<EOF
outputs = inputs: rec { outputs = inputs: rec {
packages.$system.foo = import ./simple.nix; packages.$system.foo = import ./simple.nix;
defaultPackage.$system = packages.$system.foo; defaultPackage.$system = packages.$system.foo;
# To test "nix flake init".
packages.x86_64-linux.hello = import ./simple.nix;
}; };
} }
EOF EOF
@ -339,8 +342,10 @@ nix flake pin --flake-registry $registry flake1
nix flake remove --flake-registry $registry flake1 nix flake remove --flake-registry $registry flake1
(( $(nix flake list --flake-registry $registry | wc -l) == 5 )) (( $(nix flake list --flake-registry $registry | wc -l) == 5 ))
# Test 'nix flake init'.
(cd $flake7Dir && nix flake init) (cd $flake7Dir && nix flake init)
nix flake --flake-registry $registry check $flake3Dir git -C $flake7Dir add flake.nix
nix flake --flake-registry $registry check $flake7Dir
rm -rf $TEST_ROOT/flake1-v2 rm -rf $TEST_ROOT/flake1-v2
nix flake clone --flake-registry $registry flake1 $TEST_ROOT/flake1-v2 nix flake clone --flake-registry $registry flake1 $TEST_ROOT/flake1-v2