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:
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
];
};

View File

@ -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"