added config file to the nix store

This commit is contained in:
Kristian Krsnik 2023-08-15 21:51:59 +02:00
parent 912b405511
commit 84f4b11b9c
1 changed files with 7 additions and 4 deletions

View File

@ -8,6 +8,9 @@ inputs: {
cfg = config.dyn-gandi;
package = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.default;
inherit (lib) mkIf mkEnableOption mkOption types;
format = pkgs.formats.json {};
configFile = format.generate "config.json" cfg.settings;
in {
options.dyn-gandi = {
enable = mkEnableOption "dyn-gandi";
@ -42,14 +45,14 @@ in {
environment = {
systemPackages = [package];
etc."dyn-gandi.json" = {
text = builtins.toJSON cfg.settings;
};
# etc."dyn-gandi.json" = {
# text = builtins.toJSON cfg.settings;
# };
};
systemd.services.dyn-gandi = mkIf (cfg.timer
!= null) {
script = "${package}/bin/dyn_gandi"; # TODO: add config file via command line options
script = "${package}/bin/dyn_gandi --config ${configFile}";
serviceConfig = {
Type = "oneshot";