Skip to content

Commit

Permalink
nixos/make-ext4-fs: Use closureInfo
Browse files Browse the repository at this point in the history
exportReferencesGraph is deprecated and doesn't have the generated
initial Nix database contain the SHA256 of the contents of the store
paths, which breaks various things under Nix 2.0.
  • Loading branch information
dezgeg committed Apr 9, 2018
1 parent 8322981 commit 487be79
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions nixos/lib/make-ext4-fs.nix
Expand Up @@ -7,23 +7,22 @@
, volumeLabel
}:

let
sdClosureInfo = pkgs.closureInfo { rootPaths = storePaths; };
in

pkgs.stdenv.mkDerivation {
name = "ext4-fs.img";

nativeBuildInputs = with pkgs; [e2fsprogs libfaketime perl];

# For obtaining the closure of `storePaths'.
exportReferencesGraph =
map (x: [("closure-" + baseNameOf x) x]) storePaths;

buildCommand =
''
# Add the closures of the top-level store objects.
storePaths=$(perl ${pkgs.pathsFromGraph} closure-*)
storePaths=$(cat ${sdClosureInfo}/store-paths)
# Also include a manifest of the closures in a format suitable
# for nix-store --load-db.
printRegistration=1 perl ${pkgs.pathsFromGraph} closure-* > nix-path-registration
# Also include a manifest of the closures in a format suitable for nix-store --load-db.
cp ${sdClosureInfo}/registration nix-path-registration
# Make a crude approximation of the size of the target image.
# If the script starts failing, increase the fudge factors here.
Expand Down

0 comments on commit 487be79

Please sign in to comment.