reformat and clean stuff up
This commit is contained in:
parent
b03b8f6328
commit
2b110a13c0
8 changed files with 363 additions and 504 deletions
208
modules/ezpc.nix
208
modules/ezpc.nix
|
@ -1,208 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.ezpc;
|
||||
|
||||
mainConfig = {
|
||||
services.thermald.enable = true;
|
||||
|
||||
environment.etc."chromium/policies/managed/policies.json".text = ''
|
||||
{
|
||||
"NewTabPageLocation": "https://wizbos.club/"
|
||||
}
|
||||
'';
|
||||
|
||||
workstation.enable = true;
|
||||
workstation.user = cfg.user;
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 22 ];
|
||||
networking.firewall.allowedUDPPorts = [ 1900 ];
|
||||
|
||||
hardware.pulseaudio.enable = lib.mkDefault false;
|
||||
sound.enable = lib.mkDefault false;
|
||||
|
||||
services.pipewire = {
|
||||
enable = lib.mkDefault true;
|
||||
jack.enable = lib.mkDefault true;
|
||||
alsa.enable = lib.mkDefault true;
|
||||
alsa.support32Bit = lib.mkDefault true;
|
||||
pulse.enable = lib.mkDefault true;
|
||||
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" = [ "hfp_hf" "hsp_hs" "a2dp_sink" ];
|
||||
"bluez5.hw-volume" =
|
||||
[ "hfp_ag" "hsp_ag" "a2dp_source" "a2dp_sink" ];
|
||||
};
|
||||
};
|
||||
matches = [{ "device.name" = "~bluez_card.*"; }];
|
||||
}
|
||||
{
|
||||
actions = { update-props = { "node.pause-on-idle" = false; }; };
|
||||
matches = [
|
||||
{ "node.name" = "~bluez_input.*"; }
|
||||
{ "node.name" = "~bluez_output.*"; }
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
xdg.portal.enable = lib.mkDefault true;
|
||||
xdg.portal.gtkUsePortal = lib.mkDefault true;
|
||||
xdg.portal.extraPortals = lib.mkDefault (with pkgs; [ xdg-desktop-portal-wlr xdg-desktop-portal-gtk ]);
|
||||
|
||||
# let me use audio and phones
|
||||
programs.adb.enable = cfg.developer;
|
||||
|
||||
# Set some X11 props
|
||||
services.xserver = {
|
||||
enable = lib.mkDefault false;
|
||||
layout = lib.mkDefault "us";
|
||||
libinput.enable = true;
|
||||
};
|
||||
security.pam.services = {
|
||||
swaylock.text = ''
|
||||
auth include login
|
||||
'';
|
||||
};
|
||||
};
|
||||
notBatteryConfig = {
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
|
||||
};
|
||||
batteryConfig = {
|
||||
services.upower = {
|
||||
enable = true;
|
||||
percentageLow = 15;
|
||||
percentageCritical = 10;
|
||||
percentageAction = 5;
|
||||
};
|
||||
services.tlp.enable = true;
|
||||
services.tlp.extraConfig = ''
|
||||
TLP_ENABLE=1
|
||||
CPU_SCALING_GOVERNOR_ON_BAT=powersave
|
||||
CPU_SCALING_GOVERNOR_ON_AC=ondemand
|
||||
CPU_BOOST_ON_BAT=0
|
||||
CPU_BOOST_ON_AC=1
|
||||
CPU_MIN_PERF_ON_BAT=0
|
||||
CPU_MAX_PERF_ON_BAT=30
|
||||
CPU_MIN_PERF_ON_AC=0
|
||||
CPU_MAX_PERF_ON_AC=100
|
||||
CPU_ENERGY_PERF_POLICY_ON_BAT=power
|
||||
CPU_ENERGY_PERF_POLICY_ON_AC=ondemand
|
||||
'';
|
||||
};
|
||||
gamingConfig = {
|
||||
environment.systemPackages =
|
||||
let
|
||||
steam = pkgs.steam.override { withJava = true; };
|
||||
|
||||
steam-run = steam.run;
|
||||
|
||||
newwine = (pkgs.wineFull.override { wineBuild = "wineWow"; wineRelease = "staging"; });
|
||||
newwinetricks = pkgs.winetricks.override { wine = newwine; };
|
||||
|
||||
oldwine = (pkgs.wineFull.override { wineBuild = "wineWow"; });
|
||||
oldwinetricks = pkgs.winetricks.override { wine = oldwine; };
|
||||
in
|
||||
with pkgs; ([
|
||||
xlibs.xf86inputjoystick
|
||||
oldwine
|
||||
oldwinetricks
|
||||
] ++ (if !cfg.flatSteam then [
|
||||
steam
|
||||
steam-run
|
||||
(writeScriptBin "steam-run-native" ''
|
||||
#!${pkgs.stdenv.shell}
|
||||
${(steam.override { nativeOnly = true; }).run}/bin/steam-run $@
|
||||
'')
|
||||
] else [
|
||||
# steam-run-native
|
||||
]) ++ (
|
||||
if cfg.newWine then [
|
||||
(
|
||||
pkgs.runCommand "new-wine-stuff"
|
||||
{ } ''
|
||||
mkdir -p $out/bin
|
||||
ln -s ${newwine}/bin/wine $out/bin/new-wine
|
||||
ln -s ${newwine}/bin/winecfg $out/bin/new-winecfg
|
||||
ln -s ${newwinetricks}/bin/winetricks $out/bin/new-winetricks
|
||||
''
|
||||
)
|
||||
] else [ ]
|
||||
));
|
||||
};
|
||||
in
|
||||
{
|
||||
options.ezpc = {
|
||||
enable = mkEnableOption "Enable simple PC config";
|
||||
|
||||
battery = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "If this device has a battery";
|
||||
};
|
||||
|
||||
portals = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "use weird new hipster portal shit";
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
description = "The main user of this PC";
|
||||
};
|
||||
|
||||
gaming = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "If this PC is used for gaming";
|
||||
};
|
||||
|
||||
flatSteam = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "If you use the flatpak Steam instead of NixOS";
|
||||
};
|
||||
|
||||
print = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "If this PC should support printing/scanning";
|
||||
};
|
||||
|
||||
developer = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Should enable advanced shit for developers";
|
||||
};
|
||||
|
||||
bluetooth = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "If this PC has bluetooth support";
|
||||
};
|
||||
|
||||
newWine = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "If you want to include wine-staging as new-wine";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (
|
||||
mkMerge [
|
||||
mainConfig
|
||||
(mkIf cfg.gaming gamingConfig)
|
||||
(mkIf cfg.battery batteryConfig)
|
||||
(mkIf (cfg.battery != true) notBatteryConfig)
|
||||
]
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue