From c681e1ce5f51f550a832cd2389b12cb6ac03cb5b Mon Sep 17 00:00:00 2001 From: Joshua Yuen Date: Sat, 20 Jun 2026 21:11:25 -0400 Subject: [PATCH] Reorganize flake.nix to not require changing variables to install a fresh system --- flake.nix | 26 +++++++++++++++++--------- rebuild.sh | 2 +- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index 0c8cc7d..5df9a63 100644 --- a/flake.nix +++ b/flake.nix @@ -46,13 +46,14 @@ }@inputs: let system = "x86_64-linux"; - host = "vm"; - profile = "desktop"; - username = "josh"; in { nixosConfigurations = { - nixos = nixpkgs.lib.nixosSystem { + vm = let + host = "vm"; + profile = "desktop"; + username = "josh"; + in nixpkgs.lib.nixosSystem { inherit system; specialArgs = { 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; specialArgs = { inherit inputs; - host = "installation-iso"; - profile = "desktop"; + inherit host; + inherit profile; inherit username; }; modules = [ @@ -81,7 +86,10 @@ }; }; - homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration { + homeConfigurations.josh = let + profile = "desktop"; + username = "josh"; + in home-manager.lib.homeManagerConfiguration { extraSpecialArgs = { inherit inputs; inherit profile; @@ -89,7 +97,7 @@ }; pkgs = nixpkgs.legacyPackages.${system}; modules = [ - ./homes/${username}/home.nix + ./homes/josh/home.nix stylix.homeModules.stylix ]; }; diff --git a/rebuild.sh b/rebuild.sh index 6d0997a..659abd4 100755 --- a/rebuild.sh +++ b/rebuild.sh @@ -4,7 +4,7 @@ echo "Removing old qcow2 disk ..." rm -f ./vm.qcow2 echo "Building new VM ..." -nix build .#nixosConfigurations.nixos.config.system.build.vm +nix build .#nixosConfigurations.vm.config.system.build.vm if [ $? -ne 0 ]; then echo "Failed to build VM"