modules: remove mu module in favor of env var

This commit is contained in:
Aaron Bieber 2022-12-31 09:01:50 -07:00
parent 0852ee25bb
commit 358bc13040
No known key found for this signature in database
3 changed files with 2 additions and 65 deletions

View File

@ -113,10 +113,6 @@ in {
};
};
muInit = {
enable = true;
};
services = {
pcscd.enable = true;
vnstat.enable = true;
@ -163,6 +159,7 @@ in {
STEAM_EXTRA_COMPAT_TOOLS_PATHS =
"\${HOME}/.steam/root/compatibilitytools.d";
PATH = [ "\${XDG_BIN_HOME}" ];
MUHOME = "\${HOME}/.config/mu";
};
environment.systemPackages = with pkgs; [

View File

@ -1,2 +1,2 @@
{ config, lib, pkgs, ... }: { imports = [ ./ssh-fido-agent.nix ./mu.nix ]; }
{ config, lib, pkgs, ... }: { imports = [ ./ssh-fido-agent.nix ]; }

View File

@ -1,60 +0,0 @@
{ config, lib, pkgs, ... }:
let
cfg = config.muInit;
mu = "${pkgs.mu}/bin/mu";
muInitScript = pkgs.writeScriptBin "mu-init-script" ''
#!${pkgs.runtimeShell}
set -eu
MU_HOME=~/.cache/mu
if [ "${cfg.muHome}" != "mudefault" ]; then
MU_HOME="${cfg.muHome}"
fi
while true; do
if [ ! -d $MU_HOME ]; then
echo "MU home directory missing: $MU_HOME. Creating it."
${mu} init ${
if cfg.muHome != "mudefault" then "--muhome=${cfg.muHome}" else ""
} ${if cfg.mailDir != "" then "--maildir=${cfg.mailDir}" else ""} ${
if cfg.emailAddress != "" then
"--my-address=${cfg.emailAddress}"
else
""
}
fi
sleep 5;
done
'';
in {
options = with lib; {
muInit = {
enable = lib.mkEnableOption "Enable mu server";
muHome = lib.mkOption {
type = types.str;
default = "mudefault";
};
mailDir = lib.mkOption {
type = types.str;
default = "~/Maildir";
};
emailAddress = lib.mkOption {
type = types.str;
default = "";
};
};
};
config = lib.mkIf config.muInit.enable {
environment.systemPackages = [ muInitScript ];
systemd.user.services.mu-init = {
script = "${muInitScript}/bin/mu-init-script";
wantedBy = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
serviceConfig = { Restart = "on-failure"; };
};
};
}