setting up the cumsole

This commit is contained in:
2025-12-11 12:14:43 +00:00
parent e7275b4c37
commit 4a8274bd59
10 changed files with 203 additions and 96 deletions

View File

@@ -23,7 +23,6 @@ in
{ {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
./system/hardware.nix
./system/boot.nix ./system/boot.nix
./system/network.nix ./system/network.nix
./system/inputMethods.nix ./system/inputMethods.nix
@@ -147,8 +146,74 @@ in
system.stateVersion = "24.11"; # Did you read the comment? system.stateVersion = "24.11"; # Did you read the comment?
specialisation = { specialisation = {
steam = { "01-steam" = {
configuration = { configuration = {
# ── HDMI-CEC: Turn on TV when Steam specialisation starts ─────────────────────
services.udev.packages = [ pkgs.libcec ]; # ensures cec-utils is in PATH
# A user service that runs once the graphical session (Steam/GameScope) is ready
systemd.user.services.cec-tv-on = {
description = "Turn on TV via HDMI-CEC when entering Steam specialisation";
wantedBy = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = toString (
pkgs.writeShellScript "cec-tv-on.sh" ''
# Wait a moment for the HDMI link to settle
sleep 3
# Turn on the TV and set it as active source (most TVs understand this)
${pkgs.libcec}/bin/cec-client -s -d 1 <<EOF
on 0
as
EOF
# Alternative one-liner if the above somehow fails:
# echo 'on 0' | ${pkgs.libcec}/bin/cec-client -s -d 1
# echo 'as' | ${pkgs.libcec}/bin/cec-client -s -d 1
''
);
};
};
# Make sure the user service starts automatically
systemd.user.targets.graphical-session = {
# This target already exists, we just ensure its active
unitConfig = {
RefuseManualStart = false;
RefuseManualStop = false;
};
};
#boot.loader.systemd-boot.sortKey = lib.mkForce "00000000001-steam";
hardware.graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
libva
libva-vdpau-driver
libvdpau-va-gl
];
};
# ── Bluetooth ────────────────────────────────────────────────────────────────
hardware.bluetooth = {
enable = true; # Enable Bluetooth support
powerOnBoot = true; # Power up controller on boot
settings.General = {
#Enable = "Source,Sink,Media,Socket";
# Experimental = true;
};
};
# ── Tablets ─────────────────────────────────────────────────────────────────
hardware.enableRedistributableFirmware = true;
hardware.firmware = [
pkgs.linux-firmware
];
environment = { environment = {
systemPackages = with pkgs; [ systemPackages = with pkgs; [
mangohud mangohud
@@ -159,22 +224,11 @@ in
}; };
}; };
services.ananicy = {
enable = true;
package = pkgs.ananicy-cpp;
rulesProvider = pkgs.ananicy-cpp;
extraRules = [
{
"name" = "gamescope";
"nice" = -20;
}
];
};
programs = { programs = {
gamescope = { gamescope = {
enable = true; enable = true;
capSysNice = false; capSysNice = true;
}; };
steam = { steam = {
@@ -186,20 +240,28 @@ in
mangohud mangohud
gamemode gamemode
]; ];
gamescopeSession.enable = true; gamescopeSession = {
enable = true;
args = [
"--prefer-output"
"HDMI-A-2"
"--hdr-enabled"
];
};
}; };
}; };
}; };
}; };
main-system = { "00-main-system" = {
configuration = { configuration = {
#boot.loader.systemd-boot.sortKey = lib.mkDefault "00000000000-main";
############################################################################## ##############################################################################
# Imports # Imports
############################################################################## ##############################################################################
imports = [ imports = [
./system/services.nix ./system/services.nix
./system/hardware.nix
./system/nixOSPkgs.nix ./system/nixOSPkgs.nix
#inputs.niri.nixosModules.niri #inputs.niri.nixosModules.niri
]; ];

View File

@@ -39,14 +39,12 @@ in
########################################################################## ##########################################################################
# See https://wiki.hyprland.org/Configuring/Monitors/ # See https://wiki.hyprland.org/Configuring/Monitors/
# monitor = lib.mkMerge [ monitor = lib.mkMerge [
# (lib.mkIf (systemName == "laptop") [ "eDP-1,1920x1080@59.99700,0x0,1" ]) #(lib.mkIf (systemName == "laptop") [ "eDP-1,1920x1080@59.99700,0x0,1" ])
# (lib.mkIf (systemName == "pc") [ (lib.mkIf (systemName == "pc") [
# "DP-2,2560x1440@144,0x0,1" "HDMI-A-2, disable"
# "DP-1,2560x1440@239.97,2569x0,1" ])
# #"DP-1,2560x1440@144,1920x0,1,bitdepth,10,cm,hdr" ];
# ])
# ];
monitorv2 = monitorv2 =
[ ] [ ]
@@ -227,8 +225,8 @@ in
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
master = { master = {
new_status = "master"; new_status = "master";
mfact = 0.5; mfact = 0.5;
new_on_top = true; new_on_top = true;
}; };
########################################################################## ##########################################################################

View File

@@ -44,8 +44,8 @@
}; };
shellAliases = { shellAliases = {
nix-switch = "sudo nixos-rebuild switch"; nix-switch = "nh os switch --specialisation 00-main-system";
nix-upgrade = "sudo nixos-rebuild switch --upgrade"; nix-upgrade = "(cd ~/nixos-dots && nix flake update) && echo 'flake.lock updated'";
nix-edit = "sudo vim /etc/nixos/configuration.nix"; nix-edit = "sudo vim /etc/nixos/configuration.nix";
ls = "exa -lag --icons"; ls = "exa -lag --icons";

6
flake.lock generated
View File

@@ -1426,11 +1426,11 @@
"tinted-zed": "tinted-zed" "tinted-zed": "tinted-zed"
}, },
"locked": { "locked": {
"lastModified": 1765047449, "lastModified": 1765386911,
"narHash": "sha256-VQcqjJ2g0kT9TW4ENwA2HBQJzfbCUd5s1Wm3K+R2QZY=", "narHash": "sha256-YLjQpnTZCMjCho7ZDs5O1yFVw+fDlXq4lSJDuLWHHeA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "stylix", "repo": "stylix",
"rev": "bd00e01aab676aee88e6cc5c9238b4a5a7d6639a", "rev": "cb6bbed75eaca21deb8950c2ec0036ae5cde18ca",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -35,9 +35,14 @@
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = boot.kernelModules =
[ ] [ ]
++ (lib.optionals (systemName == "pc") [ "kvm-amd" ]) ++ (lib.optionals (systemName == "pc") [ "kvm-amd" "btusb"])
++ (lib.optionals (systemName == "laptop") [ "kvm-intel" ]); ++ (lib.optionals (systemName == "laptop") [ "kvm-intel" ]);
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
boot.kernelParams = [
# Most common working combination in 2024/2025
"btusb.enable_autosuspend=0"
"btusb.reset=1"
];
fileSystems."/" = lib.mkMerge [ fileSystems."/" = lib.mkMerge [
(lib.mkIf (systemName == "pc") { (lib.mkIf (systemName == "pc") {
@@ -71,29 +76,36 @@
fsType = "btrfs"; fsType = "btrfs";
}) })
]; ];
fileSystems."/home/mrfluffy/Games" = lib.mkMerge [
(lib.mkIf (systemName == "pc") {
device = "/dev/disk/by-uuid/54188f21-d525-4681-a9d4-b798363eef17";
fsType = "ext4";
})
];
fileSystems."/server" = lib.mkIf (systemName == "pc") { # or remove the mkIf if you want it on both
device = "//192.168.1.8/mrfluffy"; # adjust the share name if its not the home share #fileSystems."/server" = lib.mkIf (systemName == "pc") { # or remove the mkIf if you want it on both
fsType = "cifs"; # device = "//192.168.1.8/mrfluffy"; # adjust the share name if its not the home share
options = let # fsType = "cifs";
# Separate credentials from the Nix store (very important for security) # options = let
credFile = "/etc/nixos/smb-credentials-mrfluffy"; # # Separate credentials from the Nix store (very important for security)
in [ # credFile = "/etc/nixos/smb-credentials-mrfluffy";
# Basic recommended options # in [
"credentials=${credFile}" # # Basic recommended options
"gid=users" # make files belong to the "users" group (or your preferred group) # "credentials=${credFile}"
"uid=1000" # replace with your users UID, or use "uid=${config.users.users.yourname.uid}" # "gid=users" # make files belong to the "users" group (or your preferred group)
"file_mode=0664" # "uid=1000" # replace with your users UID, or use "uid=${config.users.users.yourname.uid}"
"dir_mode=0775" # "file_mode=0664"
"nofail" # ← this makes the mount OPTIONAL (boot continues if unreachable) # "dir_mode=0775"
"noauto" # dont mount automatically at boot (optional, combine with x-systemd.automount) # "nofail" # ← this makes the mount OPTIONAL (boot continues if unreachable)
"x-systemd.automount" # creates a systemd automount unit → mounts on first access # "noauto" # dont mount automatically at boot (optional, combine with x-systemd.automount)
"x-systemd.mount-timeout=15" # dont wait forever # "x-systemd.automount" # creates a systemd automount unit → mounts on first access
"vers=3.0" # force SMB3 if the server supports it (recommended) # "x-systemd.mount-timeout=15" # dont wait forever
# "iocharset=utf8" # usually not needed with modern servers # "vers=3.0" # force SMB3 if the server supports it (recommended)
# "cache=loose" # improves performance for some workloads # # "iocharset=utf8" # usually not needed with modern servers
]; # # "cache=loose" # improves performance for some workloads
}; # ];
#};
swapDevices = swapDevices =
[ ] [ ]

View File

@@ -247,6 +247,7 @@ in
wineWowPackages.stable wineWowPackages.stable
mangayomi mangayomi
rink rink
protontricks
############################ ############################
# KDE / File Management # KDE / File Management

View File

@@ -8,22 +8,28 @@
let let
isLaptop = systemName == "laptop"; isLaptop = systemName == "laptop";
isPc = systemName == "pc"; isPc = systemName == "pc";
initrdBaseModules = [ "btusb" ]; initrdBaseModules = [ "btusb" ];
initrdLPModules = [ "kvm" ]; # for laptop & pc initrdLPModules = [ "kvm" ]; # for laptop & pc
kernelBaseModules = [ "v4l2loopback" ]; kernelBaseModules = [ "v4l2loopback" ];
kernelBaseParams = [ ]; kernelBaseParams = [ ];
kernelLPParams = [ "ipv6e=1" ]; # for laptop & pc kernelLPParams = [ "ipv6e=1" ]; # for laptop & pc
kernelLaptopOnly = [ "i915.force_probe=46a6" ]; kernelLaptopOnly = [ "i915.force_probe=46a6" ];
kernelPcOnly = [ "video=2560x1440x32" ]; kernelPcOnly = [ "video=2560x1440x32" ];
in in
{ {
boot = { boot = {
loader = { loader = {
systemd-boot.enable = true; systemd-boot = {
enable = true;
extraInstallCommands = ''
${lib.getExe pkgs.gnused} -i 's/default .*/default *-specialisation-00-main-system.conf/' /boot/loader/loader.conf
'';
#sortKey = "z-normal";
};
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
}; };
@@ -33,7 +39,7 @@ in
]; ];
kernelPackages = pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;
kernelModules = kernelBaseModules; kernelModules = kernelBaseModules;
extraModulePackages = [ extraModulePackages = [
pkgs.linuxPackages_latest.v4l2loopback pkgs.linuxPackages_latest.v4l2loopback
@@ -42,7 +48,7 @@ in
kernelParams = lib.mkMerge [ kernelParams = lib.mkMerge [
(lib.mkIf (isLaptop || isPc) kernelLPParams) (lib.mkIf (isLaptop || isPc) kernelLPParams)
(lib.mkIf isLaptop kernelLaptopOnly) (lib.mkIf isLaptop kernelLaptopOnly)
(lib.mkIf isPc kernelPcOnly) (lib.mkIf isPc kernelPcOnly)
]; ];
extraModprobeConfig = '' extraModprobeConfig = ''

View File

@@ -33,17 +33,17 @@ in
enable = true; enable = true;
enable32Bit = true; enable32Bit = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
rocmPackages.rocm-core #rocmPackages.rocm-core
rocmPackages.rocminfo #rocmPackages.rocminfo
rocmPackages.rocm-runtime #rocmPackages.rocm-runtime
rocmPackages.clr.icd #rocmPackages.clr.icd
rocmPackages.rocm-smi #rocmPackages.rocm-smi
rocmPackages.clr #rocmPackages.clr
#rocmPackages.hipblas ##rocmPackages.hipblas
rocmPackages.rocblas #rocmPackages.rocblas
rocmPackages.rocsolver #rocmPackages.rocsolver
rocmPackages.rocm-comgr #rocmPackages.rocm-comgr
rocmPackages.rocsparse #rocmPackages.rocsparse
# amdvlk # amdvlk
# driversi686Linux.amdvlk # driversi686Linux.amdvlk
# mesa # mesa

View File

@@ -70,6 +70,7 @@ in
# Core programs # Core programs
############################ ############################
programs = { programs = {
dconf.enable = true;
appimage = { appimage = {
enable = true; enable = true;
@@ -84,7 +85,7 @@ in
}; };
gamescope = { gamescope = {
enable = true; enable = true;
capSysNice = true; capSysNice = false;
}; };
nix-index-database = { nix-index-database = {

View File

@@ -1,4 +1,10 @@
{ config, lib, pkgs, systemName, ... }: {
config,
lib,
pkgs,
systemName,
...
}:
{ {
############################################### ###############################################
@@ -54,13 +60,32 @@
"92-low-latency" = { "92-low-latency" = {
"context.properties" = { "context.properties" = {
"default.clock.rate" = 96000; "default.clock.rate" = 96000;
"default.clock.allowed-rates" = [ 44100 48000 96000 ]; "default.clock.allowed-rates" = [
44100
48000
96000
];
}; };
}; };
}; };
}) })
]; ];
###############################################
# nice shit
###############################################
services.ananicy = {
enable = true;
package = pkgs.ananicy-cpp;
rulesProvider = pkgs.ananicy-cpp;
extraRules = [
{
"name" = "gamescope";
"nice" = -20;
}
];
};
services.blueman.enable = true; services.blueman.enable = true;
############################################### ###############################################
@@ -154,7 +179,7 @@
OLLAMA_MMAP = "0"; OLLAMA_MMAP = "0";
OLLAMA_NUM_CTX = "40000"; OLLAMA_NUM_CTX = "40000";
OLLAMA_NUM_GPU = "20"; OLLAMA_NUM_GPU = "20";
OLLAMA_FLASH_ATTENTION="true"; OLLAMA_FLASH_ATTENTION = "true";
# HSA_OVERRIDE_GFX_VERSION = "11.0.0"; # HSA_OVERRIDE_GFX_VERSION = "11.0.0";
OLLAMA_KV_CACHE_TYPE = "f16"; OLLAMA_KV_CACHE_TYPE = "f16";
}; };
@@ -167,24 +192,26 @@
description = "Service to launch Steam URLs via FIFO"; description = "Service to launch Steam URLs via FIFO";
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
serviceConfig = { serviceConfig = {
ExecStart = let ExecStart =
script = pkgs.writeShellScript "steam-run-url-service.sh" '' let
#!/usr/bin/env bash script = pkgs.writeShellScript "steam-run-url-service.sh" ''
FIFO="/run/user/$(id --user)/steam-run-url.fifo" #!/usr/bin/env bash
if [ ! -p "$FIFO" ]; then FIFO="/run/user/$(id --user)/steam-run-url.fifo"
mkfifo "$FIFO" if [ ! -p "$FIFO" ]; then
fi mkfifo "$FIFO"
while true; do
if read line <"$FIFO"; then
steam_env=();
if [ "$XDG_SESSION_DESKTOP" = "sway" ] || [ "$XDG_SESSION_DESKTOP" = "Hyprland" ] || [ "$DESKTOP_SESSION" = "sway" ] || [ "$DESKTOP_SESSION" = "Hyprland" ]; then
steam_env+=("QT_QPA_PLATFORM=wayland");
fi
steam "$line"
fi fi
done while true; do
''; if read line <"$FIFO"; then
in "${script}"; steam_env=();
if [ "$XDG_SESSION_DESKTOP" = "sway" ] || [ "$XDG_SESSION_DESKTOP" = "Hyprland" ] || [ "$DESKTOP_SESSION" = "sway" ] || [ "$DESKTOP_SESSION" = "Hyprland" ]; then
steam_env+=("QT_QPA_PLATFORM=wayland");
fi
steam "$line"
fi
done
'';
in
"${script}";
Restart = "always"; Restart = "always";
}; };
path = [ pkgs.steam ]; path = [ pkgs.steam ];