...
This commit is contained in:
10
flake.nix
10
flake.nix
@@ -7,9 +7,6 @@
|
|||||||
|
|
||||||
#old-nixpkgs.url = "github:NixOS/nixpkgs/release-22.11";
|
#old-nixpkgs.url = "github:NixOS/nixpkgs/release-22.11";
|
||||||
|
|
||||||
#rpi-nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
|
|
||||||
|
|
||||||
|
|
||||||
firefox.url = "github:nix-community/flake-firefox-nightly";
|
firefox.url = "github:nix-community/flake-firefox-nightly";
|
||||||
|
|
||||||
|
|
||||||
@@ -170,12 +167,19 @@
|
|||||||
"phone" = inputs.nix-on-droid.lib.nixOnDroidConfiguration {
|
"phone" = inputs.nix-on-droid.lib.nixOnDroidConfiguration {
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/phone/nix-on-droid.nix
|
./hosts/phone/nix-on-droid.nix
|
||||||
|
{
|
||||||
|
home-manager.extraSpecialArgs = {
|
||||||
|
inherit self inputs;
|
||||||
|
hostname = "phone";
|
||||||
|
};
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixOnDroidConfigurations = rec {
|
nixOnDroidConfigurations = rec {
|
||||||
"tab" = inputs.nix-on-droid.lib.nixOnDroidConfiguration {
|
"tab" = inputs.nix-on-droid.lib.nixOnDroidConfiguration {
|
||||||
|
specialArgs = { inherit inputs confDir workDir secretsDir persistentDir self; };
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/tab/nix-on-droid.nix
|
./hosts/tab/nix-on-droid.nix
|
||||||
];
|
];
|
||||||
|
|||||||
61
hosts/phone/nix-on-droid.nix
Normal file
61
hosts/phone/nix-on-droid.nix
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{ pkgs, self, config, lib, specialArgs, ... }:
|
||||||
|
let
|
||||||
|
sshdTmpDirectory = "${config.user.home}/sshd-tmp";
|
||||||
|
sshdDirectory = "${config.user.home}/sshd";
|
||||||
|
port = 8022;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
environment.packages = with pkgs; [
|
||||||
|
vim
|
||||||
|
openssh
|
||||||
|
(pkgs.writeScriptBin "ssd" ''
|
||||||
|
#!${pkgs.runtimeShell}
|
||||||
|
|
||||||
|
echo "Starting sshd in non-daemonized way on port ${toString port}"
|
||||||
|
${pkgs.openssh}/bin/sshd -f "${sshdDirectory}/sshd_config" -D
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
|
||||||
|
system.stateVersion = "23.05";
|
||||||
|
|
||||||
|
# Set your time zone.
|
||||||
|
time.timeZone = "Europe/Vienna";
|
||||||
|
|
||||||
|
|
||||||
|
# add mybin to path
|
||||||
|
environment.etc.profile.text = ''
|
||||||
|
export PATH=$PATH:${self}/mybin
|
||||||
|
'';
|
||||||
|
|
||||||
|
nix.extraOptions = ''
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
trusted-users = root @wheel me
|
||||||
|
'';
|
||||||
|
|
||||||
|
|
||||||
|
build.activation.sshd = ''
|
||||||
|
if [[ ! -d "${sshdDirectory}" ]]; then
|
||||||
|
$DRY_RUN_CMD rm $VERBOSE_ARG --recursive --force "${sshdTmpDirectory}"
|
||||||
|
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents "${sshdTmpDirectory}"
|
||||||
|
|
||||||
|
$VERBOSE_ECHO "Generating host keys..."
|
||||||
|
$DRY_RUN_CMD ${pkgs.openssh}/bin/ssh-keygen -t rsa -b 4096 -f "${sshdTmpDirectory}/ssh_host_rsa_key" -N ""
|
||||||
|
|
||||||
|
$VERBOSE_ECHO "Writing sshd_config..."
|
||||||
|
$DRY_RUN_CMD echo -e "HostKey ${sshdDirectory}/ssh_host_rsa_key\nPort ${toString port}\n" > "${sshdTmpDirectory}/sshd_config"
|
||||||
|
|
||||||
|
$DRY_RUN_CMD mv $VERBOSE_ARG "${sshdTmpDirectory}" "${sshdDirectory}"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
home-manager.config = {
|
||||||
|
home.file.".ssh/authorizedKeys".text = ''
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFjgXf9S9hxjyph2EEFh1el0z4OUT9fMoFAaDanjiuKa me@main"
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICWsqiz0gEepvPONYxqhKKq4Vxfe1h+jo11k88QozUch me@bitwarden"
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAioUu4ow6k+OMjjLdzogiQM4ZEM3TNekGNasaSDzQQE me@phone"
|
||||||
|
'';
|
||||||
|
imports = [
|
||||||
|
../../users/common/home.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
61
hosts/tab/nix-on-droid.nix
Normal file
61
hosts/tab/nix-on-droid.nix
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{ pkgs, self, config, lib, ... }:
|
||||||
|
let
|
||||||
|
sshdTmpDirectory = "${config.user.home}/sshd-tmp";
|
||||||
|
sshdDirectory = "${config.user.home}/sshd";
|
||||||
|
port = 8022;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
environment.packages = with pkgs; [
|
||||||
|
vim
|
||||||
|
openssh
|
||||||
|
(pkgs.writeScriptBin "ssd" ''
|
||||||
|
#!${pkgs.runtimeShell}
|
||||||
|
|
||||||
|
echo "Starting sshd in non-daemonized way on port ${toString port}"
|
||||||
|
${pkgs.openssh}/bin/sshd -f "${sshdDirectory}/sshd_config" -D
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
|
||||||
|
system.stateVersion = "23.05";
|
||||||
|
|
||||||
|
# Set your time zone.
|
||||||
|
time.timeZone = "Europe/Vienna";
|
||||||
|
|
||||||
|
|
||||||
|
# add mybin to path
|
||||||
|
environment.etc.profile.text = ''
|
||||||
|
export PATH=$PATH:${self}/mybin
|
||||||
|
'';
|
||||||
|
|
||||||
|
nix.extraOptions = ''
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
trusted-users = root @wheel me
|
||||||
|
'';
|
||||||
|
|
||||||
|
|
||||||
|
build.activation.sshd = ''
|
||||||
|
if [[ ! -d "${sshdDirectory}" ]]; then
|
||||||
|
$DRY_RUN_CMD rm $VERBOSE_ARG --recursive --force "${sshdTmpDirectory}"
|
||||||
|
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents "${sshdTmpDirectory}"
|
||||||
|
|
||||||
|
$VERBOSE_ECHO "Generating host keys..."
|
||||||
|
$DRY_RUN_CMD ${pkgs.openssh}/bin/ssh-keygen -t rsa -b 4096 -f "${sshdTmpDirectory}/ssh_host_rsa_key" -N ""
|
||||||
|
|
||||||
|
$VERBOSE_ECHO "Writing sshd_config..."
|
||||||
|
$DRY_RUN_CMD echo -e "HostKey ${sshdDirectory}/ssh_host_rsa_key\nPort ${toString port}\n" > "${sshdTmpDirectory}/sshd_config"
|
||||||
|
|
||||||
|
$DRY_RUN_CMD mv $VERBOSE_ARG "${sshdTmpDirectory}" "${sshdDirectory}"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
home-manager.config = {
|
||||||
|
home.file.".ssh/authorizedKeys".text = ''
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFjgXf9S9hxjyph2EEFh1el0z4OUT9fMoFAaDanjiuKa me@main"
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICWsqiz0gEepvPONYxqhKKq4Vxfe1h+jo11k88QozUch me@bitwarden"
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAioUu4ow6k+OMjjLdzogiQM4ZEM3TNekGNasaSDzQQE me@phone"
|
||||||
|
'';
|
||||||
|
imports = [
|
||||||
|
../../users/common/home.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
programs.nix-index.enableZshIntegration = false;
|
programs.nix-index.enableZshIntegration = false;
|
||||||
|
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
EDITOR = "nvim";
|
EDITOR = "nvim${self}";
|
||||||
};
|
};
|
||||||
|
|
||||||
home.sessionPath = [ "${self}/mybin" ];
|
home.sessionPath = [ "${self}/mybin" ];
|
||||||
@@ -74,6 +74,6 @@
|
|||||||
}))
|
}))
|
||||||
];
|
];
|
||||||
|
|
||||||
|
#*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user