From e08eb0e97080f94447e768fb4d5c68f9d5ffb580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Wed, 16 Mar 2022 16:04:22 +0100 Subject: [PATCH] feat(tahina): init --- ci.nix | 1 + configs/ssh.nix | 9 ++++--- flake.nix | 11 ++++++-- lib/retiolum-network.nix | 5 ++++ systems/makanek/monitoring/default.nix | 10 +++++++ systems/tahina/configuration.nix | 29 ++++++++++++++++++++ systems/tahina/hardware-configuration.nix | 32 +++++++++++++++++++++++ 7 files changed, 91 insertions(+), 6 deletions(-) create mode 100644 systems/tahina/configuration.nix create mode 100644 systems/tahina/hardware-configuration.nix diff --git a/ci.nix b/ci.nix index 24f71d1..3c44d62 100644 --- a/ci.nix +++ b/ci.nix @@ -53,6 +53,7 @@ zaatar = ensureFiles (["moodle.token" "telegram/moodle-dl.token" "mpd-web.key"] ++ basic); kabsa = ensureFiles basic; manakish = ensureFiles basic; + tahina = ensureFiles basic; makanek = ensureFiles ([ "irc/retiolum" "irc/hackint" diff --git a/configs/ssh.nix b/configs/ssh.nix index 9af4571..3c321d7 100644 --- a/configs/ssh.nix +++ b/configs/ssh.nix @@ -29,6 +29,11 @@ in { user = "root"; port = sshPort; }; + tahina = { + hostname = "tahina.r"; + user = "root"; + port = sshPort; + }; manakish = { hostname = "manakish.r"; user = "kfm"; @@ -44,10 +49,6 @@ in { user = "kfm"; port = sshPort; }; - tahina = { - hostname = "130.61.131.53"; - user = "ubuntu"; - }; "nextcloud.fysi.dev" = { hostname = "116.203.82.203"; user = "root"; diff --git a/flake.nix b/flake.nix index 8c1601a..253d9c2 100644 --- a/flake.nix +++ b/flake.nix @@ -108,7 +108,11 @@ in toString (krops.packages.${system}.writeDeploy "deploy-${name}" { source = krops.lib.evalSource [(source name)]; - target = "root@${host}:${toString sshPort}"; + target = "root@${host}:${ + if host == "130.61.203.118" + then "22" + else toString sshPort + }"; }); in { apps.${system} = let @@ -119,7 +123,10 @@ type = "app"; program = deployScriptFor { inherit name; - host = "${name}.r"; + host = + if name == "tahina" + then "130.61.203.118" + else "${name}.r"; }; }; }); diff --git a/lib/retiolum-network.nix b/lib/retiolum-network.nix index e1eb846..8cdd2be 100644 --- a/lib/retiolum-network.nix +++ b/lib/retiolum-network.nix @@ -18,4 +18,9 @@ ipv4 = "10.243.2.85"; ipv6 = "42:0:3c46:ac99:ae36:cb8:c551:ba27"; }; + + tahina = { + ipv4 = "10.243.2.74"; + ipv6 = "42:0:3c46:2923:1c90:872:edd6:306"; + }; } diff --git a/systems/makanek/monitoring/default.nix b/systems/makanek/monitoring/default.nix index 6f42afa..a6c4e5d 100644 --- a/systems/makanek/monitoring/default.nix +++ b/systems/makanek/monitoring/default.nix @@ -238,6 +238,16 @@ in { } ]; } + { + job_name = "tahina"; + static_configs = [ + { + targets = [ + "tahina.r:${toString config.services.prometheus.exporters.node.port}" + ]; + } + ]; + } ]; services.prometheus.exporters.blackbox = { diff --git a/systems/tahina/configuration.nix b/systems/tahina/configuration.nix new file mode 100644 index 0000000..d9465fb --- /dev/null +++ b/systems/tahina/configuration.nix @@ -0,0 +1,29 @@ +{ + lib, + config, + pkgs, + ... +}: let + inherit (import ) retiolumAddresses; +in { + imports = [ + ./hardware-configuration.nix + + + + + + + ]; + + nix.nixPath = ["/var/src"]; + + networking = { + hostName = "tahina"; + retiolum = retiolumAddresses.tahina; + }; + + system.stateVersion = "22.05"; + + environment.systemPackages = [pkgs.vim pkgs.git pkgs.tmux pkgs.python3]; +} diff --git a/systems/tahina/hardware-configuration.nix b/systems/tahina/hardware-configuration.nix new file mode 100644 index 0000000..0f15acb --- /dev/null +++ b/systems/tahina/hardware-configuration.nix @@ -0,0 +1,32 @@ +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.device = "/dev/sda"; + + boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/d36baa44-9359-45d1-af5f-dbac52c6d75e"; + fsType = "ext4"; + }; + + swapDevices = []; + + networking.useDHCP = lib.mkDefault false; + networking.interfaces.ens3.useDHCP = lib.mkDefault true; + + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}