diff --git a/README.md b/README.md index 17dbeba..73c5c97 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,20 @@ Show exported home configurations: nix eval --apply builtins.attrNames .#homeConfigurations ``` +### Testing + +These commands would are useful for debugging + +```shell +SYSTEM=lxc + +# Just evaluate (fast, catches config errors) +nix eval .#nixosConfigurations.${SYSTEM}.config.system.build.toplevel + +# Full build (slower, produces a bootable system) +nix build .#nixosConfigurations.${SYSTEM}.config.system.build.toplevel +``` + ### Remote Deploy ```shell diff --git a/modules/hosts/test-nix.nix b/modules/hosts/test-nix.nix new file mode 100644 index 0000000..fd6d089 --- /dev/null +++ b/modules/hosts/test-nix.nix @@ -0,0 +1,30 @@ +{ inputs, ... }: +let + name = "test-nix"; + username = "john"; +in +{ + flake.modules.nixos."${name}" = { pkgs, lib, ...}: { + home-manager.users."${username}" = { + imports = [ + inputs.self.homeModules."${username}" + ]; + }; + + users.users."${username}" = { + isNormalUser = true; + shell = pkgs.zsh; + }; + + programs.zsh.enable = true; + }; + + # Generic bootstrapping lxc, use a specific host file for more + flake.nixosConfigurations."${name}" = inputs.nixpkgs.lib.nixosSystem { + modules = [ + inputs.home-manager.nixosModules.home-manager + inputs.self.modules.nixos.lxc + inputs.self.modules.nixos."${name}" + ]; + }; +} diff --git a/scripts/inspect.sh b/scripts/inspect.sh index bc290a4..ba2c7b7 100755 --- a/scripts/inspect.sh +++ b/scripts/inspect.sh @@ -18,7 +18,12 @@ list_home_configurations() { list_flake_attr "homeConfigurations" "$1" } +list_nixos_configurations() { + list_flake_attr "nixosConfigurations" "$1" +} + current_dir=$(readlink -f .) flake="${1:-$current_dir}" list_home_modules "$flake" list_home_configurations "$flake" +list_nixos_configurations "$flake"