fix formatting

This commit is contained in:
notgne2 2022-09-13 18:08:19 -07:00
parent 3417784008
commit cf401b300c
Signed by: notgne2
GPG Key ID: 5CE0A245A2DAC84A
7 changed files with 240 additions and 217 deletions

View File

@ -25,9 +25,11 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
xdg.configFile."kermit.conf".text = (lib.generators.toKeyValue { xdg.configFile."kermit.conf".text = (lib.generators.toKeyValue
{
mkKeyValue = lib.generators.mkKeyValueDefault { } " "; mkKeyValue = lib.generators.mkKeyValueDefault { } " ";
} cfg.settings) + cfg.extraConfig; }
cfg.settings) + cfg.extraConfig;
home.packages = [ pkgs.kermit-terminal ]; home.packages = [ pkgs.kermit-terminal ];
}; };

View File

@ -77,9 +77,11 @@ in
dhall.dhall-lang dhall.dhall-lang
dhall.vscode-dhall-lsp-server dhall.vscode-dhall-lsp-server
elmtooling.elm-ls-vscode elmtooling.elm-ls-vscode
(rust-lang.rust-analyzer.override { rust-analyzer = pkgs.writeShellScriptBin "rust-analyzer" '' (rust-lang.rust-analyzer.override {
rust-analyzer = pkgs.writeShellScriptBin "rust-analyzer" ''
exec rust-analyzer "$@" exec rust-analyzer "$@"
''; }) '';
})
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{ {
name = "vscode-autohide"; name = "vscode-autohide";

View File

@ -38,7 +38,8 @@ in {
}; };
}; };
config = let qr = "${toString cfg.quantum}/${toString cfg.rate}"; config =
let qr = "${toString cfg.quantum}/${toString cfg.rate}";
in mkIf cfg.enable { in mkIf cfg.enable {
hardware.pulseaudio.enable = lib.mkDefault false; hardware.pulseaudio.enable = lib.mkDefault false;
sound.enable = lib.mkDefault false; sound.enable = lib.mkDefault false;
@ -175,7 +176,8 @@ in {
]; ];
environment.etc."wireplumber/main.lua.d/51-alsa-config.lua" = environment.etc."wireplumber/main.lua.d/51-alsa-config.lua" =
mkIf cfg.lowLatency { text = '' mkIf cfg.lowLatency {
text = ''
alsa_monitor.properties = { alsa_monitor.properties = {
["audio.rate"] = ${ ["audio.rate"] = ${
toString (cfg.rate * (if cfg.usbSoundcard then 2 else 1)) toString (cfg.rate * (if cfg.usbSoundcard then 2 else 1))
@ -184,7 +186,8 @@ in {
["api.alsa.headroom"] = 512, ["api.alsa.headroom"] = 512,
["api.alsa.period-size"] = ${toString cfg.periodSize} ["api.alsa.period-size"] = ${toString cfg.periodSize}
} }
''; }; '';
};
environment.etc."wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' environment.etc."wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
bluez_monitor.properties = { bluez_monitor.properties = {

View File

@ -25,7 +25,8 @@ let
rangesOutput = pkgs.runCommandNoCC "exclusionary-wildcard-ranges" { } '' rangesOutput = pkgs.runCommandNoCC "exclusionary-wildcard-ranges" { } ''
${pkgs.python3}/bin/python3 ${generateRangesScript} > $out ${pkgs.python3}/bin/python3 ${generateRangesScript} > $out
''; '';
in lib.splitString ":" (builtins.readFile "${rangesOutput}"); in
lib.splitString ":" (builtins.readFile "${rangesOutput}");
subnet = vlanIP: vlanSize: subnet = vlanIP: vlanSize:
let let
@ -38,7 +39,8 @@ let
subnetOutput = pkgs.runCommandNoCC "subnet-without-host-bits" { } '' subnetOutput = pkgs.runCommandNoCC "subnet-without-host-bits" { } ''
${pkgs.python3}/bin/python3 ${generateSubnetScript} > $out ${pkgs.python3}/bin/python3 ${generateSubnetScript} > $out
''; '';
in builtins.readFile "${subnetOutput}"; in
builtins.readFile "${subnetOutput}";
serverOpts.options = { serverOpts.options = {
ip = mkOption { ip = mkOption {
@ -86,7 +88,8 @@ let
description = "The IP to use on the wg VLAN"; description = "The IP to use on the wg VLAN";
}; };
}; };
in { in
{
options.services.ezwg = { options.services.ezwg = {
enable = mkEnableOption "Enable simple Wireguard connection"; enable = mkEnableOption "Enable simple Wireguard connection";
instances = mkOption { instances = mkOption {
@ -99,37 +102,49 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
networking.firewall.checkReversePath = false; networking.firewall.checkReversePath = false;
systemd.paths = mapAttrs' (instName: inst: { systemd.paths = mapAttrs'
(instName: inst: {
name = "wireguard-${instName}"; name = "wireguard-${instName}";
value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; }; value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
}) cfg.instances; })
cfg.instances;
systemd.services = lib.listToAttrs (flatten (mapAttrsToList (instName: inst: systemd.services = lib.listToAttrs (flatten (mapAttrsToList
(instName: inst:
[{ [{
name = "wireguard-${instName}"; name = "wireguard-${instName}";
value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; }; value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
}] ++ map (server: { }] ++ map
(server: {
name = name =
"wireguard-${instName}-peer${peerNameReplacement server.publicKey}"; "wireguard-${instName}-peer${peerNameReplacement server.publicKey}";
value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; }; value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
}) inst.servers) cfg.instances)); })
inst.servers)
cfg.instances));
networking.wireguard.interfaces = mapAttrs (instName: inst: networking.wireguard.interfaces = mapAttrs
(instName: inst:
let let
allowedIPs = if inst.proxy then allowedIPs =
if inst.proxy then
ranges (map (s: s.ip) inst.servers) ranges (map (s: s.ip) inst.servers)
else else
[ (subnet inst.vlanIP inst.vlanSize) ]; [ (subnet inst.vlanIP inst.vlanSize) ];
in { in
{
ips = [ "${inst.vlanIP}/${toString inst.vlanSize}" ]; ips = [ "${inst.vlanIP}/${toString inst.vlanSize}" ];
privateKeyFile = inst.privateKeyFile; privateKeyFile = inst.privateKeyFile;
peers = map (server: { peers = map
(server: {
inherit allowedIPs; inherit allowedIPs;
publicKey = server.publicKey; publicKey = server.publicKey;
endpoint = "${server.ip}:${toString server.port}"; endpoint = "${server.ip}:${toString server.port}";
persistentKeepalive = 25; persistentKeepalive = 25;
}) inst.servers; })
}) cfg.instances; inst.servers;
})
cfg.instances;
}; };
} }

View File

@ -10,7 +10,8 @@ let
platforms = super.meta.platforms ++ [ "x86_64-linux" ]; platforms = super.meta.platforms ++ [ "x86_64-linux" ];
}; };
}); });
in { in
{
options.fuckingprint.enable = mkEnableOption "Make my fucking printer work"; options.fuckingprint.enable = mkEnableOption "Make my fucking printer work";
config = mkIf cfg.enable { config = mkIf cfg.enable {