Refactor some modules
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
environment = {
|
||||
persistence."/persist"."/var/lib/containers" = { };
|
||||
|
||||
systemPackages = with pkgs; [ podman-compose ];
|
||||
systemPackages = with pkgs; [
|
||||
podman-compose
|
||||
kompose
|
||||
];
|
||||
};
|
||||
}
|
||||
|
4
hosts/common/configs/system/ssh-agent/default.nix
Normal file
4
hosts/common/configs/system/ssh-agent/default.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ ... }:
|
||||
{
|
||||
programs.ssh.startAgent = true;
|
||||
}
|
@@ -1,12 +1,8 @@
|
||||
{ ... }:
|
||||
{
|
||||
programs.ssh = {
|
||||
startAgent = true;
|
||||
|
||||
knownHosts = {
|
||||
installer.publicKeyFile = ../../../../installer/secrets/ssh_host_ed25519_key.pub;
|
||||
eirene.publicKeyFile = ../../../../eirene/secrets/ssh_host_ed25519_key.pub;
|
||||
elara.publicKeyFile = ../../../../elara/secrets/ssh_host_ed25519_key.pub;
|
||||
};
|
||||
programs.ssh.knownHosts = {
|
||||
installer.publicKeyFile = ../../../../installer/secrets/ssh_host_ed25519_key.pub;
|
||||
eirene.publicKeyFile = ../../../../eirene/secrets/ssh_host_ed25519_key.pub;
|
||||
elara.publicKeyFile = ../../../../elara/secrets/ssh_host_ed25519_key.pub;
|
||||
};
|
||||
}
|
||||
|
15
hosts/common/configs/system/sshd/default.nix
Normal file
15
hosts/common/configs/system/sshd/default.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
ports = [ 22 ];
|
||||
openFirewall = true;
|
||||
settings = {
|
||||
PasswordAuthentication = false;
|
||||
PermitRootLogin = "no";
|
||||
PrintMotd = false;
|
||||
};
|
||||
};
|
||||
|
||||
environment.enableAllTerminfo = true;
|
||||
}
|
@@ -1,4 +0,0 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [ wget ];
|
||||
}
|
23
hosts/common/configs/user/console/dive/default.nix
Normal file
23
hosts/common/configs/user/console/dive/default.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${user};
|
||||
in
|
||||
{
|
||||
home-manager.users.${user} = {
|
||||
home.packages = with pkgs; [ dive ];
|
||||
|
||||
xdg.configFile."dive/config.yaml" = lib.mkIf (
|
||||
(config.virtualisation.podman.enable || hmConfig.services.podman.enable)
|
||||
&& !(config.virtualisation.docker.enable || config.virtualisation.docker.rootless.enable)
|
||||
) { source = (pkgs.formats.yaml { }).generate "config.yaml" { container-engine = "podman"; }; };
|
||||
};
|
||||
}
|
@@ -31,11 +31,7 @@ lib.mkMerge [
|
||||
|
||||
home-manager.users.${user} = {
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
docker-compose
|
||||
dive
|
||||
];
|
||||
|
||||
packages = with pkgs; [ docker-compose ];
|
||||
sessionVariables.DOCKER_CONFIG = "${home}/.config/docker";
|
||||
};
|
||||
};
|
||||
|
@@ -23,14 +23,9 @@
|
||||
packages = with pkgs; [
|
||||
podman-compose
|
||||
kompose
|
||||
dive
|
||||
];
|
||||
|
||||
sessionVariables.REGISTRY_AUTH_FILE = "${home}/.config/containers/auth.json";
|
||||
};
|
||||
|
||||
xdg.configFile."dive/config.yaml".source = (pkgs.formats.yaml { }).generate "config.yaml" {
|
||||
container-engine = "podman";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
11
hosts/common/configs/user/console/ssh-agent/default.nix
Normal file
11
hosts/common/configs/user/console/ssh-agent/default.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ ... }:
|
||||
{
|
||||
home-manager.users.${user} = {
|
||||
services.ssh-agent.enable = true;
|
||||
programs.ssh.addKeysToAgent = "yes";
|
||||
};
|
||||
}
|
@@ -2,26 +2,16 @@
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{ ... }:
|
||||
{
|
||||
environment.persistence."/persist"."${home}/.ssh/known_hosts" = { };
|
||||
|
||||
home-manager.users.${user} = {
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
addKeysToAgent = "yes";
|
||||
userKnownHostsFile = "${home}/.ssh/known_hosts/default";
|
||||
};
|
||||
|
||||
services.ssh-agent.enable = true;
|
||||
|
||||
systemd.user.tmpfiles.rules = [
|
||||
"d ${home}/.ssh/known_hosts 0755 ${user} users"
|
||||
];
|
||||
systemd.user.tmpfiles.rules = [ "d ${home}/.ssh/known_hosts 0755 ${user} users" ];
|
||||
};
|
||||
}
|
||||
|
@@ -35,6 +35,7 @@
|
||||
../common/configs/system/printing
|
||||
../common/configs/system/sops
|
||||
../common/configs/system/ssh
|
||||
../common/configs/system/ssh-agent
|
||||
../common/configs/system/sudo
|
||||
../common/configs/system/system
|
||||
../common/configs/system/timezone
|
||||
@@ -42,7 +43,6 @@
|
||||
../common/configs/system/tmux
|
||||
../common/configs/system/tree
|
||||
../common/configs/system/users
|
||||
../common/configs/system/wget
|
||||
../common/configs/system/zsh
|
||||
|
||||
./users/nick
|
||||
|
@@ -10,6 +10,7 @@
|
||||
sopsFile = ../../../../../../../secrets/personal/secrets.yaml;
|
||||
path = "${home}/.config/git/credentials";
|
||||
};
|
||||
|
||||
"git/cookies" = {
|
||||
sopsFile = ../../../../../../../secrets/personal/secrets.yaml;
|
||||
path = "${home}/.config/git/cookies";
|
||||
|
@@ -15,6 +15,7 @@ in
|
||||
(import ../../../common/configs/user/console/bashmount { inherit user home; })
|
||||
(import ../../../common/configs/user/console/brightnessctl { inherit user home; })
|
||||
(import ../../../common/configs/user/console/btop { inherit user home; })
|
||||
(import ../../../common/configs/user/console/dive { inherit user home; })
|
||||
(import ../../../common/configs/user/console/fastfetch { inherit user home; })
|
||||
(import ../../../common/configs/user/console/ffmpeg { inherit user home; })
|
||||
(import ../../../common/configs/user/console/git { inherit user home; })
|
||||
@@ -36,6 +37,7 @@ in
|
||||
(import ../../../common/configs/user/console/ranger { inherit user home; })
|
||||
(import ../../../common/configs/user/console/sops { inherit user home; })
|
||||
(import ../../../common/configs/user/console/ssh { inherit user home; })
|
||||
(import ../../../common/configs/user/console/ssh-agent { inherit user home; })
|
||||
(import ../../../common/configs/user/console/syncthing { inherit user home; })
|
||||
(import ../../../common/configs/user/console/tmux { inherit user home; })
|
||||
(import ../../../common/configs/user/console/tree { inherit user home; })
|
||||
|
@@ -35,6 +35,7 @@
|
||||
../common/configs/system/printing
|
||||
../common/configs/system/sops
|
||||
../common/configs/system/ssh
|
||||
../common/configs/system/ssh-agent
|
||||
../common/configs/system/sudo
|
||||
../common/configs/system/system
|
||||
../common/configs/system/timezone
|
||||
@@ -42,7 +43,6 @@
|
||||
../common/configs/system/tmux
|
||||
../common/configs/system/tree
|
||||
../common/configs/system/users
|
||||
../common/configs/system/wget
|
||||
../common/configs/system/zsh
|
||||
|
||||
./configs/git
|
||||
|
@@ -14,6 +14,7 @@ in
|
||||
(import ../../../common/configs/user/console/bashmount { inherit user home; })
|
||||
(import ../../../common/configs/user/console/brightnessctl { inherit user home; })
|
||||
(import ../../../common/configs/user/console/btop { inherit user home; })
|
||||
(import ../../../common/configs/user/console/dive { inherit user home; })
|
||||
(import ../../../common/configs/user/console/fastfetch { inherit user home; })
|
||||
(import ../../../common/configs/user/console/git { inherit user home; })
|
||||
(import ../../../common/configs/user/console/gpg-agent { inherit user home; })
|
||||
@@ -35,6 +36,7 @@ in
|
||||
(import ../../../common/configs/user/console/ranger { inherit user home; })
|
||||
(import ../../../common/configs/user/console/sops { inherit user home; })
|
||||
(import ../../../common/configs/user/console/ssh { inherit user home; })
|
||||
(import ../../../common/configs/user/console/ssh-agent { inherit user home; })
|
||||
(import ../../../common/configs/user/console/tmux { inherit user home; })
|
||||
(import ../../../common/configs/user/console/tree { inherit user home; })
|
||||
(import ../../../common/configs/user/console/unzip { inherit user home; })
|
||||
|
@@ -25,13 +25,13 @@
|
||||
../common/configs/system/ntp
|
||||
../common/configs/system/sops
|
||||
../common/configs/system/ssh
|
||||
../common/configs/system/ssh-agent
|
||||
../common/configs/system/sudo
|
||||
../common/configs/system/system
|
||||
../common/configs/system/timezone
|
||||
../common/configs/system/tmux
|
||||
../common/configs/system/tree
|
||||
../common/configs/system/users
|
||||
../common/configs/system/wget
|
||||
../common/configs/system/zsh
|
||||
|
||||
./users/nick
|
||||
|
@@ -25,6 +25,7 @@ in
|
||||
(import ../../../common/configs/user/console/ranger { inherit user home; })
|
||||
(import ../../../common/configs/user/console/sops { inherit user home; })
|
||||
(import ../../../common/configs/user/console/ssh { inherit user home; })
|
||||
(import ../../../common/configs/user/console/ssh-agent { inherit user home; })
|
||||
(import ../../../common/configs/user/console/tmux { inherit user home; })
|
||||
(import ../../../common/configs/user/console/tree { inherit user home; })
|
||||
(import ../../../common/configs/user/console/wget { inherit user home; })
|
||||
|
@@ -186,7 +186,7 @@ new_entry="| \`$host\` | [hosts/$host/README.md](./hosts/$host/README.md) |"
|
||||
last_table_line=$(grep -n "^| " README.md | tail -n 1 | cut -d: -f1)
|
||||
sed -i "${last_table_line}a$new_entry" README.md
|
||||
|
||||
sed -i "/knownHosts = {/a\\ $host.publicKeyFile = ../../../../$host/secrets/ssh_host_ed25519_key.pub;" ./hosts/common/configs/system/ssh/default.nix
|
||||
sed -i "/knownHosts = {/a\\ $host.publicKeyFile = ../../../../$host/secrets/ssh_host_ed25519_key.pub;" ./hosts/common/configs/system/ssh/default.nix
|
||||
|
||||
nix fmt
|
||||
|
||||
|
Reference in New Issue
Block a user