diff --git a/flake.lock b/flake.lock index 5285932..7ed8f7d 100644 --- a/flake.lock +++ b/flake.lock @@ -141,6 +141,26 @@ "url": "https://flakehub.com/f/DeterminateSystems/determinate/3" } }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1781152676, + "narHash": "sha256-RxWs5ND31KzTG7wvMM+PMfUjyNpmIEr999lqNARaM5o=", + "owner": "nix-community", + "repo": "disko", + "rev": "ff8702b4de27f72b4c78573dfb89ec74e36abdf1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "fenix": { "inputs": { "nixpkgs": [ @@ -711,6 +731,7 @@ "agenix": "agenix", "claude-code": "claude-code", "determinite": "determinite", + "disko": "disko", "home-manager": "home-manager_2", "microcosm-rs": "microcosm-rs", "ngp-nur": "ngp-nur", diff --git a/flake.nix b/flake.nix index 423aeac..4d51b73 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,10 @@ url = "https://flakehub.com/f/DeterminateSystems/determinate/3"; inputs.nixpkgs.follows = "nixpkgs"; }; + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; home-manager = { url = "github:nix-community/home-manager/release-26.05"; inputs.nixpkgs.follows = "nixpkgs"; @@ -62,6 +66,7 @@ nixpkgs-unstable, nixos-wsl, determinite, + disko, home-manager, pre-commit-hooks, agenix, @@ -146,6 +151,18 @@ valheim-server.nixosModules.default ]; }; + nixosConfigurations.othinus = basicSystem { + extraGroups = [ + "libvirtd" + "qemu-libvirtd" + "docker" + ]; + useUnstable = true; + modules = [ + disko.nixosModules.disko + ./host-specific/othinus/configuration.nix + ]; + }; nixosConfigurations.shizuri = basicSystem { useUnstable = true; modules = [ diff --git a/host-specific/othinus/boot.nix b/host-specific/othinus/boot.nix new file mode 100644 index 0000000..a100fd3 --- /dev/null +++ b/host-specific/othinus/boot.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; +} diff --git a/host-specific/othinus/configuration.nix b/host-specific/othinus/configuration.nix new file mode 100644 index 0000000..527f182 --- /dev/null +++ b/host-specific/othinus/configuration.nix @@ -0,0 +1,35 @@ +{ lib, ... }: +{ + imports = [ + ./disko.nix + ./hardware-configuration.nix + ./boot.nix + ./networking.nix + ./packages.nix + ./virtualisation.nix + ]; + + age.secrets.noah-password.file = lib.mkForce ../../secrets/noah-hashed-password-othinus.age; + + programs.mosh.enable = lib.mkForce false; + + ngp.binaryCacheCopy.enable = false; + system.activationScripts.copyNixStoreToMisaki.text = lib.mkForce ""; + + nix.distributedBuilds = lib.mkForce false; + nix.buildMachines = lib.mkForce [ ]; + + security.sudo.extraRules = [ + { + users = [ "noah" ]; + commands = [ + { + command = "ALL"; + options = [ "NOPASSWD" ]; + } + ]; + } + ]; + + system.stateVersion = "26.05"; +} diff --git a/host-specific/othinus/disko.nix b/host-specific/othinus/disko.nix new file mode 100644 index 0000000..4d59000 --- /dev/null +++ b/host-specific/othinus/disko.nix @@ -0,0 +1,43 @@ +{ ... }: +{ + disko.devices = { + disk.main = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "fmask=0077" + "dmask=0077" + ]; + extraArgs = [ + "-n" + "NIXBOOT" + ]; + }; + }; + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + extraArgs = [ + "-L" + "nixos" + ]; + }; + }; + }; + }; + }; + }; +} diff --git a/host-specific/othinus/hardware-configuration.nix b/host-specific/othinus/hardware-configuration.nix new file mode 100644 index 0000000..9e2ee8b --- /dev/null +++ b/host-specific/othinus/hardware-configuration.nix @@ -0,0 +1,41 @@ +# Do not modify this file! It was generated from Othinus' Arch Linux hardware state. +# Please make changes to /etc/nixos/configuration.nix instead. +{ + config, + lib, + modulesPath, + pkgs, + ... +}: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.kernelPackages = pkgs.linuxPackages_latest; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "usb_storage" + "usbhid" + "sd_mod" + ]; + boot.initrd.kernelModules = [ "kvm-amd" ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + hardware.enableRedistributableFirmware = true; + + swapDevices = [ + { + device = "/swapfile"; + size = 4 * 1024; + } + ]; + + networking.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/host-specific/othinus/networking.nix b/host-specific/othinus/networking.nix new file mode 100644 index 0000000..234b878 --- /dev/null +++ b/host-specific/othinus/networking.nix @@ -0,0 +1,29 @@ +{ ... }: +{ + networking.hostName = "othinus"; + + systemd.network.enable = true; + systemd.network.networks."50-enp2s0" = { + matchConfig.Name = "enp2s0"; + networkConfig = { + DHCP = "yes"; + MulticastDNS = "yes"; + }; + }; + + networking.tempAddresses = "disabled"; + networking.useNetworkd = true; + + networking.firewall = { + enable = true; + allowPing = true; + allowedUDPPorts = [ + # mDNS + 5353 + ]; + allowedUDPPortRanges = [ ]; + allowedTCPPorts = [ ]; + }; + + services.resolved.settings.Resolve.MulticastDNS = "yes"; +} diff --git a/host-specific/othinus/packages.nix b/host-specific/othinus/packages.nix new file mode 100644 index 0000000..160a28f --- /dev/null +++ b/host-specific/othinus/packages.nix @@ -0,0 +1,28 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + neovim + tzdata + wget + file + fishPlugins.fzf-fish + fzf + qemu + qemu-utils + OVMF + ncdu + smartmontools + man-pages + man-pages-posix + perf + ]; + + documentation.dev.enable = true; + + boot.binfmt.emulatedSystems = [ + "aarch64-linux" + "riscv64-linux" + ]; + + systemd.tmpfiles.rules = [ "L+ /var/lib/qemu/firmware - - - - ${pkgs.qemu}/share/qemu/firmware" ]; +} diff --git a/host-specific/othinus/virtualisation.nix b/host-specific/othinus/virtualisation.nix new file mode 100644 index 0000000..30515f7 --- /dev/null +++ b/host-specific/othinus/virtualisation.nix @@ -0,0 +1,14 @@ +{ ... }: +{ + virtualisation = { + libvirtd = { + enable = true; + qemu.runAsRoot = false; + }; + + docker = { + enable = true; + storageDriver = "overlay2"; + }; + }; +} diff --git a/secrets/noah-hashed-password-othinus.age b/secrets/noah-hashed-password-othinus.age new file mode 100644 index 0000000..5cc3d60 --- /dev/null +++ b/secrets/noah-hashed-password-othinus.age @@ -0,0 +1,17 @@ +age-encryption.org/v1 +-> ssh-ed25519 w7rGUA XVLdlfcGN/E71eXfGluZa+sDp8BHw6Um34cdfRwrImI +cpUeKlXYzNrv01U5C981I5z1/A7k/CxpAGwJV4zYKc8 +-> ssh-ed25519 QBbeMw +basiBgIiqGq34aaPjy2Cpr1p4TgZHpliippQvSQPAw +f+cqE7PabyreDISy5QtwIWVzJ3yxmv84t/6U0B4bJKc +-> ssh-ed25519 Wv0Urw vCPgSY6qTMRYorg71tSeghMi9RJcwHP3bwa2uHAVT20 +N4d+arjhYwdOTau/aaQOzazCPKpOW3OTTOahw6+esL8 +-> ssh-ed25519 WVNCXA Jky8kZLoEsRSzQrqVckOfr8r3zfMg7uINumXHz9eahc +TXPsp8KykUWz9xiSXS5czzLywJtm67bnp1fedGF+70s +-> ssh-ed25519 RvGf1w UvryAEJvtSc6U8ZPaZ9jRaDz2PvK6W6U3eASH+UxLAo +KLVhmqbfodbjYmSg4eQZEH5nHg3gzrtND/ex+EzsqEU +-> ssh-ed25519 fmqBGg Ll4H9N3ukYEwMw1XpaFVeWx40gKB1bsvx5YjcKYI2D4 +gUNjLWk7JLzQhdORxgMNzjugus/A5JM9UkJH3o6ATAA +-> ssh-ed25519 ZZDANg NX1C1uwFTZJp22NzunNC00J/cNeDMVkxH2uIMzBRMXU +M7ELuJmZXUT3nAc6EM45FaHA070iQ2FF/qYsj/hOZ8Y +--- cuK3ph0JXhbccobS51f4a7WUWPGAvlrBJWlxet7xNR4 +�("��ٺIvG�Ϙ�'5�3ꉭX���֮��ty \ No newline at end of file diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 658c092..61ab6c1 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -9,11 +9,13 @@ let ]; misaki = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO+Rcf4Lr+JPWGKQol6eAml6SMgERkGJWgN7y1qYUUvX root@nixos"; odin = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJIuvOXEK7M2i/Q8FeableBS+L20zwQpLetOuFGUhba2 root@nixos"; + othinus = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICed8x4g/8BA5J1DnkVZWcjyR8RO8QbvQJJiCjglfDbB root@mini"; touma-wsl = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFeyj52bQ/nf5k4HwDckeHy8wU3weDtY6IF6VlUJ/hAH root@nixos"; shizuri = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIaMdVtl8UlDa9kI/PO62Glu/PeJXfgXNsVg92b+BibE root@nixos"; hosts = [ misaki odin + othinus touma-wsl shizuri ]; @@ -21,6 +23,7 @@ in { "porkbun-api-key.age".publicKeys = [ misaki ] ++ noah; "noah-hashed-password.age".publicKeys = hosts; + "noah-hashed-password-othinus.age".publicKeys = [ othinus ] ++ noah; "nix-serve-secret-key.age".publicKeys = [ misaki noah @@ -44,5 +47,5 @@ in "influxdb-admin-token.age".publicKeys = [ misaki ] ++ noah; "kagi-env.age".publicKeys = noah; "pushover-env.age".publicKeys = hosts ++ noah; - "dev-secrets-env.age".publicKeys= noah; + "dev-secrets-env.age".publicKeys = noah; }