mirror of
https://github.com/NixOS/nix.git
synced 2024-11-21 14:22:29 +00:00
Add a utility function for creating/registering a simple flake
This commit is contained in:
parent
e1cb905aca
commit
4cafea7c7b
@ -4,15 +4,9 @@ source ./common.sh
|
||||
|
||||
TODO_NixOS
|
||||
|
||||
requireGit
|
||||
createFlake1
|
||||
|
||||
flake1Dir=$TEST_ROOT/flake1
|
||||
lockfileSummaryFlake=$TEST_ROOT/lockfileSummaryFlake
|
||||
|
||||
createGitRepo "$flake1Dir" ""
|
||||
createSimpleGitFlake "$flake1Dir"
|
||||
nix registry add --registry "$registry" flake1 "git+file://$flake1Dir"
|
||||
|
||||
createGitRepo "$lockfileSummaryFlake" "--initial-branch=main"
|
||||
|
||||
# Test that the --commit-lock-file-summary flag and its alias work
|
||||
|
@ -38,12 +38,21 @@ EOF
|
||||
}
|
||||
|
||||
createSimpleGitFlake() {
|
||||
requireGit
|
||||
local flakeDir="$1"
|
||||
writeSimpleFlake "$flakeDir"
|
||||
git -C "$flakeDir" add flake.nix simple.nix shell.nix simple.builder.sh config.nix
|
||||
git -C "$flakeDir" commit -m 'Initial'
|
||||
}
|
||||
|
||||
# Create a simple Git flake and add it to the registry as "flake1".
|
||||
createFlake1() {
|
||||
flake1Dir="$TEST_ROOT/flake1"
|
||||
createGitRepo "$flake1Dir" ""
|
||||
createSimpleGitFlake "$flake1Dir"
|
||||
nix registry add --registry "$registry" flake1 "git+file://$flake1Dir"
|
||||
}
|
||||
|
||||
writeDependentFlake() {
|
||||
local flakeDir="$1"
|
||||
cat > "$flakeDir/flake.nix" <<EOF
|
||||
|
@ -2,11 +2,8 @@
|
||||
|
||||
source ./common.sh
|
||||
|
||||
requireGit
|
||||
|
||||
repoDir="$TEST_ROOT/repo"
|
||||
createGitRepo "$repoDir"
|
||||
createSimpleGitFlake "$repoDir"
|
||||
createFlake1
|
||||
repoDir="$flake1Dir"
|
||||
|
||||
# Check that a flakeref without a query is accepted correctly.
|
||||
expectStderr 0 nix --offline build --dry-run "git+file://$repoDir#foo"
|
||||
|
@ -2,12 +2,7 @@
|
||||
|
||||
source ./common.sh
|
||||
|
||||
requireGit
|
||||
|
||||
flake1Dir=$TEST_ROOT/flake1
|
||||
|
||||
createGitRepo "$flake1Dir"
|
||||
createSimpleGitFlake "$flake1Dir"
|
||||
createFlake1
|
||||
|
||||
export EDITOR=cat
|
||||
nix edit "$flake1Dir#" | grepQuiet simple.builder.sh
|
||||
|
@ -4,15 +4,9 @@ source ./common.sh
|
||||
|
||||
TODO_NixOS
|
||||
|
||||
requireGit
|
||||
createFlake1
|
||||
|
||||
flake1Dir=$TEST_ROOT/flake1
|
||||
scriptDir=$TEST_ROOT/nonFlake
|
||||
|
||||
createGitRepo "$flake1Dir" ""
|
||||
createSimpleGitFlake "$flake1Dir"
|
||||
nix registry add --registry "$registry" flake1 "git+file://$flake1Dir"
|
||||
|
||||
mkdir -p "$scriptDir"
|
||||
|
||||
cat > "$scriptDir/shebang.sh" <<EOF
|
||||
|
Loading…
Reference in New Issue
Block a user