diff --git a/flake.nix b/flake.nix index f5cf5d3..0173b95 100644 --- a/flake.nix +++ b/flake.nix @@ -191,6 +191,27 @@ }; modules = [ (mkModule domain system inputs stateVersion modules hostname) ]; }; + mkReport = domain: system: inputs: stateVersion: modules: hostname: let + nixos = mkConfig domain system inputs stateVersion modules hostname; + cfg = nixos.config; + inherit (nixos.pkgs) lib; + in { + inherit system; # TODO: cross system + fqdn = cfg.networking.fqdn; + allowedTCPPorts = cfg.networking.firewall.allowedTCPPorts; + allowedUDPPorts = cfg.networking.firewall.allowedUDPPorts; + bootloader = if cfg.boot.loader.grub.enable then "grub" + else if cfg.boot.loader.systemd-boot.enable then "systemd-boot" + else null; + mounts = lib.pipe cfg.fileSystems [ + (lib.filterAttrs (mount: fs: fs.fsType != "nfs")) + (lib.mapAttrs (mount: fs: "${fs.fsType}://${fs.device}")) + ]; + nginx-vhosts = lib.pipe cfg.services.nginx.virtualHosts [ + #(lib.filterAttrs (domain: vhost: ) + (lib.mapAttrs (domain: vhost: vhost.serverAliases or [])) + ]; + }; mkHosts = mk: let ls = imports: { inherit imports; }; hw = nixos-hardware.nixosModules; @@ -228,6 +249,7 @@ nixosModules = mkHosts mkModule; nixosConfigurations = mkHosts mkConfig; + nixosReports = mkHosts mkReport; packages = forAllSystems ({ inputs, pkgs, lib, flakes, ... }: { nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" '' @@ -277,6 +299,7 @@ pkgs.age pkgs.sops pkgs.ssh-to-age + pkgs.just ]; in { envrc-local = mkShell envrc-pkgs; @@ -289,6 +312,7 @@ flakes.self.pkgs.nixos-rebuild-nom pkgs.age pkgs.ssh-to-age + pkgs.just ]; }); diff --git a/justfile b/justfile new file mode 100644 index 0000000..af2ad3b --- /dev/null +++ b/justfile @@ -0,0 +1,2 @@ +report: + nix eval .#nixosReports --json | yq . --yaml-output