From 88c9607c2f044aab898bed319fb7d1f587c17012 Mon Sep 17 00:00:00 2001 From: catvayor Date: Tue, 25 Jun 2024 18:31:43 +0200 Subject: [PATCH] ~ --- hive.nix | 66 +++++++++++++++++------------- machines/kat-mail-test/default.nix | 4 +- machines/kat-traque/default.nix | 6 +-- machines/kat-traque/traque-pkg.nix | 4 +- machines/kat-watcher/default.nix | 15 ++++--- 5 files changed, 50 insertions(+), 45 deletions(-) diff --git a/hive.nix b/hive.nix index 34a5086..094ffd6 100644 --- a/hive.nix +++ b/hive.nix @@ -44,20 +44,16 @@ in system.build.anywhere = pkgs.writeShellApplication { name = "anywhere-deploy_${name}.sh"; runtimeInputs = [ pkgs.nixos-anywhere ]; + # --kexec ${nodes.kat-kexec.config.system.build.kexecTarball}/${nodes.kat-kexec.config.system.kexec-installer.name}-${pkgs.stdenv.hostPlatform.system}.tar.gz text = '' - nixos-anywhere --kexec ${nodes.kat-kexec.config.system.build.kexecTarball}/${nodes.kat-kexec.config.system.kexec-installer.name}-${pkgs.stdenv.hostPlatform.system}.tar.gz --store-paths ${config.system.build.diskoScriptNoDeps} ${config.system.build.toplevel} ${config.deployment.targetHost} + nixos-anywhere --store-paths ${config.system.build.diskoScriptNoDeps} ${config.system.build.toplevel} ${config.deployment.targetHost} ''; }; }; }; kat-probook = - { - name, - nodes, - users, - ... - }: + { users, ... }: { deployment.allowLocalDeployment = true; @@ -73,7 +69,7 @@ in }; kat-r86s = - { name, nodes, ... }: + { users, ... }: { deployment.targetHost = "r86s.kat"; imports = [ @@ -82,10 +78,23 @@ in ]; }; - kat-virt = - { name, nodes, ... }: + kat-watcher = + { users, ... }: { - deployment.targetHost = "virt.kat"; + deployment.targetHost = "watcher.kat"; + imports = [ + ./machines/kat-watcher + (users.root { ssh = true; }) + ]; + }; + + kat-virt = + { users, ... }: + { + deployment = { + targetHost = "virt.kat"; + tags = [ "kat-vms" ]; + }; imports = [ ./machines/kat-virt @@ -95,9 +104,12 @@ in }; kat-traque = - { name, nodes, ... }: + { users, ... }: { - deployment.targetHost = "traque.kat"; + deployment = { + targetHost = "traque.kat"; + tags = [ "kat-vms" ]; + }; imports = [ ./machines/kat-traque @@ -107,9 +119,12 @@ in }; kat-mail-test = - { name, nodes, ... }: + { users, ... }: { - deployment.targetHost = "mail-test.kat"; + deployment = { + targetHost = "mail-test.kat"; + tags = [ "kat-vms" ]; + }; imports = [ ./machines/kat-mail-test @@ -118,20 +133,13 @@ in users.users.root.openssh.authorizedKeys.keys = [ id_sylvain ]; }; - kat-watcher = - { name, nodes, ... }: - { - deployment.targetHost = "watcher.kat"; - imports = [ - ./machines/kat-watcher - (users.root { ssh = true; }) - ]; - }; - kat-son = - { name, nodes, ... }: + { users, ... }: { - deployment.targetHost = "son.kat"; + deployment = { + targetHost = "son.kat"; + tags = [ "kat-vms" ]; + }; imports = [ ./machines/kat-son (users.root { ssh = true; }) @@ -140,7 +148,7 @@ in kat-iso = { - name, + users, pkgs, modulesPath, ... @@ -175,7 +183,7 @@ in kat-kexec = { - name, + users, pkgs, modulesPath, lib, diff --git a/machines/kat-mail-test/default.nix b/machines/kat-mail-test/default.nix index 2c3dde1..daa9930 100644 --- a/machines/kat-mail-test/default.nix +++ b/machines/kat-mail-test/default.nix @@ -99,9 +99,7 @@ in loginAccounts = { "root@${host}" = { - catchAll = [ - host - ]; + catchAll = [ host ]; aliases = builtins.genList (id: "user${toString id}@${host}") 10 ++ [ "moderators@${host}" ]; hashedPassword = "$2b$05$FoCVDECXYG0KXPigPuIZtuNFiviwSg8RuXx0FbnzC7ZRp.Mz8VWOe"; }; diff --git a/machines/kat-traque/default.nix b/machines/kat-traque/default.nix index 81446a7..0da3b14 100644 --- a/machines/kat-traque/default.nix +++ b/machines/kat-traque/default.nix @@ -7,7 +7,7 @@ ... }: let - traque-pkg = pkgs.callPackage ./traque-pkg.nix {}; + traque-pkg = pkgs.callPackage ./traque-pkg.nix { }; in { imports = [ @@ -160,9 +160,7 @@ in serviceConfig = { WorkingDirectory = "/var/lib/traque"; ExecStart = "${traque-pkg}/bin/traque"; - ExecReload = [ - "${pkgs.coreutils}/bin/kill -HUP $MAINPID" - ]; + ExecReload = [ "${pkgs.coreutils}/bin/kill -HUP $MAINPID" ]; User = "traque"; Group = "traque"; DynamicUser = true; diff --git a/machines/kat-traque/traque-pkg.nix b/machines/kat-traque/traque-pkg.nix index 8242e0a..8fdaa88 100644 --- a/machines/kat-traque/traque-pkg.nix +++ b/machines/kat-traque/traque-pkg.nix @@ -1,6 +1,4 @@ -{ lib -, rustPlatform -}: +{ lib, rustPlatform }: rustPlatform.buildRustPackage rec { pname = "traque"; diff --git a/machines/kat-watcher/default.nix b/machines/kat-watcher/default.nix index ec8b553..f5b1cb0 100644 --- a/machines/kat-watcher/default.nix +++ b/machines/kat-watcher/default.nix @@ -90,12 +90,15 @@ }) vhosts; streamConfig = builtins.concatStringsSep "\n" ( - lib.mapAttrsToList (vhost: sshport: lib.optionalString (!isNull sshport) '' - server { - listen ${toString sshport}; - proxy_pass ${kat-r86s}:${toString sshport}; - } - '') vhosts + lib.mapAttrsToList ( + vhost: sshport: + lib.optionalString (!isNull sshport) '' + server { + listen ${toString sshport}; + proxy_pass ${kat-r86s}:${toString sshport}; + } + '' + ) vhosts ) + '' server {