keep dropbear host keys in /persist if it exists

This commit is contained in:
Daniel Barlow 2023-05-21 12:01:42 +01:00
parent f249c12bec
commit a48d51ffdc
2 changed files with 6 additions and 4 deletions

View file

@ -149,12 +149,14 @@ in rec {
run = "${pkgs.chrony}/bin/chronyd -f ${config} -d"; run = "${pkgs.chrony}/bin/chronyd -f ${config} -d";
}; };
services.sshd = longrun { services.sshd = longrun {
name = "sshd"; name = "sshd";
run = '' run = ''
mkdir -p /run/dropbear if test -d /persist; then
${dropbear}/bin/dropbear -E -P /run/dropbear.pid -R -F mkdir -p /persist/secrets/dropbear
ln -s /persist/secrets/dropbear /run
fi
${dropbear}/bin/dropbear -E -R -P /run/dropbear.pid -F
''; '';
}; };

View file

@ -32,7 +32,7 @@ in
in runCommand "make-jffs2" { in runCommand "make-jffs2" {
depsBuildBuild = [ mtdutils ]; depsBuildBuild = [ mtdutils ];
} '' } ''
mkdir -p $TMPDIR/empty/nix/store/ mkdir -p $TMPDIR/empty/nix/store/ $TMPDIR/empty/secrets
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
grafts=$(sed < ${systemConfiguration}/etc/nix-store-paths 's/^\(.*\)$/--graft \1:\1/g') grafts=$(sed < ${systemConfiguration}/etc/nix-store-paths 's/^\(.*\)$/--graft \1:\1/g')