chore(flake): update inputs
This commit is contained in:
parent
7b2e2298e3
commit
5a6de0b6c8
24
flake.lock
24
flake.lock
|
@ -35,11 +35,11 @@
|
|||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1601282935,
|
||||
"narHash": "sha256-WQAFV6sGGQxrRs3a+/Yj9xUYvhTpukQJIcMbIi7LCJ4=",
|
||||
"lastModified": 1604964167,
|
||||
"narHash": "sha256-+mTmiCD29wecyDaGlbeWpvnysBygagl9FdMVfdU0RTM=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "588973065fce51f4763287f0fda87a174d78bf48",
|
||||
"rev": "af81e8d00b2cd021d8806104f14d66ae429dc2f7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -104,11 +104,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1604628022,
|
||||
"narHash": "sha256-zCbTh91NBQdGRtO+GZxfKnmRjp+4rOQ2B8wtNpVcxgs=",
|
||||
"lastModified": 1605346738,
|
||||
"narHash": "sha256-s+PkRKyPCjQeoZuWOMag+2A9C133k2zhYJHLiHwv4KQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "4cc1b77c3fc4f4b3bc61921dda72663eea962fa3",
|
||||
"rev": "7c3c64208e5696cac0e5bb70ac7d4cd04427882d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -120,11 +120,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1604369895,
|
||||
"narHash": "sha256-uB/ihiWdfTjVQ9sKdtj6xeyvb41uC2J4MXiOLkwJccs=",
|
||||
"lastModified": 1605171959,
|
||||
"narHash": "sha256-JIM7QrQ2jpnA6qRfP8MzXD8USiWYStfL9Cssz01QvMw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "34ad166a830d3ac1541dcce571c52231f2f0865a",
|
||||
"rev": "a371c1071161104d329f6a85d922fd92b7cbab63",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -136,11 +136,11 @@
|
|||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1604744395,
|
||||
"narHash": "sha256-+7OS8LHjHzShJHBp4P0QEa16wvKHF3Zc9R36qot/2g0=",
|
||||
"lastModified": 1605327268,
|
||||
"narHash": "sha256-HuCE2b4miBA/lKCvWQqPvQY0s9JIB0Wij3N7zorv/+g=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "49da2eff49d2bd9dd5483512323219bc68559bfa",
|
||||
"rev": "d57163576758253355e8b4425228256ee63887d3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -1,94 +0,0 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
# apikeyFile implementation inspired by grafana config
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.custom.cfdyndns;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.custom.cfdyndns = {
|
||||
enable = mkEnableOption "Cloudflare Dynamic DNS Client";
|
||||
|
||||
email = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
The email address to use to authenticate to CloudFlare.
|
||||
'';
|
||||
};
|
||||
|
||||
apikey = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.str;
|
||||
description = ''
|
||||
The API Key to use to authenticate to CloudFlare.
|
||||
'';
|
||||
};
|
||||
|
||||
apikeyFile = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.path;
|
||||
description = ''
|
||||
The API Key to use to authenticate to CloudFlare.
|
||||
'';
|
||||
};
|
||||
|
||||
records = mkOption {
|
||||
default = [];
|
||||
example = [ "host.tld" ];
|
||||
type = types.listOf types.str;
|
||||
description = ''
|
||||
The records to update in CloudFlare.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.apikey != null -> cfg.apikeyFile == null;
|
||||
message = "Cannot set both apikey and apikeyFile";
|
||||
}
|
||||
];
|
||||
|
||||
systemd.services.cfdyndns = {
|
||||
description = "CloudFlare Dynamic DNS Client";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
startAt = "5 minutes";
|
||||
script = ''
|
||||
${optionalString (cfg.apikey != null) ''
|
||||
export CLOUDFLARE_APIKEY="${cfg.apikey}"
|
||||
''}
|
||||
${optionalString (cfg.apikeyFile != null) ''
|
||||
export CLOUDFLARE_APIKEY="$(cat ${escapeShellArg cfg.apikeyFile})"
|
||||
''}
|
||||
${pkgs.cfdyndns}/bin/cfdyndns
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
User = config.ids.uids.cfdyndns;
|
||||
Group = config.ids.gids.cfdyndns;
|
||||
};
|
||||
environment = {
|
||||
CLOUDFLARE_EMAIL = "${cfg.email}";
|
||||
CLOUDFLARE_RECORDS = "${concatStringsSep "," cfg.records}";
|
||||
};
|
||||
};
|
||||
|
||||
users.users = {
|
||||
cfdyndns = {
|
||||
group = "cfdyndns";
|
||||
uid = config.ids.uids.cfdyndns;
|
||||
};
|
||||
};
|
||||
|
||||
users.groups = {
|
||||
cfdyndns = {
|
||||
gid = config.ids.gids.cfdyndns;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
3
rpi4.nix
3
rpi4.nix
|
@ -7,7 +7,6 @@ with builtins; {
|
|||
# ./system
|
||||
./system/nix.nix
|
||||
./system/i18n.nix
|
||||
./modules/cfdyndns.nix
|
||||
./services/syncthing/rpi4.nix
|
||||
./services/jellyfin.nix
|
||||
./services/home-assistant.nix
|
||||
|
@ -32,7 +31,7 @@ with builtins; {
|
|||
email = "felschr@pm.me";
|
||||
};
|
||||
|
||||
services.custom.cfdyndns = {
|
||||
services.cfdyndns = {
|
||||
enable = true;
|
||||
email = "felschr@pm.me";
|
||||
apikeyFile = "/etc/nixos/secrets/cfdyndns-apikey";
|
||||
|
|
Loading…
Reference in a new issue