split flake outputs into own file
1 file changed, 196 insertions(+), 0 deletions(-)
changed files
A outputs.nix
@@ -0,0 +1,196 @@ +inputs: +with inputs; +let + # System types to support. + supportedSystems = [ + "x86_64-linux" + "aarch64-linux" + "aarch64-darwin" + ]; + + # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + + overlayedNixpkgs = + system: + import nixpkgs { + inherit system; + config = { + allowUnfree = true; + }; + overlays = [ + (self: super: { + unstable = import nixpkgs-unstable { inherit system; }; + personal = import ./packages/overlay.nix self super; + }) + ]; + }; + + nixosSystem = + { + system, + modules, + ... + }@args: + nixpkgs.lib.nixosSystem ( + { + inherit system; + pkgs = overlayedNixpkgs system; + inherit modules; + specialArgs = { + inherit pkgsUnstable; + inherit inputs; + }; + } + // args + ); + + mkHomeConfiguration = + { modules, system }: + home-manager.lib.homeManagerConfiguration { + pkgs = import nixpkgs { + inherit system; + overlays = [ + agenix.overlays.default + scriptura.overlays.default + (self: super: { + personal = import ./packages/overlay.nix self super; + iqan = iqan.packages.${system}.iqan; + }) + ]; + }; + + extraSpecialArgs = { + inherit inputs; + }; + + modules = [ + nixvim.homeModules.nixvim + scriptura.homeModules.scriptura + ] + ++ modules; + }; +in +{ + nixosConfigurations = { + # build with `nixos-rebuild build-image --image-variant iso-installer` + minimal-iso = nixosSystem { + system = "x86_64-linux"; + modules = [ ./system/hosts/installer.nix ]; + }; + prefect = nixosSystem { + system = "x86_64-linux"; + modules = ( + with nixos-hardware.nixosModules; + [ + ./system/hosts/prefect.nix + common-cpu-amd-pstate + common-cpu-amd-zenpower + common-pc-ssd + common-pc + "${nixos-hardware}/common/gpu/nvidia/ada-lovelace" + ] + ); + }; + r5 = nixosSystem { + system = "aarch64-linux"; + modules = [ + agenix.nixosModules.default + srvos.nixosModules.server + nanopi.nixosModules.r5s + ./system/hosts/r5.nix + ./system/hosts/r5-hardware.nix + ]; + }; + hasel = nixosSystem { + system = "x86_64-linux"; + modules = [ + srvos.nixosModules.server + agenix.nixosModules.default + ./packages/modules/nixos/laminar.nix + ./packages/modules/nixos/bark.nix + ./system/hosts/hasel.nix + ]; + }; + ulme = nixosSystem { + system = "x86_64-linux"; + modules = [ + srvos.nixosModules.server + agenix.nixosModules.default + ./packages/modules/nixos/bark.nix + ./system/hosts/ulme.nix + ]; + }; + }; + darwinConfigurations = { + marvin = darwin.lib.darwinSystem { + system = "aarch64-darwin"; + modules = [ + srvos.darwinModules.desktop + ./system/hosts/marvin.nix + ]; + }; + }; + homeConfigurations = { + "alin@marvin" = mkHomeConfiguration { + system = "aarch64-darwin"; + modules = [ + ./user/hosts/marvin.nix + ./private/ssh.nix + ]; + }; + "alin@prefect" = mkHomeConfiguration { + system = "x86_64-linux"; + modules = [ + ./user/hosts/prefect.nix + ./private/ssh.nix + ]; + }; + "alin@r5" = mkHomeConfiguration { + system = "aarch64-linux"; + modules = [ + ./user/hosts/r5.nix + ]; + }; + "alin@hasel" = mkHomeConfiguration { + system = "x86_64-linux"; + modules = [ + ./user/hosts/server.nix + { + home.stateVersion = "26.05"; + } + ]; + }; + "alin@ulme" = mkHomeConfiguration { + system = "x86_64-linux"; + modules = [ + ./user/hosts/server.nix + { + home.stateVersion = "26.05"; + } + ]; + }; + + }; + + devShells = forAllSystems ( + system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + default = pkgs.mkShellNoCC { + packages = with pkgs; [ + just + nh + home-manager + nixos-rebuild + nixos-option + ]; + }; + secrets = pkgs.mkShellNoCC { + packages = [ agenix.packages.${system}.default ]; + }; + } + ); +}