From 12b8a7da851194480791a6ab57ead5d6f40b46a7 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 10 Jun 2022 16:56:15 +0200 Subject: [PATCH] hades: init --- flake.nix | 9 +++ hades.nix | 23 ++++++ hosts/hades/default.nix | 71 ++++++++++++++++++ hosts/hades/hardware-configuration.nix | 29 +++++++ hosts/hades/home.nix | 5 ++ hosts/hades/secrets.nix | 20 +++++ modules/secrets/secrets.nix | 3 +- .../secrets/users/alarsyo-hashed-password.age | Bin 694 -> 793 bytes .../secrets/users/root-hashed-password.age | Bin 619 -> 821 bytes 9 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 hades.nix create mode 100644 hosts/hades/default.nix create mode 100644 hosts/hades/hardware-configuration.nix create mode 100644 hosts/hades/home.nix create mode 100644 hosts/hades/secrets.nix diff --git a/flake.nix b/flake.nix index bf6fc2c..5ed22ed 100644 --- a/flake.nix +++ b/flake.nix @@ -102,6 +102,15 @@ ++ sharedModules; }; + hades = nixpkgs.lib.nixosSystem rec { + inherit system; + modules = + [ + ./hades.nix + ] + ++ sharedModules; + }; + boreal = nixpkgs.lib.nixosSystem rec { inherit system; modules = diff --git a/hades.nix b/hades.nix new file mode 100644 index 0000000..26018f0 --- /dev/null +++ b/hades.nix @@ -0,0 +1,23 @@ +{...}: { + imports = [ + # Default configuration + ./base + + # Module definitions + ./modules + + # Service definitions + ./services + + # Host-specific config + ./hosts/hades + ]; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "22.05"; # Did you read the comment? +} diff --git a/hosts/hades/default.nix b/hosts/hades/default.nix new file mode 100644 index 0000000..95e529a --- /dev/null +++ b/hosts/hades/default.nix @@ -0,0 +1,71 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). +{ + config, + lib, + pkgs, + ... +}: let + secrets = config.my.secrets; +in { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + + ./home.nix + ./secrets.nix + ]; + + boot.loader.systemd-boot.enable = false; + boot.loader.grub = { + enable = true; + efiSupport = false; + devices = ["/dev/sda" "/dev/sdb"]; + }; + + boot.tmpOnTmpfs = true; + + networking.hostName = "hades"; # Define your hostname. + networking.domain = "alarsyo.net"; + + # Set your time zone. + time.timeZone = "Europe/Paris"; + + networking.useDHCP = false; + networking.interfaces.enp35s0.ipv4.addresses = [ + { + address = "95.217.121.60"; + prefixLength = 26; + } + ]; + networking.interfaces.enp35s0.ipv6.addresses = [ + { + address = "2a01:4f9:4a:3649::2"; + prefixLength = 64; + } + ]; + networking.defaultGateway = "95.217.121.1"; + networking.defaultGateway6 = { + address = "fe80::1"; + interface = "enp35s0"; + }; + networking.nameservers = ["1.1.1.1" "1.0.0.1"]; + my.networking.externalInterface = "enp35s0"; + + # List services that you want to enable: + my.services = { + tailscale = { + enable = true; + exitNode = true; + }; + }; + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + services.openssh.permitRootLogin = "no"; + services.openssh.passwordAuthentication = false; + + # Takes a long while to build + documentation.nixos.enable = false; +} diff --git a/hosts/hades/hardware-configuration.nix b/hosts/hades/hardware-configuration.nix new file mode 100644 index 0000000..57882a3 --- /dev/null +++ b/hosts/hades/hardware-configuration.nix @@ -0,0 +1,29 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = ["ahci" "sd_mod"]; + boot.initrd.kernelModules = ["dm-snapshot"]; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/2a24010c-14bd-439b-b30b-d0e18db69952"; + fsType = "ext4"; + }; + + swapDevices = []; + + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/hades/home.nix b/hosts/hades/home.nix new file mode 100644 index 0000000..3bb7dab --- /dev/null +++ b/hosts/hades/home.nix @@ -0,0 +1,5 @@ +{config, ...}: { + home-manager.users.alarsyo = { + my.theme = config.home-manager.users.alarsyo.my.themes.solarizedLight; + }; +} diff --git a/hosts/hades/secrets.nix b/hosts/hades/secrets.nix new file mode 100644 index 0000000..3fbc379 --- /dev/null +++ b/hosts/hades/secrets.nix @@ -0,0 +1,20 @@ +{ + config, + lib, + options, + ... +}: { + config.age = { + secrets = let + toSecret = name: {...} @ attrs: + { + file = ./../../modules/secrets + "/${name}.age"; + } + // attrs; + in + lib.mapAttrs toSecret { + "users/alarsyo-hashed-password" = {}; + "users/root-hashed-password" = {}; + }; + }; +} diff --git a/modules/secrets/secrets.nix b/modules/secrets/secrets.nix index 7e1ce4b..68137cc 100644 --- a/modules/secrets/secrets.nix +++ b/modules/secrets/secrets.nix @@ -3,10 +3,11 @@ let users = [alarsyo]; boreal = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAagal1aqZh52wEmgsw7fkCzO41o4Cx+nV4wJGZuX1RP root@boreal"; + hades = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMxw8CtKUPAiPdKDEnuS7UyRrZN5BkUwsy5UPVF8V+lt root@hades"; poseidon = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKYhZYMbWQG9TSQ2qze8GgFo2XrZzgu/GuSOGwenByJo root@poseidon"; zephyrus = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILU4JfIADH9MXUnVe+3ezYK9WXsqy/jJcm1zFkmL4aSU root@zephyrus"; - machines = [boreal poseidon zephyrus]; + machines = [boreal hades poseidon zephyrus]; all = users ++ machines; in { diff --git a/modules/secrets/users/alarsyo-hashed-password.age b/modules/secrets/users/alarsyo-hashed-password.age index 9d80aa72837e8960690453faa7b6615c69c3c397..f9a9f83c1edaf2939968fd91df928d4e88cebc77 100644 GIT binary patch literal 793 zcmZ9|yNlBR0Dy57T!K0|-4r<#CDf#OHi$x#OPaQ6lUy%JQxxnYO`A0Dv`MPN34(Bg zgD4JyAR;;l=OpMRo{vEf1s@=%h?AS=Dhi6@{RO{|uWOkF)9Xihkc@rrxF1>YtOyiN zfpI)4m;;m`iZp2G4aKoQ-jwlnrxqk)8c!i!qSRJ7DwgSvnoU_D@ZuorM3|4XPzyk% zu|pGylxKB<>9Q4-qZ{*Rr6h%;_S`0$#o;LHOa?~H;C5<3yOg6A$n+?=lGHWG>mVVe z!i??Oyh6#Wl~`j|6WmaoWL%Nzv3-D>ED=6h#!*`8;*8FFsby%MOUfidk=lx{!1ljV zr0eMZPHj$d(~<)63hpZj?G0=-NE*ScxI88zuY<|dP{r|_#jCU>;YmKR%fOVZ7b^lw z%DFvK*F6Vo6{o*CAV8XGP7)p+QrJGG87)tY56hIqZ%U*ZJQ4*6J=y?8Wj zRa?0^GZO>r)g8DLwcOBkm$vV|;0z;kcdl>H@^T9L1t?#qi2r zb*JW_mSCr#z5-jRIM6lK(;)@*(=-w*qTTGGS*~II%%n7O?h=O0Hvp+0(;8y%8swv$ z2_A}UZ#3kVql&KD9Au}d#6vK$+-lDLpEOTbP9Z1GkOeC;yRiwLKa5(Qdk6vO0fq@> zpin4)nAO02M_0p!$&X2eDY1z(3P-XMbIo*Gg_EKX>cbhWv-x}N~zMY#X> Ycb(Y>zrTJ?NIx97@$#Mc>nZX0FT{ZoXaE2J delta 627 zcmWm7O;6Kc003Y(pwfd8F~P)OMj{8rv8`*j^RHV?xfPn~D@l^0KYe zOc%<_6`kVoy2JppspL4lVF%%AwGhB4lLZ7;DaRdQBH3~}tW@#^xLt$@Cs#s`!nzFF5W&rw4^=yeX!14 z*fYL>7r#dLkMqQ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