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
9 changes: 7 additions & 2 deletions modules/options/prune-lock.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ let
pkgs:
pkgs.writeShellApplication {
name = "prune-lock";
runtimeInputs = [ pkgs.diffutils ];
text = ''
nix flake metadata > /dev/null
${prune-cmd pkgs} flake.lock pruned.lock
mv pruned.lock flake.lock
if cmp -s flake.lock pruned.lock; then
rm pruned.lock
else
mv pruned.lock flake.lock
fi
nix flake metadata > /dev/null
'';
};

Expand Down
5 changes: 4 additions & 1 deletion modules/write-flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,12 @@ let
pkgs.writeShellApplication {
name = "write-flake";
meta.description = "Generate a flake.nix file";
runtimeInputs = [ pkgs.diffutils ];
text = ''
cd ${config.flake-file.intoPath}
cat ${formatted pkgs} > flake.nix
if ! cmp -s ${formatted pkgs} flake.nix; then
cat ${formatted pkgs} > flake.nix
fi
${hooks}
'';
};
Expand Down
Loading