From 57d59e5f691a8e9e5483bdad3b9833054c7320c4 Mon Sep 17 00:00:00 2001 From: Truxnell <9149206+truxnell@users.noreply.github.com> Date: Mon, 25 Mar 2024 20:12:54 +1100 Subject: [PATCH] chore: hacking --- nixos/hosts/dns01/default.nix | 93 ++----------------- nixos/hosts/dns01/hardware-configuration.nix | 32 ------- nixos/modules/nixos/system/default.nix | 2 + nixos/modules/nixos/system/nix.nix | 2 +- nixos/modules/nixos/system/systempackages.nix | 8 +- nixos/profiles/global.nix | 1 + nixos/profiles/hw-gaming-desktop.nix | 2 + nixos/profiles/hw-thinkpad-e14-amd.nix | 3 +- 8 files changed, 20 insertions(+), 123 deletions(-) delete mode 100644 nixos/hosts/dns01/hardware-configuration.nix diff --git a/nixos/hosts/dns01/default.nix b/nixos/hosts/dns01/default.nix index 0f8a191..fb7913a 100644 --- a/nixos/hosts/dns01/default.nix +++ b/nixos/hosts/dns01/default.nix @@ -3,107 +3,30 @@ # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). { config , lib -, pkgs +, pkgs , ... }: { imports = [ - # Host-specific - ./hardware-configuration.nix - - # Common imports - ../common/nixos/users/truxnell ../common/optional/fish.nix ../common/optional/monitoring.nix ../common/optional/reboot-required.nix - ../common/optional/sops-nix.nix ../common/optional/dnscrypt-proxy2.nix ../common/optional/cloudflare-dyndns.nix ../common/optional/maddy.nix ]; - # Use the extlinux boot loader. (NixOS wants to enable GRUB by default) - boot.loader.grub.enable = false; - # Enables the generation of /boot/extlinux/extlinux.conf - boot.loader.generic-extlinux-compatible.enable = true; - networking.hostName = "dns01"; # Define your hostname. + networking.useDHCP = lib.mkDefault true; - console.enable = false; - environment.systemPackages = with pkgs; [ - libraspberrypi - raspberrypi-eeprom - ]; + fileSystems."/" = + { + device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888"; + fsType = "ext4"; + }; - # Pick only one of the below networking options. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + swapDevices = [ ]; - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - # Select internationalisation properties. - # i18n.defaultLocale = "en_US.UTF-8"; - # console = { - # font = "Lat2-Terminus16"; - # keyMap = "us"; - # useXkbConfig = true; # use xkb.options in tty. - # }; - # Enable the X11 windowing system. - # services.xserver.enable = true; - - # Configure keymap in X11 - # services.xserver.xkb.layout = "us"; - # services.xserver.xkb.options = "eurosign:e,caps:escape"; - - # Enable CUPS to print documents. - # services.printing.enable = true; - - # Enable sound. - # sound.enable = true; - # hardware.pulseaudio.enable = true; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # Copy the NixOS configuration file and link it from the resulting system - # (/run/current-system/configuration.nix). This is useful in case you - # accidentally delete configuration.nix. - # system.copySystemConfiguration = true; - - # This option defines the first version of NixOS you have installed on this particular machine, - # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. - # - # Most users should NEVER change this value after the initial install, for any reason, - # even if you've upgraded your system to a new NixOS release. - # - # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, - # so changing it will NOT upgrade your system. - # - # This value being lower than the current NixOS release does NOT mean your system is - # out of date, out of support, or vulnerable. - # - # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, - # and migrated your data accordingly. - # - # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . - system.stateVersion = "23.11"; # Did you read the comment? } diff --git a/nixos/hosts/dns01/hardware-configuration.nix b/nixos/hosts/dns01/hardware-configuration.nix deleted file mode 100644 index e2b253d..0000000 --- a/nixos/hosts/dns01/hardware-configuration.nix +++ /dev/null @@ -1,32 +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, pkgs, modulesPath, ... }: - -{ - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "usb_storage" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888"; - fsType = "ext4"; - }; - - 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.end0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlan0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; -} diff --git a/nixos/modules/nixos/system/default.nix b/nixos/modules/nixos/system/default.nix index 933dabe..57e42b9 100644 --- a/nixos/modules/nixos/system/default.nix +++ b/nixos/modules/nixos/system/default.nix @@ -3,5 +3,7 @@ ./openssh.nix ./time.nix ./security.nix + ./systempackages.nix + ./nix.nix ]; } diff --git a/nixos/modules/nixos/system/nix.nix b/nixos/modules/nixos/system/nix.nix index 51a9002..22e0d7a 100644 --- a/nixos/modules/nixos/system/nix.nix +++ b/nixos/modules/nixos/system/nix.nix @@ -30,7 +30,7 @@ in }; - nix = { + config.nix = { optimise.automatic = cfg.autoOptimiseStore; diff --git a/nixos/modules/nixos/system/systempackages.nix b/nixos/modules/nixos/system/systempackages.nix index c23f202..49969d1 100644 --- a/nixos/modules/nixos/system/systempackages.nix +++ b/nixos/modules/nixos/system/systempackages.nix @@ -8,10 +8,10 @@ let cfg = config.mySystem.system; in { - options.mySystem.system.packages = { - autoOptimiseStore = mkOption + options.mySystem.system = { + packages = mkOption { - type = lib.types.list; + type = with types; listOf package; description = "List of system level package installs"; default = [ ]; }; @@ -21,6 +21,6 @@ in # This is NixOS so lets keep this liiight? # Ideally i'd keep most of it to home-manager user only stuff # and keep server role as light as possible - config.environment.system.packages = cfg.packages; + config.environment.systemPackages = cfg.packages; } diff --git a/nixos/profiles/global.nix b/nixos/profiles/global.nix index 7ee1bb5..f544622 100644 --- a/nixos/profiles/global.nix +++ b/nixos/profiles/global.nix @@ -25,6 +25,7 @@ with lib; # basics for all devices time.timeZone = "Australia/Melbourne"; security.increaseWheelLoginLimits = true; + system.packages = [ pkgs.bat ]; }; i18n = { diff --git a/nixos/profiles/hw-gaming-desktop.nix b/nixos/profiles/hw-gaming-desktop.nix index 0b108b6..066b5d0 100644 --- a/nixos/profiles/hw-gaming-desktop.nix +++ b/nixos/profiles/hw-gaming-desktop.nix @@ -3,9 +3,11 @@ with lib; { boot = { + initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; kernelModules = [ "kvm-amd" ]; extraModulePackages = [ ]; + loader = { systemd-boot.enable = true; efi.canTouchEfiVariables = true; diff --git a/nixos/profiles/hw-thinkpad-e14-amd.nix b/nixos/profiles/hw-thinkpad-e14-amd.nix index d7a0686..2486db9 100644 --- a/nixos/profiles/hw-thinkpad-e14-amd.nix +++ b/nixos/profiles/hw-thinkpad-e14-amd.nix @@ -5,9 +5,10 @@ with lib; boot = { initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "usb_storage" "sd_mod" ]; + initrd.kernelModules = [ "amdgpu" ]; kernelModules = [ "kvm-amd" ]; extraModulePackages = [ ]; - initrd.kernelModules = [ "amdgpu" ]; + loader = { systemd-boot.enable = true; efi.canTouchEfiVariables = true;