nixfmt
This commit is contained in:
parent
ac021ac976
commit
91eea7811a
13
common.nix
13
common.nix
@ -1,9 +1,7 @@
|
|||||||
{ config, pkgs, lib, options, ... }:
|
{ config, pkgs, lib, options, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [ ./modules ];
|
||||||
./modules
|
|
||||||
];
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
services.haveged.enable = lib.mkDefault true;
|
services.haveged.enable = lib.mkDefault true;
|
||||||
@ -19,9 +17,12 @@
|
|||||||
|
|
||||||
programs.mosh.enable = lib.mkDefault true;
|
programs.mosh.enable = lib.mkDefault true;
|
||||||
|
|
||||||
systemd.services.nix-gc.serviceConfig.IOSchedulingPriority = lib.mkDefault 7;
|
systemd.services.nix-gc.serviceConfig.IOSchedulingPriority =
|
||||||
systemd.services.nix-gc.serviceConfig.IOSchedulingClass = lib.mkDefault "idle";
|
lib.mkDefault 7;
|
||||||
systemd.services.nix-gc.serviceConfig.CPUSchedulingPolicy = lib.mkDefault "idle";
|
systemd.services.nix-gc.serviceConfig.IOSchedulingClass =
|
||||||
|
lib.mkDefault "idle";
|
||||||
|
systemd.services.nix-gc.serviceConfig.CPUSchedulingPolicy =
|
||||||
|
lib.mkDefault "idle";
|
||||||
|
|
||||||
nix = {
|
nix = {
|
||||||
gc = {
|
gc = {
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
npmlock2nix = {
|
npmlock2nix = {
|
||||||
url = github:nix-community/npmlock2nix;
|
url = "github:nix-community/npmlock2nix";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -86,7 +86,8 @@
|
|||||||
nixosModules.common-chekkie = import ./users/chekkie.nix;
|
nixosModules.common-chekkie = import ./users/chekkie.nix;
|
||||||
|
|
||||||
homeManagerModules.common = import ./home-manager/common.nix inputs;
|
homeManagerModules.common = import ./home-manager/common.nix inputs;
|
||||||
homeManagerModules.common-notgne2 = import ./home-manager/users/notgne2.nix inputs;
|
homeManagerModules.common-notgne2 =
|
||||||
|
import ./home-manager/users/notgne2.nix inputs;
|
||||||
homeManagerModules.common-glooder = import ./home-manager/users/glooder.nix;
|
homeManagerModules.common-glooder = import ./home-manager/users/glooder.nix;
|
||||||
homeManagerModules.common-chekkie = import ./home-manager/users/chekkie.nix;
|
homeManagerModules.common-chekkie = import ./home-manager/users/chekkie.nix;
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let cfg = config.de2;
|
||||||
cfg = config.de2;
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
options.de2.enable = mkEnableOption "Enable de2 system stuff";
|
options.de2.enable = mkEnableOption "Enable de2 system stuff";
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
@ -14,8 +12,8 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
i18n.inputMethod = {
|
i18n.inputMethod = {
|
||||||
enabled = "ibus";
|
enabled = "ibus";
|
||||||
ibus.engines = with pkgs.ibus-engines; [ typing-booster uniemoji ];
|
ibus.engines = with pkgs.ibus-engines; [ typing-booster uniemoji ];
|
||||||
};
|
};
|
||||||
|
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
@ -28,7 +26,13 @@ in
|
|||||||
services.power-profiles-daemon.enable = lib.mkDefault false;
|
services.power-profiles-daemon.enable = lib.mkDefault false;
|
||||||
|
|
||||||
# for KDE connect
|
# for KDE connect
|
||||||
networking.firewall.allowedTCPPortRanges = [ { from = 1714; to = 1764; } ];
|
networking.firewall.allowedTCPPortRanges = [{
|
||||||
networking.firewall.allowedUDPPortRanges = [ { from = 1714; to = 1764; } ];
|
from = 1714;
|
||||||
|
to = 1764;
|
||||||
|
}];
|
||||||
|
networking.firewall.allowedUDPPortRanges = [{
|
||||||
|
from = 1714;
|
||||||
|
to = 1764;
|
||||||
|
}];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let cfg = config.services.ezpassthru;
|
||||||
cfg = config.services.ezpassthru;
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
options.services.ezpassthru = {
|
options.services.ezpassthru = {
|
||||||
enable =
|
enable = mkEnableOption
|
||||||
mkEnableOption
|
"Enable simple VM PCI passthrough config (NOTE: this is only for ppl with a primary AMD/Intel, and a non-primary NVidia)";
|
||||||
"Enable simple VM PCI passthrough config (NOTE: this is only for ppl with a primary AMD/Intel, and a non-primary NVidia)";
|
|
||||||
|
|
||||||
PCIs = mkOption {
|
PCIs = mkOption {
|
||||||
description = "The ID pairs of your PCI devices to passthrough";
|
description = "The ID pairs of your PCI devices to passthrough";
|
||||||
@ -29,11 +26,7 @@ in
|
|||||||
"vfio"
|
"vfio"
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.kernelParams = [
|
boot.kernelParams = [ "intel_iommu=on" "amd_iommu=on" "pcie_aspm=off" ];
|
||||||
"intel_iommu=on"
|
|
||||||
"amd_iommu=on"
|
|
||||||
"pcie_aspm=off"
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.extraModprobeConfig = "options vfio-pci ids=${
|
boot.extraModprobeConfig = "options vfio-pci ids=${
|
||||||
builtins.concatStringsSep "," (builtins.attrNames cfg.PCIs)
|
builtins.concatStringsSep "," (builtins.attrNames cfg.PCIs)
|
||||||
|
275
modules/ezpw.nix
275
modules/ezpw.nix
@ -1,9 +1,7 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let cfg = config.services.ezpw;
|
||||||
cfg = config.services.ezpw;
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
options.services.ezpw = {
|
options.services.ezpw = {
|
||||||
enable = mkEnableOption "Enable pipewire";
|
enable = mkEnableOption "Enable pipewire";
|
||||||
|
|
||||||
@ -15,13 +13,15 @@ in
|
|||||||
|
|
||||||
usbSoundcard = mkOption {
|
usbSoundcard = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "Doubles the audio rate for alsa outputs in low latency mode";
|
description =
|
||||||
|
"Doubles the audio rate for alsa outputs in low latency mode";
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
periodSize = mkOption {
|
periodSize = mkOption {
|
||||||
type = types.int;
|
type = types.int;
|
||||||
description = "Pipewire period size in low latency mode (\"tweak by trial-and-error\")";
|
description = ''
|
||||||
|
Pipewire period size in low latency mode ("tweak by trial-and-error")'';
|
||||||
default = 32;
|
default = 32;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -38,166 +38,169 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = let qr = "${toString cfg.quantum}/${toString cfg.rate}";
|
||||||
let
|
in mkIf cfg.enable {
|
||||||
qr = "${toString cfg.quantum}/${toString cfg.rate}";
|
hardware.pulseaudio.enable = lib.mkDefault false;
|
||||||
in
|
sound.enable = lib.mkDefault false;
|
||||||
mkIf cfg.enable {
|
|
||||||
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"; }
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pipewire-pulse = {
|
"context.modules" = [
|
||||||
"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-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.*"; }];
|
name = "libpipewire-module-rtkit";
|
||||||
actions = {
|
args = {
|
||||||
update-props = {
|
"nice.level" = -11;
|
||||||
"audio.format" = "S32LE";
|
"rt.prio" = 88;
|
||||||
"audio.rate" = cfg.rate * (if cfg.usbSoundcard then 2 else 1);
|
"rt.time.soft" = 200000;
|
||||||
"api.alsa.period-size" = cfg.periodSize;
|
"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"; }
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
media-session.config.bluez-monitor = {
|
pipewire-pulse = {
|
||||||
properties = {
|
"context.modules" = [
|
||||||
"bluez5.codecs" = [ "sbc" "aac" "ldac" "aptx" "aptx_hd" ];
|
|
||||||
"bluez5.mdbc-support" = true;
|
|
||||||
};
|
|
||||||
rules = [
|
|
||||||
{
|
{
|
||||||
actions = {
|
name = "libpipewire-module-rtkit";
|
||||||
update-props = {
|
args = {
|
||||||
"bluez5.auto-connect" = [ "hsp_hs" "hfp_hf" "a2dp_sink" ];
|
"nice.level" = -11;
|
||||||
"bluez5.hw-volume" =
|
"rt.prio" = 88;
|
||||||
[ "hsp_ag" "hfp_ag" "a2dp_source" "a2dp_sink" ];
|
"rt.time.soft" = 200000;
|
||||||
"bluez5.autoswitch-profile" = true;
|
"rt.time.hard" = 200000;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
matches = [{ "device.name" = "~bluez_card.*"; }];
|
flags = [ "ifexists" "nofail" ];
|
||||||
}
|
}
|
||||||
|
{ name = "libpipewire-module-protocol-native"; }
|
||||||
|
{ name = "libpipewire-module-client-node"; }
|
||||||
|
{ name = "libpipewire-module-adapter"; }
|
||||||
|
{ name = "libpipewire-module-metadata"; }
|
||||||
{
|
{
|
||||||
actions = { update-props = { "node.pause-on-idle" = false; }; };
|
name = "libpipewire-module-protocol-pulse";
|
||||||
matches = [
|
args = {
|
||||||
{ "node.name" = "~bluez_input.*"; }
|
"pulse.min.req" = qr;
|
||||||
{ "node.name" = "~bluez_output.*"; }
|
"pulse.default.req" = qr;
|
||||||
];
|
"pulse.min.quantum" = qr;
|
||||||
|
"server.address" = [ "unix:native" ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
"stream.properties" = {
|
||||||
|
"node.latency" = qr;
|
||||||
|
"resample.quality" = 1;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
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 = [
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
[
|
||||||
# pactl is required for pipewire-pulse
|
# pactl is required for pipewire-pulse
|
||||||
pulseaudio
|
pulseaudio
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.etc."wireplumber/main.lua.d/51-alsa-config.lua".text = mkIf cfg.lowLatency ''
|
environment.etc."wireplumber/main.lua.d/51-alsa-config.lua".text =
|
||||||
|
mkIf cfg.lowLatency ''
|
||||||
alsa_monitor.properties = {
|
alsa_monitor.properties = {
|
||||||
["audio.rate"] = ${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",
|
["audio.format"] = "S32LE",
|
||||||
["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 = {
|
||||||
["bluez5.enable-sbc-xq"] = true,
|
["bluez5.enable-sbc-xq"] = true,
|
||||||
["bluez5.enable-msbc"] = true,
|
["bluez5.enable-msbc"] = true,
|
||||||
["bluez5.enable-hw-volume"] = true,
|
["bluez5.enable-hw-volume"] = true,
|
||||||
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
|
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
xdg.portal.enable = lib.mkDefault true;
|
xdg.portal.enable = lib.mkDefault true;
|
||||||
xdg.portal.gtkUsePortal = 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 ]);
|
xdg.portal.extraPortals = lib.mkDefault (with pkgs; [
|
||||||
};
|
xdg-desktop-portal-gnome
|
||||||
|
xdg-desktop-portal-wlr
|
||||||
|
xdg-desktop-portal-gtk
|
||||||
|
]);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,7 @@ 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
|
in lib.splitString ":" (builtins.readFile "${rangesOutput}");
|
||||||
lib.splitString ":" (builtins.readFile "${rangesOutput}");
|
|
||||||
|
|
||||||
subnet = vlanIP: vlanSize:
|
subnet = vlanIP: vlanSize:
|
||||||
let
|
let
|
||||||
@ -39,8 +38,7 @@ 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
|
in builtins.readFile "${subnetOutput}";
|
||||||
builtins.readFile "${subnetOutput}";
|
|
||||||
|
|
||||||
serverOpts.options = {
|
serverOpts.options = {
|
||||||
ip = mkOption {
|
ip = mkOption {
|
||||||
@ -88,8 +86,7 @@ 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,51 +96,40 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable
|
config = mkIf cfg.enable {
|
||||||
{
|
networking.firewall.checkReversePath = false;
|
||||||
networking.firewall.checkReversePath = false;
|
|
||||||
|
|
||||||
systemd.paths = mapAttrs'
|
systemd.paths = mapAttrs' (instName: inst: {
|
||||||
(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
|
systemd.services = lib.listToAttrs (flatten (mapAttrsToList (instName: inst:
|
||||||
(mapAttrsToList
|
[{
|
||||||
(instName: inst: [
|
name = "wireguard-${instName}";
|
||||||
{
|
value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
|
||||||
name = "wireguard-${instName}";
|
}] ++ map (server: {
|
||||||
value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
|
name =
|
||||||
}
|
"wireguard-${instName}-peer${peerNameReplacement server.publicKey}";
|
||||||
] ++ map
|
value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
|
||||||
(server: {
|
}) inst.servers) cfg.instances));
|
||||||
name = "wireguard-${instName}-peer${peerNameReplacement server.publicKey}";
|
|
||||||
value = if inst.autoStart then { } else { wantedBy = mkForce [ ]; };
|
|
||||||
})
|
|
||||||
inst.servers)
|
|
||||||
cfg.instances));
|
|
||||||
|
|
||||||
|
networking.wireguard.interfaces = mapAttrs (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;
|
||||||
|
|
||||||
networking.wireguard.interfaces = mapAttrs
|
};
|
||||||
(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;
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,14 @@ with lib;
|
|||||||
let
|
let
|
||||||
cfg = config.fuckingprint;
|
cfg = config.fuckingprint;
|
||||||
|
|
||||||
fixPlatforms = p: p.overrideAttrs (super: super // { meta = super.meta // { platforms = super.meta.platforms ++ [ "x86_64-linux" ]; }; });
|
fixPlatforms = p:
|
||||||
in
|
p.overrideAttrs (super:
|
||||||
{
|
super // {
|
||||||
|
meta = super.meta // {
|
||||||
|
platforms = super.meta.platforms ++ [ "x86_64-linux" ];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
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 {
|
||||||
@ -76,7 +81,9 @@ in
|
|||||||
mfcl3770cdwlpr
|
mfcl3770cdwlpr
|
||||||
|
|
||||||
# Maybe this isn't a good idea?
|
# Maybe this isn't a good idea?
|
||||||
(mfcl8690cdwcupswrapper.override { mfcl8690cdwlpr = fixPlatforms mfcl8690cdwlpr; })
|
(mfcl8690cdwcupswrapper.override {
|
||||||
|
mfcl8690cdwlpr = fixPlatforms mfcl8690cdwlpr;
|
||||||
|
})
|
||||||
(fixPlatforms mfcl8690cdwlpr)
|
(fixPlatforms mfcl8690cdwlpr)
|
||||||
];
|
];
|
||||||
hardware.sane.enable = true;
|
hardware.sane.enable = true;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let cfg = config.services.kiosk;
|
||||||
cfg = config.services.kiosk;
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
options.services.kiosk = {
|
options.services.kiosk = {
|
||||||
enable = mkEnableOption "Enable simple kiosk display";
|
enable = mkEnableOption "Enable simple kiosk display";
|
||||||
|
|
||||||
@ -65,20 +63,18 @@ in
|
|||||||
displayManager.xserverArgs = if cfg.cursor then [ ] else [ "-nocursor" ];
|
displayManager.xserverArgs = if cfg.cursor then [ ] else [ "-nocursor" ];
|
||||||
displayManager.defaultSession = "kiosk+ratpoison";
|
displayManager.defaultSession = "kiosk+ratpoison";
|
||||||
|
|
||||||
desktopManager.session = [
|
desktopManager.session = [{
|
||||||
{
|
name = "kiosk";
|
||||||
name = "kiosk";
|
start = ''
|
||||||
start = ''
|
# dont blank the screen after 5min
|
||||||
# dont blank the screen after 5min
|
xset dpms force on
|
||||||
xset dpms force on
|
xset -dpms
|
||||||
xset -dpms
|
xset s noblank
|
||||||
xset s noblank
|
xset s off
|
||||||
xset s off
|
|
||||||
|
|
||||||
${cfg.session}
|
${cfg.session}
|
||||||
'';
|
'';
|
||||||
}
|
}];
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let cfg = config.workstation;
|
||||||
cfg = config.workstation;
|
in {
|
||||||
in
|
|
||||||
{
|
|
||||||
options.workstation = {
|
options.workstation = {
|
||||||
enable = mkEnableOption "make my computer work";
|
enable = mkEnableOption "make my computer work";
|
||||||
|
|
||||||
@ -37,7 +35,13 @@ in
|
|||||||
|
|
||||||
services.thermald.enable = lib.mkDefault true;
|
services.thermald.enable = lib.mkDefault true;
|
||||||
|
|
||||||
boot.kernelParams = lib.optionals cfg.battery [ "iwlwifi.uapsd_disable=0" "iwlmvm.power_scheme=3" "iwldvm.force_cam=0" "snd_hda_intel.power_save=1" "snd_ac97_codec.power_save=1" ];
|
boot.kernelParams = lib.optionals cfg.battery [
|
||||||
|
"iwlwifi.uapsd_disable=0"
|
||||||
|
"iwlmvm.power_scheme=3"
|
||||||
|
"iwldvm.force_cam=0"
|
||||||
|
"snd_hda_intel.power_save=1"
|
||||||
|
"snd_ac97_codec.power_save=1"
|
||||||
|
];
|
||||||
|
|
||||||
# Don't kill the battery
|
# Don't kill the battery
|
||||||
services.upower = {
|
services.upower = {
|
||||||
@ -109,9 +113,7 @@ in
|
|||||||
# Optimizes running games
|
# Optimizes running games
|
||||||
programs.gamemode = {
|
programs.gamemode = {
|
||||||
enable = lib.mkDefault true;
|
enable = lib.mkDefault true;
|
||||||
settings = {
|
settings = { general.renice = 10; };
|
||||||
general.renice = 10;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Allows realtime stuff, useful for games, audio etc
|
# Allows realtime stuff, useful for games, audio etc
|
||||||
@ -164,20 +166,29 @@ in
|
|||||||
|
|
||||||
# the user should have some basic permissions lol
|
# the user should have some basic permissions lol
|
||||||
users.users."${cfg.user}" = {
|
users.users."${cfg.user}" = {
|
||||||
extraGroups = [ "adbusers" "audio" "video" "libvirtd" "kvm" "sway" "wheel" "networkmanager" "docker" "podman" "input" "uinput" ];
|
extraGroups = [
|
||||||
|
"adbusers"
|
||||||
|
"audio"
|
||||||
|
"video"
|
||||||
|
"libvirtd"
|
||||||
|
"kvm"
|
||||||
|
"sway"
|
||||||
|
"wheel"
|
||||||
|
"networkmanager"
|
||||||
|
"docker"
|
||||||
|
"podman"
|
||||||
|
"input"
|
||||||
|
"uinput"
|
||||||
|
];
|
||||||
|
|
||||||
subUidRanges = [
|
subUidRanges = [{
|
||||||
{
|
startUid = 100000;
|
||||||
startUid = 100000;
|
count = 65536;
|
||||||
count = 65536;
|
}];
|
||||||
}
|
subGidRanges = [{
|
||||||
];
|
startGid = 100000;
|
||||||
subGidRanges = [
|
count = 65536;
|
||||||
{
|
}];
|
||||||
startGid = 100000;
|
|
||||||
count = 65536;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# brightness
|
# brightness
|
||||||
@ -268,6 +279,7 @@ in
|
|||||||
|
|
||||||
# bluetooth
|
# bluetooth
|
||||||
hardware.bluetooth.enable = lib.mkDefault true;
|
hardware.bluetooth.enable = lib.mkDefault true;
|
||||||
hardware.bluetooth.settings.General.Enable = lib.mkDefault "Source,Sink,Media,Socket";
|
hardware.bluetooth.settings.General.Enable =
|
||||||
|
lib.mkDefault "Source,Sink,Media,Socket";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user