From 195502dcbe4dbba78195c0fb263bba24f60ebc57 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sat, 22 Jun 2024 12:10:36 -0400 Subject: [PATCH] simplified module options and host configs after dropping nixos-hardware input --- flake.lock | 53 ++-------- flake.nix | 8 +- hosts/fallarbor/default.nix | 45 +++----- hosts/fallarbor/hardware.nix | 70 +++++++++---- hosts/fallarbor/home.nix | 4 +- hosts/lavaridge/default.nix | 66 +++++------- hosts/lavaridge/hardware.nix | 47 +++++---- hosts/lavaridge/home.nix | 4 +- hosts/mandarin/default.nix | 63 ++++++------ hosts/mandarin/hardware.nix | 32 ++---- hosts/mauville/default.nix | 181 ++++++++++++++++++--------------- hosts/mauville/filesystems.nix | 36 +++++++ hosts/mauville/hardware.nix | 48 +-------- hosts/petalburg/default.nix | 50 ++++----- hosts/petalburg/hardware.nix | 40 ++++---- hosts/petalburg/home.nix | 4 +- hosts/rustboro/default.nix | 39 ++++--- hosts/rustboro/hardware.nix | 57 ++++++----- hosts/rustboro/home.nix | 4 +- nixosModules/options.nix | 31 ++++-- 20 files changed, 429 insertions(+), 453 deletions(-) create mode 100644 hosts/mauville/filesystems.nix diff --git a/flake.lock b/flake.lock index 0e7dc3dd..057e8f12 100644 --- a/flake.lock +++ b/flake.lock @@ -147,11 +147,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1718835324, - "narHash": "sha256-U5eKTPAXppfSIqKqMIgbyuTBy1gr2seSOUl8sUSR8FE=", + "lastModified": 1719068705, + "narHash": "sha256-gXVqDR1SWofZMZnCz7pXfOP5+e/PNgvZGSI3Eoh+r7c=", "ref": "refs/heads/main", - "rev": "fabc30df52ab5d2c369fc8acd4ff909a6ba3b8ac", - "revCount": 4870, + "rev": "0b924f541c744f96d32c9a0d98dcfd90205bab4c", + "revCount": 4875, "submodules": true, "type": "git", "url": "https://github.com/hyprwm/Hyprland" @@ -270,7 +270,9 @@ }, "iio-hyprland": { "inputs": { - "nixpkgs": "nixpkgs_2", + "nixpkgs": [ + "nixpkgsUnstable" + ], "systems": "systems_3" }, "locked": { @@ -287,22 +289,6 @@ "type": "github" } }, - "nixos-hardware": { - "locked": { - "lastModified": 1718894893, - "narHash": "sha256-hxQBUtDbFOCCW1CsFZTS9Q5Ov1ZKdJgbBZHSez1M6iA=", - "owner": "NixOS", - "repo": "nixos-hardware", - "rev": "083823b7904e43a4fc1c7229781417e875359a42", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "master", - "repo": "nixos-hardware", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1718530797, @@ -321,11 +307,11 @@ }, "nixpkgsUnstable": { "locked": { - "lastModified": 1718714799, - "narHash": "sha256-FUZpz9rg3gL8NVPKbqU8ei1VkPLsTIfAJ2fdAf5qjak=", + "lastModified": 1718895438, + "narHash": "sha256-k3JqJrkdoYwE3fHE6xGDY676AYmyh4U2Zw+0Bwe5DLU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c00d587b1a1afbf200b1d8f0b0e4ba9deb1c7f0e", + "rev": "d603719ec6e294f034936c0d0dc06f689d91b6c3", "type": "github" }, "original": { @@ -336,22 +322,6 @@ } }, "nixpkgs_2": { - "locked": { - "lastModified": 1713714899, - "narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "6143fc5eeb9c4f00163267708e26191d1e918932", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1718835956, "narHash": "sha256-wM9v2yIxClRYsGHut5vHICZTK7xdrUGfrLkXvSuv6s4=", @@ -374,8 +344,7 @@ "home-manager": "home-manager_2", "hyprland": "hyprland", "iio-hyprland": "iio-hyprland", - "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_2", "nixpkgsUnstable": "nixpkgsUnstable" } }, diff --git a/flake.nix b/flake.nix index 4428baba..46b6f222 100644 --- a/flake.nix +++ b/flake.nix @@ -23,10 +23,10 @@ hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; ## Motion sensor and auto-rotate for Hyprland. - iio-hyprland.url = "github:JeanSchoeller/iio-hyprland"; - - # Pre-baked hardware support for various devices. - nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + iio-hyprland = { + url = "github:JeanSchoeller/iio-hyprland"; + inputs.nixpkgs.follows = "nixpkgsUnstable"; + }; # Latest stable NixOS release. nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; diff --git a/hosts/fallarbor/default.nix b/hosts/fallarbor/default.nix index 5416018f..0256239f 100644 --- a/hosts/fallarbor/default.nix +++ b/hosts/fallarbor/default.nix @@ -13,22 +13,25 @@ ./home.nix ]; - boot = { - # Bootloader. - loader.systemd-boot.enable = true; - loader.efi.canTouchEfiVariables = true; - - # Use latest Linux kernel. - kernelPackages = pkgs.linuxPackages_latest; + boot.loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; }; - networking.hostName = "fallarbor"; # Define your hostname. + networking.hostName = "fallarbor"; - services = { - fwupd.enable = true; - }; + system.stateVersion = "24.05"; alyraffauf = { + apps.steam.enable = true; + base.enable = true; + + desktop = { + enable = true; + greetd.enable = true; + hyprland.enable = true; + }; + services = { flatpak.enable = true; syncthing = { @@ -37,33 +40,17 @@ }; tailscale.enable = true; }; - base = { - enable = true; - plymouth.enable = true; - zramSwap = {enable = true;}; - }; + users = { aly = { enable = true; password = "$y$j9T$0p6rc4p5sn0LJ/6XyAGP7.$.wmTafwMMscdW1o8kqqoHJP7U8kF.4WBmzzcPYielR3"; }; + dustin = { enable = true; password = "$y$j9T$OXQYhj4IWjRJWWYsSwcqf.$lCcdq9S7m0EAdej9KMHWj9flH8K2pUb2gitNhLTlLG/"; }; }; - desktop = { - enable = true; - greetd.enable = true; - hyprland.enable = true; - }; - apps = { - steam.enable = true; - }; - scripts = { - hoenn.enable = true; - }; }; - - system.stateVersion = "24.05"; } diff --git a/hosts/fallarbor/hardware.nix b/hosts/fallarbor/hardware.nix index def7efdf..5e65d432 100644 --- a/hosts/fallarbor/hardware.nix +++ b/hosts/fallarbor/hardware.nix @@ -2,53 +2,85 @@ config, inputs, lib, - modulesPath, pkgs, ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - inputs.nixos-hardware.nixosModules.framework-11th-gen-intel - ]; - boot = { + blacklistedKernelModules = ["cros-usbpd-charger"]; + + extraModulePackages = with config.boot.kernelPackages; [ + framework-laptop-kmod + ]; + initrd = { availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; - kernelModules = []; + kernelModules = ["i915"]; }; - extraModulePackages = []; - kernelModules = ["kvm-intel"]; + kernelModules = [ + # https://github.com/DHowett/framework-laptop-kmod?tab=readme-ov-file#usage + "cros_ec_lpcs" + "cros_ec" + "i915" + "kvm-intel" + ]; + + kernelPackages = pkgs.linuxPackages_latest; + + kernelParams = [ + "nvme.noacpi=1" # https://community.frame.work/t/linux-battery-life-tuning/6665/156 + ]; }; - nixpkgs = { - hostPlatform = lib.mkDefault "x86_64-linux"; + environment = { + sessionVariables = { + LIBVA_DRIVER_NAME = "iHD"; # Force intel-media-driver + VDPAU_DRIVER = "va_gl"; + }; + + systemPackages = [pkgs.framework-tool] ++ lib.optional (pkgs ? "fw-ectool") pkgs.fw-ectool; }; hardware = { - cpu.intel.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; - + acpilight.enable = true; + cpu.intel.updateMicrocode = true; enableAllFirmware = true; opengl = { enable = true; + driSupport = true; + driSupport32Bit = true; extraPackages = with pkgs; [ intel-media-driver # LIBVA_DRIVER_NAME=iHD intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) libvdpau-va-gl ]; + + extraPackages32 = with pkgs.driversi686Linux; [ + intel-media-driver # LIBVA_DRIVER_NAME=iHD + intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + libvdpau-va-gl + ]; }; + + sensor.iio.enable = true; }; - environment.sessionVariables = { - LIBVA_DRIVER_NAME = "iHD"; # Force intel-media-driver - }; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; # Save power/better manage heat & fans. powerManagement.powertop.enable = true; - services.thermald.enable = true; - networking.useDHCP = lib.mkDefault true; + services = { + fprintd.enable = true; + fstrim.enable = true; + fwupd.enable = true; + thermald.enable = true; + + udev.extraRules = '' + # Ethernet expansion card support + ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8156", ATTR{power/autosuspend}="20" + ''; + }; } diff --git a/hosts/fallarbor/home.nix b/hosts/fallarbor/home.nix index f19cae0c..8edd44d2 100644 --- a/hosts/fallarbor/home.nix +++ b/hosts/fallarbor/home.nix @@ -1,8 +1,8 @@ { - inputs, config, - pkgs, + inputs, lib, + pkgs, ... }: { home-manager = { diff --git a/hosts/lavaridge/default.nix b/hosts/lavaridge/default.nix index 934a43d4..6e29c0af 100644 --- a/hosts/lavaridge/default.nix +++ b/hosts/lavaridge/default.nix @@ -13,59 +13,47 @@ ./home.nix ]; - boot = { - # Bootloader. - loader.systemd-boot.enable = true; - loader.efi.canTouchEfiVariables = true; - - # Use latest Linux kernel. - kernelPackages = pkgs.linuxPackages_latest; + boot.loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; }; - networking.hostName = "lavaridge"; # Define your hostname. + networking.hostName = "lavaridge"; - services = { - fwupd.enable = true; - }; + system.stateVersion = "24.05"; alyraffauf = { - base = { - enable = true; - sambaAutoMount = true; - plymouth.enable = true; - zramSwap = {enable = true;}; - }; - users = { - aly = { - enable = true; - password = "$y$j9T$NSS7QcEtN4yiigPyofwlI/$nxdgz0lpySa0heDMjGlHe1gX3BWf48jK6Tkfg4xMEs6"; - }; - }; - desktop = { - enable = true; - greetd = { - enable = true; - session = lib.getExe config.programs.hyprland.package; - autologin = { - enable = true; - user = "aly"; - }; - }; - hyprland.enable = true; - }; apps = { steam.enable = true; podman.enable = true; virt-manager.enable = true; }; - scripts = { - hoenn.enable = true; + + base.enable = true; + + desktop = { + enable = true; + + greetd = { + enable = true; + + autologin = { + enable = true; + user = "aly"; + }; + }; + + hyprland.enable = true; }; + services = { syncthing.enable = true; tailscale.enable = true; }; - }; - system.stateVersion = "24.05"; + users.aly = { + enable = true; + password = "$y$j9T$NSS7QcEtN4yiigPyofwlI/$nxdgz0lpySa0heDMjGlHe1gX3BWf48jK6Tkfg4xMEs6"; + }; + }; } diff --git a/hosts/lavaridge/hardware.nix b/hosts/lavaridge/hardware.nix index c8bfeae2..c23dc60b 100644 --- a/hosts/lavaridge/hardware.nix +++ b/hosts/lavaridge/hardware.nix @@ -1,49 +1,52 @@ -# 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, inputs, lib, - modulesPath, pkgs, ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - inputs.nixos-hardware.nixosModules.framework-13-7040-amd - ]; - boot = { + extraModulePackages = with config.boot.kernelPackages; [ + framework-laptop-kmod + ]; + initrd = { - availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"]; + availableKernelModules = ["nvme" "sd_mod" "thunderbolt" "usb_storage" "xhci_pci"]; kernelModules = ["amdgpu"]; }; - extraModulePackages = []; - kernelModules = ["kvm-amd" "amdgpu"]; - kernelParams = ["amdgpu.abmlevel=0"]; + kernelModules = ["amdgpu" "cros_ec" "cros_ec_lpcs" "kvm-amd"]; + kernelPackages = pkgs.linuxPackages_latest; + kernelParams = ["amdgpu.abmlevel=0" "amd_pstate=active"]; }; - hardware = { - cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + environment.systemPackages = [pkgs.framework-tool]; + hardware = { + cpu.amd.updateMicrocode = true; enableAllFirmware = true; opengl = { - ## radv: an open-source Vulkan driver from freedesktop + enable = true; driSupport = true; driSupport32Bit = true; - - ## amdvlk: an open-source Vulkan driver from AMD extraPackages = [pkgs.rocmPackages.clr.icd pkgs.amdvlk]; extraPackages32 = [pkgs.driversi686Linux.amdvlk]; }; + + sensor.iio.enable = true; }; - services.xserver.videoDrivers = ["amdgpu"]; - - networking.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + + services = { + fprintd.enable = true; + fstrim.enable = true; + fwupd.enable = true; + + udev.extraRules = '' + # Ethernet expansion card support + ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0bda", ATTR{idProduct}=="8156", ATTR{power/autosuspend}="20" + ''; + }; } diff --git a/hosts/lavaridge/home.nix b/hosts/lavaridge/home.nix index acd2a41b..66037032 100644 --- a/hosts/lavaridge/home.nix +++ b/hosts/lavaridge/home.nix @@ -1,8 +1,8 @@ { - inputs, config, - pkgs, + inputs, lib, + pkgs, ... }: { home-manager = { diff --git a/hosts/mandarin/default.nix b/hosts/mandarin/default.nix index 13b9165c..5ab991df 100644 --- a/hosts/mandarin/default.nix +++ b/hosts/mandarin/default.nix @@ -1,4 +1,4 @@ -# Custom Desktop with Ryzen CPU and Nvidia GPU. +# Custom desktop with AMD Ryzen 5 5600x, 32GB RAM, AMD Rx 7800 XT, and 1TB SSD + 2TB SSD. { config, inputs, @@ -13,62 +13,61 @@ ./home.nix ]; - boot = { - # Bootloader. - loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; - }; + boot.loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; }; networking.hostName = "mandarin"; + system.stateVersion = "24.05"; + alyraffauf = { - base = { - enable = true; - plymouth.enable = true; - zramSwap.enable = true; - }; - users = { - aly = { - enable = true; - password = "$y$j9T$NSS7QcEtN4yiigPyofwlI/$nxdgz0lpySa0heDMjGlHe1gX3BWf48jK6Tkfg4xMEs6"; - }; - morgan = { - enable = true; - password = "$y$j9T$frYXYFwo4KuPWEqilfPCN1$CtRMMK4HFLKu90qkv1cCkvp1UdJocUbkySQlVElwkM2"; - }; + apps = { + podman.enable = true; + steam.enable = true; + virt-manager.enable = true; }; + + base.enable = true; + desktop = { enable = true; + greetd = { enable = true; - session = lib.getExe config.programs.hyprland.package; + autologin = { enable = true; user = "morgan"; }; }; + hyprland.enable = true; steam.enable = true; }; - apps = { - steam.enable = true; - podman.enable = true; - virt-manager.enable = true; - }; - scripts = { - hoenn.enable = true; - }; + services = { flatpak.enable = true; + ollama = { enable = true; gpu = "amd"; }; + tailscale.enable = true; }; - }; - system.stateVersion = "24.05"; + users = { + aly = { + enable = true; + password = "$y$j9T$NSS7QcEtN4yiigPyofwlI/$nxdgz0lpySa0heDMjGlHe1gX3BWf48jK6Tkfg4xMEs6"; + }; + + morgan = { + enable = true; + password = "$y$j9T$frYXYFwo4KuPWEqilfPCN1$CtRMMK4HFLKu90qkv1cCkvp1UdJocUbkySQlVElwkM2"; + }; + }; + }; } diff --git a/hosts/mandarin/hardware.nix b/hosts/mandarin/hardware.nix index 642dd0be..f19922e7 100644 --- a/hosts/mandarin/hardware.nix +++ b/hosts/mandarin/hardware.nix @@ -1,53 +1,35 @@ -# 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, inputs, lib, - modulesPath, pkgs, ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - inputs.nixos-hardware.nixosModules.common-cpu-amd - inputs.nixos-hardware.nixosModules.common-pc-ssd - ]; - boot = { initrd = { - availableKernelModules = [ - "nvme" - "sd_mod" - "usb_storage" - "usbhid" - "xhci_pci" - ]; + availableKernelModules = ["nvme" "sd_mod" "usb_storage" "usbhid" "xhci_pci"]; kernelModules = ["amdgpu"]; }; + kernelModules = ["kvm-amd" "amdgpu"]; + + kernelPackages = pkgs.linuxPackages_latest; }; hardware = { - cpu.amd.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; - + cpu.amd.updateMicrocode = true; enableAllFirmware = true; opengl = { enable = true; driSupport = true; driSupport32Bit = true; - extraPackages = with pkgs; [rocmPackages.clr.icd amdvlk]; extraPackages32 = with pkgs; [driversi686Linux.amdvlk]; }; }; - services.xserver.videoDrivers = ["amdgpu"]; - - networking.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + + services.fstrim.enable = true; } diff --git a/hosts/mauville/default.nix b/hosts/mauville/default.nix index a1f68f53..a19df6f6 100644 --- a/hosts/mauville/default.nix +++ b/hosts/mauville/default.nix @@ -14,92 +14,30 @@ archiveDirectory = "/mnt/Archive"; in { imports = [ + ./filesystems.nix ./hardware.nix ./home.nix ]; - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - networking.hostName = hostName; # Define your hostname. - - alyraffauf = { - apps = { - nicotine-plus.enable = true; - podman.enable = true; - steam.enable = true; - virt-manager.enable = true; - }; - containers = { - nixos = { - navidrome.enable = true; - }; - oci = { - audiobookshelf.enable = true; - freshRSS.enable = true; - plexMediaServer.enable = true; - transmission.enable = true; - }; - }; - desktop = { - enable = true; - greetd = { - enable = true; - session = lib.getExe config.programs.hyprland.package; - autologin = { - enable = true; - user = "aly"; - }; - }; - hyprland.enable = true; - sway.enable = true; - }; - users = { - aly = { - enable = true; - password = "$y$j9T$SHPShqI2IpRE101Ey2ry/0$0mhW1f9LbVY02ifhJlP9XVImge9HOpf23s9i1JFLIt9"; - }; - dustin = { - enable = true; - password = "$y$j9T$3mMCBnUQ.xjuPIbSof7w0.$fPtRGblPRSwRLj7TFqk1nzuNQk2oVlgvb/bE47sghl."; - }; - }; - services = { - binaryCache.enable = true; - ollama = { - enable = true; - gpu = "amd"; - listenAddress = "0.0.0.0:11434"; - }; - syncthing = { - enable = true; - syncMusic = true; - musicPath = "${mediaDirectory}/Music"; - }; - tailscale.enable = true; - }; - scripts = { - hoenn.enable = true; - }; - base = { - enable = true; - plymouth.enable = true; - zramSwap = { - enable = true; - size = 100; - }; - }; + boot.loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; }; + system.stateVersion = "23.11"; + networking = { - firewall = let - transmissionPort = config.alyraffauf.containers.oci.transmission.port; - bitTorrentPort = config.alyraffauf.containers.oci.transmission.bitTorrentPort; - in { - allowedTCPPorts = [80 443 transmissionPort bitTorrentPort]; - allowedUDPPorts = [bitTorrentPort]; + firewall = { + allowedTCPPorts = [ + 80 + 443 + config.alyraffauf.containers.oci.transmission.port + config.alyraffauf.containers.oci.transmission.bitTorrentPort + ]; + + allowedUDPPorts = [config.alyraffauf.containers.oci.transmission.bitTorrentPort]; }; + # My router doesn't expose settings for NAT loopback # So we have to use this workaround. extraHosts = '' @@ -109,6 +47,8 @@ in { 127.0.0.1 plex.${domain} 127.0.0.1 podcasts.${domain} ''; + + hostName = hostName; }; security.acme = { @@ -118,6 +58,7 @@ in { services = { fail2ban.enable = true; + nginx = { enable = true; recommendedGzipSettings = true; @@ -128,9 +69,11 @@ in { "music.${domain}" = { enableACME = true; forceSSL = true; + locations."/" = { proxyPass = "http://127.0.0.1:4533"; proxyWebsockets = true; + extraConfig = '' proxy_buffering off; ''; @@ -140,9 +83,11 @@ in { "news.${domain}" = { enableACME = true; forceSSL = true; + locations."/" = { proxyPass = "http://127.0.0.1:${toString config.alyraffauf.containers.oci.freshRSS.port}"; proxyWebsockets = true; # needed if you need to use WebSocket + extraConfig = '' proxy_buffering off; proxy_redirect off; @@ -156,6 +101,7 @@ in { "nixcache.${domain}" = { enableACME = true; forceSSL = true; + locations."/".proxyPass = "http://${config.services.nix-serve.bindAddress}:${ toString config.services.nix-serve.port }"; @@ -164,9 +110,11 @@ in { "plex.${domain}" = { enableACME = true; forceSSL = true; + locations."/" = { proxyPass = "http://127.0.0.1:${toString config.alyraffauf.containers.oci.plexMediaServer.port}"; proxyWebsockets = true; + extraConfig = '' proxy_buffering off; ''; @@ -176,9 +124,10 @@ in { "podcasts.${domain}" = { enableACME = true; forceSSL = true; + locations."/" = { proxyPass = "http://127.0.0.1:${toString config.alyraffauf.containers.oci.audiobookshelf.port}"; - # proxyWebsockets = true; # This breaks audiobookshelf. + extraConfig = '' client_max_body_size 500M; proxy_buffering off; @@ -195,8 +144,9 @@ in { }; samba = { enable = true; - securityType = "user"; openFirewall = true; + securityType = "user"; + shares = { Media = { browseable = "yes"; @@ -207,6 +157,7 @@ in { "create mask" = "0755"; "directory mask" = "0755"; }; + Archive = { browseable = "yes"; comment = "Archive @ ${hostName}"; @@ -218,11 +169,79 @@ in { }; }; }; + samba-wsdd = { enable = true; openFirewall = true; }; }; - system.stateVersion = "23.11"; + alyraffauf = { + apps = { + nicotine-plus.enable = true; + podman.enable = true; + steam.enable = true; + virt-manager.enable = true; + }; + + base = { + enable = true; + zramSwap.size = 100; + }; + + containers = { + nixos.navidrome.enable = true; + + oci = { + audiobookshelf.enable = true; + freshRSS.enable = true; + plexMediaServer.enable = true; + transmission.enable = true; + }; + }; + + desktop = { + enable = true; + + greetd = { + enable = true; + + autologin = { + enable = true; + user = "aly"; + }; + }; + + hyprland.enable = true; + }; + users = { + aly = { + enable = true; + password = "$y$j9T$SHPShqI2IpRE101Ey2ry/0$0mhW1f9LbVY02ifhJlP9XVImge9HOpf23s9i1JFLIt9"; + }; + + dustin = { + enable = true; + password = "$y$j9T$3mMCBnUQ.xjuPIbSof7w0.$fPtRGblPRSwRLj7TFqk1nzuNQk2oVlgvb/bE47sghl."; + }; + }; + + services = { + binaryCache.enable = true; + + ollama = { + enable = true; + gpu = "amd"; + listenAddress = "0.0.0.0:11434"; + }; + + syncthing = { + enable = true; + syncMusic = true; + musicPath = "${mediaDirectory}/Music"; + }; + + tailscale.enable = true; + }; + }; } diff --git a/hosts/mauville/filesystems.nix b/hosts/mauville/filesystems.nix new file mode 100644 index 00000000..b98f5b3b --- /dev/null +++ b/hosts/mauville/filesystems.nix @@ -0,0 +1,36 @@ +{ + config, + inputs, + lib, + pkgs, + ... +}: { + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/c4217c88-3101-434b-8321-58e2ac89527c"; + fsType = "ext4"; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/3445-B2A0"; + fsType = "vfat"; + }; + + "/mnt/Archive" = { + device = "/dev/disk/by-uuid/f7e9e6d6-2bf6-429a-aaf0-49b55d53fc83"; + fsType = "ext4"; + }; + + "/mnt/Media" = { + device = "/dev/disk/by-uuid/d988d5ca-f9d6-4d85-aa0e-8a437b3c859a"; + fsType = "ext4"; + }; + }; + + swapDevices = [ + { + device = "/dev/disk/by-uuid/26094ada-7ba4-4437-bacb-b3cdf6c3397b"; + priority = 1; + } + ]; +} diff --git a/hosts/mauville/hardware.nix b/hosts/mauville/hardware.nix index 0cea1b2f..a530346d 100644 --- a/hosts/mauville/hardware.nix +++ b/hosts/mauville/hardware.nix @@ -2,16 +2,9 @@ config, inputs, lib, - modulesPath, pkgs, ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - inputs.nixos-hardware.nixosModules.common-cpu-amd - inputs.nixos-hardware.nixosModules.common-pc-ssd - ]; - boot = { initrd = { availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "sd_mod"]; @@ -22,8 +15,7 @@ }; hardware = { - cpu.amd.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; + cpu.amd.updateMicrocode = true; enableAllFirmware = true; @@ -31,46 +23,12 @@ enable = true; driSupport = true; driSupport32Bit = true; - extraPackages = with pkgs; [rocmPackages.clr.icd amdvlk]; extraPackages32 = with pkgs; [driversi686Linux.amdvlk]; }; }; - fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/c4217c88-3101-434b-8321-58e2ac89527c"; - fsType = "ext4"; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/3445-B2A0"; - fsType = "vfat"; - }; - - "/mnt/Archive" = { - device = "/dev/disk/by-uuid/f7e9e6d6-2bf6-429a-aaf0-49b55d53fc83"; - fsType = "ext4"; - }; - - "/mnt/Media" = { - device = "/dev/disk/by-uuid/d988d5ca-f9d6-4d85-aa0e-8a437b3c859a"; - fsType = "ext4"; - }; - }; - - swapDevices = [ - { - device = "/dev/disk/by-uuid/26094ada-7ba4-4437-bacb-b3cdf6c3397b"; - priority = 1; - } - ]; - - services.xserver = { - videoDrivers = ["amdgpu"]; # Add AMDGPU driver. - }; - - networking.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + + services.fstrim.enable = true; } diff --git a/hosts/petalburg/default.nix b/hosts/petalburg/default.nix index b71eda81..ae6bb52b 100644 --- a/hosts/petalburg/default.nix +++ b/hosts/petalburg/default.nix @@ -1,4 +1,4 @@ -# Lenovo Yoga 9i Convertible with Intel Core i7-1360P, 15GB RAM, 512GB SSD. +# Lenovo Yoga 9i Convertible with Intel Core i7-1360P, 16GB RAM, 512GB SSD. { config, inputs, @@ -13,53 +13,43 @@ ./home.nix ]; - boot = { - # Bootloader. - loader.systemd-boot.enable = true; - loader.efi.canTouchEfiVariables = true; - - # Use latest Linux kernel. - kernelPackages = pkgs.linuxPackages_latest; + boot.loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; }; - networking.hostName = "petalburg"; # Define your hostname. + networking.hostName = "petalburg"; + + system.stateVersion = "24.05"; alyraffauf = { - base = { - enable = true; - sambaAutoMount = true; - plymouth.enable = true; - zramSwap = {enable = true;}; - }; - users = { - aly = { - enable = true; - password = "$y$j9T$TitXX3J690cnK41XciNMg/$APKHM/os6FKd9H9aXGxaHaQ8zP5SenO9EO94VYafl43"; - }; - }; + apps.steam.enable = true; + + base.enable = true; + desktop = { enable = true; + greetd = { enable = true; - session = lib.getExe config.programs.hyprland.package; + autologin = { enable = true; user = "aly"; }; }; + hyprland.enable = true; }; - apps = { - steam.enable = true; - }; - scripts = { - hoenn.enable = true; - }; + services = { syncthing.enable = true; tailscale.enable = true; }; - }; - system.stateVersion = "24.05"; + users.aly = { + enable = true; + password = "$y$j9T$TitXX3J690cnK41XciNMg/$APKHM/os6FKd9H9aXGxaHaQ8zP5SenO9EO94VYafl43"; + }; + }; } diff --git a/hosts/petalburg/hardware.nix b/hosts/petalburg/hardware.nix index b6af5e61..deece35c 100644 --- a/hosts/petalburg/hardware.nix +++ b/hosts/petalburg/hardware.nix @@ -2,57 +2,57 @@ config, inputs, lib, - modulesPath, pkgs, ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - inputs.nixos-hardware.nixosModules.common-cpu-intel - inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd - ]; - boot = { initrd = { - availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; - kernelModules = []; + availableKernelModules = ["nvme" "sd_mod" "thunderbolt" "usb_storage" "xhci_pci"]; + kernelModules = ["i915"]; }; - extraModulePackages = []; kernelModules = ["kvm-intel"]; + kernelPackages = pkgs.linuxPackages_latest; }; - # Intel drivers with accelerated video playback support. - nixpkgs = { - hostPlatform = lib.mkDefault "x86_64-linux"; + environment.sessionVariables = { + LIBVA_DRIVER_NAME = "iHD"; + VDPAU_DRIVER = "va_gl"; }; hardware = { - cpu.intel.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; + cpu.intel.updateMicrocode = true; enableAllFirmware = true; opengl = { enable = true; + driSupport = true; + driSupport32Bit = true; extraPackages = with pkgs; [ intel-media-driver # LIBVA_DRIVER_NAME=iHD intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) libvdpau-va-gl ]; + + extraPackages32 = with pkgs.driversi686Linux; [ + intel-media-driver # LIBVA_DRIVER_NAME=iHD + intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + libvdpau-va-gl + ]; }; sensor.iio.enable = true; # Enable auto-rotate and tablet mode. }; - environment.sessionVariables = { - LIBVA_DRIVER_NAME = "iHD"; # Force intel-media-driver - }; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; # Save power/better manage heat & fans. powerManagement.powertop.enable = true; - services.thermald.enable = true; - networking.useDHCP = lib.mkDefault true; + services = { + fstrim.enable = true; + thermald.enable = true; + }; } diff --git a/hosts/petalburg/home.nix b/hosts/petalburg/home.nix index 54604f3f..f16f0c6d 100644 --- a/hosts/petalburg/home.nix +++ b/hosts/petalburg/home.nix @@ -1,8 +1,8 @@ { - inputs, config, - pkgs, + inputs, lib, + pkgs, ... }: { home-manager = { diff --git a/hosts/rustboro/default.nix b/hosts/rustboro/default.nix index 58ff3e8d..1be7788c 100644 --- a/hosts/rustboro/default.nix +++ b/hosts/rustboro/default.nix @@ -13,49 +13,44 @@ ./home.nix ]; - boot = { - # Bootloader. - loader.systemd-boot.enable = true; - loader.efi.canTouchEfiVariables = true; + boot.loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = true; }; - networking.hostName = "rustboro"; # Define your hostname. + networking.hostName = "rustboro"; + + system.stateVersion = "24.05"; alyraffauf = { base = { enable = true; - sambaAutoMount = true; - plymouth.enable = true; - zramSwap = { - enable = true; - size = 100; - }; - }; - users = { - aly = { - enable = true; - password = "$y$j9T$VdtiEyMOegHpcUwgmCVFD0$K8Ne6.zk//VJNq2zxVQ0xE0Wg3LohvAQd3Xm9aXdM15"; - }; + zramSwap.size = 100; }; + desktop = { enable = true; + greetd = { enable = true; - session = lib.getExe config.programs.hyprland.package; + autologin = { enable = true; user = "aly"; }; }; + hyprland.enable = true; }; - scripts = { - hoenn.enable = true; - }; + services = { syncthing.enable = true; tailscale.enable = true; }; + + users.aly = { + enable = true; + password = "$y$j9T$VdtiEyMOegHpcUwgmCVFD0$K8Ne6.zk//VJNq2zxVQ0xE0Wg3LohvAQd3Xm9aXdM15"; + }; }; - system.stateVersion = "24.05"; } diff --git a/hosts/rustboro/hardware.nix b/hosts/rustboro/hardware.nix index 59d39b4c..965e0c88 100644 --- a/hosts/rustboro/hardware.nix +++ b/hosts/rustboro/hardware.nix @@ -2,32 +2,21 @@ config, inputs, lib, - modulesPath, pkgs, ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd - inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t440p - ]; - boot = { + extraModprobeConfig = '' + options bbswitch use_acpi_to_detect_card_state=1 + options thinkpad_acpi force_load=1 fan_control=1 + ''; + initrd = { - availableKernelModules = [ - "xhci_pci" - "ehci_pci" - "ahci" - "usb_storage" - "sd_mod" - "sr_mod" - "rtsx_pci_sdmmc" - ]; - kernelModules = []; + availableKernelModules = ["ahci" "ehci_pci" "i915" "rtsx_pci_sdmmc" "sd_mod" "sr_mod" "usb_storage" "xhci_pci"]; + kernelModules = ["i915" "tpm-rng"]; }; - extraModulePackages = []; - kernelModules = ["kvm-intel"]; + kernelModules = ["i915" "kvm-intel"]; }; powerManagement = { @@ -35,30 +24,44 @@ powertop.enable = true; }; - nixpkgs = { - hostPlatform = lib.mkDefault "x86_64-linux"; - }; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware = { - cpu.intel.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; - + cpu.intel.updateMicrocode = true; enableAllFirmware = true; opengl = { enable = true; + driSupport = true; + driSupport32Bit = true; + extraPackages = with pkgs; [ intel-media-driver # LIBVA_DRIVER_NAME=iHD intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) libvdpau-va-gl ]; + + extraPackages32 = with pkgs.driversi686Linux; [ + intel-media-driver # LIBVA_DRIVER_NAME=iHD + intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + libvdpau-va-gl + ]; + }; + + trackpoint = { + enable = true; + emulateWheel = true; }; }; environment.sessionVariables = { - LIBVA_DRIVER_NAME = "iHD"; # Force intel-media-driver + LIBVA_DRIVER_NAME = "iHD"; + VDPAU_DRIVER = "va_gl"; }; - networking.useDHCP = lib.mkDefault true; + services = { + fstrim.enable = true; + fwupd.enable = true; + }; } diff --git a/hosts/rustboro/home.nix b/hosts/rustboro/home.nix index 4a76fba5..81c197da 100644 --- a/hosts/rustboro/home.nix +++ b/hosts/rustboro/home.nix @@ -1,8 +1,8 @@ { - inputs, config, - pkgs, + inputs, lib, + pkgs, ... }: { home-manager = { diff --git a/nixosModules/options.nix b/nixosModules/options.nix index 194d5952..d5829e66 100644 --- a/nixosModules/options.nix +++ b/nixosModules/options.nix @@ -187,8 +187,11 @@ sway.enable = lib.mkEnableOption "Sway wayland session."; }; - scripts.hoenn.enable = - lib.mkEnableOption "Hoenn system configuration script"; + scripts.hoenn.enable = lib.mkOption { + description = "Hoenn system configuration script"; + default = config.alyraffauf.base.enable; + type = lib.types.bool; + }; services = { binaryCache.enable = lib.mkEnableOption "nixpkgs cache server."; flatpak.enable = @@ -215,7 +218,7 @@ }; syncMusic = lib.mkOption { description = "Whether to sync music folder."; - default = true; + default = config.alyraffauf.services.syncthing.enable; type = lib.types.bool; }; musicPath = lib.mkOption { @@ -229,16 +232,28 @@ base = { enable = lib.mkEnableOption "Basic system configuration and sane defaults."; - sambaAutoMount = lib.mkEnableOption "Automounting of mauville Samba Shares."; - plymouth.enable = - lib.mkEnableOption "Plymouth boot screen with catppuccin theme."; + sambaAutoMount = lib.mkOption { + description = "Automounting of mauville Samba Shares."; + default = + config.alyraffauf.services.tailscale.enable && !(config.networking.hostName == "mauville"); + type = lib.types.bool; + }; + plymouth.enable = lib.mkOption { + description = "Plymouth boot screen with catppuccin theme."; + default = config.alyraffauf.base.enable; + type = lib.types.bool; + }; power-profiles-daemon.enable = lib.mkOption { description = "Power Profiles Daemon for power management."; - default = true; + default = config.alyraffauf.base.enable; type = lib.types.bool; }; zramSwap = { - enable = lib.mkEnableOption "Zram swap."; + enable = lib.mkOption { + description = "zram swap."; + default = config.alyraffauf.base.enable; + type = lib.types.bool; + }; size = lib.mkOption { description = "Percent size of the zram swap relative to RAM."; default = 50;