Merge remote-tracking branch 'ni/master'

This commit is contained in:
lassulus 2021-12-29 00:20:31 +01:00
commit d3c3f1551f
2 changed files with 10 additions and 32 deletions

View File

@ -1,24 +1,8 @@
{ config, lib, options, pkgs, ... }: { 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
options = { options = {
krebs.ergo = { krebs.ergo = {
enable = lib.mkEnableOption "Ergo IRC daemon";
enable = mkEnableOption "Ergo IRC daemon"; config = lib.mkOption {
config = mkOption {
type = (pkgs.formats.json {}).type; type = (pkgs.formats.json {}).type;
description = '' description = ''
Ergo IRC daemon configuration file. Ergo IRC daemon configuration file.
@ -74,28 +58,22 @@ in
}; };
}; };
}; };
}; };
}; };
config = let
cfg = config.krebs.ergo;
###### implementation configFile = pkgs.writeJSON "ergo.conf" cfg.config;
in lib.mkIf cfg.enable ({
config = mkIf cfg.enable ({
krebs.ergo.config = krebs.ergo.config =
lib.mapAttrsRecursive (_: lib.mkDefault) options.krebs.ergo.config.default; lib.mapAttrsRecursive (_: lib.mkDefault) options.krebs.ergo.config.default;
systemd.services.ergo = { systemd.services.ergo = {
description = "Ergo IRC daemon"; description = "Ergo IRC daemon";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
ExecStart = "${ergo}/bin/ergo run --conf ${configFile}"; ExecStart = "${pkgs.ergo}/bin/ergo run --conf ${configFile}";
DynamicUser = true; DynamicUser = true;
StateDirectory = "ergo"; StateDirectory = "ergo";
}; };
}; };
}); });
} }

View File

@ -2,12 +2,12 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "ircaids"; pname = "ircaids";
version = "1.1.0"; version = "1.2.0";
src = pkgs.fetchgit { src = pkgs.fetchgit {
url = "https://cgit.krebsco.de/ircaids"; url = "https://cgit.krebsco.de/ircaids";
rev = "refs/tags/${version}"; rev = "refs/tags/${version}";
sha256 = "05zd5dhsif00q8s1g5vzjd6x9n0c806nhfbdcgjdfgfy1j3kygyq"; sha256 = "049ln54llfrn99q0pzwlb7iaz4igd4f3n4rb6mpc9irsy32bv3qg";
}; };
buildPhase = null; buildPhase = null;