Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions .github/workflows/flake-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
runs-on: ubuntu-latest
env:
NIX_PATH: "nixpkgs=https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"
# write-tack resolves refs via api.github.com; anonymous rate limits flake on shared runners
GITHUB_TOKEN: ${{ github.token }}
steps:
- uses: wimpysworld/nothing-but-nix@v10
- uses: cachix/install-nix-action@v31
Expand All @@ -58,6 +60,7 @@ jobs:
exclude:
- template: minimal
- template: flakeless-parts
- template: tack
steps:
- uses: wimpysworld/nothing-but-nix@v10
- uses: cachix/install-nix-action@v31
Expand Down Expand Up @@ -127,23 +130,34 @@ jobs:
cd templates/unflake
sed -i 's/# flake-file = import/flake-file = import/' default.nix
nix-shell . -A flake-file.sh --run 'write-unflake --verbose'
nixlock:
tack:
needs: [nix-fmt]
name: Check nixlock
name: Check tack
runs-on: ubuntu-latest
if: ${{ contains(github.event.pull_request.labels.*.name, 'nixlock') }}
if: ${{ contains(github.event.pull_request.labels.*.name, 'tack') }}
env:
NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz"
GITHUB_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- uses: wimpysworld/nothing-but-nix@v10
- uses: cachix/install-nix-action@v31
- uses: DeterminateSystems/magic-nix-cache-action@main
# The tack template is lock-less (its flake.nix declares no inputs), so
# the generic template job cannot --override-input it. Instead the
# template's recomposable tackOverrides arg injects this checkout's
# flake-file, exercising the override path at the same time.
- run: |
set -e -o pipefail
cd templates/nixlock
sed -i 's/# flake-file = import/flake-file = import/' default.nix
nix-shell . -A flake-file.sh --run write-nixlock
cd templates/tack
local_flake_file='tackOverrides.flake-file = import ./../../modules;'
nix build -L --impure --expr "
((import ./.) { $local_flake_file }).packages.\${builtins.currentSystem}.write-tack
"
./result/bin/write-tack
git diff --exit-code .tack/pins.toml
nix build -L --impure --expr "
((import ./.) { $local_flake_file }).devShells.\${builtins.currentSystem}.default
"
dev:
needs: [bootstrap-minimal, bootstrap-tests, nix-fmt]
name: Check flake dev
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bootstrap-tests/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This means
- Your inputs follow a **typed Input Schema**.
- Your outputs can be defined on a **typed Output Schema** [example](templates/minimal/flake-file.nix).

> Despite the original flake-oriented name, it NOW also works on _stable Nix_, non-flakes environments via [npins](templates/npins), [unflake](templates/unflake), [nixlock](https://codeberg.org/FrdrCkII/nixlock)
> Despite the original flake-oriented name, it NOW also works on _stable Nix_, non-flakes environments via [npins](templates/npins), [unflake](templates/unflake)

<table><tr><td>

Expand All @@ -39,7 +39,7 @@ This means
- Incrementally add [flake-parts-builder](#parts_templates) templates.
- Pick flakeModules for different feature sets.
- [Dendritic](https://vic.github.io/dendrix/Dendritic.html) flake template.
- Works on stable Nix, [npins](templates/npins), [unflake](templates/unflake), [nixlock](templates/nixlock) environments.
- Works on stable Nix, [npins](templates/npins), [unflake](templates/unflake) environments.

</td><td>

Expand Down
93 changes: 24 additions & 69 deletions dev/_bootstrap-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -172,43 +172,6 @@ let
'';
};

test-nixlock-update = pkgs.writeShellApplication {
name = "test-nixlock-update";
runtimeInputs = [
(empty.flake-file.apps.write-nixlock pkgs)
];
text = ''
write-nixlock lock
grep empty ${outdir}/nixlock.lock.nix
write-nixlock update
grep empty ${outdir}/nixlock.lock.nix
'';
};

test-nixlock-update-one = pkgs.writeShellApplication {
name = "test-nixlock-update-one";
runtimeInputs = [
(empty.flake-file.apps.write-nixlock pkgs)
];
text = ''
write-nixlock lock
write-nixlock update empty
grep empty ${outdir}/nixlock.lock.nix
if write-nixlock update nonexistent 2>/dev/null; then exit 1; fi
'';
};

test-nixlock = pkgs.writeShellApplication {
name = "test-nixlock";
runtimeInputs = [
(empty.flake-file.apps.write-nixlock pkgs)
];
text = ''
write-nixlock
grep empty ${outdir}/nixlock.lock.nix
'';
};

test-write-lock-flake = pkgs.writeShellApplication {
name = "test-write-lock-flake";
runtimeInputs = [
Expand All @@ -230,21 +193,38 @@ let
];
text = ''
mkdir -p ${outdir}/npins
echo '{"pins":{},"version":7}' > ${outdir}/npins/sources.json
echo '{"pins":{},"version":8}' > ${outdir}/npins/sources.json
write-lock
jq -e '.pins | has("empty")' ${outdir}/npins/sources.json
'';
};

test-write-lock-nixlock = pkgs.writeShellApplication {
name = "test-write-lock-nixlock";
test-tack = pkgs.writeShellApplication {
name = "test-tack";
runtimeInputs = [
(empty.flake-file.apps.write-tack pkgs)
pkgs.jq
];
text = ''
write-tack
cat ${outdir}/.tack/pins.toml
grep github:vic/empty-flake ${outdir}/.tack/pins.toml
jq -e 'has("empty")' ${outdir}/.tack/pins.lock.json
[ -e ${outdir}/.tack/default.nix ]
'';
};

test-write-lock-tack = pkgs.writeShellApplication {
name = "test-write-lock-tack";
runtimeInputs = [
(empty.flake-file.apps.write-lock pkgs)
pkgs.jq
];
text = ''
echo '{ }' > ${outdir}/nixlock.lock.nix
mkdir -p ${outdir}/.tack
echo '{ }' > ${outdir}/.tack/pins.lock.json
write-lock
grep empty ${outdir}/nixlock.lock.nix
jq -e 'has("empty")' ${outdir}/.tack/pins.lock.json
'';
};

Expand All @@ -260,28 +240,6 @@ let
'';
};

test-nixlock-schemes = pkgs.writeShellApplication {
name = "test-nixlock-schemes";
runtimeInputs = [
(all-inputs-schemes.flake-file.apps.write-nixlock pkgs)
];
text = ''
write-nixlock
cat ${outdir}/nixlock.lock.nix
grep '"simple"' ${outdir}/nixlock.lock.nix
grep '"withBranch"' ${outdir}/nixlock.lock.nix
grep '"noflake"' ${outdir}/nixlock.lock.nix
grep '"gitHttps"' ${outdir}/nixlock.lock.nix
grep '"tarball"' ${outdir}/nixlock.lock.nix
grep '"tarballPlus"' ${outdir}/nixlock.lock.nix
grep '"fileHttps"' ${outdir}/nixlock.lock.nix
grep '"attrGh"' ${outdir}/nixlock.lock.nix
grep '"attrGhRef"' ${outdir}/nixlock.lock.nix
if grep '"followsSimple"' ${outdir}/nixlock.lock.nix; then exit 1; fi
grep vic/empty-flake ${outdir}/nixlock.lock.nix
'';
};

in
pkgs.mkShell {
buildInputs = [
Expand All @@ -293,13 +251,10 @@ pkgs.mkShell {
test-npins-skip
test-npins-follows
test-npins-transitive
test-nixlock
test-nixlock-update
test-nixlock-update-one
test-nixlock-schemes
test-tack
test-write-lock-flake
test-write-lock-npins
test-write-lock-nixlock
test-write-lock-tack
test-write-lock-unflake
];
}
35 changes: 16 additions & 19 deletions dev/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion dev/modules/formatter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"**/npins/default.nix" # generated by write-npins
"*.bash"
"docs/*"
"**/nixlock.lock.nix" # generated by write-nixlock
"**/.tack/default.nix" # generated by: tack init --resolver
"**/.tack/pins.toml" # generated by write-tack
"**/.tack/pins.lock.json" # generated by: tack update
];
};
};
Expand Down
Loading
Loading