feat: introduce treefmt and fmt all
This commit is contained in:
parent
80250b0179
commit
27c6c4f9fa
237 changed files with 5440 additions and 5214 deletions
|
@ -1,48 +1,48 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.steveej.holo-zerotier;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.steveej.holo-zerotier = {
|
||||
enable = lib.mkEnableOption "Enable holo-zerotier";
|
||||
autostart = lib.mkOption {default = false;};
|
||||
autostart = lib.mkOption { default = false; };
|
||||
};
|
||||
|
||||
config = {
|
||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) ["zerotierone"];
|
||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "zerotierone" ];
|
||||
|
||||
services.zerotierone = {
|
||||
enable = cfg.enable;
|
||||
inherit (cfg) enable;
|
||||
joinNetworks = [
|
||||
# moved to the service below as it's now secret
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services.zerotierone.wantedBy = lib.mkIf (!cfg.autostart) (lib.mkForce []);
|
||||
systemd.services.zerotierone.wantedBy = lib.mkIf (!cfg.autostart) (lib.mkForce [ ]);
|
||||
|
||||
systemd.services.zerotieroneSecretNetworks = {
|
||||
enable = cfg.enable;
|
||||
requiredBy = ["zerotierone.service"];
|
||||
partOf = ["zerotierone.service"];
|
||||
inherit (cfg) enable;
|
||||
requiredBy = [ "zerotierone.service" ];
|
||||
partOf = [ "zerotierone.service" ];
|
||||
|
||||
serviceConfig.Type = "oneshot";
|
||||
serviceConfig.RemainAfterExit = true;
|
||||
|
||||
script = let
|
||||
secret = config.sops.secrets.zerotieroneNetworks;
|
||||
in ''
|
||||
# include the secret's hash to trigger a restart on change
|
||||
# ${builtins.hashString "sha256" (builtins.toJSON secret)}
|
||||
script =
|
||||
let
|
||||
secret = config.sops.secrets.zerotieroneNetworks;
|
||||
in
|
||||
''
|
||||
# include the secret's hash to trigger a restart on change
|
||||
# ${builtins.hashString "sha256" (builtins.toJSON secret)}
|
||||
|
||||
${config.systemd.services.zerotierone.preStart}
|
||||
${config.systemd.services.zerotierone.preStart}
|
||||
|
||||
rm -rf /var/lib/zerotier-one/networks.d/*.conf
|
||||
for network in `grep -v '#' ${secret.path}`; do
|
||||
touch /var/lib/zerotier-one/networks.d/''${network}.conf
|
||||
done
|
||||
'';
|
||||
rm -rf /var/lib/zerotier-one/networks.d/*.conf
|
||||
for network in `grep -v '#' ${secret.path}`; do
|
||||
touch /var/lib/zerotier-one/networks.d/''${network}.conf
|
||||
done
|
||||
'';
|
||||
};
|
||||
|
||||
sops.secrets.zerotieroneNetworks = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue