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

@ -57,39 +57,39 @@ in
]); ]);
profiles.default = { profiles.default = {
settings = { settings = {
"browser.startup.homepage" = "https://wizbos.club"; "browser.startup.homepage" = "https://wizbos.club";
# Make the browser usable, if I wanted autism privacy, I would use TOR browser. # Make the browser usable, if I wanted autism privacy, I would use TOR browser.
"privacy.resistFingerprinting" = false; "privacy.resistFingerprinting" = false;
"webgl.disabled" = false; "webgl.disabled" = false;
"privacy.clearOnShutdown.history" = false; "privacy.clearOnShutdown.history" = false;
"privacy.clearOnShutdown.cookies" = false; "privacy.clearOnShutdown.cookies" = false;
"privacy.clearOnShutdown.sessions" = false; "privacy.clearOnShutdown.sessions" = false;
"privacy.clearOnShutdown.cache" = false; "privacy.clearOnShutdown.cache" = false;
"places.history.enabled" = true; "places.history.enabled" = true;
"network.dns.disableIPv6" = false; "network.dns.disableIPv6" = false;
"media.peerconnection.ice.no_host" = false; "media.peerconnection.ice.no_host" = false;
# Make Jitsi work sanely # Make Jitsi work sanely
"media.setsinkid.enabled" = true; "media.setsinkid.enabled" = true;
"privacy.webrtc.legacyGlobalIndicator" = false; "privacy.webrtc.legacyGlobalIndicator" = false;
"privacy.webrtc.hideGlobalIndicator" = true; "privacy.webrtc.hideGlobalIndicator" = true;
# good tweaks # good tweaks
"toolkit.legacyUserProfileCustomizations.stylesheets" = true; "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"layers.acceleration.force-enabled" = true; "layers.acceleration.force-enabled" = true;
"gfx.webrender.all" = true; "gfx.webrender.all" = true;
"svg.context-properties.content.enabled" = true; "svg.context-properties.content.enabled" = true;
"reader.color_scheme" = "dark"; "reader.color_scheme" = "dark";
# # LibreWolf ruins the user agent making sites unusable without RFP, so use the user agent from RFP manually. This also seems sane for compatibility when using Firefox. # # LibreWolf ruins the user agent making sites unusable without RFP, so use the user agent from RFP manually. This also seems sane for compatibility when using Firefox.
# "general.useragent.override" = "Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0"; # "general.useragent.override" = "Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0";
# set the user agent to a _realistic_ user agent because cloudflare keeps sniffing my balls # set the user agent to a _realistic_ user agent because cloudflare keeps sniffing my balls
"general.useragent.override" = "Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0"; "general.useragent.override" = "Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0";
};
}; };
};
}; };
programs.kermit = { programs.kermit = {
@ -336,7 +336,7 @@ in
cycle-windows-backward = [ "" ]; cycle-windows-backward = [ "" ];
activate-window-menu = [ "" ]; activate-window-menu = [ "" ];
cycle-panels = [ "" ]; cycle-panels = [ "" ];
cycle-panels-backward = [ ""]; cycle-panels-backward = [ "" ];
switch-panels = [ "" ]; switch-panels = [ "" ];
switch-panels-backward = [ "" ]; switch-panels-backward = [ "" ];
switch-applications = [ "<Super>Tab" ]; switch-applications = [ "<Super>Tab" ];

View File

@ -25,11 +25,11 @@ in
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
ark ark
unzip unzip
unrar unrar
mpv mpv
]; ];
xsession.enable = true; xsession.enable = true;

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 {} " "; {
} cfg.settings) + cfg.extraConfig; mkKeyValue = lib.generators.mkKeyValueDefault { } " ";
}
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 {
exec rust-analyzer "$@" rust-analyzer = pkgs.writeShellScriptBin "rust-analyzer" ''
''; }) exec rust-analyzer "$@"
'';
})
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{ {
name = "vscode-autohide"; name = "vscode-autohide";

View File

@ -38,169 +38,172 @@ in {
}; };
}; };
config = let qr = "${toString cfg.quantum}/${toString cfg.rate}"; config =
in mkIf cfg.enable { let qr = "${toString cfg.quantum}/${toString cfg.rate}";
hardware.pulseaudio.enable = lib.mkDefault false; in mkIf cfg.enable {
sound.enable = lib.mkDefault false; hardware.pulseaudio.enable = lib.mkDefault false;
sound.enable = lib.mkDefault false;
services.pipewire = { services.pipewire = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
jack.enable = lib.mkDefault true; jack.enable = lib.mkDefault true;
alsa.enable = lib.mkDefault true; alsa.enable = lib.mkDefault true;
alsa.support32Bit = lib.mkDefault true; alsa.support32Bit = lib.mkDefault true;
pulse.enable = lib.mkDefault true; pulse.enable = lib.mkDefault true;
media-session.enable = lib.mkDefault false; media-session.enable = lib.mkDefault false;
wireplumber.enable = lib.mkDefault true; wireplumber.enable = lib.mkDefault true;
config = mkIf cfg.lowLatency { config = mkIf cfg.lowLatency {
pipewire = { pipewire = {
"context.properties" = { "context.properties" = {
"default.clock.rate" = cfg.rate; "default.clock.rate" = cfg.rate;
"default.clock.quantum" = cfg.quantum; "default.clock.quantum" = cfg.quantum;
"default.clock.min-quantum" = cfg.quantum; "default.clock.min-quantum" = cfg.quantum;
};
"context.modules" = [
{
name = "libpipewire-module-rtkit";
args = {
"nice.level" = -11;
"rt.prio" = 88;
"rt.time.soft" = 200000;
"rt.time.hard" = 200000;
};
flags = [ "ifexists" "nofail" ];
}
{ name = "libpipewire-module-protocol-native"; }
{ name = "libpipewire-module-profiler"; }
{ name = "libpipewire-module-metadata"; }
{ name = "libpipewire-module-spa-device-factory"; }
{ name = "libpipewire-module-spa-node-factory"; }
{ name = "libpipewire-module-client-node"; }
{ name = "libpipewire-module-client-device"; }
{
name = "libpipewire-module-portal";
flags = [ "ifexists" "nofail" ];
}
{
name = "libpipewire-module-access";
args = { };
}
{ name = "libpipewire-module-adapter"; }
{ name = "libpipewire-module-link-factory"; }
{ name = "libpipewire-module-session-manager"; }
];
}; };
"context.modules" = [ pipewire-pulse = {
{ "context.modules" = [
name = "libpipewire-module-rtkit"; {
args = { name = "libpipewire-module-rtkit";
"nice.level" = -11; args = {
"rt.prio" = 88; "nice.level" = -11;
"rt.time.soft" = 200000; "rt.prio" = 88;
"rt.time.hard" = 200000; "rt.time.soft" = 200000;
}; "rt.time.hard" = 200000;
flags = [ "ifexists" "nofail" ]; };
} flags = [ "ifexists" "nofail" ];
{ name = "libpipewire-module-protocol-native"; } }
{ name = "libpipewire-module-profiler"; } { name = "libpipewire-module-protocol-native"; }
{ name = "libpipewire-module-metadata"; } { name = "libpipewire-module-client-node"; }
{ name = "libpipewire-module-spa-device-factory"; } { name = "libpipewire-module-adapter"; }
{ name = "libpipewire-module-spa-node-factory"; } { name = "libpipewire-module-metadata"; }
{ name = "libpipewire-module-client-node"; } {
{ name = "libpipewire-module-client-device"; } name = "libpipewire-module-protocol-pulse";
{ args = {
name = "libpipewire-module-portal"; "pulse.min.req" = qr;
flags = [ "ifexists" "nofail" ]; "pulse.default.req" = qr;
} "pulse.min.quantum" = qr;
{ "server.address" = [ "unix:native" ];
name = "libpipewire-module-access"; };
args = { }; }
} ];
{ name = "libpipewire-module-adapter"; }
{ name = "libpipewire-module-link-factory"; }
{ name = "libpipewire-module-session-manager"; }
];
};
pipewire-pulse = { "stream.properties" = {
"context.modules" = [ "node.latency" = qr;
{ "resample.quality" = 1;
name = "libpipewire-module-rtkit";
args = {
"nice.level" = -11;
"rt.prio" = 88;
"rt.time.soft" = 200000;
"rt.time.hard" = 200000;
};
flags = [ "ifexists" "nofail" ];
}
{ name = "libpipewire-module-protocol-native"; }
{ name = "libpipewire-module-client-node"; }
{ name = "libpipewire-module-adapter"; }
{ name = "libpipewire-module-metadata"; }
{
name = "libpipewire-module-protocol-pulse";
args = {
"pulse.min.req" = qr;
"pulse.default.req" = qr;
"pulse.min.quantum" = qr;
"server.address" = [ "unix:native" ];
};
}
];
"stream.properties" = {
"node.latency" = qr;
"resample.quality" = 1;
};
};
};
media-session.config.alsa-monitor = mkIf cfg.lowLatency {
rules = [{
matches = [{ node.name = "alsa_output.*"; }];
actions = {
update-props = {
"audio.format" = "S32LE";
"audio.rate" = cfg.rate * (if cfg.usbSoundcard then 2 else 1);
"api.alsa.period-size" = cfg.periodSize;
}; };
}; };
}];
};
media-session.config.bluez-monitor = {
properties = {
"bluez5.codecs" = [ "sbc" "aac" "ldac" "aptx" "aptx_hd" ];
"bluez5.mdbc-support" = true;
}; };
rules = [
{ media-session.config.alsa-monitor = mkIf cfg.lowLatency {
rules = [{
matches = [{ node.name = "alsa_output.*"; }];
actions = { actions = {
update-props = { update-props = {
"bluez5.auto-connect" = [ "hsp_hs" "hfp_hf" "a2dp_sink" ]; "audio.format" = "S32LE";
"bluez5.hw-volume" = "audio.rate" = cfg.rate * (if cfg.usbSoundcard then 2 else 1);
[ "hsp_ag" "hfp_ag" "a2dp_source" "a2dp_sink" ]; "api.alsa.period-size" = cfg.periodSize;
"bluez5.autoswitch-profile" = true;
}; };
}; };
matches = [{ "device.name" = "~bluez_card.*"; }]; }];
} };
{
actions = { update-props = { "node.pause-on-idle" = false; }; }; media-session.config.bluez-monitor = {
matches = [ properties = {
{ "node.name" = "~bluez_input.*"; } "bluez5.codecs" = [ "sbc" "aac" "ldac" "aptx" "aptx_hd" ];
{ "node.name" = "~bluez_output.*"; } "bluez5.mdbc-support" = true;
]; };
} rules = [
]; {
actions = {
update-props = {
"bluez5.auto-connect" = [ "hsp_hs" "hfp_hf" "a2dp_sink" ];
"bluez5.hw-volume" =
[ "hsp_ag" "hfp_ag" "a2dp_source" "a2dp_sink" ];
"bluez5.autoswitch-profile" = true;
};
};
matches = [{ "device.name" = "~bluez_card.*"; }];
}
{
actions = { update-props = { "node.pause-on-idle" = false; }; };
matches = [
{ "node.name" = "~bluez_input.*"; }
{ "node.name" = "~bluez_output.*"; }
];
}
];
};
}; };
};
environment.systemPackages = with pkgs; environment.systemPackages = with pkgs;
[ [
# pactl is required for pipewire-pulse # pactl is required for pipewire-pulse
pulseaudio pulseaudio
]; ];
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 {
alsa_monitor.properties = { text = ''
["audio.rate"] = ${ alsa_monitor.properties = {
toString (cfg.rate * (if cfg.usbSoundcard then 2 else 1)) ["audio.rate"] = ${
}, toString (cfg.rate * (if cfg.usbSoundcard then 2 else 1))
["audio.format"] = "S32LE", },
["api.alsa.headroom"] = 512, ["audio.format"] = "S32LE",
["api.alsa.period-size"] = ${toString cfg.periodSize} ["api.alsa.headroom"] = 512,
["api.alsa.period-size"] = ${toString cfg.periodSize}
}
'';
};
environment.etc."wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
bluez_monitor.properties = {
["bluez5.enable-sbc-xq"] = true,
["bluez5.enable-msbc"] = true,
["bluez5.enable-hw-volume"] = true,
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
} }
''; }; '';
environment.etc."wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' xdg.portal.enable = lib.mkDefault true;
bluez_monitor.properties = { xdg.portal.gtkUsePortal = lib.mkDefault true;
["bluez5.enable-sbc-xq"] = true, xdg.portal.extraPortals = lib.mkDefault (with pkgs; [
["bluez5.enable-msbc"] = true, xdg-desktop-portal-gnome
["bluez5.enable-hw-volume"] = true, xdg-desktop-portal-wlr
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]" xdg-desktop-portal-gtk
} ]);
''; };
xdg.portal.enable = lib.mkDefault true;
xdg.portal.gtkUsePortal = lib.mkDefault true;
xdg.portal.extraPortals = lib.mkDefault (with pkgs; [
xdg-desktop-portal-gnome
xdg-desktop-portal-wlr
xdg-desktop-portal-gtk
]);
};
} }

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'
name = "wireguard-${instName}"; (instName: inst: {
value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
}) cfg.instances;
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: { })
name = cfg.instances;
"wireguard-${instName}-peer${peerNameReplacement server.publicKey}";
value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
}) inst.servers) cfg.instances));
networking.wireguard.interfaces = mapAttrs (instName: inst: systemd.services = lib.listToAttrs (flatten (mapAttrsToList
let (instName: inst:
allowedIPs = if inst.proxy then [{
ranges (map (s: s.ip) inst.servers) name = "wireguard-${instName}";
else value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
[ (subnet inst.vlanIP inst.vlanSize) ]; }] ++ map
in { (server: {
ips = [ "${inst.vlanIP}/${toString inst.vlanSize}" ]; name =
privateKeyFile = inst.privateKeyFile; "wireguard-${instName}-peer${peerNameReplacement server.publicKey}";
peers = map (server: { value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
inherit allowedIPs; })
publicKey = server.publicKey; inst.servers)
endpoint = "${server.ip}:${toString server.port}"; cfg.instances));
persistentKeepalive = 25;
}) inst.servers; networking.wireguard.interfaces = mapAttrs
}) cfg.instances; (instName: inst:
let
allowedIPs =
if inst.proxy then
ranges (map (s: s.ip) inst.servers)
else
[ (subnet inst.vlanIP inst.vlanSize) ];
in
{
ips = [ "${inst.vlanIP}/${toString inst.vlanSize}" ];
privateKeyFile = inst.privateKeyFile;
peers = map
(server: {
inherit allowedIPs;
publicKey = server.publicKey;
endpoint = "${server.ip}:${toString server.port}";
persistentKeepalive = 25;
})
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 {