parent
c9951e3774
commit
0fe6eb58a5
2 changed files with 29 additions and 7 deletions
|
@ -2,18 +2,18 @@
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
fleetFlake,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
sshdTmpDirectory = "${config.user.home}/sshd-tmp";
|
sshdTmpDirectory = "${config.user.home}/sshd-tmp";
|
||||||
sshdDirectory = "${config.user.home}/sshd";
|
sshdDirectory = "${config.user.home}/sshd";
|
||||||
pathToPubKey = "/mnt/sdcard/Download/picard_host_key.pub";
|
|
||||||
port = 8022;
|
port = 8022;
|
||||||
in {
|
in {
|
||||||
# Backup etc files instead of failing to activate generation if a file already exists in /etc
|
# Backup etc files instead of failing to activate generation if a file already exists in /etc
|
||||||
environment.etcBackupExtension = ".bak";
|
environment.etcBackupExtension = ".bak";
|
||||||
|
|
||||||
# Read the changelog before changing this value
|
# Read the changelog before changing this value
|
||||||
system.stateVersion = "23.11";
|
system.stateVersion = "24.05";
|
||||||
|
|
||||||
# Set up nix for flakes
|
# Set up nix for flakes
|
||||||
nix.extraOptions = ''
|
nix.extraOptions = ''
|
||||||
|
@ -23,9 +23,25 @@ in {
|
||||||
# Set your time zone
|
# Set your time zone
|
||||||
time.timeZone = "Europe/Rome";
|
time.timeZone = "Europe/Rome";
|
||||||
|
|
||||||
build.activation.sshd = ''
|
home-manager.config = {pkgs, ...}: {
|
||||||
|
home.stateVersion = "24.05";
|
||||||
|
_module.args = {
|
||||||
|
hostname = "janeway";
|
||||||
|
age.secrets = {};
|
||||||
|
};
|
||||||
|
imports = [../../hmModules/shell];
|
||||||
|
};
|
||||||
|
|
||||||
|
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 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
|
if [[ ! -d "${sshdDirectory}" ]]; then
|
||||||
$DRY_RUN_CMD rm $VERBOSE_ARG --recursive --force "${sshdTmpDirectory}"
|
$DRY_RUN_CMD rm $VERBOSE_ARG --recursive --force "${sshdTmpDirectory}"
|
||||||
|
@ -41,16 +57,20 @@ in {
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
environment.packages = [
|
environment.packages = let
|
||||||
pkgs.vim
|
inherit (fleetFlake.inputs.ccrEmacs.packages.aarch64-linux) ccrEmacs;
|
||||||
|
in [
|
||||||
pkgs.bottom
|
pkgs.bottom
|
||||||
pkgs.helix
|
pkgs.helix
|
||||||
pkgs.stress
|
pkgs.stress
|
||||||
pkgs.openssh
|
pkgs.openssh
|
||||||
pkgs.git
|
pkgs.git
|
||||||
|
pkgs.btop
|
||||||
|
(ccrEmacs.overrideAttrs {
|
||||||
|
inherit (pkgs) emacs;
|
||||||
|
})
|
||||||
(pkgs.writeScriptBin "sshd-start" ''
|
(pkgs.writeScriptBin "sshd-start" ''
|
||||||
#!${pkgs.runtimeShell}
|
#!${pkgs.runtimeShell}
|
||||||
|
|
||||||
echo "Starting sshd in non-daemonized way on port ${toString port}"
|
echo "Starting sshd in non-daemonized way on port ${toString port}"
|
||||||
${pkgs.openssh}/bin/sshd -f "${sshdDirectory}/sshd_config" -D
|
${pkgs.openssh}/bin/sshd -f "${sshdDirectory}/sshd_config" -D
|
||||||
'')
|
'')
|
||||||
|
|
|
@ -291,6 +291,7 @@ in {
|
||||||
internal = true;
|
internal = true;
|
||||||
default = hostname: config:
|
default = hostname: config:
|
||||||
inputs.nix-on-droid.lib.nixOnDroidConfiguration {
|
inputs.nix-on-droid.lib.nixOnDroidConfiguration {
|
||||||
|
pkgs = inputs.nixpkgsUnstable.legacyPackages.aarch64-linux;
|
||||||
modules = [
|
modules = [
|
||||||
({
|
({
|
||||||
lib,
|
lib,
|
||||||
|
@ -298,6 +299,7 @@ in {
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
nixpkgs.overlays = config.overlays;
|
nixpkgs.overlays = config.overlays;
|
||||||
|
_module.args.fleetFlake = self;
|
||||||
})
|
})
|
||||||
"${self.outPath}/hosts/${hostname}"
|
"${self.outPath}/hosts/${hostname}"
|
||||||
];
|
];
|
||||||
|
|
Loading…
Add table
Reference in a new issue