diff --git a/default.nix b/default.nix index 209a228..7d23d24 100644 --- a/default.nix +++ b/default.nix @@ -1,114 +1,120 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). +{ self, inputs, ... }: { -{ config, lib, pkgs, ... }: + flake.nixosConfigurations."homebox" = inputs.nixpkgs.lib.nixosSystem { -{ + modules = [ + self.nixosModules.homebox + ]; + }; - imports = [ # Include the results of the hardware scan. - ./hardware-configuration.nix - - (import ./disko.nix { device1 = "/dev/nvme0n1"; device2 = "/dev/nvme1n1"; device3 = "/dev/sda"; }) - ]; + flake.nixosModules.homebox = { config, lib, pkgs, ... }: - config = { + { - services = { - xserver = { - enable = false; - videoDrivers = ["nvidia"]; - }; - displayManager = { - enable = false; - defaultSession = "hyprland"; - autoLogin = { - enable = true; - user = "nathan"; + imports = [ # Include the results of the hardware scan. + + (import ./disko.nix { device1 = "/dev/nvme0n1"; device2 = "/dev/nvme1n1"; device3 = "/dev/sda"; }) + ]; + + config = { + + services = { + xserver = { + enable = false; + videoDrivers = ["nvidia"]; }; - }; - pulseaudio.enable = false; - - hardware.openrgb = { - enable = true; - motherboard = "amd"; - }; - }; - - hardware = { - nvidia = { - open = true; - modesetting.enable = true; - nvidiaPersistenced = true; - }; - - bluetooth = { - enable = true; - powerOnBoot = false; - }; - }; - - sops = { - age.keyFile = "/var/lib/sops/age/keys.txt"; - defaultSopsFile = ./secrets.yaml; - defaultSopsFormat = "yaml"; - - secrets = { - "nathan/pass" = { - neededForUsers = true; - }; - }; - }; - - sysconfig = { - - docker.nvidia = true; - - remoteBuildClient = false; - - users = { - nathan = { - isSuperuser = true; - extraGroups = [ "networkmanager" "docker" ]; - ssh.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAsU69CxfQk58CvItPN426h5Alnpb60SH37wet97Vb57 nathan@laptop" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEnUhN2uHwAJF/SLRX3wlGRmfhV3zpP88JQAYB+gh8jW nathan@localhost" - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCM7ZgIu4+ntHZbzo9iQPq5pUt7AhpOnfvvI0lWDgO4CgtkPGvyFrDnW87wjAKGKYkgKeHWHIkwq2hkEDqlPD+7xxtPpwzfyo7ZS23xlP31rL14HcG21jGHgx9SO7RmGDHHylu4PwJzz/KX59hcVmpSSV4hgB/mYA9UKe6VHv39X4y3HsjmiHwNBOKXltG4V+VkxOZD6HcZ62sgkyDTaqDpE7p+q8vHPbm6dVTKC9cMjtJmjB5EesMGKcEAy3VN2tA9M0EndtaLcBKM39vDXGpBsjURYZTu7NbQnncnO7L8kVL0nT4vA/d4mCjB51dPoXIcxn1ise0TOb9G7TxMbBQQO5YMOpiB2iuZRRvB3sYoKwbO8YfSxZi0EhvLcxkF9GBFw+pWPl0p0D2fPBbW88YQfEpoAt2EWvEu/pgaMJsTHpgaIuDwPLVQmDciX4MRoi324oElGSK8yN0P8IaCHhFchuehLBWvTi34Qot0GpnxeTzmlLzImICO9Yq0I7dk2rk= nathan@rpi-3dp" - ]; - shell = pkgs.zsh; - hashedPasswordFile = config.sops.secrets."nathan/pass".path; - home-manager = { + displayManager = { + enable = false; + defaultSession = "hyprland"; + autoLogin = { enable = true; - standalone = false; - extraModules = [ - { - homeconfig = { - minimal = false; - virtual-machines = true; - hyprland.enable = false; - hyprlock.enable = false; - wal.enable = true; - mpd.enable = true; - hyprpanel.enable = false; - calcurse.enable = true; - rofi.enable = false; - firefox.enable = false; - git.enable = true; - nh.enable = true; - }; + user = "nathan"; + }; + }; + pulseaudio.enable = false; - services.hypridle.enable = lib.mkForce false; + hardware.openrgb = { + enable = true; + motherboard = "amd"; + }; + }; - home.packages = with pkgs; [ - wayvnc - openrgb - ]; - } - ]; + hardware = { + nvidia = { + open = true; + modesetting.enable = true; + nvidiaPersistenced = true; + }; + + bluetooth = { + enable = true; + powerOnBoot = false; + }; + }; + + sops = { + age.keyFile = "/var/lib/sops/age/keys.txt"; + defaultSopsFile = ./secrets.yaml; + defaultSopsFormat = "yaml"; + + secrets = { + "nathan/pass" = { + neededForUsers = true; + }; + }; + }; + + sysconfig = { + + host = "homebox"; + + docker.nvidia = true; + + remoteBuildClient = false; + + users = { + nathan = { + isSuperuser = true; + extraGroups = [ "networkmanager" "docker" ]; + ssh.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAsU69CxfQk58CvItPN426h5Alnpb60SH37wet97Vb57 nathan@laptop" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEnUhN2uHwAJF/SLRX3wlGRmfhV3zpP88JQAYB+gh8jW nathan@localhost" + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCM7ZgIu4+ntHZbzo9iQPq5pUt7AhpOnfvvI0lWDgO4CgtkPGvyFrDnW87wjAKGKYkgKeHWHIkwq2hkEDqlPD+7xxtPpwzfyo7ZS23xlP31rL14HcG21jGHgx9SO7RmGDHHylu4PwJzz/KX59hcVmpSSV4hgB/mYA9UKe6VHv39X4y3HsjmiHwNBOKXltG4V+VkxOZD6HcZ62sgkyDTaqDpE7p+q8vHPbm6dVTKC9cMjtJmjB5EesMGKcEAy3VN2tA9M0EndtaLcBKM39vDXGpBsjURYZTu7NbQnncnO7L8kVL0nT4vA/d4mCjB51dPoXIcxn1ise0TOb9G7TxMbBQQO5YMOpiB2iuZRRvB3sYoKwbO8YfSxZi0EhvLcxkF9GBFw+pWPl0p0D2fPBbW88YQfEpoAt2EWvEu/pgaMJsTHpgaIuDwPLVQmDciX4MRoi324oElGSK8yN0P8IaCHhFchuehLBWvTi34Qot0GpnxeTzmlLzImICO9Yq0I7dk2rk= nathan@rpi-3dp" + ]; + shell = pkgs.zsh; + hashedPasswordFile = config.sops.secrets."nathan/pass".path; + home-manager = { + enable = true; + standalone = false; + extraModules = [ + { + homeconfig = { + minimal = false; + virtual-machines = true; + hyprland.enable = false; + hyprlock.enable = false; + wal.enable = true; + mpd.enable = true; + hyprpanel.enable = false; + calcurse.enable = true; + rofi.enable = false; + firefox.enable = false; + git.enable = true; + nh.enable = true; + }; + + services.hypridle.enable = lib.mkForce false; + + home.packages = with pkgs; [ + wayvnc + openrgb + ]; + } + ]; + }; }; }; }; - }; @@ -118,7 +124,8 @@ # this value at the release version of the first install of this system. # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.05"; # Did you read the comment? - }; + system.stateVersion = "23.05"; # Did you read the comment? + }; + }; } diff --git a/disko.nix b/disko.nix index 9aba623..2f8d5ba 100644 --- a/disko.nix +++ b/disko.nix @@ -1,145 +1,148 @@ -{ - device1 ? throw "Set this to your disk device, e.g. /dev/sda", - device2, - device3, - ... -}: { - disko.devices = { - disk = { - main = { - device = device1; - type = "disk"; - content = { - type = "gpt"; - partitions = { - boot = { - name = "boot"; - size = "1M"; - type = "EF02"; - }; - esp = { - name = "ESP"; - size = "500M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; - swap = { - size = "4G"; - content = { - type = "swap"; - resumeDevice = true; - }; - }; - root = { - name = "root"; - size = "100%"; - content = { - type = "lvm_pv"; - vg = "root_vg"; - }; - }; - }; - }; - }; - ssd1 = { - device = device2; - type = "disk"; - content = { - type = "gpt"; - partitions = { - ssd1 = { - name = "ssd1"; - size = "100%"; - content = { - type = "lvm_pv"; - vg = "ssd1_vg"; - }; - }; - }; - }; - }; - hdd1 = { - device = device3; - type = "disk"; - content = { - type = "gpt"; - partitions = { - hdd1 = { - name = "hdd1"; - size = "100%"; - content = { - type = "lvm_pv"; - vg = "hdd1_vg"; - }; - }; - }; - }; - }; - }; - lvm_vg = { - root_vg = { - type = "lvm_vg"; - lvs = { - root = { - size = "100%FREE"; - content = { - type = "btrfs"; - extraArgs = ["-f"]; +{ ... }: { - subvolumes = { - "/root" = { - mountpoint = "/"; - }; + flake.diskoConfigurations.homebox = { + device1 ? throw "Set this to your disk device, e.g. /dev/sda", + device2, + device3, + ... + }: { + disko.devices = { + disk = { + main = { + device = device1; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + esp = { + name = "ESP"; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + swap = { + size = "4G"; + content = { + type = "swap"; + resumeDevice = true; + }; + }; + root = { + name = "root"; + size = "100%"; + content = { + type = "lvm_pv"; + vg = "root_vg"; + }; + }; + }; + }; + }; + ssd1 = { + device = device2; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ssd1 = { + name = "ssd1"; + size = "100%"; + content = { + type = "lvm_pv"; + vg = "ssd1_vg"; + }; + }; + }; + }; + }; + hdd1 = { + device = device3; + type = "disk"; + content = { + type = "gpt"; + partitions = { + hdd1 = { + name = "hdd1"; + size = "100%"; + content = { + type = "lvm_pv"; + vg = "hdd1_vg"; + }; + }; + }; + }; + }; + }; + lvm_vg = { + root_vg = { + type = "lvm_vg"; + lvs = { + root = { + size = "100%FREE"; + content = { + type = "btrfs"; + extraArgs = ["-f"]; - "/nix" = { - mountOptions = ["subvol=nix" "noatime"]; - mountpoint = "/nix"; - }; - }; - }; - }; - }; - }; - ssd1_vg = { - type = "lvm_vg"; - lvs = { - ssd1 = { - size = "100%FREE"; - content = { - type = "btrfs"; - extraArgs = [ "-f" ]; - subvolumes = { - "/ssd1" = { - mountOptions = [ "subvol=ssd1" "noatime" ]; - mountpoint = "/ssd1"; - }; - }; - }; - }; - }; - }; - hdd1_vg = { - type = "lvm_vg"; - lvs = { - hdd1 = { - size = "100%FREE"; - content = { - type = "btrfs"; - extraArgs = [ "-f" ]; - subvolumes = { - "/hdd1" = { - mountOptions = [ "subvol=hdd1" "noatime" ]; - mountpoint = "/hdd1"; - }; - }; - }; - }; - }; - }; - }; - }; + subvolumes = { + "/root" = { + mountpoint = "/"; + }; + + "/nix" = { + mountOptions = ["subvol=nix" "noatime"]; + mountpoint = "/nix"; + }; + }; + }; + }; + }; + }; + ssd1_vg = { + type = "lvm_vg"; + lvs = { + ssd1 = { + size = "100%FREE"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/ssd1" = { + mountOptions = [ "subvol=ssd1" "noatime" ]; + mountpoint = "/ssd1"; + }; + }; + }; + }; + }; + }; + hdd1_vg = { + type = "lvm_vg"; + lvs = { + hdd1 = { + size = "100%FREE"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/hdd1" = { + mountOptions = [ "subvol=hdd1" "noatime" ]; + mountpoint = "/hdd1"; + }; + }; + }; + }; + }; + }; + }; + }; + }; } diff --git a/flake.nix b/flake.nix deleted file mode 100644 index c6e56c8..0000000 --- a/flake.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ - - description = "System Configuration"; - - inputs = { - - nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; - - home-manager = { - url = "github:nix-community/home-manager/release-25.11"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - olympus = { - #url = "git+https://gitea.esotericbytes.com/Blunkall-Technologies/Olympus"; - url = "git+file:///home/nathan/Projects/Olympus"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.home-manager.follows = "home-manager"; - }; - }; - - outputs = { self, nixpkgs, olympus, ... }: let - host = "homebox"; - - in { - - nixosConfigurations."${host}" = nixpkgs.lib.nixosSystem { - - specialArgs = olympus.inputs; - - modules = [ - { sysconfig.host = host; } - ./. - olympus.profiles.homebox - ]; - }; - }; -} diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 622fabb..7861c1c 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -1,39 +1,24 @@ -# 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") - ]; + flake.nixosModules.homebox = { config, lib, pkgs, modulesPath, ... }: - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ "dm-snapshot" ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + { + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; - # 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.br-de2feead48ad.useDHCP = lib.mkDefault true; - # networking.interfaces.docker0.useDHCP = lib.mkDefault true; - # networking.interfaces.enp6s0.useDHCP = lib.mkDefault true; - # networking.interfaces.ve-blunkall-us.useDHCP = lib.mkDefault true; - # networking.interfaces.ve-gitea.useDHCP = lib.mkDefault true; - # networking.interfaces.ve-home-assnHYM.useDHCP = lib.mkDefault true; - # networking.interfaces.ve-jellyfin.useDHCP = lib.mkDefault true; - # networking.interfaces.ve-keycloak.useDHCP = lib.mkDefault true; - # networking.interfaces.ve-n8n.useDHCP = lib.mkDefault true; - # networking.interfaces.ve-netbird.useDHCP = lib.mkDefault true; - # networking.interfaces.ve-nextcloud.useDHCP = lib.mkDefault true; - # networking.interfaces.ve-ollama.useDHCP = lib.mkDefault true; - # networking.interfaces.ve-traefik.useDHCP = lib.mkDefault true; - # networking.interfaces.ve-wyoming.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp7s0.useDHCP = lib.mkDefault true; + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +# 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; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + }; }