updated modules in flake
This commit is contained in:
@ -1,15 +1,72 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.dyn-gandi;
|
||||
self: {
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.services.dyn-gandi;
|
||||
inherit (lib) mkIf mkEnableOption mkOption types;
|
||||
in {
|
||||
options.services.dyn-gandi = {
|
||||
enable = mkEnableOption "dyn-gandi";
|
||||
|
||||
options.dyn-gandi = {
|
||||
enable = lib.mkEnableOption null // {
|
||||
description = lib.mdDoc '''';
|
||||
timer = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 0;
|
||||
description = lib.mdDoc ''
|
||||
The time intervall in seconds the script should be repeated.
|
||||
0 disables automatic starts.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = with types; let
|
||||
valueType = nullOr (oneOf [
|
||||
bool
|
||||
int
|
||||
float
|
||||
str
|
||||
path
|
||||
(attrsOf valueType)
|
||||
(listOf valueType)
|
||||
]);
|
||||
in
|
||||
valueType;
|
||||
|
||||
default = {api = {"example.com" = ["@" "www"];};};
|
||||
example = {
|
||||
General = {
|
||||
disabledTrayIcon = true;
|
||||
showStartupLaunchMessage = false;
|
||||
};
|
||||
};
|
||||
description = '''';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [self.packages.x86_64-linux.default];
|
||||
|
||||
};
|
||||
}
|
||||
xdg.configFile."dyn-gandi/config.json" = {
|
||||
text = builtins.toJSON cfg.settings;
|
||||
};
|
||||
|
||||
systemd.user.services.dyn-gandi =
|
||||
mkIf cfg.timer
|
||||
!= 0 {
|
||||
Unit = {
|
||||
Description = "DNS Updater tool for Gandi.net";
|
||||
After = ["graphical-session-pre.target"];
|
||||
PartOf = ["graphical-session.target"];
|
||||
};
|
||||
};
|
||||
systemd.user.timers.dyn-gandi = {
|
||||
wantedBy = ["timers.target"];
|
||||
timerConfig = {
|
||||
OnBootSec = "0s";
|
||||
OnUnitActiveSec = "${cfg.timer}s";
|
||||
Unit = "dyn-gandi.service";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
16
nix/module.nix
Normal file
16
nix/module.nix
Normal file
@ -0,0 +1,16 @@
|
||||
inputs: { config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.services.dyn-gandi;
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
#package = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||
in {
|
||||
|
||||
options.services.dyn-gandi = {
|
||||
enable = mkEnableOption null;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user