linted
This commit is contained in:
atagen 2025-02-02 16:57:31 +11:00
parent 4e99a0e323
commit 7485de646a
95 changed files with 2743 additions and 2282 deletions

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: let
}:
let
# gives some output like:
# Address = [
# "10.10.10.10/32"
@ -24,8 +25,14 @@
# PublicKey = [
# "xxx"
# ];
inherit (lib) mapAttrs' mapAttrs mapAttrsToList listToAttrs splitString filter filterAttrs length head last;
inherit (builtins) readFile readDir;
inherit (lib)
mapAttrsToList
listToAttrs
splitString
filterAttrs
head
;
inherit (builtins) readDir;
# parseMullvad = file: {
# name = head (splitString "." file);
# value = listToAttrs (map (entry: {
@ -38,24 +45,19 @@
# };
# definitions =
# map parseMullvad (getFiles ../../mullvad);
getFiles = path:
mapAttrsToList (n: v: n)
(filterAttrs (n: v: v == "regular")
(readDir path));
in {
environment.systemPackages = [pkgs.wireguard-tools.out];
networking.wg-quick.interfaces = listToAttrs (map (f: rec {
getFiles = path: mapAttrsToList (n: _v: n) (filterAttrs (_n: v: v == "regular") (readDir path));
in
{
environment.systemPackages = [ pkgs.wireguard-tools.out ];
networking.wg-quick.interfaces = listToAttrs (
map (f: rec {
name = head (splitString "." f);
value = {
autostart =
if (name == "au-syd-wg-101")
then true
else false;
autostart = if (name == "au-syd-wg-101") then true else false;
configFile = builtins.toString ../../mullvad/${f};
};
})
(getFiles
../../mullvad));
}) (getFiles ../../mullvad)
);
# listToAttrs (map ({
# name,
# value,