diff options
author | tv <tv@krebsco.de> | 2021-12-28 23:53:27 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2021-12-28 23:53:27 +0100 |
commit | 69d266b76b88c7d6b416cc4aac24ca3f78aeaa7e (patch) | |
tree | 938a688819bbdd4702c712bc0b7406430f18f3fb | |
parent | a59ed5197fc04424690ec3a3b58b5071d17a1be6 (diff) |
ergo: kill dead code and stuff
-rw-r--r-- | krebs/3modules/ergo.nix | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/krebs/3modules/ergo.nix b/krebs/3modules/ergo.nix index 74e621fcb..0ce0345d8 100644 --- a/krebs/3modules/ergo.nix +++ b/krebs/3modules/ergo.nix @@ -1,24 +1,8 @@ -{ config, lib, options, pkgs, ... }: - -let - inherit (lib) mkEnableOption mkIf mkOption types; - inherit (pkgs) coreutils ergo; - cfg = config.krebs.ergo; - - configFile = pkgs.writeText "ergo.conf" (builtins.toJSON cfg.config); -in - -{ - - ###### interface - +{ config, lib, options, pkgs, ... }: { options = { - krebs.ergo = { - - enable = mkEnableOption "Ergo IRC daemon"; - - config = mkOption { + enable = lib.mkEnableOption "Ergo IRC daemon"; + config = lib.mkOption { type = (pkgs.formats.json {}).type; description = '' Ergo IRC daemon configuration file. @@ -74,28 +58,22 @@ in }; }; }; - }; - }; - - - ###### implementation - - config = mkIf cfg.enable ({ - + config = let + cfg = config.krebs.ergo; + configFile = pkgs.writeJSON "ergo.conf" cfg.config; + in lib.mkIf cfg.enable ({ krebs.ergo.config = lib.mapAttrsRecursive (_: lib.mkDefault) options.krebs.ergo.config.default; - systemd.services.ergo = { description = "Ergo IRC daemon"; wantedBy = [ "multi-user.target" ]; serviceConfig = { - ExecStart = "${ergo}/bin/ergo run --conf ${configFile}"; + ExecStart = "${pkgs.ergo}/bin/ergo run --conf ${configFile}"; DynamicUser = true; StateDirectory = "ergo"; }; }; - }); } |