Make devshell commands to run command builds

This commit is contained in:
Jack O'Sullivan 2022-02-19 23:57:06 +00:00
parent fafb7d4656
commit 31d21e7870
3 changed files with 30 additions and 6 deletions

View File

@ -48,5 +48,33 @@ in
help = "Run `home-manager switch`"; help = "Run `home-manager switch`";
command = ''home-manager switch --flake . "$@"''; command = ''home-manager switch --flake . "$@"'';
} }
{
name = "build-system";
category = "tasks";
help = "Build NixOS configuration";
command = ''nix build "''${@:2}" ".#nixosConfigurations.\"$1\".config.system.build.toplevel"'';
}
{
name = "run-vm";
category = "tasks";
help = "Run NixOS configuration as a VM";
command =
''
cd "$PRJ_ROOT"
nix run ".#nixosConfigurations.\"$1\".config.my.buildAs.devVM"
'';
}
{
name = "build-iso";
category = "tasks";
help = "Build NixOS configuration into an ISO";
command = ''nix build "''${@:2}" ".#nixosConfigurations.\"$1\".config.my.buildAs.iso"'';
}
{
name = "build-home";
category = "tasks";
help = "Build home-manager configuration";
command = ''nix build "''${@:2}" ".#homeConfigurations.\"$1\".activationPackage"'';
}
]; ];
} }

View File

@ -113,23 +113,18 @@
nixosModules = inlineModules modules; nixosModules = inlineModules modules;
homeModules = inlineModules homeModules; homeModules = inlineModules homeModules;
# TODO: Cleanup and possibly even turn into modules?
nixosConfigurations = import ./nixos { nixosConfigurations = import ./nixos {
inherit lib pkgsFlakes hmFlakes inputs; inherit lib pkgsFlakes hmFlakes inputs;
pkgs' = configPkgs'; pkgs' = configPkgs';
modules = attrValues modules; modules = attrValues modules;
homeModules = attrValues homeModules; homeModules = attrValues homeModules;
}; };
systems = mapAttrs (_: system: system.config.system.build.toplevel) self.nixosConfigurations;
vms = mapAttrs (_: system: system.config.my.buildAs.devVM) self.nixosConfigurations;
isos = mapAttrs (_: system: system.config.my.buildAs.iso) self.nixosConfigurations;
homeConfigurations = import ./home-manager { homeConfigurations = import ./home-manager {
inherit lib hmFlakes inputs; inherit lib hmFlakes inputs;
pkgs' = configPkgs'; pkgs' = configPkgs';
modules = attrValues homeModules; modules = attrValues homeModules;
}; };
homes = mapAttrs (_: home: home.activationPackage) self.homeConfigurations;
deploy = { deploy = {
nodes = filterAttrs (_: n: n != null) nodes = filterAttrs (_: n: n != null)

View File

@ -17,9 +17,10 @@ in
# Whatever installer mechanism is chosen will provied an appropriate `/` # Whatever installer mechanism is chosen will provied an appropriate `/`
tmproot.enable = false; tmproot.enable = false;
firewall.nat.enable = false; firewall.nat.enable = false;
server.enable = true;
deploy.enable = false; deploy.enable = false;
user.enable = false; user.enable = false;
server.enable = true;
}; };
environment.sessionVariables = { environment.sessionVariables = {