{ description = "NixOS configuration of DerGrumpf"; # the nixConfig here only affects the flake itself, not the system configuration! nixConfig = { extra-substituters = [ "https://nix-community.cachix.org" "https://hyprland.cachix.org" ]; extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; }; inputs = { # Core nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # Desktop ENV hyprland.url = "github:hyprwm/Hyprland"; hyprland-plugins = { url = "github:hyprwm/hyprland-plugins"; inputs.hyprland.follows = "hyprland"; }; # Customization spicetify-nix.url = "github:Gerg-L/spicetify-nix"; nixcord.url = "github:kaylorben/nixcord"; catppuccin.url = "github:catppuccin/nix"; # User Config home-manager.url = "github:nix-community/home-manager/release-24.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = inputs@{ self, nixpkgs, home-manager, catppuccin, ... }: let system = "x86_64-linux"; # Common Configuration commonModules = [ ( { config, ... }: { nix.settings = { accept-flake-config = true; experimental-features = [ "nix-command" "flakes" ]; }; } ) ]; commonHomeManagerConfig = { username, monitorSetup ? "single", }: { home-manager = { useGlobalPkgs = true; useUserPackages = true; backupFileExtension = "backup"; extraSpecialArgs = { inherit inputs; inherit username monitorSetup; }; users.${username} = import ./users/${username}/home.nix; sharedModules = [ inputs.catppuccin.homeModules.catppuccin inputs.nixcord.homeModules.nixcord ]; }; }; # System Builder mkSystem = { hostname, username, system ? "x86_64-linux", monitorSetup ? "single", extraModules ? [ ], }: nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit inputs; inherit username monitorSetup; }; modules = commonModules ++ [ ./hosts/${hostname} ./users/${username}/nixos.nix home-manager.nixosModules.home-manager (commonHomeManagerConfig { inherit username monitorSetup; }) ] ++ extraModules; }; # ISO configuration isoConfig = nixpkgs.lib.nixosSystem { inherit system; modules = [ (import (nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")) ( { pkgs, ... }: { environment.systemPackages = with pkgs; [ neovim git wget curl ]; nix.settings.experimental-features = [ "nix-command" "flakes" ]; } ) ]; }; in { packages.${system}.default = self.nixosConfigurations.iso.config.system.build.isoImage; nixosConfigurations = { iso = isoConfig; qemu = mkSystem { hostname = "qemu"; username = "phil"; monitorSetup = "single"; }; m920q = mkSystem { hostname = "m920q"; username = "phil"; monitorSetup = "dual"; }; hp15-n028sg = mkSystem { hostname = "hp15-n028sg"; username = "phil"; monitorSetup = "dual"; }; }; }; }