From 03e51067913a8ca2c16ca421fddb7c1f49ebc1ac Mon Sep 17 00:00:00 2001 From: materus Date: Thu, 18 May 2023 22:29:52 +0200 Subject: [PATCH] Move steam and fonts settings to profile option --- configurations/host/materusPC/default.nix | 2 + configurations/host/materusPC/tmp.nix | 73 ------------------- configurations/profile/os/default.nix | 3 + configurations/profile/os/fonts.nix | 24 +++++++ configurations/profile/os/games/default.nix | 6 ++ configurations/profile/os/games/steam.nix | 77 +++++++++++++++++++++ 6 files changed, 112 insertions(+), 73 deletions(-) create mode 100644 configurations/profile/os/fonts.nix create mode 100644 configurations/profile/os/games/default.nix create mode 100644 configurations/profile/os/games/steam.nix diff --git a/configurations/host/materusPC/default.nix b/configurations/host/materusPC/default.nix index 34e523d..15ee621 100644 --- a/configurations/host/materusPC/default.nix +++ b/configurations/host/materusPC/default.nix @@ -16,5 +16,7 @@ materus.profile.nix.enable = true; materus.profile.nixpkgs.enable = true; + materus.profile.fonts.enable = true; + materus.profile.steam.enable = true; } diff --git a/configurations/host/materusPC/tmp.nix b/configurations/host/materusPC/tmp.nix index 4d2d095..2a2d3a1 100644 --- a/configurations/host/materusPC/tmp.nix +++ b/configurations/host/materusPC/tmp.nix @@ -1,47 +1,5 @@ { config, pkgs, lib, inputs, materusFlake, materusPkgs, ... }: let - steam = pkgs.steam.override { - extraPkgs = pkgs: [ - pkgs.nss_latest - pkgs.libstrangle - pkgs.libkrb5 - pkgs.keyutils - pkgs.libGL - pkgs.libglvnd - pkgs.gamescope - pkgs.steamPackages.steam - pkgs.libxcrypt - pkgs.gnutls - pkgs.xorg.libXcursor - pkgs.xorg.libXi - pkgs.xorg.libXinerama - pkgs.xorg.libXScrnSaver - pkgs.openvdb - pkgs.tbb_2021_8 - pkgs.gtk4 - pkgs.gtk3 - pkgs.glib - pkgs.gsettings-desktop-schemas - - - - - ]; - - extraLibraries = pkgs: [ - pkgs.libkrb5 - pkgs.keyutils - pkgs.ncurses6 - pkgs.fontconfig - pkgs.libxcrypt - pkgs.gnutls - pkgs.gsettings-desktop-schemas - - ]; - extraEnv = { XDG_DATA_DIRS = "/usr/share:$XDG_DATA_DIRS"; }; - - }; - grml-config = pkgs.fetchFromGitHub { owner = "grml"; @@ -210,8 +168,6 @@ in #SSH_ASKPASS_REQUIRE = "prefer"; - STEAM_EXTRA_COMPAT_TOOLS_PATHS = "\${HOME}/.steam/root/compatibilitytools.d"; - MOZ_USE_XINPUT2 = "1"; PATH = [ "\${XDG_BIN_HOME}" @@ -250,11 +206,6 @@ in environment.pathsToLink = [ "/share/zsh" "/share/bash-completion" "/share/fish" ]; environment.shells = with pkgs; [ zsh bashInteractive fish ]; programs = { - steam = { - enable = true; - dedicatedServer.openFirewall = true; - remotePlay.openFirewall = true; - }; fish.enable = true; zsh = { enable = true; @@ -271,28 +222,6 @@ in command-not-found.enable = false; dconf.enable = true; }; - - fonts.fontDir.enable = true; - fonts.enableDefaultFonts = true; - fonts.fonts = with pkgs; [ - dejavu_fonts - hack-font - noto-fonts - noto-fonts-extra - noto-fonts-emoji - noto-fonts-cjk-sans - noto-fonts-cjk-serif - ubuntu_font_family - wqy_zenhei - monocraft - (nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" "Meslo" "ProFont" ]; }) - ]; - fonts.fontconfig.enable = true; - fonts.fontconfig.cache32Bit = true; - fonts.fontconfig.defaultFonts.sansSerif = [ "Noto Sans" "DejaVu Sans" "WenQuanYi Zen Hei" "Noto Color Emoji" ]; - fonts.fontconfig.defaultFonts.serif = [ "Noto Serif" "DejaVu Serif" "WenQuanYi Zen Hei" "Noto Color Emoji"]; - fonts.fontconfig.defaultFonts.emoji = [ "Noto Color Emoji" "OpenMoji Color" ]; - fonts.fontconfig.defaultFonts.monospace = [ "FiraCode Nerd Font Mono" "Noto Sans Mono" "WenQuanYi Zen Hei Mono" ]; networking.networkmanager.extraConfig = lib.mkDefault '' [connectivity] uri=http://nmcheck.gnome.org/check_network_status.txt @@ -300,8 +229,6 @@ in environment.systemPackages = with pkgs; [ firefox - steam - steam.run gamescope (pkgs.lutris.override { extraLibraries = pkgs: with pkgs; [ pkgs.libunwind pkgs.libusb1 pkgs.gnutls pkgs.gtk3 pkgs.pango ]; }) materusPkgs.amdgpu-pro-libs.prefixes diff --git a/configurations/profile/os/default.nix b/configurations/profile/os/default.nix index 469f890..2b7b523 100644 --- a/configurations/profile/os/default.nix +++ b/configurations/profile/os/default.nix @@ -2,5 +2,8 @@ { imports = [ ./nix.nix + ./fonts.nix + + ./games ]; } diff --git a/configurations/profile/os/fonts.nix b/configurations/profile/os/fonts.nix new file mode 100644 index 0000000..fe95b68 --- /dev/null +++ b/configurations/profile/os/fonts.nix @@ -0,0 +1,24 @@ +{ config, pkgs, lib, materusPkgs, ... }: +let + packages = config.materus.profile.packages; + cfg = config.materus.profile.fonts; +in +{ + options.materus.profile.fonts.enable = materusPkgs.lib.mkBoolOpt false "Enable materus font settings for OS"; + + config = lib.mkIf cfg.enable { + + fonts.fonts = packages.list.fonts ++ packages.list.moreFonts; + fonts.enableDefaultFonts = lib.mkDefault true; + + fonts.fontconfig.enable = lib.mkDefault true; + fonts.fontconfig.cache32Bit = lib.mkDefault true; + + fonts.fontconfig.defaultFonts.sansSerif = lib.mkDefault [ "Noto Sans" "DejaVu Sans" "WenQuanYi Zen Hei" "Noto Color Emoji" ]; + fonts.fontconfig.defaultFonts.serif = lib.mkDefault [ "Noto Serif" "DejaVu Serif" "WenQuanYi Zen Hei" "Noto Color Emoji" ]; + fonts.fontconfig.defaultFonts.emoji = lib.mkDefault [ "Noto Color Emoji" "OpenMoji Color" ]; + fonts.fontconfig.defaultFonts.monospace = lib.mkDefault [ "FiraCode Nerd Font Mono" "Noto Sans Mono" "WenQuanYi Zen Hei Mono" ]; + + fonts.fontDir.enable = lib.mkDefault true; + }; +} diff --git a/configurations/profile/os/games/default.nix b/configurations/profile/os/games/default.nix new file mode 100644 index 0000000..9f7cee8 --- /dev/null +++ b/configurations/profile/os/games/default.nix @@ -0,0 +1,6 @@ +{ config, pkgs, ... }: +{ + imports = [ + ./steam.nix + ]; +} diff --git a/configurations/profile/os/games/steam.nix b/configurations/profile/os/games/steam.nix new file mode 100644 index 0000000..73dc088 --- /dev/null +++ b/configurations/profile/os/games/steam.nix @@ -0,0 +1,77 @@ +{ config, pkgs, lib, materusPkgs, ... }: +let + + steamPkg = pkgs.steam.override { + + extraPkgs = pkgs: [ + pkgs.nss_latest + pkgs.libstrangle + pkgs.libkrb5 + pkgs.keyutils + pkgs.libGL + pkgs.libglvnd + pkgs.gamescope + pkgs.steamPackages.steam + pkgs.libxcrypt + pkgs.gnutls + pkgs.xorg.libXcursor + pkgs.xorg.libXi + pkgs.xorg.libXinerama + pkgs.xorg.libXScrnSaver + pkgs.openvdb + pkgs.tbb_2021_8 + pkgs.gtk4 + pkgs.gtk3 + pkgs.glib + pkgs.gsettings-desktop-schemas + pkgs.fuse + + ]; + + extraLibraries = pkgs: [ + pkgs.libkrb5 + pkgs.keyutils + pkgs.ncurses6 + pkgs.fontconfig + pkgs.libxcrypt + pkgs.gnutls + ] ++ + (with config.hardware.opengl; if pkgs.hostPlatform.is64bit + then [ package ] ++ extraPackages + else [ package32 ] ++ extraPackages32); + + extraEnv = { + XDG_DATA_DIRS = "/usr/share:\${XDG_DATA_DIRS}"; + OBS_VKCAPTURE = "1"; + }; + + }; + + cfg = config.materus.profile.steam; +in +{ + options.materus.profile.steam.enable = materusPkgs.lib.mkBoolOpt false "Enable materus steam settings for OS"; + options.materus.profile.steam.package = lib.mkOption { + type = lib.types.package; + default = steamPkg; + description = "Package used by steam"; + }; + + + config = lib.mkIf cfg.enable { + hardware.steam-hardware.enable = lib.mkDefault true; + programs.steam = { + enable = lib.mkDefault true; + dedicatedServer.openFirewall = lib.mkDefault true; + remotePlay.openFirewall = lib.mkDefault true; + }; + environment.sessionVariables = rec { + STEAM_EXTRA_COMPAT_TOOLS_PATHS = lib.mkDefault "\${HOME}/.steam/root/compatibilitytools.d"; + }; + environment.systemPackages = [ + steamPkg + steamPkg.run + + ]; + }; +}