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