Loading nixos/modules/services/networking/headplane.nix +203 −176 Original line number Diff line number Diff line Loading @@ -14,16 +14,31 @@ let ; inherit (lib.attrsets) filterAttrsRecursive; cfg = config.services.headplane; settingsFile = (pkgs.formats.yaml { }).generate "headplane-config.yaml" ( # Headplane config can't have `null` values. filterAttrsRecursive (n: v: v != null) cfg.settings settingsFormat = pkgs.formats.yaml { }; filterSettings = lib.converge ( filterAttrsRecursive ( _: v: !lib.elem v [ { } null ] ) ); agentSettings = cfg.settings.integration.agent; settings = cfg.settings // { integration = cfg.settings.integration // { agent = if agentSettings == null || !agentSettings.enabled then null else agentSettings; }; }; settingsFile = settingsFormat.generate "headplane-config.yaml" (filterSettings settings); in { options.services.headplane = { enable = mkEnableOption "Headplane"; package = mkPackageOption pkgs "headplane" { }; agent.package = mkPackageOption pkgs "headplane-agent" { }; debug = mkEnableOption "Enable debug loggin"; settings = mkOption { Loading Loading @@ -157,7 +172,8 @@ in type = types.submodule { options = { agent = mkOption { type = types.submodule { type = types.nullOr ( types.submodule { options = { enabled = mkOption { type = types.bool; Loading @@ -172,8 +188,8 @@ in executable_path = mkOption { type = types.path; readOnly = true; default = "${cfg.settings.integration.agent.package}/bin/hp_agent"; defaultText = lib.literalExpression ''"''\${config.services.headplane.settings.integration.agent.package}/bin/hp_agent"''; default = "${cfg.agent.package}/bin/hp_agent"; defaultText = lib.literalExpression ''"''${config.services.headplane.agent.package}/bin/hp_agent"''; description = '' Path to the headplane agent binary. ''; Loading Loading @@ -220,11 +236,10 @@ in It needs to be writable by the user running the Headplane process. ''; }; package = mkPackageOption pkgs "headplane-agent" { }; }; }; default = { }; } ); default = null; description = "Agent configuration for the Headplane agent."; }; Loading Loading @@ -253,18 +268,17 @@ in }; oidc = mkOption { type = types.submodule { type = types.nullOr ( types.submodule { options = { issuer = mkOption { type = types.nullOr types.str; default = null; type = types.str; description = "URL to OpenID issuer."; example = "https://provider.example.com/issuer-url"; }; client_id = mkOption { type = types.nullOr types.str; default = null; type = types.str; description = "The client ID for the OIDC client."; example = "your-client-id"; }; Loading Loading @@ -295,8 +309,7 @@ in }; headscale_api_key_path = mkOption { type = types.nullOr types.path; default = null; type = types.path; description = '' Path to a file containing the Headscale API key. ''; Loading Loading @@ -373,8 +386,9 @@ in example = "https://provider.example.com/userinfo"; }; }; }; default = { }; } ); default = null; description = "OIDC Configuration for authentication."; }; }; Loading @@ -384,6 +398,19 @@ in }; config = mkIf cfg.enable { assertions = [ { assertion = cfg.settings.integration.agent == null || !cfg.settings.integration.agent.enabled || cfg.settings.integration.agent.pre_authkey_path != null; message = '' services.headplane.settings.integration.agent.pre_authkey_path must be set when services.headplane.settings.integration.agent.enabled is true. ''; } ]; environment = { systemPackages = [ cfg.package ]; etc."headplane/config.yaml".source = "${settingsFile}"; Loading pkgs/by-name/he/headplane-agent/package.nix +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ buildGoModule (finalAttrs: { }; vendorHash = "sha256-MvrqKMD+A+qBZmzQv+T9920U5uJop+pjfJpZdm2ZqEA="; subPackages = [ "cmd/hp_agent" ]; ldflags = [ "-s" Loading Loading
nixos/modules/services/networking/headplane.nix +203 −176 Original line number Diff line number Diff line Loading @@ -14,16 +14,31 @@ let ; inherit (lib.attrsets) filterAttrsRecursive; cfg = config.services.headplane; settingsFile = (pkgs.formats.yaml { }).generate "headplane-config.yaml" ( # Headplane config can't have `null` values. filterAttrsRecursive (n: v: v != null) cfg.settings settingsFormat = pkgs.formats.yaml { }; filterSettings = lib.converge ( filterAttrsRecursive ( _: v: !lib.elem v [ { } null ] ) ); agentSettings = cfg.settings.integration.agent; settings = cfg.settings // { integration = cfg.settings.integration // { agent = if agentSettings == null || !agentSettings.enabled then null else agentSettings; }; }; settingsFile = settingsFormat.generate "headplane-config.yaml" (filterSettings settings); in { options.services.headplane = { enable = mkEnableOption "Headplane"; package = mkPackageOption pkgs "headplane" { }; agent.package = mkPackageOption pkgs "headplane-agent" { }; debug = mkEnableOption "Enable debug loggin"; settings = mkOption { Loading Loading @@ -157,7 +172,8 @@ in type = types.submodule { options = { agent = mkOption { type = types.submodule { type = types.nullOr ( types.submodule { options = { enabled = mkOption { type = types.bool; Loading @@ -172,8 +188,8 @@ in executable_path = mkOption { type = types.path; readOnly = true; default = "${cfg.settings.integration.agent.package}/bin/hp_agent"; defaultText = lib.literalExpression ''"''\${config.services.headplane.settings.integration.agent.package}/bin/hp_agent"''; default = "${cfg.agent.package}/bin/hp_agent"; defaultText = lib.literalExpression ''"''${config.services.headplane.agent.package}/bin/hp_agent"''; description = '' Path to the headplane agent binary. ''; Loading Loading @@ -220,11 +236,10 @@ in It needs to be writable by the user running the Headplane process. ''; }; package = mkPackageOption pkgs "headplane-agent" { }; }; }; default = { }; } ); default = null; description = "Agent configuration for the Headplane agent."; }; Loading Loading @@ -253,18 +268,17 @@ in }; oidc = mkOption { type = types.submodule { type = types.nullOr ( types.submodule { options = { issuer = mkOption { type = types.nullOr types.str; default = null; type = types.str; description = "URL to OpenID issuer."; example = "https://provider.example.com/issuer-url"; }; client_id = mkOption { type = types.nullOr types.str; default = null; type = types.str; description = "The client ID for the OIDC client."; example = "your-client-id"; }; Loading Loading @@ -295,8 +309,7 @@ in }; headscale_api_key_path = mkOption { type = types.nullOr types.path; default = null; type = types.path; description = '' Path to a file containing the Headscale API key. ''; Loading Loading @@ -373,8 +386,9 @@ in example = "https://provider.example.com/userinfo"; }; }; }; default = { }; } ); default = null; description = "OIDC Configuration for authentication."; }; }; Loading @@ -384,6 +398,19 @@ in }; config = mkIf cfg.enable { assertions = [ { assertion = cfg.settings.integration.agent == null || !cfg.settings.integration.agent.enabled || cfg.settings.integration.agent.pre_authkey_path != null; message = '' services.headplane.settings.integration.agent.pre_authkey_path must be set when services.headplane.settings.integration.agent.enabled is true. ''; } ]; environment = { systemPackages = [ cfg.package ]; etc."headplane/config.yaml".source = "${settingsFile}"; Loading
pkgs/by-name/he/headplane-agent/package.nix +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ buildGoModule (finalAttrs: { }; vendorHash = "sha256-MvrqKMD+A+qBZmzQv+T9920U5uJop+pjfJpZdm2ZqEA="; subPackages = [ "cmd/hp_agent" ]; ldflags = [ "-s" Loading