parent
c9951e3774
commit
4a65c60a29
2 changed files with 11 additions and 3 deletions
|
@ -6,7 +6,6 @@
|
|||
}: let
|
||||
sshdTmpDirectory = "${config.user.home}/sshd-tmp";
|
||||
sshdDirectory = "${config.user.home}/sshd";
|
||||
pathToPubKey = "/mnt/sdcard/Download/picard_host_key.pub";
|
||||
port = 8022;
|
||||
in {
|
||||
# Backup etc files instead of failing to activate generation if a file already exists in /etc
|
||||
|
@ -23,9 +22,16 @@ in {
|
|||
# Set your time zone
|
||||
time.timeZone = "Europe/Rome";
|
||||
|
||||
build.activation.sshd = ''
|
||||
build.activation.sshd = let
|
||||
keys = (builtins.import ../../lib).keys;
|
||||
inherit (keys) hosts users;
|
||||
in ''
|
||||
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents "${config.user.home}/.ssh"
|
||||
$DRY_RUN_CMD cat ${pathToPubKey} > "${config.user.home}/.ssh/authorized_keys"
|
||||
$DRY_RUN_CMD echo ${hosts.picard} > "${config.user.home}/.ssh/authorized_keys"
|
||||
$DRY_RUN_CMD echo ${hosts.sisko} >> "${config.user.home}/.ssh/authorized_keys"
|
||||
$DRY_RUN_CMD echo ${hosts.kirk} >> "${config.user.home}/.ssh/authorized_keys"
|
||||
$DRY_RUN_CMD echo ${users.ccr-ssh} >> "${config.user.home}/.ssh/authorized_keys"
|
||||
$DRY_RUN_CMD echo ${users.ccr-gpg} >> "${config.user.home}/.ssh/authorized_keys"
|
||||
|
||||
if [[ ! -d "${sshdDirectory}" ]]; then
|
||||
$DRY_RUN_CMD rm $VERBOSE_ARG --recursive --force "${sshdTmpDirectory}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue