mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Desktop] Refactor config in smaller files
This commit is contained in:
parent
16073bf6fb
commit
773c7844bc
4 changed files with 84 additions and 21 deletions
22
desktop.nix
22
desktop.nix
|
|
@ -6,7 +6,6 @@ let
|
||||||
filterConfig = pkgs.callPackage ./packages/pipewire-noise-filter.cfg.nix {
|
filterConfig = pkgs.callPackage ./packages/pipewire-noise-filter.cfg.nix {
|
||||||
noiseFilterStrength = cfg.audio.noise-filter.strength;
|
noiseFilterStrength = cfg.audio.noise-filter.strength;
|
||||||
};
|
};
|
||||||
mkTmpDir = dirpath: cleanup: "D ${dirpath} 777 root root ${cleanup}";
|
|
||||||
in {
|
in {
|
||||||
options.aviallon.desktop = {
|
options.aviallon.desktop = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
|
|
@ -54,8 +53,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
./desktop/plasma.nix
|
./desktop
|
||||||
./desktop/developer.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
@ -207,24 +205,6 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
programs.steam.enable = !generalCfg.minimal;
|
|
||||||
hardware.steam-hardware.enable = !generalCfg.minimal;
|
|
||||||
programs.steam.remotePlay.openFirewall = true;
|
|
||||||
environment.variables = {
|
|
||||||
"__GL_SHADER_DISK_CACHE" = "true";
|
|
||||||
"__GL_SHADER_DISK_CACHE_SIZE" = "${toString (50 * 1000)}";
|
|
||||||
"__GL_SHADER_DISK_CACHE_SKIP_CLEANUP" = "1"; # Avoid 128mb limit of shader cache
|
|
||||||
"__GL_SHADER_DISK_CACHE_PATH" = cfg.graphics.shaderCache.path + "/nvidia" ;
|
|
||||||
"MESA_SHADER_CACHE_MAX_SIZE" = "50G"; # Put large-enough value. Default is only 1G
|
|
||||||
"MESA_SHADER_CACHE_DIR" = cfg.graphics.shaderCache.path + "/mesa";
|
|
||||||
"MESA_GLSL_CACHE_DIR" = cfg.graphics.shaderCache.path + "/mesa";
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
|
||||||
(mkTmpDir (cfg.graphics.shaderCache.path + "/nvidia") cfg.graphics.shaderCache.cleanupInterval)
|
|
||||||
(mkTmpDir (cfg.graphics.shaderCache.path + "/mesa") cfg.graphics.shaderCache.cleanupInterval)
|
|
||||||
];
|
|
||||||
|
|
||||||
aviallon.programs.allowUnfreeList = [
|
aviallon.programs.allowUnfreeList = [
|
||||||
"spotify"
|
"spotify"
|
||||||
"spotify-unwrapped"
|
"spotify-unwrapped"
|
||||||
|
|
|
||||||
10
desktop/default.nix
Normal file
10
desktop/default.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
with lib;
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./developer.nix
|
||||||
|
./multimedia.nix
|
||||||
|
./plasma.nix
|
||||||
|
./games.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
58
desktop/games.nix
Normal file
58
desktop/games.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.aviallon.desktop;
|
||||||
|
generalCfg = config.aviallon.general;
|
||||||
|
mkTmpDir = dirpath: cleanup: "D ${dirpath} 777 root root ${cleanup}";
|
||||||
|
in {
|
||||||
|
|
||||||
|
options = {
|
||||||
|
aviallon.desktop.gaming = {
|
||||||
|
enable = mkEnableOption "gaming features";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.gaming.enable {
|
||||||
|
assertions = [
|
||||||
|
{ assertion = cfg.gaming.enable -> cfg.enable; message = "Gaming features requires desktop to be enabled"; }
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
#gamescope
|
||||||
|
mangohud
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.gamemode = {
|
||||||
|
settings = {
|
||||||
|
general = {
|
||||||
|
renice = 15;
|
||||||
|
softrealtime = "auto";
|
||||||
|
};
|
||||||
|
gpu = {
|
||||||
|
apply_gpu_optimisations = "accept-responsibility";
|
||||||
|
amd_performance_level = "high";
|
||||||
|
nv_powermizer_mode = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.steam.enable = !generalCfg.minimal;
|
||||||
|
hardware.steam-hardware.enable = !generalCfg.minimal;
|
||||||
|
programs.steam.remotePlay.openFirewall = true;
|
||||||
|
environment.variables = {
|
||||||
|
"__GL_SHADER_DISK_CACHE" = "true";
|
||||||
|
"__GL_SHADER_DISK_CACHE_SIZE" = "${toString (50 * 1000)}";
|
||||||
|
"__GL_SHADER_DISK_CACHE_SKIP_CLEANUP" = "1"; # Avoid 128mb limit of shader cache
|
||||||
|
"__GL_SHADER_DISK_CACHE_PATH" = cfg.graphics.shaderCache.path + "/nvidia" ;
|
||||||
|
"MESA_SHADER_CACHE_MAX_SIZE" = "50G"; # Put large-enough value. Default is only 1G
|
||||||
|
"MESA_SHADER_CACHE_DIR" = cfg.graphics.shaderCache.path + "/mesa";
|
||||||
|
"MESA_GLSL_CACHE_DIR" = cfg.graphics.shaderCache.path + "/mesa";
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
(mkTmpDir (cfg.graphics.shaderCache.path + "/nvidia") cfg.graphics.shaderCache.cleanupInterval)
|
||||||
|
(mkTmpDir (cfg.graphics.shaderCache.path + "/mesa") cfg.graphics.shaderCache.cleanupInterval)
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
15
desktop/multimedia.nix
Normal file
15
desktop/multimedia.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.aviallon.desktop;
|
||||||
|
in {
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
ffmpeg-full
|
||||||
|
krita
|
||||||
|
obs-studio
|
||||||
|
scribus
|
||||||
|
yt-dlp
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue