commit 68ab6faeb3f9c1b9f63614372c2ca75355731974
parent 00aeb8181190a2f731ea48d52841898d70595778
Author: Daniel Barlow <dan@telent.net>
Date: Fri, 19 May 2023 23:53:29 +0100
write etc/nix-store-paths in systemConfiguration
Diffstat:
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/modules/jffs2.nix b/modules/jffs2.nix
@@ -5,7 +5,6 @@
, ...
}:
let
- inherit (pkgs) closureInfo;
inherit (lib) mkIf;
in
{
@@ -36,11 +35,7 @@ in
mkdir -p $TMPDIR/empty/nix/store/
cp ${systemConfiguration}/bin/activate $TMPDIR/empty/activate
ln -s ${pkgs.s6-init-bin}/bin/init $TMPDIR/empty/init
- pkgClosure=${closureInfo {
- rootPaths = [ systemConfiguration ];
- }}
- cp $pkgClosure/registration nix-path-registration
- grafts=$(sed < $pkgClosure/store-paths 's/^\(.*\)$/--graft \1:\1/g')
+ grafts=$(sed < ${systemConfiguration}/etc/nix-store-paths 's/^\(.*\)$/--graft \1:\1/g')
mkfs.jffs2 --compression-mode=size ${endian} -e ${config.hardware.flash.eraseBlockSize} --enable-compressor=lzo --pad --root $TMPDIR/empty --output $out $grafts --squash --faketime
'';
};
diff --git a/pkgs/systemconfig/default.nix b/pkgs/systemconfig/default.nix
@@ -8,6 +8,7 @@
writeText
, lib
, s6-init-bin
+, closureInfo
, stdenv
}:
let
@@ -61,7 +62,8 @@ let
}
'';
in attrset:
- stdenv.mkDerivation {
+ let makedevs = activateScript attrset;
+ in stdenv.mkDerivation {
name="make-stuff";
src = ./.;
@@ -69,11 +71,13 @@ in attrset:
LDFLAGS = "-static";
postConfigure = ''
- cp ${activateScript attrset} makedevs.c
+ cp ${makedevs} makedevs.c
'';
makeFlags = ["makedevs"];
installPhase = ''
- mkdir -p $out/bin
+ closure=${closureInfo { rootPaths = [ makedevs ]; }}
+ mkdir -p $out/bin $out/etc
+ cp $closure/store-paths $out/etc/nix-store-paths
$STRIP --remove-section=.note --remove-section=.comment --strip-all makedevs -o $out/bin/activate
ln -s ${s6-init-bin}/bin/init $out/bin/init
'';