Reorganize flake.nix to not require changing variables to install a fresh system

This commit is contained in:
Joshua Yuen 2026-06-20 21:11:25 -04:00
parent da423c8565
commit c681e1ce5f
Signed by: josh
GPG Key ID: 502720BC22ED411C
2 changed files with 18 additions and 10 deletions

View File

@ -46,13 +46,14 @@
}@inputs: }@inputs:
let let
system = "x86_64-linux"; system = "x86_64-linux";
host = "vm";
profile = "desktop";
username = "josh";
in in
{ {
nixosConfigurations = { nixosConfigurations = {
nixos = nixpkgs.lib.nixosSystem { vm = let
host = "vm";
profile = "desktop";
username = "josh";
in nixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;
@ -65,12 +66,16 @@
]; ];
}; };
live = nixpkgs.lib.nixosSystem { live = let
host = "installation-iso";
profile = "desktop";
username = "josh";
in nixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;
host = "installation-iso"; inherit host;
profile = "desktop"; inherit profile;
inherit username; inherit username;
}; };
modules = [ modules = [
@ -81,7 +86,10 @@
}; };
}; };
homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration { homeConfigurations.josh = let
profile = "desktop";
username = "josh";
in home-manager.lib.homeManagerConfiguration {
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs; inherit inputs;
inherit profile; inherit profile;
@ -89,7 +97,7 @@
}; };
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
modules = [ modules = [
./homes/${username}/home.nix ./homes/josh/home.nix
stylix.homeModules.stylix stylix.homeModules.stylix
]; ];
}; };

View File

@ -4,7 +4,7 @@ echo "Removing old qcow2 disk ..."
rm -f ./vm.qcow2 rm -f ./vm.qcow2
echo "Building new VM ..." echo "Building new VM ..."
nix build .#nixosConfigurations.nixos.config.system.build.vm nix build .#nixosConfigurations.vm.config.system.build.vm
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed to build VM" echo "Failed to build VM"