mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-17 22:28:55 +00:00
headplane: 0.6.3 -> 0.7.0, inherit headplane-agent from headplane, nixos/headplane: clean up deprecated options (#538802)
This commit is contained in:
@@ -44,7 +44,7 @@ in
|
||||
settings = mkOption {
|
||||
description = ''
|
||||
Headplane configuration options. Generates a YAML config file.
|
||||
See: https://github.com/tale/headplane/blob/main/config.example.yaml
|
||||
See <https://github.com/tale/headplane/blob/main/config.example.yaml>.
|
||||
'';
|
||||
type = types.submodule {
|
||||
options = {
|
||||
@@ -129,6 +129,16 @@ in
|
||||
headscale = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
api_key_path = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
Path to a file containing a Headscale API key.
|
||||
This is required for OIDC authentication aswell for the Headplane agent.
|
||||
'';
|
||||
example = lib.literalExpression "config.sops.secrets.headplane_pre_authkey.path";
|
||||
};
|
||||
|
||||
url = mkOption {
|
||||
type = types.str;
|
||||
default = "http://127.0.0.1:${toString config.services.headscale.port}";
|
||||
@@ -211,15 +221,6 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
pre_authkey_path = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
Path to a file containing a Headscale pre-auth key for the agent.
|
||||
'';
|
||||
example = lib.literalExpression "config.sops.secrets.headplane_pre_authkey.path";
|
||||
};
|
||||
|
||||
executable_path = mkOption {
|
||||
type = types.path;
|
||||
readOnly = true;
|
||||
@@ -237,20 +238,14 @@ in
|
||||
};
|
||||
|
||||
cache_ttl = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = null;
|
||||
type = types.ints.positive;
|
||||
default = 180000;
|
||||
description = ''
|
||||
Deprecated cache TTL for the agent. This option is accepted
|
||||
by Headplane 0.6.2 but has no effect.
|
||||
How long to cache agent information (in milliseconds).
|
||||
If you want data to update faster, reduce the TTL, but this will increase the frequency of requests to Headscale.
|
||||
'';
|
||||
};
|
||||
|
||||
cache_path = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/headplane/agent_cache.json";
|
||||
description = "The path to store the agent's cache.";
|
||||
};
|
||||
|
||||
work_dir = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/headplane/agent";
|
||||
@@ -325,16 +320,6 @@ in
|
||||
example = lib.literalExpression "config.sops.secrets.oidc_client_secret.path";
|
||||
};
|
||||
|
||||
headscale_api_key_path = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
Path to a file containing the Headscale API key.
|
||||
Required for OIDC authentication.
|
||||
'';
|
||||
example = lib.literalExpression "config.sops.secrets.headscale_api_key.path";
|
||||
};
|
||||
|
||||
disable_api_key_login = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
@@ -366,25 +351,6 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
redirect_uri = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
Deprecated OIDC redirect URI. Use services.headplane.settings.server.base_url
|
||||
instead; Headplane derives the callback URL from it.
|
||||
'';
|
||||
example = "https://headplane.example.com/admin/oidc/callback";
|
||||
};
|
||||
|
||||
strict_validation = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
description = ''
|
||||
Deprecated OIDC validation setting. This option is accepted
|
||||
by Headplane 0.6.2 but has no effect.
|
||||
'';
|
||||
};
|
||||
|
||||
profile_picture_source = mkOption {
|
||||
type = types.enum [
|
||||
"oidc"
|
||||
@@ -429,16 +395,6 @@ in
|
||||
description = "Custom userinfo endpoint URL.";
|
||||
example = "https://provider.example.com/userinfo";
|
||||
};
|
||||
|
||||
user_storage_file = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
Deprecated path to the pre-0.6.2 JSON user database.
|
||||
Headplane uses this once to migrate users into its internal database.
|
||||
'';
|
||||
example = "/var/lib/headplane/users.json";
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -452,33 +408,6 @@ in
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
warnings =
|
||||
lib.optionals (cfg.settings.oidc != null && cfg.settings.oidc.redirect_uri != null) [
|
||||
''
|
||||
services.headplane.settings.oidc.redirect_uri is deprecated by Headplane 0.6.2.
|
||||
Use services.headplane.settings.server.base_url instead; Headplane derives
|
||||
the OIDC callback URL from it.
|
||||
''
|
||||
]
|
||||
++ lib.optionals (cfg.settings.oidc != null && cfg.settings.oidc.strict_validation != null) [
|
||||
''
|
||||
services.headplane.settings.oidc.strict_validation is deprecated and has no effect
|
||||
in Headplane 0.6.2.
|
||||
''
|
||||
]
|
||||
++ lib.optionals (cfg.settings.oidc != null && cfg.settings.oidc.user_storage_file != null) [
|
||||
''
|
||||
services.headplane.settings.oidc.user_storage_file is deprecated. Headplane 0.6.2
|
||||
uses it only to migrate the pre-0.6.2 JSON user database into the internal database.
|
||||
''
|
||||
]
|
||||
++ lib.optionals (agentSettings != null && agentSettings.cache_ttl != null) [
|
||||
''
|
||||
services.headplane.settings.integration.agent.cache_ttl is deprecated and has no
|
||||
effect in Headplane 0.6.2.
|
||||
''
|
||||
];
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = config.services.headscale.enable;
|
||||
@@ -502,26 +431,25 @@ in
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion = cfg.settings.oidc == null || cfg.settings.oidc.headscale_api_key_path != null;
|
||||
assertion = cfg.settings.oidc == null || cfg.settings.headscale.api_key_path != null;
|
||||
message = ''
|
||||
services.headplane.settings.oidc.headscale_api_key_path must be set
|
||||
when services.headplane.settings.oidc is non-null. Headplane's OIDC
|
||||
flow requires a Headscale API key to mint sessions.
|
||||
services.headplane.settings.headscale.api_key_path must be set
|
||||
when services.headplane.settings.oidc is non-null.
|
||||
Headplane's OIDC flow requires a Headscale API key to mint sessions.
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion =
|
||||
agentSettings == null || !agentSettings.enabled || agentSettings.pre_authkey_path != null;
|
||||
agentSettings == null || !agentSettings.enabled || cfg.settings.headscale.api_key_path != null;
|
||||
message = ''
|
||||
services.headplane.settings.integration.agent.pre_authkey_path must be set
|
||||
when the agent is enabled.
|
||||
services.headplane.settings.headscale.api_key_path must be set when the agent is enabled.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
environment = {
|
||||
systemPackages = [ cfg.package ];
|
||||
etc."headplane/config.yaml".source = "${settingsFile}";
|
||||
etc."headplane/config.yaml".source = settingsFile;
|
||||
};
|
||||
|
||||
systemd.services.headplane = {
|
||||
@@ -534,6 +462,7 @@ in
|
||||
config.systemd.services.headscale.name
|
||||
];
|
||||
requires = [ config.systemd.services.headscale.name ];
|
||||
restartTriggers = [ settingsFile ];
|
||||
|
||||
environment = {
|
||||
HEADPLANE_DEBUG_LOG = toString cfg.debug;
|
||||
|
||||
@@ -1,22 +1,15 @@
|
||||
{
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
headplane,
|
||||
lib,
|
||||
}:
|
||||
buildGoModule (finalAttrs: {
|
||||
pname = "headplane-agent";
|
||||
__structuredAttrs = true;
|
||||
# Note, if you are upgrading this, you should upgrade headplane at the same time
|
||||
version = "0.6.3";
|
||||
inherit (headplane) version src;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "tale";
|
||||
repo = "headplane";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-zvJUTKRIlHyPMq80teVXBSb7K9Zz44Kuuj2PPi6qIOw=";
|
||||
};
|
||||
vendorHash = headplane.goVendorHash;
|
||||
|
||||
vendorHash = "sha256-MvrqKMD+A+qBZmzQv+T9920U5uJop+pjfJpZdm2ZqEA=";
|
||||
subPackages = [ "cmd/hp_agent" ];
|
||||
|
||||
ldflags = [
|
||||
|
||||
@@ -3,32 +3,31 @@
|
||||
fetchFromGitHub,
|
||||
fetchPnpmDeps,
|
||||
git,
|
||||
headplane-agent,
|
||||
lib,
|
||||
makeWrapper,
|
||||
nixosTests,
|
||||
nodejs_22,
|
||||
nodejs_24,
|
||||
pnpm_10,
|
||||
pnpmConfigHook,
|
||||
stdenv,
|
||||
}:
|
||||
let
|
||||
pname = "headplane";
|
||||
# Note, if you are upgrading this, you should upgrade headplane-agent at the same time
|
||||
version = "0.6.3";
|
||||
pnpmDepsHash = "sha256-CsmffCo9Se/4oiOqbcuhjPMuGmR2GL+YfcyWgzBTAh8=";
|
||||
version = "0.7.0";
|
||||
goVendorHash = "sha256-MvrqKMD+A+qBZmzQv+T9920U5uJop+pjfJpZdm2ZqEA=";
|
||||
pnpmDepsHash = "sha256-OBerkCnB/QL5HGYp2kehzFYEIKSuqpBt0dTFHIypc00=";
|
||||
src = fetchFromGitHub {
|
||||
owner = "tale";
|
||||
repo = "headplane";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-zvJUTKRIlHyPMq80teVXBSb7K9Zz44Kuuj2PPi6qIOw=";
|
||||
hash = "sha256-UMAGsrG2xfpgWlsDhf4aWJKoOrUbruucDNOhCJcYmQQ=";
|
||||
};
|
||||
|
||||
headplaneSshWasm = buildGoModule {
|
||||
pname = "headplane-ssh-wasm";
|
||||
inherit version src;
|
||||
subPackages = [ "cmd/hp_ssh" ];
|
||||
vendorHash = "sha256-MvrqKMD+A+qBZmzQv+T9920U5uJop+pjfJpZdm2ZqEA=";
|
||||
vendorHash = goVendorHash;
|
||||
env.CGO_ENABLED = 0;
|
||||
doCheck = false;
|
||||
buildPhase = ''
|
||||
@@ -73,7 +72,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
nativeBuildInputs = [
|
||||
git
|
||||
makeWrapper
|
||||
nodejs_22
|
||||
nodejs_24
|
||||
pnpm_10
|
||||
pnpmConfigHook
|
||||
];
|
||||
@@ -82,14 +81,14 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
inherit (finalAttrs) pname version src;
|
||||
pnpm = pnpm_10;
|
||||
hash = pnpmDepsHash;
|
||||
fetcherVersion = 3;
|
||||
fetcherVersion = 4;
|
||||
};
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
cp ${headplaneSshWasm}/hp_ssh.wasm app/hp_ssh.wasm
|
||||
cp ${headplaneSshWasm}/wasm_exec.js app/wasm_exec.js
|
||||
pnpm --offline build
|
||||
cp ${headplaneSshWasm}/hp_ssh.wasm public/hp_ssh.wasm
|
||||
cp ${headplaneSshWasm}/wasm_exec.js public/wasm_exec.js
|
||||
pnpm build
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
@@ -97,18 +96,15 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
runHook preInstall
|
||||
mkdir -p $out/{bin,share/headplane}
|
||||
cp -r build $out/share/headplane/
|
||||
cp -r node_modules $out/share/headplane/
|
||||
cp -r drizzle $out/share/headplane/
|
||||
substituteInPlace $out/share/headplane/build/server/index.js \
|
||||
--replace "$PWD" "../.."
|
||||
makeWrapper ${lib.getExe nodejs_22} $out/bin/headplane \
|
||||
makeWrapper ${lib.getExe nodejs_24} $out/bin/headplane \
|
||||
--chdir $out/share/headplane \
|
||||
--add-flags $out/share/headplane/build/server/index.js
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
agent = headplane-agent;
|
||||
inherit goVendorHash;
|
||||
tests = { inherit (nixosTests) headplane; };
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user