diff --git a/flake.nix b/flake.nix index 6ac9fbb..de700c6 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,6 @@ description = "Jimbo's systems as a flake"; inputs = { - # Nixpkgs nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nur.url = "github:nix-community/NUR"; @@ -37,15 +36,16 @@ ... } @inputs: let inherit (self) outputs; - forAllSystems = nixpkgs.lib.genAttrs [ - "aarch64-linux" - "x86_64-linux" - ]; + mkNixos = modules: nixpkgs.lib.nixosSystem { + inherit modules; + specialArgs = { inherit inputs outputs; }; + }; + + mkHome = modules: pkgs: home-manager.lib.homeManagerConfiguration { + inherit modules pkgs; + extraSpecialArgs = { inherit inputs outputs; }; + }; in rec { - # Your custom packages - # Accessible through 'nix build', 'nix shell', etc - packages = forAllSystems (system: import ./extras/pkgs nixpkgs.legacyPackages.${system}); - # Your custom packages and modifications, exported as overlays overlays = import ./extras/overlays.nix { inherit inputs; }; @@ -59,76 +59,40 @@ # NixOS config entrypoint, use 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { - JimDesktop = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - ./system/hosts/JimDesktop/configuration.nix - lanzaboote.nixosModules.lanzaboote - ]; - }; - JimServer = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - ./system/hosts/JimServer/configuration.nix - mailserver.nixosModule - ]; - }; - JimPine = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - ./system/hosts/JimPine/configuration.nix - hardware.nixosModules.pine64-pinebook-pro - ]; - }; - JimLenovo = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ - ./system/hosts/JimLenovo/configuration.nix - ]; - }; + JimDesktop = mkNixos [ + ./system/hosts/JimDesktop/configuration.nix + lanzaboote.nixosModules.lanzaboote + ]; + JimServer = mkNixos [ + ./system/hosts/JimServer/configuration.nix + mailserver.nixosModule + ]; + JimPine = mkNixos [ + ./system/hosts/JimPine/configuration.nix + hardware.nixosModules.pine64-pinebook-pro + ]; }; # Home-manager configuration, use 'home-manager --flake .#your-username@your-hostname' homeConfigurations = { - "jimbo@JimDesktop" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home/hosts/JimDesktop/home.nix - nur.nixosModules.nur - ]; - }; - "jimbo@JimServer" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home/hosts/JimServer/home.nix - ]; - }; - "jimbo@JimPine" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.aarch64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home/hosts/JimPine/home.nix - nur.nixosModules.nur - ]; - }; - "jimbo@JimLenovo" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home/hosts/JimLenovo/home.nix - nur.nixosModules.nur - ]; - }; + "jimbo@JimDesktop" = mkHome [ + ./home/hosts/JimDesktop/home.nix + nur.nixosModules.nur + ] nixpkgs.legacyPackages."x86_64-linux"; + + "jimbo@JimServer" = mkHome [ + ./home/hosts/JimServer/home.nix + ] nixpkgs.legacyPackages.x86_64-linux; + + "jimbo@JimPine" = mkHome [ + ./home/hosts/JimPine/home.nix + nur.nixosModules.nur + ] nixpkgs.legacyPackages.aarch64-linux; + # Derivation for ssh envrionments on other people's servers - "jimbo@JimTerminal" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home/hosts/JimTerminal/home.nix - ]; - }; + "jimbo@JimTerminal" = mkHome [ + ./home/hosts/JimTerminal/home.nix + ] nixpkgs.legacyPackages.x86_64-linux; }; }; }