Skip to content

Commit b2f8e36

Browse files
committed
refactor: change subflake locking to an absolute git locking strategy for compatibility with nix 2.18+
1 parent 4177882 commit b2f8e36

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

.envrc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
#!/bin/sh
22

3-
# first time
4-
if [[ ! -d $(nix store add-path --name source --dry-run .) ]]; then
5-
nix store add-path --name source .
6-
(cd ./src/local && nix flake lock --update-input std)
7-
(cd ./src/tests && nix flake lock --update-input std)
8-
fi
3+
# This locks subflakes to the latest commit of std
4+
(cd ./src/local && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD))
5+
(cd ./src/tests && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD))
96

107
# shellcheck disable=SC1090
118
. "$(fetchurl "https://raw.githubusercontent.com/paisano-nix/direnv/main/lib" "sha256-IgQhKK7UHL1AfCUntJO2KCaIDJQotRnK2qC4Daxk+wI=")"
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# create the store path of
2-
nix store add-path --name source .
2+
nix store add --name source .
33

4-
# update the subflake lockfile to the (now existing) store path
5-
# set lastModified to 1 because unknown issues in the GH action environment
6-
(cd ./src/local && nix flake lock --update-input std && (
7-
jq '.nodes.std.locked.lastModified = 1' flake.lock > flake.lock.new && rm flake.lock && mv flake.lock.new flake.lock
8-
) && git add -f flake.lock)
9-
(cd ./src/tests && nix flake lock --update-input std && (
10-
jq '.nodes.std.locked.lastModified = 1' flake.lock > flake.lock.new && rm flake.lock && mv flake.lock.new flake.lock
11-
) &&git add -f flake.lock)
12-
# continue normally ...
4+
# This locks subflakes to the latest commit of std
5+
(cd ./src/local && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)&shallow=1)
6+
(cd ./src/tests && nix flake lock --override-input std git+file://$(pwd)/../..?rev=$(git -C ../.. rev-parse HEAD)&shallow=1)

0 commit comments

Comments
 (0)