moved config insto nix store for home manager module

This commit is contained in:
Kristian Krsnik 2023-08-15 22:13:10 +02:00
parent 84f4b11b9c
commit 7eb2ab7fe3
2 changed files with 5 additions and 12 deletions

View File

@ -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}";
};
};

View File

@ -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) {