From 7eb2ab7fe3d006b6ad2906bba3ae030f21addfc0 Mon Sep 17 00:00:00 2001 From: Kristian Krsnik Date: Tue, 15 Aug 2023 22:13:10 +0200 Subject: [PATCH] moved config insto nix store for home manager module --- nix/hm-module.nix | 9 ++++----- nix/module.nix | 8 +------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/nix/hm-module.nix b/nix/hm-module.nix index 615493e..c04271e 100644 --- a/nix/hm-module.nix +++ b/nix/hm-module.nix @@ -7,6 +7,9 @@ self: { cfg = config.dyn-gandi; package = 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"; @@ -40,10 +43,6 @@ in { config = mkIf cfg.enable { home.packages = [package]; # TODO: make this architecture independent - xdg.configFile."dyn-gandi/config.json" = { - text = builtins.toJSON cfg.settings; - }; - systemd.user.services.dyn-gandi = mkIf (cfg.timer != null) { Unit = { @@ -54,7 +53,7 @@ in { Service = { Type = "oneshot"; - ExecStart = "${package}/bin/dyn_gandi"; # TODO: add config file via command line options + ExecStart = "${package}/bin/dyn_gandi --config ${configFile}"; }; }; diff --git a/nix/module.nix b/nix/module.nix index b6c8a07..2e5a711 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -42,13 +42,7 @@ in { }; config = mkIf cfg.enable { - environment = { - systemPackages = [package]; - - # etc."dyn-gandi.json" = { - # text = builtins.toJSON cfg.settings; - # }; - }; + environment.systemPackages = [package]; systemd.services.dyn-gandi = mkIf (cfg.timer != null) {