diff --git a/aly.nix b/aly.nix index 6d1d6111..fb0ec861 100644 --- a/aly.nix +++ b/aly.nix @@ -3,9 +3,13 @@ config, pkgs, lib, - unstable, ... -}: { +}: let + unstable = import inputs.nixpkgsUnstable { + system = pkgs.system; + config.allowUnfree = true; + }; +in { imports = [./homeManagerModules]; home.username = "aly"; home.homeDirectory = "/home/aly"; diff --git a/flake.lock b/flake.lock index b057aaf4..bb5c599d 100644 --- a/flake.lock +++ b/flake.lock @@ -116,7 +116,7 @@ "type": "github" } }, - "nixpkgs-unstable": { + "nixpkgsUnstable": { "locked": { "lastModified": 1716330097, "narHash": "sha256-8BO3B7e3BiyIDsaKA0tY8O88rClYRTjvAp66y+VBUeU=", @@ -139,7 +139,7 @@ "jovian": "jovian", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", - "nixpkgs-unstable": "nixpkgs-unstable" + "nixpkgsUnstable": "nixpkgsUnstable" } } }, diff --git a/flake.nix b/flake.nix index 9542d3da..31fa43c0 100644 --- a/flake.nix +++ b/flake.nix @@ -12,24 +12,18 @@ }; # Unstable NixOS. - nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; - - # # Unstable version of home-manager. - # home-manager-unstable = { - # url = "github:nix-community/home-manager/master"; - # inputs.nixpkgs.follows = "nixpkgs-unstable"; - # }; + nixpkgsUnstable.url = "github:nixos/nixpkgs/nixos-unstable"; + # Automated disk partitioning. disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; }; - # impermanence.url = "github:nix-community/impermanence"; - # Pre-baked hardware support for various devices. nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + # Useful modules for Steam Deck. jovian = { url = "github:Jovian-Experiments/Jovian-NixOS"; inputs.nixpkgs.follows = "nixpkgs"; @@ -43,106 +37,33 @@ ]; }; - outputs = inputs @ { - nixpkgs, - nixpkgs-unstable, - home-manager, - nixos-hardware, - disko, - jovian, - ... - }: let - system = "x86_64-linux"; - nixosModules = [ - disko.nixosModules.disko - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = {inherit inputs unstable;}; - home-manager.sharedModules = [{imports = [./homeManagerModules];}]; - home-manager.backupFileExtension = "backup"; - } - ./nixosModules - ]; - unstable = import nixpkgs-unstable { - inherit system; - config.allowUnfree = true; - }; - specialArgs = {inherit inputs unstable;}; - in { - formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra; + outputs = inputs @ {self, ...}: { + formatter = inputs.nixpkgs.lib.genAttrs [ + "aarch64-darwin" + "aarch64-linux" + "x86_64-darwin" + "x86_64-linux" + ] (system: inputs.nixpkgs.legacyPackages.${system}.alejandra); - nixosConfigurations = { - # Steam Deck OLED - mossdeep = nixpkgs.lib.nixosSystem rec { - inherit system specialArgs; - modules = - nixosModules - ++ [ - ./hosts/mossdeep - jovian.nixosModules.default - nixos-hardware.nixosModules.common-pc-laptop-ssd - ]; - }; + nixosModules.default = + import ./nixosModules inputs; - # Framework 13 with AMD Ryzen 7640U and 32GB RAM. - lavaridge = nixpkgs.lib.nixosSystem rec { - inherit system specialArgs; - modules = - nixosModules - ++ [ - ./hosts/lavaridge - nixos-hardware.nixosModules.framework-13-7040-amd - ]; - }; - - # Framework 13 with 11th Gen Intel Core i5 and 16GB RAM. - fallarbor = nixpkgs.lib.nixosSystem rec { - inherit system specialArgs; - modules = - nixosModules - ++ [ - ./hosts/fallarbor - nixos-hardware.nixosModules.framework-11th-gen-intel - ]; - }; - - # Home Lab. Ryzen 5 2600 with 16GB RAM, RX 6700. - mauville = nixpkgs.lib.nixosSystem rec { - inherit system specialArgs; - modules = - nixosModules - ++ [ - ./hosts/mauville - nixos-hardware.nixosModules.common-cpu-amd - nixos-hardware.nixosModules.common-pc-ssd - ]; - }; - - # Lenovo Yoga 9i with i7-1360P and 16GB RAM. - petalburg = nixpkgs.lib.nixosSystem rec { - inherit system specialArgs; - modules = - nixosModules - ++ [ - ./hosts/petalburg - nixos-hardware.nixosModules.common-cpu-intel - nixos-hardware.nixosModules.common-pc-laptop-ssd - ]; - }; - - # T440p with i5-4210M and 16GB RAM. - rustboro = nixpkgs.lib.nixosSystem rec { - inherit system specialArgs; - modules = - nixosModules - ++ [ - ./hosts/rustboro - nixos-hardware.nixosModules.common-pc-laptop-ssd - nixos-hardware.nixosModules.lenovo-thinkpad-t440p - ]; - }; - }; + nixosConfigurations = + inputs.nixpkgs.lib.genAttrs [ + "fallarbor" + "lavaridge" + "mauville" + "mossdeep" + "petalburg" + "rustboro" + ] ( + host: + inputs.nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs self;}; + modules = [ + ./hosts/${host} + ]; + } + ); }; } diff --git a/homeManagerModules/desktop/hypr/default.nix b/homeManagerModules/desktop/hypr/default.nix index 6673843e..2dc9eca4 100644 --- a/homeManagerModules/desktop/hypr/default.nix +++ b/homeManagerModules/desktop/hypr/default.nix @@ -4,7 +4,6 @@ config, osConfig, inputs, - unstable, ... }: { imports = [./hypridle ./hyprlock ./hyprpaper ./hyprshade]; @@ -61,7 +60,7 @@ }; wayland.windowManager.hyprland.enable = true; - wayland.windowManager.hyprland.package = unstable.hyprland; + wayland.windowManager.hyprland.package = inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".hyprland; wayland.windowManager.hyprland.extraConfig = let modifier = "SUPER"; diff --git a/homeManagerModules/desktop/sway/default.nix b/homeManagerModules/desktop/sway/default.nix index 546fdffd..9c45ded2 100644 --- a/homeManagerModules/desktop/sway/default.nix +++ b/homeManagerModules/desktop/sway/default.nix @@ -3,7 +3,6 @@ lib, config, inputs, - unstable, ... }: { imports = [./autoRotate.nix ./randomWallpaper.nix ./redShift.nix ./virtKeyboard.nix]; @@ -80,7 +79,7 @@ wayland.windowManager.sway.package = if config.alyraffauf.desktop.sway.tabletMode.enable then pkgs.sway - else unstable.swayfx; + else inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".swayfx; wayland.windowManager.sway.wrapperFeatures.gtk = true; wayland.windowManager.sway.checkConfig = false; @@ -493,7 +492,7 @@ bindswitch --reload --locked lid:off output eDP-1 enable ${ - if config.wayland.windowManager.sway.package == unstable.swayfx + if config.wayland.windowManager.sway.package == inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".swayfx then " blur enable blur_passes 1 diff --git a/hosts/fallarbor/default.nix b/hosts/fallarbor/default.nix index da17a85a..bc82c0f0 100644 --- a/hosts/fallarbor/default.nix +++ b/hosts/fallarbor/default.nix @@ -1,13 +1,17 @@ # Framework 13 with 11th gen Intel Core i5, 16GB RAM, 512GB SSD. { config, + inputs, + lib, pkgs, + self, ... }: { imports = [ ./disko.nix - ./hardware-configuration.nix # Include the results of the hardware scan. + ./hardware-configuration.nix ./home.nix + self.nixosModules.default ]; boot = { diff --git a/hosts/fallarbor/disko.nix b/hosts/fallarbor/disko.nix index 1d4f0fc5..2f549777 100644 --- a/hosts/fallarbor/disko.nix +++ b/hosts/fallarbor/disko.nix @@ -1,4 +1,7 @@ -{ +{inputs, ...}: { + imports = [ + inputs.disko.nixosModules.disko + ]; disko.devices = { disk = { vdb = { diff --git a/hosts/fallarbor/hardware-configuration.nix b/hosts/fallarbor/hardware-configuration.nix index 00039d64..4bbdc412 100644 --- a/hosts/fallarbor/hardware-configuration.nix +++ b/hosts/fallarbor/hardware-configuration.nix @@ -3,9 +3,13 @@ lib, pkgs, modulesPath, + inputs, ... }: { - imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + inputs.nixos-hardware.nixosModules.framework-11th-gen-intel + ]; boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; boot.initrd.kernelModules = []; diff --git a/hosts/fallarbor/home.nix b/hosts/fallarbor/home.nix index 9524bbe1..f762bcda 100644 --- a/hosts/fallarbor/home.nix +++ b/hosts/fallarbor/home.nix @@ -5,6 +5,9 @@ lib, ... }: { + imports = [ + inputs.home-manager.nixosModules.home-manager + ]; home-manager = { users.aly = import ../../aly.nix; users.dustin = import ../../dustin.nix; diff --git a/hosts/lavaridge/default.nix b/hosts/lavaridge/default.nix index a16614b1..ebbdc52b 100644 --- a/hosts/lavaridge/default.nix +++ b/hosts/lavaridge/default.nix @@ -1,15 +1,17 @@ # Framework Laptop 13 with AMD Ryzen 7640U, 32GB RAM, 1TB SSD. { - inputs, config, - pkgs, + inputs, lib, + pkgs, + self, ... }: { imports = [ - ./hardware-configuration.nix # Include the results of the hardware scan. - ./home.nix ./disko.nix + ./hardware-configuration.nix + ./home.nix + self.nixosModules.default ]; boot = { diff --git a/hosts/lavaridge/disko.nix b/hosts/lavaridge/disko.nix index a6a16273..0558b9a9 100644 --- a/hosts/lavaridge/disko.nix +++ b/hosts/lavaridge/disko.nix @@ -1,4 +1,7 @@ -{ +{inputs, ...}: { + imports = [ + inputs.disko.nixosModules.disko + ]; disko.devices = { disk = { vdb = { diff --git a/hosts/lavaridge/hardware-configuration.nix b/hosts/lavaridge/hardware-configuration.nix index e4de0464..67f7c097 100644 --- a/hosts/lavaridge/hardware-configuration.nix +++ b/hosts/lavaridge/hardware-configuration.nix @@ -6,9 +6,13 @@ lib, pkgs, modulesPath, + inputs, ... }: { - imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + inputs.nixos-hardware.nixosModules.framework-13-7040-amd + ]; boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"]; boot.initrd.kernelModules = []; diff --git a/hosts/lavaridge/home.nix b/hosts/lavaridge/home.nix index e11a4580..f2e7420b 100644 --- a/hosts/lavaridge/home.nix +++ b/hosts/lavaridge/home.nix @@ -5,6 +5,9 @@ lib, ... }: { + imports = [ + inputs.home-manager.nixosModules.home-manager + ]; home-manager = { sharedModules = [ { diff --git a/hosts/mauville/default.nix b/hosts/mauville/default.nix index 0175c765..0243dfe6 100644 --- a/hosts/mauville/default.nix +++ b/hosts/mauville/default.nix @@ -1,8 +1,10 @@ # Custom desktop with AMD Ryzen 5 2600, 16GB RAM, AMD Rx 6700, and 1TB SSD + 2TB HDD. { config, - pkgs, + input, lib, + pkgs, + self, ... }: let acmeEmail = "alyraffauf@gmail.com"; @@ -11,7 +13,11 @@ mediaDirectory = "/mnt/Media"; archiveDirectory = "/mnt/Archive"; in { - imports = [./hardware-configuration.nix ./home.nix]; + imports = [ + ./hardware-configuration.nix + ./home.nix + self.nixosModules.default + ]; # Bootloader. boot.loader.systemd-boot.enable = true; diff --git a/hosts/mauville/hardware-configuration.nix b/hosts/mauville/hardware-configuration.nix index 776f00bb..d1d5ccff 100644 --- a/hosts/mauville/hardware-configuration.nix +++ b/hosts/mauville/hardware-configuration.nix @@ -3,9 +3,14 @@ lib, pkgs, modulesPath, + inputs, ... }: { - imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + 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"]; boot.initrd.kernelModules = []; diff --git a/hosts/mauville/home.nix b/hosts/mauville/home.nix index 886deecf..7ceda5b7 100644 --- a/hosts/mauville/home.nix +++ b/hosts/mauville/home.nix @@ -5,6 +5,9 @@ lib, ... }: { + imports = [ + inputs.home-manager.nixosModules.home-manager + ]; home-manager = { sharedModules = [ { diff --git a/hosts/mossdeep/default.nix b/hosts/mossdeep/default.nix index 110f1651..34bc9561 100644 --- a/hosts/mossdeep/default.nix +++ b/hosts/mossdeep/default.nix @@ -1,15 +1,18 @@ -# Framework Laptop 13 with AMD Ryzen 7640U, 32GB RAM, 1TB SSD. +# Steam Deck OLED { - inputs, config, - pkgs, + inputs, lib, + pkgs, + self, ... }: { imports = [ - ./hardware-configuration.nix # Include the results of the hardware scan. - ./home.nix ./disko.nix + ./hardware-configuration.nix + ./home.nix + self.nixosModules.default + inputs.jovian.nixosModules.default ]; boot = { diff --git a/hosts/mossdeep/disko.nix b/hosts/mossdeep/disko.nix index 54d34b71..fcdb1863 100644 --- a/hosts/mossdeep/disko.nix +++ b/hosts/mossdeep/disko.nix @@ -1,4 +1,7 @@ -{ +{inputs, ...}: { + imports = [ + inputs.disko.nixosModules.disko + ]; disko.devices = { disk = { vdb = { diff --git a/hosts/mossdeep/hardware-configuration.nix b/hosts/mossdeep/hardware-configuration.nix index 8563f60e..3c2cdc5f 100644 --- a/hosts/mossdeep/hardware-configuration.nix +++ b/hosts/mossdeep/hardware-configuration.nix @@ -6,9 +6,13 @@ lib, pkgs, modulesPath, + inputs, ... }: { - imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd + ]; boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "usb_storage" "sd_mod"]; boot.initrd.kernelModules = ["amdgpu"]; diff --git a/hosts/mossdeep/home.nix b/hosts/mossdeep/home.nix index 0118277f..d64a06f7 100644 --- a/hosts/mossdeep/home.nix +++ b/hosts/mossdeep/home.nix @@ -5,6 +5,9 @@ lib, ... }: { + imports = [ + inputs.home-manager.nixosModules.home-manager + ]; home-manager = { users.aly = import ../../aly.nix; }; diff --git a/hosts/petalburg/default.nix b/hosts/petalburg/default.nix index 9074f8ee..d540e3ad 100644 --- a/hosts/petalburg/default.nix +++ b/hosts/petalburg/default.nix @@ -1,14 +1,17 @@ # Lenovo Yoga 9i Convertible with Intel Core i7-1360P, 15GB RAM, 512GB SSD. { config, + inputs, lib, pkgs, + self, ... }: { imports = [ ./disko.nix - ./hardware-configuration.nix # Include the results of the hardware scan. + ./hardware-configuration.nix ./home.nix + self.nixosModules.default ]; boot = { diff --git a/hosts/petalburg/disko.nix b/hosts/petalburg/disko.nix index a6a16273..0558b9a9 100644 --- a/hosts/petalburg/disko.nix +++ b/hosts/petalburg/disko.nix @@ -1,4 +1,7 @@ -{ +{inputs, ...}: { + imports = [ + inputs.disko.nixosModules.disko + ]; disko.devices = { disk = { vdb = { diff --git a/hosts/petalburg/hardware-configuration.nix b/hosts/petalburg/hardware-configuration.nix index 44f821ef..c556fce6 100644 --- a/hosts/petalburg/hardware-configuration.nix +++ b/hosts/petalburg/hardware-configuration.nix @@ -3,9 +3,14 @@ lib, pkgs, modulesPath, + inputs, ... }: { - imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + 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"]; boot.initrd.kernelModules = []; diff --git a/hosts/petalburg/home.nix b/hosts/petalburg/home.nix index ce187e93..da786474 100644 --- a/hosts/petalburg/home.nix +++ b/hosts/petalburg/home.nix @@ -5,6 +5,9 @@ lib, ... }: { + imports = [ + inputs.home-manager.nixosModules.home-manager + ]; home-manager = { sharedModules = [ { diff --git a/hosts/rustboro/default.nix b/hosts/rustboro/default.nix index a096bfef..98a49ae3 100644 --- a/hosts/rustboro/default.nix +++ b/hosts/rustboro/default.nix @@ -1,14 +1,17 @@ # Lenovo Thinkpad T440p with a Core i5 4210M, 16GB RAM, 512GB SSD. { config, + inputs, lib, pkgs, + self, ... }: { imports = [ - ./hardware-configuration.nix # Include the results of the hardware scan. - ./home.nix ./disko.nix + ./hardware-configuration.nix + ./home.nix + self.nixosModules.default ]; boot = { @@ -16,31 +19,6 @@ loader.systemd-boot.enable = true; loader.efi.canTouchEfiVariables = true; }; - # initrd.postDeviceCommands = lib.mkAfter '' - # mkdir /btrfs_tmp - # mount /dev/sda2 /btrfs_tmp - # if [[ -e /btrfs_tmp/rootfs ]]; then - # mkdir -p /btrfs_tmp/old_roots - # timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/rootfs)" "+%Y-%m-%-d_%H:%M:%S") - # mv /btrfs_tmp/rootfs "/btrfs_tmp/old_roots/$timestamp" - # fi - - # delete_subvolume_recursively() { - # IFS=$'\n' - # for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do - # delete_subvolume_recursively "/btrfs_tmp/$i" - # done - # btrfs subvolume delete "$1" - # } - - # for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +5); do - # delete_subvolume_recursively "$i" - # done - - # btrfs subvolume create /btrfs_tmp/rootfs - # umount /btrfs_tmp - # ''; - # }; networking.hostName = "rustboro"; # Define your hostname. @@ -82,17 +60,5 @@ tailscale.enable = true; }; }; - - # environment.persistence."/persist" = { - # hideMounts = true; - # directories = [ - # "/etc/NetworkManager/system-connections" - # "/etc/ssh" - # ]; - # files = [ - # "/etc/machine-id" - # ]; - # }; - system.stateVersion = "24.05"; } diff --git a/hosts/rustboro/disko.nix b/hosts/rustboro/disko.nix index 66b9e72f..7c41aa1f 100644 --- a/hosts/rustboro/disko.nix +++ b/hosts/rustboro/disko.nix @@ -1,4 +1,7 @@ -{ +{inputs, ...}: { + imports = [ + inputs.disko.nixosModules.disko + ]; disko.devices = { disk = { vdb = { diff --git a/hosts/rustboro/hardware-configuration.nix b/hosts/rustboro/hardware-configuration.nix index 4066f4e7..c1116f5e 100644 --- a/hosts/rustboro/hardware-configuration.nix +++ b/hosts/rustboro/hardware-configuration.nix @@ -3,9 +3,14 @@ lib, pkgs, modulesPath, + inputs, ... }: { - imports = [(modulesPath + "/installer/scan/not-detected.nix")]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd + inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t440p + ]; boot.initrd.availableKernelModules = [ "xhci_pci" diff --git a/hosts/rustboro/home.nix b/hosts/rustboro/home.nix index 35c0d64a..b170df44 100644 --- a/hosts/rustboro/home.nix +++ b/hosts/rustboro/home.nix @@ -5,6 +5,9 @@ lib, ... }: { + imports = [ + inputs.home-manager.nixosModules.home-manager + ]; home-manager = { sharedModules = [ { diff --git a/nixosModules/default.nix b/nixosModules/default.nix index a20f10c4..1bbfcbe9 100644 --- a/nixosModules/default.nix +++ b/nixosModules/default.nix @@ -1,4 +1,4 @@ -{ +inputs: { config, pkgs, ... diff --git a/nixosModules/desktop/hyprland/default.nix b/nixosModules/desktop/hyprland/default.nix index f261ea45..f9855437 100644 --- a/nixosModules/desktop/hyprland/default.nix +++ b/nixosModules/desktop/hyprland/default.nix @@ -3,7 +3,6 @@ pkgs, lib, config, - unstable, ... }: { options = { @@ -29,7 +28,7 @@ gnupg.agent.pinentryPackage = pkgs.pinentry-gnome3; hyprland = { enable = true; - package = unstable.hyprland; + package = inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".hyprland; }; }; }; diff --git a/nixosModules/desktop/sway/default.nix b/nixosModules/desktop/sway/default.nix index 0baefa8c..357e41c1 100644 --- a/nixosModules/desktop/sway/default.nix +++ b/nixosModules/desktop/sway/default.nix @@ -3,7 +3,6 @@ pkgs, lib, config, - unstable, ... }: { options = { @@ -30,7 +29,7 @@ gnupg.agent.pinentryPackage = pkgs.pinentry-gnome3; sway = { enable = true; - package = unstable.swayfx; + package = inputs.nixpkgsUnstable.legacyPackages."${pkgs.system}".swayfx; }; }; }; diff --git a/nixosModules/user/default.nix b/nixosModules/user/default.nix index 72e88bc9..b6163adf 100644 --- a/nixosModules/user/default.nix +++ b/nixosModules/user/default.nix @@ -6,7 +6,17 @@ unstable, ... }: { - imports = [./aly ./dustin]; + imports = [ + inputs.home-manager.nixosModules.home-manager + ./aly + ./dustin + ]; + + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = {inherit inputs unstable;}; + home-manager.sharedModules = [{imports = [../../homeManagerModules];}]; + home-manager.backupFileExtension = "backup"; users.mutableUsers = false; users.users.root.openssh.authorizedKeys.keys = [