diff --git a/blade.nix b/blade.nix index 7d4fbcf..5d18116 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 = "24.05"; # Did you read the comment? diff --git a/components/base-server.nix b/components/base-server.nix new file mode 100644 index 0000000..42b7f5d --- /dev/null +++ b/components/base-server.nix @@ -0,0 +1,49 @@ +{ config, pkgs, ... }: +{ + # Set your time zone. + time.timeZone = "Australia/Brisbane"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_AU.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_AU.UTF-8"; + LC_IDENTIFICATION = "en_AU.UTF-8"; + LC_MEASUREMENT = "en_AU.UTF-8"; + LC_MONETARY = "en_AU.UTF-8"; + LC_NAME = "en_AU.UTF-8"; + LC_NUMERIC = "en_AU.UTF-8"; + LC_PAPER = "en_AU.UTF-8"; + LC_TELEPHONE = "en_AU.UTF-8"; + LC_TIME = "en_AU.UTF-8"; + }; + + # Configure keymap in X11 + services.xserver = { + layout = "au"; + xkbVariant = ""; + }; + + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + environment.systemPackages = with pkgs; [ + wget + btop + duf + sshed + nmap + fish + starship + thefuck + git + 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..d1ca797 100644 --- a/components/base-software.nix +++ b/components/base-software.nix @@ -1,17 +1,10 @@ { 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"; # Select internationalisation properties. - i18n.defaultLocale = "en_GB.UTF-8"; + i18n.defaultLocale = "en_AU.UTF-8"; i18n.extraLocaleSettings = { LC_ADDRESS = "en_AU.UTF-8"; @@ -59,6 +52,19 @@ xkbVariant = ""; }; + # Enable Numlock being turned on at startup + systemd.services.numLockOnTty = { + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + # /run/current-system/sw/bin/setleds -D +num < "$tty"; + ExecStart = pkgs.lib.mkForce (pkgs.writeShellScript "numLockOnTty" '' + for tty in /dev/tty{1..6}; do + ${pkgs.kbd}/bin/setleds -D +num < "$tty"; + done + ''); + }; + }; + # Enable CUPS to print documents. services.printing.enable = true; # Print auto discovery is not working seeing if this fixes it. diff --git a/components/user-kurtisa.nix b/components/user-kurtisa.nix index 4353e2e..67e7bad 100644 --- a/components/user-kurtisa.nix +++ b/components/user-kurtisa.nix @@ -12,12 +12,21 @@ in boot.kernelModules = [ "kvm-intel" "kvm-amd" ]; virtualisation.libvirtd.enable = true; virtualisation.spiceUSBRedirection.enable = true; + + #docker + virtualisation.docker.enable = true; + + #GS CONNECT + programs.kdeconnect = { + enable = true; + package = pkgs.gnomeExtensions.gsconnect; + }; # My user account. Don't forget to set a password with ‘passwd’. users.users.kurtisa = { isNormalUser = true; description = "Kurtis Andrews"; - extraGroups = [ "networkmanager" "wheel" ]; + extraGroups = [ "networkmanager" "wheel" "docker" ]; packages = with pkgs; [ firefox thunderbird @@ -31,7 +40,6 @@ in gnome.gnome-boxes gnomeExtensions.caffeine gnome.gnome-disk-utility - gnome-extension-manager ]; shell = pkgs.fish; }; @@ -42,8 +50,12 @@ in tap-to-click = true; two-finger-scrolling-enabled = true; }; + "org/gnome/mutter" = { + edge-tiling = true; + }; "org/gnome/shell".enabled-extensions = [ "caffeine@patapon.info" + "gsconnect@andyholmes.github.io" ]; "org/gnome/desktop/interface" = { clock-format = "12h"; diff --git a/game-serv.nix b/game-serv.nix new file mode 100644 index 0000000..a9fc531 --- /dev/null +++ b/game-serv.nix @@ -0,0 +1,27 @@ +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + /etc/nixos/hardware-configuration.nix + ./components/base-server.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "game-serv"; # Define your hostname. + + users.users.kurtisa = { + isNormalUser = true; + description = "Kurtis Andrews"; + extraGroups = [ "networkmanager" "wheel" "docker"]; + shell = pkgs.fish; + }; + + # Docker + virtualisation.docker.enable = true; + + system.stateVersion = "23.11"; # Did you read the comment? +} \ No newline at end of file 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/update-nix.sh b/update-nix.sh deleted file mode 100755 index 5aec184..0000000 --- a/update-nix.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -# This will update the repo - -echo "Updating Configs" - -git pull - -echo "Done" \ No newline at end of file diff --git a/vargix-os b/vargix-os index 671b6b6..9a97b1a 100755 --- a/vargix-os +++ b/vargix-os @@ -1,27 +1,31 @@ #!/usr/bin/env bash +scriptDIR=$(dirname $0) hostname=$(hostname -f) + # Okay need to get the hostname and see if this exists in our list of items. start () { if [ $hostname == "nixos" ] then # no hostname defined. need to generate menu. - menuItems=( - "1. blade " - "2. W00072" - "3. W00149" - "Q. Exit " - ) - menuActions=( - setupBlade - setupW00072 - setupW00149 - quitApp - ) + menuIndex=1 + menuItems=() + menuActions=() + for entry in "$scriptDIR"/*.nix + do + entry=${entry##*/} + entry=${entry%.nix} + menuItems+=("$menuIndex. $entry") + menuActions+=(build_$entry) + eval "build_${entry}() { hostname=${entry}; doBuild; }" + ((menuIndex+=1)) + done + menuItems+=("Q. Exit") + menuActions+=(quitApp) menuTitle=" New nixos instance detected. Please select a build to deploy." else # Need to check if the nix file exists - if [[ ! -f "$hostname.nix" ]] + if [[ ! -f $scriptDIR/$hostname.nix ]] then menuItems=( "Q. Exit" @@ -33,12 +37,12 @@ start () { else menuItems=( "1. Perform Rebuild" - "2. Update Build " + "2. Update Configs " "Q. Exit " ) menuActions=( doBuild - updateBuild + updateScript quitApp ) menuTitle=" $hostname was found. Proceed with rebuild?" @@ -52,24 +56,11 @@ start () { menuLoop } -setupBlade () { - hostname="blade" - doBuild -} - -setupW00072 () { - hostname="w00072" - doBuild -} - -setupW00149 () { - hostname="w00149" - doBuild -} - doBuild () { logo - sudo nixos-rebuild switch -I nixos-config=./$hostname.nix + sudo nixos-rebuild switch -I nixos-config=$scriptDIR/$hostname.nix --upgrade + echo Finished .. press any key to continue + read -n 1 return 0 } @@ -79,6 +70,14 @@ updateBuild () { return 0 } +updateScript () { + git -C $scriptDIR pull + echo Script pulled you may need to restart vargix-os if theres been an update to it + echo .. press any key to continue + read -n 1 + return 0 +} + quitApp () { return 0 } 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?