Skip to content

Commit

Permalink
Run "nix-store --optimise" before packaging in mkEnvTgz
Browse files Browse the repository at this point in the history
  • Loading branch information
vog committed Nov 27, 2024
1 parent 7f7380f commit a5b51df
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,21 @@ let
exportReferencesGraph = [ "refs" env ];
}
''
mkdir -p .envroot/nix/store
mkdir -p tmp/.envroot/nix/store
cat ${closure} | while read dep; do
cp -a $dep .envroot/nix/store/
cp -a $dep tmp/.envroot/nix/store/
done
mkdir -p tmp/.envroot/nix/var/nix
cat refs >tmp/.envroot/nix/var/nix/db-refs
ln -sf .envroot${env} tmp/env
./tmp/env nix-store --optimise
chmod -R u+w tmp/.envroot/nix/store/.links
rm -rf tmp/.envroot/nix/store/.links
mkdir -p .envroot/nix
mv tmp/.envroot/nix/store .envroot/nix/
mv tmp/env ./
mkdir -p .envroot/nix/var/nix
cat refs >.envroot/nix/var/nix/db-refs
ln -sf .envroot${env} env
tar c --sort=name --owner 0 --group 0 --numeric-owner --mtime=@1 -- .envroot env | gzip -9n >$out
'';
bootstrapEnvTgz = mkEnvTgz {
Expand Down

0 comments on commit a5b51df

Please sign in to comment.