Add tests for --registry and second arg for nix registry pin

This commit is contained in:
Alexander Bantyev 2021-07-02 16:10:57 +03:00
parent 811f3e8605
commit d8ad6f1c10
No known key found for this signature in database
GPG key ID: E081FF12ADCB4AD5

View file

@ -90,76 +90,14 @@ EOF
git -C $nonFlakeDir add README.md git -C $nonFlakeDir add README.md
git -C $nonFlakeDir commit -m 'Initial' git -C $nonFlakeDir commit -m 'Initial'
cat > $registry <<EOF # Construct a custom registry, additionally test the --registry flag
{ nix registry add --registry $registry flake1 git+file://$flake1Dir
"version": 2, nix registry add --registry $registry flake2 git+file://$flake2Dir
"flakes": [ nix registry add --registry $registry flake3 git+file://$flake3Dir
{ "from": { nix registry add --registry $registry flake4 flake3
"type": "indirect", nix registry add --registry $registry flake5 hg+file://$flake5Dir
"id": "flake1" nix registry add --registry $registry nixpkgs flake1
}, nix registry add --registry $registry templates git+file://$templatesDir
"to": {
"type": "git",
"url": "file://$flake1Dir"
}
},
{ "from": {
"type": "indirect",
"id": "flake2"
},
"to": {
"type": "git",
"url": "file://$flake2Dir"
}
},
{ "from": {
"type": "indirect",
"id": "flake3"
},
"to": {
"type": "git",
"url": "file://$flake3Dir"
}
},
{ "from": {
"type": "indirect",
"id": "flake4"
},
"to": {
"type": "indirect",
"id": "flake3"
}
},
{ "from": {
"type": "indirect",
"id": "flake5"
},
"to": {
"type": "hg",
"url": "file://$flake5Dir"
}
},
{ "from": {
"type": "indirect",
"id": "nixpkgs"
},
"to": {
"type": "indirect",
"id": "flake1"
}
},
{ "from": {
"type": "indirect",
"id": "templates"
},
"to": {
"type": "git",
"url": "file://$templatesDir"
}
}
]
}
EOF
# Test 'nix flake list'. # Test 'nix flake list'.
[[ $(nix registry list | wc -l) == 7 ]] [[ $(nix registry list | wc -l) == 7 ]]
@ -405,6 +343,8 @@ nix registry add flake1 flake3
[[ $(nix registry list | wc -l) == 8 ]] [[ $(nix registry list | wc -l) == 8 ]]
nix registry pin flake1 nix registry pin flake1
[[ $(nix registry list | wc -l) == 8 ]] [[ $(nix registry list | wc -l) == 8 ]]
nix registry pin flake1 flake3
[[ $(nix registry list | wc -l) == 8 ]]
nix registry remove flake1 nix registry remove flake1
[[ $(nix registry list | wc -l) == 7 ]] [[ $(nix registry list | wc -l) == 7 ]]