From a48d51ffdc8c2a38c36663535f126cb6d8c36e61 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sun, 21 May 2023 12:01:42 +0100 Subject: [PATCH] keep dropbear host keys in /persist if it exists --- examples/rotuer.nix | 8 +++++--- modules/jffs2.nix | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/rotuer.nix b/examples/rotuer.nix index 610b26b..22d78fd 100644 --- a/examples/rotuer.nix +++ b/examples/rotuer.nix @@ -149,12 +149,14 @@ in rec { run = "${pkgs.chrony}/bin/chronyd -f ${config} -d"; }; - services.sshd = longrun { name = "sshd"; run = '' - mkdir -p /run/dropbear - ${dropbear}/bin/dropbear -E -P /run/dropbear.pid -R -F + if test -d /persist; then + mkdir -p /persist/secrets/dropbear + ln -s /persist/secrets/dropbear /run + fi + ${dropbear}/bin/dropbear -E -R -P /run/dropbear.pid -F ''; }; diff --git a/modules/jffs2.nix b/modules/jffs2.nix index 031fedc..fdda2ab 100644 --- a/modules/jffs2.nix +++ b/modules/jffs2.nix @@ -32,7 +32,7 @@ in in runCommand "make-jffs2" { depsBuildBuild = [ mtdutils ]; } '' - mkdir -p $TMPDIR/empty/nix/store/ + mkdir -p $TMPDIR/empty/nix/store/ $TMPDIR/empty/secrets cp ${systemConfiguration}/bin/activate $TMPDIR/empty/activate ln -s ${pkgs.s6-init-bin}/bin/init $TMPDIR/empty/init grafts=$(sed < ${systemConfiguration}/etc/nix-store-paths 's/^\(.*\)$/--graft \1:\1/g')