write etc/nix-store-paths in systemConfiguration

This commit is contained in:
Daniel Barlow 2023-05-19 23:53:29 +01:00
parent 00aeb81811
commit 68ab6faeb3
2 changed files with 8 additions and 9 deletions

View file

@ -5,7 +5,6 @@
, ... , ...
}: }:
let let
inherit (pkgs) closureInfo;
inherit (lib) mkIf; inherit (lib) mkIf;
in in
{ {
@ -36,11 +35,7 @@ in
mkdir -p $TMPDIR/empty/nix/store/ mkdir -p $TMPDIR/empty/nix/store/
cp ${systemConfiguration}/bin/activate $TMPDIR/empty/activate cp ${systemConfiguration}/bin/activate $TMPDIR/empty/activate
ln -s ${pkgs.s6-init-bin}/bin/init $TMPDIR/empty/init ln -s ${pkgs.s6-init-bin}/bin/init $TMPDIR/empty/init
pkgClosure=${closureInfo { grafts=$(sed < ${systemConfiguration}/etc/nix-store-paths 's/^\(.*\)$/--graft \1:\1/g')
rootPaths = [ systemConfiguration ];
}}
cp $pkgClosure/registration nix-path-registration
grafts=$(sed < $pkgClosure/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 mkfs.jffs2 --compression-mode=size ${endian} -e ${config.hardware.flash.eraseBlockSize} --enable-compressor=lzo --pad --root $TMPDIR/empty --output $out $grafts --squash --faketime
''; '';
}; };

View file

@ -8,6 +8,7 @@
writeText writeText
, lib , lib
, s6-init-bin , s6-init-bin
, closureInfo
, stdenv , stdenv
}: }:
let let
@ -61,7 +62,8 @@ let
} }
''; '';
in attrset: in attrset:
stdenv.mkDerivation { let makedevs = activateScript attrset;
in stdenv.mkDerivation {
name="make-stuff"; name="make-stuff";
src = ./.; src = ./.;
@ -69,11 +71,13 @@ in attrset:
LDFLAGS = "-static"; LDFLAGS = "-static";
postConfigure = '' postConfigure = ''
cp ${activateScript attrset} makedevs.c cp ${makedevs} makedevs.c
''; '';
makeFlags = ["makedevs"]; makeFlags = ["makedevs"];
installPhase = '' 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 $STRIP --remove-section=.note --remove-section=.comment --strip-all makedevs -o $out/bin/activate
ln -s ${s6-init-bin}/bin/init $out/bin/init ln -s ${s6-init-bin}/bin/init $out/bin/init
''; '';