{ description = "Martin's NixOS configuration - Based on EmergentMind/nix-config"; inputs = { # # ========= Official NixOS and HM Package Sources ========= # nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; # The next two are for pinning to stable vs unstable regardless of what the above is set to # This is particularly useful when an upcoming stable release is in beta because you can effectively # keep 'nixpkgs-stable' set to stable for critical packages while setting 'nixpkgs' to the beta branch to # get a jump start on deprecation changes. # See also 'stable-packages' and 'unstable-packages' overlays at 'overlays/default.nix" nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-25.05"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; home-manager = { url = "github:nix-community/home-manager/release-25.05"; inputs.nixpkgs.follows = "nixpkgs"; }; # # ========= Utilities ========= # # Secrets management sops-nix = { url = "github:mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; # Catppuccin theming catppuccin.url = "github:catppuccin/nix"; simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-25.05"; # Spotify spicetify-nix = { url = "github:Gerg-L/spicetify-nix"; inputs.nixpkgs.follows = "nixpkgs-unstable"; }; # Browser zen-browser.url = "github:0xc000022070/zen-browser-flake"; }; outputs = { self, nixpkgs, home-manager, ... }@inputs: let inherit (self) outputs; common = import ./shared/common.nix; theme = import ./shared/theme.nix; # # ========= Architectures ========= # forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ]; # ========== Extend lib with lib.custom ========== # NOTE: This approach allows lib.custom to propagate into hm # see: https://github.com/nix-community/home-manager/pull/3454 customLib = (_self: _super: { custom = import ./lib { inherit (nixpkgs) lib; }; }); lib = nixpkgs.lib.extend customLib; libHm = home-manager.lib.extend customLib; systems = import ./systems.nix { inherit common; }; knownSystems = { # Samsung S23 FE localhost-y4maoyqm = { ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII7SSjiqnjif1Kko60iXVTKJ7a1/lRlR8TFNtoclNcnQ"; }; # OnePlus 8 localhost-4izgka9k = { ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIALtulVgLrUEpKnpfPFQTHjaEXTxs2Q818NC18eLx0bj"; }; }; in { # # ========= Overlays ========= # # Custom modifications/overrides to upstream packages overlays = import ./overlays.nix { inherit inputs; }; # # ========= Host Configurations ========= # nixosConfigurations = builtins.mapAttrs ( hostName: { system, username, ... }@systemConfig: nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit outputs inputs common theme lib hostName systemConfig systems knownSystems ; isDarwin = false; }; modules = [ ./hosts/${hostName} home-manager.nixosModules.home-manager { home-manager = { # Backups conflicting files in case of error backupFileExtension = "bkp"; useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = { inherit inputs common theme libHm systemConfig systems ; }; users.${username} = import ./hosts/${hostName}/home-manager; }; } { nixpkgs.overlays = [ # TODO temp fix for tailscale: https://github.com/tailscale/tailscale/issues/16966#issuecomment-3239543750 (_: prev: { tailscale = prev.tailscale.overrideAttrs (old: { checkFlags = builtins.map ( flag: if prev.lib.hasPrefix "-skip=" flag then flag + "|^TestGetList$|^TestIgnoreLocallyBoundPorts$|^TestPoller$" else flag ) old.checkFlags; }); }) ]; } ]; } ) systems; # # ========= Formatting ========= # # Nix formatter available through 'nix fmt' https://github.com/NixOS/nixfmt formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); # # ========= DevShell ========= # # Custom shell for bootstrapping on new hosts, modifying nix-config, and secrets management devShells = forAllSystems ( system: import ./shell.nix { pkgs = nixpkgs.legacyPackages.${system}; } ); }; }