1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 19:01:16 +02:00

Fix shellcheck lints

This commit is contained in:
silvanshade 2025-02-03 17:47:37 -07:00
parent c73096ba5f
commit 137ba71f02
No known key found for this signature in database

View file

@ -6,14 +6,14 @@ requireGit
create_flake() { create_flake() {
local flakeDir="$1" local flakeDir="$1"
createGitRepo $flakeDir createGitRepo "$flakeDir"
cat > $flakeDir/flake.nix <<EOF cat > "$flakeDir/flake.nix" <<EOF
{ {
outputs = { self }: { x = 2; }; outputs = { self }: { x = 2; };
} }
EOF EOF
git -C $flakeDir add flake.nix git -C "$flakeDir" add flake.nix
git -C $flakeDir commit -m Initial git -C "$flakeDir" commit -m Initial
} }
test_symlink_points_to_flake() { test_symlink_points_to_flake() {
@ -34,15 +34,15 @@ test_symlink_points_to_flake_in_subdir
test_symlink_points_to_dir_in_repo() { test_symlink_points_to_dir_in_repo() {
local repoDir="$TEST_ROOT/flake1" local repoDir="$TEST_ROOT/flake1"
createGitRepo $repoDir createGitRepo "$repoDir"
mkdir -p "$repoDir/subdir" mkdir -p "$repoDir/subdir"
cat > $repoDir/subdir/flake.nix <<EOF cat > "$repoDir/subdir/flake.nix" <<EOF
{ {
outputs = { self }: { x = 2; }; outputs = { self }: { x = 2; };
} }
EOF EOF
git -C $repoDir add subdir/flake.nix git -C "$repoDir" add subdir/flake.nix
git -C $repoDir commit -m Initial git -C "$repoDir" commit -m Initial
ln -sn "$TEST_ROOT/flake1/subdir" "$TEST_ROOT/flake1_sym" ln -sn "$TEST_ROOT/flake1/subdir" "$TEST_ROOT/flake1_sym"
[[ $(nix eval "$TEST_ROOT/flake1_sym#x") = 2 ]] [[ $(nix eval "$TEST_ROOT/flake1_sym#x") = 2 ]]
rm -rf "$TEST_ROOT/flake1" "$TEST_ROOT/flake1_sym" rm -rf "$TEST_ROOT/flake1" "$TEST_ROOT/flake1_sym"
@ -51,22 +51,22 @@ test_symlink_points_to_dir_in_repo
test_symlink_from_repo_to_another() { test_symlink_from_repo_to_another() {
local repoDir="$TEST_ROOT/repo1" local repoDir="$TEST_ROOT/repo1"
createGitRepo $repoDir createGitRepo "{$repoDir}"
echo "Hello" > $repoDir/file echo "Hello" > "$repoDir/file"
mkdir $repoDir/subdir mkdir "$repoDir/subdir"
cat > $repoDir/subdir/flake.nix <<EOF cat > "$repoDir/subdir/flake.nix" <<EOF
{ {
outputs = { self }: { x = builtins.readFile ../file; }; outputs = { self }: { x = builtins.readFile ../file; };
} }
EOF EOF
git -C $repoDir add subdir/flake.nix file git -C "$repoDir" add subdir/flake.nix file
git -C $repoDir commit -m Initial git -C "$repoDir" commit -m Initial
[[ $(nix eval "$TEST_ROOT/repo1/subdir#x") == \"Hello\\n\" ]] [[ $(nix eval "$TEST_ROOT/repo1/subdir#x") == \"Hello\\n\" ]]
local repo2Dir="$TEST_ROOT/repo2" local repo2Dir="$TEST_ROOT/repo2"
createGitRepo $repo2Dir createGitRepo "$repo2Dir"
ln -sn "$repoDir/subdir" "$repo2Dir/flake1_sym" ln -sn "$repoDir/subdir" "$repo2Dir/flake1_sym"
echo "World" > $repo2Dir/file echo "World" > "$repo2Dir/file"
git -C "$repo2Dir" add flake1_sym file git -C "$repo2Dir" add flake1_sym file
git -C "$repo2Dir" commit -m Initial git -C "$repo2Dir" commit -m Initial
[[ $(nix eval "$repo2Dir/flake1_sym#x") == \"Hello\\n\" ]] [[ $(nix eval "$repo2Dir/flake1_sym#x") == \"Hello\\n\" ]]