From 02648203c622930938cdef4717b6f3b62b531bbb Mon Sep 17 00:00:00 2001 From: Kurtis Date: Wed, 10 Apr 2024 09:08:22 +1000 Subject: [PATCH] Moved config to local one Added rock64 configuration modified configs for a desktop and server version --- blade.nix | 9 ++- components/base-server.nix | 12 +--- components/base-software.nix | 7 -- hosts/blade/hardware-configuration.nix | 92 ------------------------- hosts/w00149/hardware-configuration.nix | 40 ----------- rock64.nix | 57 +++++++++++++++ w00072.nix | 9 ++- w00149.nix | 9 ++- 8 files changed, 84 insertions(+), 151 deletions(-) delete mode 100644 hosts/blade/hardware-configuration.nix delete mode 100644 hosts/w00149/hardware-configuration.nix create mode 100644 rock64.nix diff --git a/blade.nix b/blade.nix index 7f684f4..b371e33 100644 --- a/blade.nix +++ b/blade.nix @@ -2,11 +2,18 @@ { imports = [ # Include the results of the hardware scan. - ./hosts/blade/hardware-configuration.nix + /etc/nixos/hardware-configuration.nix ./components/base-software.nix ./components/user-kurtisa.nix ]; + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Enable networking + networking.networkmanager.enable = true; + networking.hostName = "blade"; # Define your hostname. system.stateVersion = "23.11"; # Did you read the comment? diff --git a/components/base-server.nix b/components/base-server.nix index 5a8fdca..d15332d 100644 --- a/components/base-server.nix +++ b/components/base-server.nix @@ -1,12 +1,5 @@ { config, pkgs, ... }: { - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # Enable networking - networking.networkmanager.enable = true; - # Set your time zone. time.timeZone = "Australia/Brisbane"; @@ -29,9 +22,7 @@ nixpkgs.config.allowUnfree = true; # List packages installed in system profile. To search, run: - # $ nix search wget environment.systemPackages = with pkgs; [ - # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. wget btop duf @@ -44,6 +35,9 @@ stow ]; + # Enable the OpenSSH daemon. + services.openssh.enable = true; + programs.fish.enable = true; } \ No newline at end of file diff --git a/components/base-software.nix b/components/base-software.nix index 20cae6c..8f8bd6f 100644 --- a/components/base-software.nix +++ b/components/base-software.nix @@ -1,12 +1,5 @@ { config, pkgs, ... }: { - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # Enable networking - networking.networkmanager.enable = true; - # Set your time zone. time.timeZone = "Australia/Brisbane"; diff --git a/hosts/blade/hardware-configuration.nix b/hosts/blade/hardware-configuration.nix deleted file mode 100644 index 4b32da8..0000000 --- a/hosts/blade/hardware-configuration.nix +++ /dev/null @@ -1,92 +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" "nvme" "uas" "usbhid" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/6270d5e5-c300-4fb5-9752-93bca7d8cb4b"; - fsType = "ext4"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/5184-28C3"; - fsType = "vfat"; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/156b072b-2d78-40f7-a4ae-9ff8b88b7003"; } - ]; - - # 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.wlo1.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - # Nvidia Drivers - # Enable OpenGL - hardware.opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; - }; - - # Load nvidia driver for Xorg and Wayland - services.xserver.videoDrivers = ["nvidia"]; # or "nvidiaLegacy470 etc. - - hardware.nvidia = { - - # Modesetting is required. - modesetting.enable = true; - - # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - # Enable this if you have graphical corruption issues or application crashes after waking - # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead - # of just the bare essentials. - powerManagement.enable = false; - - # Fine-grained power management. Turns off GPU when not in use. - # Experimental and only works on modern Nvidia GPUs (Turing or newer). - powerManagement.finegrained = false; - - # Use the NVidia open source kernel module (not to be confused with the - # independent third-party "nouveau" open source driver). - # Support is limited to the Turing and later architectures. Full list of - # supported GPUs is at: - # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus - # Only available from driver 515.43.04+ - # Currently alpha-quality/buggy, so false is currently the recommended setting. - open = false; - - # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. - nvidiaSettings = true; - - # Optionally, you may need to select the appropriate driver version for your specific GPU. - package = config.boot.kernelPackages.nvidiaPackages.stable; - }; - - # laptop hybrid video settings settings - hardware.nvidia.prime = { - offload = { - enable = true; - enableOffloadCmd = true; - }; - # Make sure to use the correct Bus ID values for your system! - intelBusId = "PCI:0:2:0"; - nvidiaBusId = "PCI:2:0:0"; - }; -} diff --git a/hosts/w00149/hardware-configuration.nix b/hosts/w00149/hardware-configuration.nix deleted file mode 100644 index 3130bda..0000000 --- a/hosts/w00149/hardware-configuration.nix +++ /dev/null @@ -1,40 +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" "ahci" "nvme" "uas" "usbhid" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/fcc18df6-fd6c-46b6-ba9b-68b35dc7e2e9"; - fsType = "ext4"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/A3AC-7B6E"; - fsType = "vfat"; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/da9cffb9-6af8-4591-8c0c-eeb059144813"; } - ]; - - # 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.eno1.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/rock64.nix b/rock64.nix new file mode 100644 index 0000000..cb64a00 --- /dev/null +++ b/rock64.nix @@ -0,0 +1,57 @@ +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + /etc/nixos/hardware-configuration.nix + ./components/base-server.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 = "rock64"; # Define your hostname. + + # Set your time zone. + time.timeZone = "Australia/Brisbane"; + + users.users.kurtisa = { + isNormalUser = true; + description = "Kurtis Andrews"; + extraGroups = [ "networkmanager" "wheel" ]; + }; + + # List packages installed in system profile. + environment.systemPackages = with pkgs; [ + netclient + ]; + + # Docker + virtualisation.docker.enable = true; + + #wireguard settings + networking.firewall = { + allowedUDPPorts = [ 51820 ]; # Clients and peers can use the same port, see listenport + }; + networking.wireguard.interfaces = { + wg0 = { + ips = [ "10.138.53.253/32" ]; + listenPort = 51820; + mtu = 1420; + privateKey = "EP5qHEd5XCjnRVAHQSobA8LJhnlBMtVFgNbR75s1eUw="; + + peers = [ + { + publicKey = "y5qD7a3Pf2Hmt/kje6zGObPBkYbg4V2Ugxzml1B32xw="; + allowedIPs = [ "10.138.53.0/24" "10.7.0.0/24" "10.14.88.0/24" "10.13.50.0/24" ]; + endpoint = "139.99.171.43:51821"; + persistentKeepalive = 25; + } + ]; + }; + }; + system.stateVersion = "23.05"; # Did you read the comment? + +} diff --git a/w00072.nix b/w00072.nix index 2cc9ae9..859af52 100644 --- a/w00072.nix +++ b/w00072.nix @@ -2,11 +2,18 @@ { imports = [ # Include the results of the hardware scan. - ./hosts/w00072/hardware-configuration.nix + /etc/nixos/hardware-configuration.nix ./components/base-software.nix ./components/user-kurtisa.nix ]; + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Enable networking + networking.networkmanager.enable = true; + networking.hostName = "w00072"; # Define your hostname. system.stateVersion = "23.11"; # Did you read the comment? diff --git a/w00149.nix b/w00149.nix index 6a70a16..551d2ac 100644 --- a/w00149.nix +++ b/w00149.nix @@ -2,11 +2,18 @@ { imports = [ # Include the results of the hardware scan. - ./hosts/w00149/hardware-configuration.nix + /etc/nixos/hardware-configuration.nix ./components/base-software.nix ./components/user-kurtisa.nix ]; + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Enable networking + networking.networkmanager.enable = true; + networking.hostName = "w00149"; # Define your hostname. system.stateVersion = "23.11"; # Did you read the comment?