Simplify flake.nix

This commit is contained in:
Joshua Yuen 2026-09-11 22:55:03 -04:00
parent 2937154e38
commit 8f0ca00343
Signed by: josh
GPG Key ID: 530DA0331EFE99F5
1 changed files with 38 additions and 64 deletions

102
flake.nix
View File

@ -47,98 +47,72 @@
}@inputs: }@inputs:
let let
system = "x86_64-linux"; system = "x86_64-linux";
username = "josh";
profile = "desktop";
homePath = ./. + "/homes/${username}/home.nix";
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
overlays = [ nix-vscode-extensions.overlays.default ]; overlays = [ nix-vscode-extensions.overlays.default ];
}; };
mkHost =
{
host,
extraModules ? [ ],
}:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit
homePath
host
inputs
profile
username
;
};
inherit pkgs;
modules = [ ./hosts/${host} ] ++ extraModules;
};
in in
{ {
nixosConfigurations = { nixosConfigurations = {
laptop = let laptop = mkHost { host = "laptop"; };
host = "laptop";
profile = "desktop";
username = "josh";
in nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit host;
inherit profile;
inherit username;
};
pkgs = pkgs;
modules = [
./hosts/${host}
];
};
vm = let vm = mkHost { host = "vm"; };
host = "vm";
profile = "desktop";
username = "josh";
in nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit host;
inherit profile;
inherit username;
};
pkgs = pkgs;
modules = [
./hosts/${host}
];
};
live = let live = mkHost {
host = "installation-iso"; host = "installation-iso";
profile = "desktop"; extraModules = [
username = "josh";
in nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit host;
inherit profile;
inherit username;
};
pkgs = pkgs;
modules = [
(nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix") (nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")
{ environment.systemPackages = [ install-system.packages.${system}.default ]; } { environment.systemPackages = [ install-system.packages.${system}.default ]; }
./hosts/installation-iso
]; ];
}; };
}; };
homeConfigurations.josh = let homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration {
profile = "desktop"; extraSpecialArgs = {
username = "josh"; inherit inputs profile username;
gpgSigningKey = null; };
in home-manager.lib.homeManagerConfiguration { inherit pkgs;
extraSpecialArgs = {
inherit inputs;
inherit profile;
inherit username;
};
pkgs = pkgs;
modules = [ modules = [
{ {
modules.gpg.signingKey = gpgSigningKey; modules.gpg.signingKey = null;
} }
./homes/josh/home.nix homePath
stylix.homeModules.stylix stylix.homeModules.stylix
]; ];
}; };
devShell.${system} = nixpkgs.legacyPackages.${system}.pkgs.mkShell { devShell.${system} = pkgs.mkShell {
packages = with nixpkgs.legacyPackages.${system}.pkgs; [ packages = with pkgs; [
nil nil
nixd nixd
]; ];
}; };
formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-tree; formatter.${system} = pkgs.nixfmt-tree;
}; };
} }