overlays: add oidc-agent
This commit is contained in:
parent
cc19e46df0
commit
3771134e3a
10 changed files with 256 additions and 8 deletions
50
modules/nixos/oidc-agent.nix
Normal file
50
modules/nixos/oidc-agent.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkIf mkEnableOption mkOption types;
|
||||
|
||||
cfg = config.programs.oidc-agent;
|
||||
providerFormat = pkgs.formats.json {};
|
||||
in
|
||||
{
|
||||
options.programs.oidc-agent = {
|
||||
enable = mkEnableOption "OpenID Connect Agent";
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.oidc-agent;
|
||||
description = ''
|
||||
Which oidc-agent package to use
|
||||
'';
|
||||
};
|
||||
providers = mkOption {
|
||||
type = providerFormat.type;
|
||||
default = {};
|
||||
description = ''
|
||||
Configuration of providers which contains a json array of json objects
|
||||
each describing an issuer, see https://indigo-dc.gitbook.io/oidc-agent/configuration/issuers
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.user.services.oidc-agent = {
|
||||
unitConfig = {
|
||||
Description = "OpenID Connect Agent";
|
||||
Documentation = "man:oidc-agent(1)";
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "${cfg.package}/bin/oidc-agent -d --log-stderr -a %t/oidc-agent";
|
||||
};
|
||||
};
|
||||
|
||||
# environment.etc."oidc-agent/config".source = "${pkgs.oidc-agent}/etc/oidc-agent/config";
|
||||
|
||||
# environment.etc."oidc-agent/issuer.config.d".source =
|
||||
# "${pkgs.oidc-agent}/etc/oidc-agent/issuer.config.d";
|
||||
|
||||
# environment.etc."oidc-agent/issuer.config".source =
|
||||
# providerFormat.generate "oidc-agent-issuer.config" cfg.providers;
|
||||
|
||||
environment.extraInit = ''export OIDC_SOCK="$XDG_RUNTIME_DIR/oidc-agent"'';
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue