diff options
author | Franck Cuny <franck@fcuny.net> | 2022-06-10 11:42:32 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-06-10 13:12:35 -0700 |
commit | 98e01cdbfa047a32c1beb73438c5b93ca0592978 (patch) | |
tree | 403b462f1b6d6e4432c010e8f47e179e3e730a97 /nix | |
parent | docs(gerrit): document various things (diff) | |
download | world-98e01cdbfa047a32c1beb73438c5b93ca0592978.tar.gz |
fix(fmt): correct formatting for all nix files
This was done by running `nixpkgs-fmt .'. Change-Id: I4ea6c1e759bf468d08074be2111cbc7af72df295 Reviewed-on: https://cl.fcuny.net/c/world/+/404 Tested-by: CI Reviewed-by: Franck Cuny <franck@fcuny.net>
Diffstat (limited to 'nix')
-rw-r--r-- | nix/mkSystem.nix | 3 | ||||
-rw-r--r-- | nix/private-wireguard.nix | 27 |
2 files changed, 17 insertions, 13 deletions
diff --git a/nix/mkSystem.nix b/nix/mkSystem.nix index 28e42b1..88d6f99 100644 --- a/nix/mkSystem.nix +++ b/nix/mkSystem.nix @@ -21,7 +21,8 @@ inputs.nixpkgs.lib.nixosSystem { }; # Add each input as a registry nix.registry = inputs.nixpkgs.lib.mapAttrs' - (n: v: inputs.nixpkgs.lib.nameValuePair (n) ({ flake = v; })) inputs; + (n: v: inputs.nixpkgs.lib.nameValuePair (n) ({ flake = v; })) + inputs; } ]; } diff --git a/nix/private-wireguard.nix b/nix/private-wireguard.nix index 706dfd8..8e5d74c 100644 --- a/nix/private-wireguard.nix +++ b/nix/private-wireguard.nix @@ -10,7 +10,8 @@ let allPeers = wgcfg.peers; thisPeer = allPeers."${hostname}" or null; otherPeers = lib.filterAttrs (n: v: n != hostname) allPeers; -in { +in +{ options.networking.private-wireguard = { enable = mkEnableOption "Enable private wireguard vpn connection"; }; @@ -24,17 +25,19 @@ in { "${wgcfg.subnet4}.${toString thisPeer.ipv4}/${toString wgcfg.mask4}" ]; - peers = lib.mapAttrsToList (name: peer: - { - allowedIPs = [ - "${wgcfg.subnet4}.${toString peer.ipv4}/${toString wgcfg.mask4}" - ]; - publicKey = peer.key; - } // lib.optionalAttrs (peer ? externalIp) { - endpoint = "${peer.externalIp}:${toString port}"; - } // lib.optionalAttrs (!(thisPeer ? externalIp)) { - persistentKeepalive = 10; - }) otherPeers; + peers = lib.mapAttrsToList + (name: peer: + { + allowedIPs = [ + "${wgcfg.subnet4}.${toString peer.ipv4}/${toString wgcfg.mask4}" + ]; + publicKey = peer.key; + } // lib.optionalAttrs (peer ? externalIp) { + endpoint = "${peer.externalIp}:${toString port}"; + } // lib.optionalAttrs (!(thisPeer ? externalIp)) { + persistentKeepalive = 10; + }) + otherPeers; }; }; }; |