config/modules/idm/default.nix
2023-06-17 09:30:47 +02:00

25 lines
815 B
Nix

{ pkgs, ... }:
{
services.kanidm = {
enableClient = true;
clientSettings = {
uri = "https://idm.privatevoid.net";
};
};
environment.systemPackages = let
idmAlias = pkgs.runCommand "kanidm-idm-alias" {} ''
mkdir -p $out/bin
ln -s ${pkgs.kanidm}/bin/kanidm $out/bin/idm
mkdir -p $out/share/bash-completion/completions
cat >$out/share/bash-completion/completions/idm.bash <<EOF
source ${pkgs.kanidm}/share/bash-completion/completions/kanidm.bash
complete -F _kanidm -o bashdefault -o default idm
EOF
mkdir -p $out/share/zsh/site-functions
cp ${pkgs.kanidm}/share/zsh/site-functions/_kanidm $out/share/zsh/site-functions/_idm
substituteInPlace $out/share/zsh/site-functions/_idm --replace kanidm idm
'';
in [ idmAlias ];
}