From 10b0df38b4286237b56ff9177f8d4c5676bfb5c1 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 30 Oct 2023 04:22:32 -0400 Subject: tree-wide: refactor i went overboard on modules. this is much comfier --- parts/systems/atlas/default.nix | 50 ------ parts/systems/atlas/hardware-configuration.nix | 29 ---- parts/systems/atlas/miniflux.nix | 20 --- parts/systems/atlas/nginx.nix | 32 ---- parts/systems/caroline/default.nix | 17 -- parts/systems/default.nix | 47 ----- parts/systems/glados-wsl/default.nix | 39 ----- parts/systems/glados/boot.nix | 25 --- parts/systems/glados/default.nix | 61 ------- parts/systems/glados/hardware-configuration.nix | 72 -------- parts/systems/profiles.nix | 102 ----------- parts/systems/turret/default.nix | 38 ----- parts/systems/turret/files/etc/config/dhcp | 55 ------ parts/systems/turret/files/etc/config/dropbear | 5 - parts/systems/turret/files/etc/config/firewall | 189 --------------------- .../turret/files/etc/config/https-dns-proxy | 18 -- parts/systems/turret/files/etc/config/luci | 41 ----- parts/systems/turret/files/etc/config/network | 29 ---- parts/systems/turret/files/etc/config/rpcd | 10 -- parts/systems/turret/files/etc/config/system | 16 -- parts/systems/turret/files/etc/config/ucitrack | 56 ------ parts/systems/turret/files/etc/config/uhttpd | 31 ---- parts/systems/turret/files/etc/config/wireless | 34 ---- .../turret/files/etc/dropbear/authorized_keys | 1 - 24 files changed, 1017 deletions(-) delete mode 100644 parts/systems/atlas/default.nix delete mode 100644 parts/systems/atlas/hardware-configuration.nix delete mode 100644 parts/systems/atlas/miniflux.nix delete mode 100644 parts/systems/atlas/nginx.nix delete mode 100644 parts/systems/caroline/default.nix delete mode 100644 parts/systems/default.nix delete mode 100644 parts/systems/glados-wsl/default.nix delete mode 100644 parts/systems/glados/boot.nix delete mode 100644 parts/systems/glados/default.nix delete mode 100644 parts/systems/glados/hardware-configuration.nix delete mode 100644 parts/systems/profiles.nix delete mode 100644 parts/systems/turret/default.nix delete mode 100644 parts/systems/turret/files/etc/config/dhcp delete mode 100644 parts/systems/turret/files/etc/config/dropbear delete mode 100644 parts/systems/turret/files/etc/config/firewall delete mode 100644 parts/systems/turret/files/etc/config/https-dns-proxy delete mode 100644 parts/systems/turret/files/etc/config/luci delete mode 100644 parts/systems/turret/files/etc/config/network delete mode 100644 parts/systems/turret/files/etc/config/rpcd delete mode 100644 parts/systems/turret/files/etc/config/system delete mode 100644 parts/systems/turret/files/etc/config/ucitrack delete mode 100644 parts/systems/turret/files/etc/config/uhttpd delete mode 100644 parts/systems/turret/files/etc/config/wireless delete mode 100644 parts/systems/turret/files/etc/dropbear/authorized_keys (limited to 'parts/systems') diff --git a/parts/systems/atlas/default.nix b/parts/systems/atlas/default.nix deleted file mode 100644 index 24cb139..0000000 --- a/parts/systems/atlas/default.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - config, - pkgs, - ... -}: { - imports = [ - ./hardware-configuration.nix - ./miniflux.nix - ./nginx.nix - ]; - - _module.args.nixinate = { - host = "atlas"; - sshUser = "root"; - buildOn = "remote"; - substituteOnTarget = true; - hermetic = false; - }; - - boot = { - loader.systemd-boot.enable = true; - loader.efi.canTouchEfiVariables = true; - tmp.cleanOnBoot = true; - }; - - networking = { - domain = "mydadleft.me"; - hostName = "atlas"; - }; - - services = { - guzzle-api = { - enable = true; - domain = "api.${config.networking.domain}"; - nginx = { - enableACME = true; - acmeRoot = null; - addSSL = true; - }; - }; - }; - - users.users.atlas = { - isNormalUser = true; - shell = pkgs.bash; - passwordFile = config.age.secrets.userPassword.path; - }; - - zramSwap.enable = true; -} diff --git a/parts/systems/atlas/hardware-configuration.nix b/parts/systems/atlas/hardware-configuration.nix deleted file mode 100644 index 00c6cd8..0000000 --- a/parts/systems/atlas/hardware-configuration.nix +++ /dev/null @@ -1,29 +0,0 @@ -{modulesPath, ...}: { - imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; - - boot = { - extraModulePackages = []; - kernelModules = []; - - initrd = { - availableKernelModules = ["virtio_pci" "usbhid"]; - kernelModules = []; - }; - }; - - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/f0c84809-83f5-414b-a973-496d25d74c6d"; - fsType = "ext4"; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/A253-0826"; - fsType = "vfat"; - }; - }; - - swapDevices = []; -} diff --git a/parts/systems/atlas/miniflux.nix b/parts/systems/atlas/miniflux.nix deleted file mode 100644 index 5ed5d40..0000000 --- a/parts/systems/atlas/miniflux.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - config, - self, - ... -}: { - config = { - age.secrets = { - miniflux.file = "${self}/parts/secrets/systems/${config.networking.hostName}/miniflux.age"; - }; - - services.miniflux = { - enable = true; - adminCredentialsFile = config.age.secrets.miniflux.path; - config = { - BASE_URL = "https://miniflux.${config.networking.domain}"; - LISTEN_ADDR = "localhost:7000"; - }; - }; - }; -} diff --git a/parts/systems/atlas/nginx.nix b/parts/systems/atlas/nginx.nix deleted file mode 100644 index cdf483d..0000000 --- a/parts/systems/atlas/nginx.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - config, - self, - ... -}: let - inherit (config.networking) domain; - inherit (self.lib.utils.nginx) mkVHosts mkProxy; -in { - server = { - acme.enable = true; - services.cloudflared.enable = true; - }; - - services.nginx = { - enable = true; - - recommendedGzipSettings = true; - recommendedOptimisation = true; - recommendedProxySettings = true; - recommendedTlsSettings = true; - - virtualHosts = mkVHosts { - "miniflux.${domain}" = { - locations = mkProxy "/" "7000"; - }; - - "msix.${domain}" = { - root = "/var/www/msix"; - }; - }; - }; -} diff --git a/parts/systems/caroline/default.nix b/parts/systems/caroline/default.nix deleted file mode 100644 index 3ec2dd2..0000000 --- a/parts/systems/caroline/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -_: { - desktop = { - homebrew.enable = true; - gpg.enable = true; - }; - - homebrew.casks = ["altserver"]; - - networking = rec { - computerName = "caroline"; - hostName = computerName; - }; - - nix.settings.trusted-users = ["seth"]; - - services.tailscale.enable = true; -} diff --git a/parts/systems/default.nix b/parts/systems/default.nix deleted file mode 100644 index e9ef9ba..0000000 --- a/parts/systems/default.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ - inputs, - self, - withSystem, - ... -}: { - flake = let - inherit (self.lib.configs) mapSystems; - profiles = import ./profiles.nix {inherit self inputs;}; - in { - darwinConfigurations = mapSystems { - caroline = { - system = "x86_64-darwin"; - profile = profiles.personal-darwin; - }; - }; - - nixosConfigurations = mapSystems { - glados = { - modules = with inputs; [ - lanzaboote.nixosModules.lanzaboote - ]; - profile = profiles.personal; - }; - - glados-wsl = { - modules = [inputs.nixos-wsl.nixosModules.wsl]; - profile = profiles.personal; - }; - - atlas = { - modules = [inputs.guzzle_api.nixosModules.default]; - system = "aarch64-linux"; - profile = profiles.server; - }; - }; - - openwrtConfigurations.turret = withSystem "x86_64-linux" ({pkgs, ...}: - pkgs.callPackage ./turret { - inherit (inputs) openwrt-imagebuilder; - }); - }; - - perSystem = {system, ...}: { - apps = (inputs.nixinate.nixinate.${system} self).nixinate; - }; -} diff --git a/parts/systems/glados-wsl/default.nix b/parts/systems/glados-wsl/default.nix deleted file mode 100644 index 98b57ed..0000000 --- a/parts/systems/glados-wsl/default.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ - modulesPath, - pkgs, - ... -}: { - imports = [ - (modulesPath + "/profiles/minimal.nix") - ../../modules/nixos/features/tailscale.nix - ]; - - environment.systemPackages = with pkgs; [ - wslu - ]; - - base.networking.enable = false; - features.tailscale.enable = true; - - wsl = { - enable = true; - defaultUser = "seth"; - nativeSystemd = true; - wslConf.network = { - hostname = "glados-wsl"; - generateResolvConf = true; - }; - startMenuLaunchers = false; - interop.includePath = false; - }; - - services.dbus.apparmor = "disabled"; - - networking.hostName = "glados-wsl"; - - security = { - apparmor.enable = false; - audit.enable = false; - auditd.enable = false; - }; -} diff --git a/parts/systems/glados/boot.nix b/parts/systems/glados/boot.nix deleted file mode 100644 index 4a9af4e..0000000 --- a/parts/systems/glados/boot.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - lib, - pkgs, - ... -}: { - environment.systemPackages = with pkgs; [ - sbctl - tpm2-tss - ]; - - boot = { - initrd.systemd.enable = true; - kernelPackages = pkgs.linuxPackages_latest; - - bootspec.enable = true; - loader.systemd-boot.enable = lib.mkForce false; - - lanzaboote = { - enable = true; - pkiBundle = "/etc/secureboot"; - }; - - supportedFilesystems = ["btrfs" "ntfs"]; - }; -} diff --git a/parts/systems/glados/default.nix b/parts/systems/glados/default.nix deleted file mode 100644 index de2c1d5..0000000 --- a/parts/systems/glados/default.nix +++ /dev/null @@ -1,61 +0,0 @@ -{lib, ...}: { - imports = [ - ./boot.nix - ./hardware-configuration.nix - ../../modules/nixos/features/tailscale.nix - ../../modules/nixos/features/virtualisation.nix - ]; - - boot = { - kernelParams = ["amd_pstate=active"]; - kernel.sysctl = { - "vm.swappiness" = 100; - "vm.vfs_cache_pressure" = 500; - "vm.dirty_background_ratio" = 1; - "vm.dirty_ratio" = 50; - }; - }; - - desktop.gnome.enable = true; - - features = { - tailscale.enable = true; - virtualisation.enable = true; - }; - - hardware = { - nvidia.enable = true; - ssd.enable = true; - }; - - networking.hostName = "glados"; - - security.tpm2 = { - enable = true; - abrmd.enable = true; - }; - - services = { - flatpak.enable = true; - fwupd.enable = true; - }; - - systemd = { - services."prepare-kexec".wantedBy = ["multi-user.target"]; - tmpfiles.rules = let - nproc = 12; - in - builtins.map - (n: "w /sys/devices/system/cpu/cpu${builtins.toString n}/cpufreq/energy_performance_preference - - - - ${"balance_performance"}") - (lib.range 0 (nproc - 1)); - }; - - powerManagement.cpuFreqGovernor = "powersave"; - - zramSwap = { - enable = true; - algorithm = "zstd"; - swapDevices = 1; - memoryPercent = 50; - }; -} diff --git a/parts/systems/glados/hardware-configuration.nix b/parts/systems/glados/hardware-configuration.nix deleted file mode 100644 index a7ff9e9..0000000 --- a/parts/systems/glados/hardware-configuration.nix +++ /dev/null @@ -1,72 +0,0 @@ -# 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, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot = { - extraModulePackages = []; - kernelModules = ["kvm-amd"]; - - initrd = { - availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; - kernelModules = []; - - luks.devices."cryptroot" = { - device = "/dev/disk/by-uuid/bbbc1f37-53f5-4776-a70e-f2779179de50"; - allowDiscards = true; - crypttabExtraOpts = ["tpm2-device=auto"]; - }; - }; - }; - - fileSystems = { - "/" = { - device = "/dev/mapper/cryptroot"; - fsType = "btrfs"; - options = ["subvol=root" "compress=zstd" "noatime"]; - }; - - "/var/log" = { - device = "/dev/mapper/cryptroot"; - fsType = "btrfs"; - options = ["subvol=var_log" "compress=zstd" "noatime"]; - }; - - "/nix" = { - device = "/dev/mapper/cryptroot"; - fsType = "btrfs"; - options = ["subvol=nix" "compress=zstd" "noatime" "nodatacow"]; - }; - - "/home" = { - device = "/dev/mapper/cryptroot"; - fsType = "btrfs"; - options = ["subvol=home" "compress=zstd" "noatime"]; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/B95B-9412"; - fsType = "vfat"; - }; - }; - - swapDevices = []; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/parts/systems/profiles.nix b/parts/systems/profiles.nix deleted file mode 100644 index eada9ac..0000000 --- a/parts/systems/profiles.nix +++ /dev/null @@ -1,102 +0,0 @@ -{ - inputs, - self, - ... -}: let - specialArgs = {inherit inputs self;}; -in { - personal = { - system = "x86_64-linux"; - builder = inputs.nixpkgs.lib.nixosSystem; - inherit specialArgs; - - modules = with inputs; [ - agenix.nixosModules.default - catppuccin.nixosModules.catppuccin - hm.nixosModules.home-manager - nur.nixosModules.nur - self.nixosModules.default - - ../users/seth/system.nix - - { - age = { - identityPaths = ["/etc/age/key"]; - secrets = let - baseDir = "${self}/parts/secrets/shared"; - in { - rootPassword.file = "${baseDir}/rootPassword.age"; - sethPassword.file = "${baseDir}/sethPassword.age"; - }; - }; - - base.enable = true; - system.stateVersion = "23.11"; - - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - extraSpecialArgs = specialArgs; - }; - } - ]; - }; - - personal-darwin = { - builder = inputs.darwin.lib.darwinSystem; - inherit specialArgs; - modules = with inputs; [ - hm.darwinModules.home-manager - self.darwinModules.default - - ../users/seth/system.nix - - { - base.enable = true; - desktop.enable = true; - system.stateVersion = 4; - - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - extraSpecialArgs = specialArgs; - - users.seth = { - imports = [ - ../users/seth/darwin.nix - ]; - - getchoo.desktop.enable = false; - }; - }; - } - ]; - }; - - server = { - builder = inputs.nixpkgs-stable.lib.nixosSystem; - inherit specialArgs; - - modules = with inputs; [ - agenix.nixosModules.default - ../modules/nixos/base - ../modules/nixos/server - ../modules/nixos/features/tailscale.nix - - { - features.tailscale = { - enable = true; - ssh.enable = true; - }; - - server = { - enable = true; - secrets.enable = true; - }; - - nix.registry.n.flake = nixpkgs-stable; - system.stateVersion = "23.05"; - } - ]; - }; -} diff --git a/parts/systems/turret/default.nix b/parts/systems/turret/default.nix deleted file mode 100644 index faac3d2..0000000 --- a/parts/systems/turret/default.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ - pkgs, - openwrt-imagebuilder, - ... -}: let - inherit (pkgs) runCommand; - inherit (pkgs.stdenv) mkDerivation; - inherit (openwrt-imagebuilder.lib) build profiles; - wrtProfiles = profiles { - inherit pkgs; - release = "22.03.3"; - }; - config = mkDerivation { - name = "openwrt-config-files"; - src = ./files; - installPhase = '' - mkdir -p $out - cp -r * $out/ - ''; - }; - image = - wrtProfiles.identifyProfile "netgear_wac104" - // { - packages = ["https-dns-proxy"]; - - files = runCommand "image-files" {} '' - mkdir -p $out/etc/uci-defaults - cat > $out/etc/uci-defaults/99-custom <