From feead04648dab65851bc565fa7dbed99d106acc3 Mon Sep 17 00:00:00 2001 From: cosmeak Date: Tue, 12 May 2026 15:56:35 +0200 Subject: [PATCH] wip: transformation of loki to a steam machine --- flake.lock | 90 +++++++++---------- .../desktop.nix} | 3 +- modules/features/gaming.nix | 44 ++++----- .../minecraft-servers/cobblestone.nix | 19 ++++ .../features/minecraft-servers/prismarine.nix | 2 +- modules/hosts/loki/_gamingstation.nix | 27 ++++++ modules/hosts/loki/_workstation.nix | 12 +++ modules/hosts/loki/configuration.nix | 27 +++--- modules/hosts/nanna/configuration.nix | 1 + 9 files changed, 141 insertions(+), 84 deletions(-) rename modules/features/{workstation-base.nix => bases/desktop.nix} (71%) create mode 100644 modules/features/minecraft-servers/cobblestone.nix create mode 100644 modules/hosts/loki/_gamingstation.nix create mode 100644 modules/hosts/loki/_workstation.nix diff --git a/flake.lock b/flake.lock index 7b32639..f8ceb91 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "cachyos-kernel": { "flake": false, "locked": { - "lastModified": 1776608760, - "narHash": "sha256-ehDv8bF7k/2Kf4b8CCoSm51U/MOoFuLsRXqe5wZ57sE=", + "lastModified": 1778227630, + "narHash": "sha256-IZIpCvjTLn6dzgFa6vOB6rUkMp3gktQy8suVXkPfvSg=", "owner": "CachyOS", "repo": "linux-cachyos", - "rev": "7e06e29005853bbaaa3b1c1067f915d6e0db728a", + "rev": "24da68625ce48a4ea1b28996050f1229e7bc78a2", "type": "github" }, "original": { @@ -19,11 +19,11 @@ "cachyos-kernel-patches": { "flake": false, "locked": { - "lastModified": 1776792814, - "narHash": "sha256-39dlIhz9KxUNQFxGpE9SvCviaOWAivdW0XJM8RnPNmg=", + "lastModified": 1777876120, + "narHash": "sha256-fdFgVCoua3rsQyyHkgxcnwi0hUktR8UtcI/suS8jcbg=", "owner": "CachyOS", "repo": "kernel-patches", - "rev": "d7d558d0b2e239e27b40bcf1af6fe12e323aa391", + "rev": "e80ce8172953b8c199daf6a2850974bb12731ae9", "type": "github" }, "original": { @@ -90,11 +90,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1775087534, - "narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=", + "lastModified": 1777988971, + "narHash": "sha256-qIoWPDs+0/8JecyYgE3gpKQxW/4bLW/gp45vow9ioCQ=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b", + "rev": "0678d8986be1661af6bb555f3489f2fdfc31f6ff", "type": "github" }, "original": { @@ -108,11 +108,11 @@ "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { - "lastModified": 1775087534, - "narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=", + "lastModified": 1777988971, + "narHash": "sha256-qIoWPDs+0/8JecyYgE3gpKQxW/4bLW/gp45vow9ioCQ=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b", + "rev": "0678d8986be1661af6bb555f3489f2fdfc31f6ff", "type": "github" }, "original": { @@ -129,11 +129,11 @@ ] }, "locked": { - "lastModified": 1776684358, - "narHash": "sha256-Nn42mX8ikB1hpLwceqe65yJx7/T87j1Cpyik2KL6/YY=", + "lastModified": 1777732535, + "narHash": "sha256-gaHRkPaGAAjc6D4sZ+/haEKMJGO79tu4ROBlyOjXuco=", "owner": "feel-co", "repo": "hjem", - "rev": "fb7ee87a1e72b3b21723d5ec76c8ca395c02fbc6", + "rev": "ab977051adce0bf9f7c1032327e72f0febda6f7b", "type": "github" }, "original": { @@ -150,11 +150,11 @@ "spectrum": "spectrum" }, "locked": { - "lastModified": 1776340739, - "narHash": "sha256-s4FDictJlPtY6Shd6scG5hgrDMiHth09+svtvTA5NLA=", + "lastModified": 1778369133, + "narHash": "sha256-zfYJAAVau1dDlVo8PfA0oQFVwvRjpp8Zz+T61+ywogI=", "owner": "microvm-nix", "repo": "microvm.nix", - "rev": "2f2f62fdfdca2750e3399f66bd03986ab967e5ca", + "rev": "9ddb425679d44e6e1e5cd5df9db0c42ed99df4a4", "type": "github" }, "original": { @@ -172,11 +172,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1776796985, - "narHash": "sha256-cNFg3H09sBZl1v9ds6PDHfLCUTDJbefGMSv+WxFs+9c=", + "lastModified": 1778438210, + "narHash": "sha256-QFqKZ1PvbuXOJfH+QfhEAQW5TVrFBDMc6kRkii4l7uk=", "owner": "xddxdd", "repo": "nix-cachyos-kernel", - "rev": "ac5956bbceb022998fc1dd0001322f10ef1e6dda", + "rev": "fd9bda8a7986c9d35c4e5462f0be1d42ea529812", "type": "github" }, "original": { @@ -214,11 +214,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1776828595, - "narHash": "sha256-LkFpFnPTK6H0gwyfYezN3kEKHVxjSdPp/tBnrQRFP3E=", + "lastModified": 1778039471, + "narHash": "sha256-Arjg44jFcpSqOKK05EIxbKIjhfjou/EGF12COFU+9QA=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "28f0f2369655a5910e810c35c698dfaa9ccec692", + "rev": "87611ef4788116de05f851920c5958f0c37d5b05", "type": "github" }, "original": { @@ -229,11 +229,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1776830795, - "narHash": "sha256-PAfvLwuHc1VOvsLcpk6+HDKgMEibvZjCNvbM1BJOA7o=", + "lastModified": 1778143761, + "narHash": "sha256-lkesY6x2X2qxlqLM7CT2iM/0rP2JB7fruPN3h8POXmI=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "72674a6b5599e844c045ae7449ba91f803d44ebc", + "rev": "3bcaa367d4c550d687a17ac792fd5cda214ee871", "type": "github" }, "original": { @@ -245,11 +245,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1776750258, - "narHash": "sha256-jab3OFEK7MpiAolaLBjvIxdf258UWvvusWxPJPE5ito=", + "lastModified": 1778401622, + "narHash": "sha256-+0rgLm/T6U2I/0KrgUOz5471i6nDVFMihe4Vy/eAmNk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8d73c2809cb39eecce6284c38100e69a6064e5d9", + "rev": "eeac4f06ba6d4c5540c4838d13b31a2cbe0e104b", "type": "github" }, "original": { @@ -261,11 +261,11 @@ }, "nixpkgs-darwin": { "locked": { - "lastModified": 1776784345, - "narHash": "sha256-IwBAqEljQ0WNVRRQf/ItWIHqIgi5ap+noM2unsLCa8Y=", + "lastModified": 1778111371, + "narHash": "sha256-L3LdhmeKcBrMVxqeEHwfwA1FFVf40DDCAOV8S0+PlLc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "377ba9abb3f416ee2786cb7eb6219bb1d29ce63f", + "rev": "25b257cc037722030ae920bba7c167d4db554a10", "type": "github" }, "original": { @@ -277,11 +277,11 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1774748309, - "narHash": "sha256-+U7gF3qxzwD5TZuANzZPeJTZRHS29OFQgkQ2kiTJBIQ=", + "lastModified": 1777168982, + "narHash": "sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "333c4e0545a6da976206c74db8773a1645b5870a", + "rev": "f5901329dade4a6ea039af1433fb087bd9c1fe14", "type": "github" }, "original": { @@ -292,11 +292,11 @@ }, "nixpkgs-lib_2": { "locked": { - "lastModified": 1774748309, - "narHash": "sha256-+U7gF3qxzwD5TZuANzZPeJTZRHS29OFQgkQ2kiTJBIQ=", + "lastModified": 1777168982, + "narHash": "sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "333c4e0545a6da976206c74db8773a1645b5870a", + "rev": "f5901329dade4a6ea039af1433fb087bd9c1fe14", "type": "github" }, "original": { @@ -307,11 +307,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1776329215, - "narHash": "sha256-a8BYi3mzoJ/AcJP8UldOx8emoPRLeWqALZWu4ZvjPXw=", + "lastModified": 1778274207, + "narHash": "sha256-I4puXmX1iovcCHZlRmztO3vW0mAbbRvq4F8wgIMQ1MM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b86751bc4085f48661017fa226dee99fab6c651b", + "rev": "b3da656039dc7a6240f27b2ef8cc6a3ef3bccae7", "type": "github" }, "original": { @@ -339,11 +339,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1776560675, - "narHash": "sha256-p68udKWWh7+V4ZPpcMDq0gTHWNZJnr4JPI+kHPPE40o=", + "lastModified": 1778003029, + "narHash": "sha256-q/nkKLDtHIyLjZpKhWk3cSK5IYsFqtMd6UtXF3ddjgA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e07580dae39738e46609eaab8b154de2488133ce", + "rev": "0c88e1f2bdb93d5999019e99cb0e61e1fe2af4c5", "type": "github" }, "original": { diff --git a/modules/features/workstation-base.nix b/modules/features/bases/desktop.nix similarity index 71% rename from modules/features/workstation-base.nix rename to modules/features/bases/desktop.nix index 40d3d51..a1e1cf5 100644 --- a/modules/features/workstation-base.nix +++ b/modules/features/bases/desktop.nix @@ -1,10 +1,9 @@ { inputs, ... }: { - flake.nixosModules.workstation-base = { pkgs, ... }: { + flake.nixosModules.desktop-base = { pkgs, ... }: { imports = with inputs.self.nixosModules; [ bootloader audio - kde-desktop ]; environment.systemPackages = with pkgs; [ diff --git a/modules/features/gaming.nix b/modules/features/gaming.nix index f103dc9..2e7a374 100644 --- a/modules/features/gaming.nix +++ b/modules/features/gaming.nix @@ -2,34 +2,26 @@ { allowedUnfreePackages = [ "steam" "steam-unwrapped" ]; - flake.nixosModules.gaming = { pkgs, ... }: { - # User CachyOS kernel patches specically mades for gaming - nix.settings.substituters = [ "https://attic.xuyh0120.win/lantian" ]; - nix.settings.trusted-public-keys = [ "lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc=" ]; - nixpkgs.overlays = [ inputs.nix-cachyos-kernel.overlays.pinned ]; - boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest; + flake.nixosModules.gaming = { pkgs, lib, config, ... }: { + options.modules.gaming.enable = lib.mkEnableOption "gaming module" // { default = true; }; - # Use ananicy - services.ananicy.enable = true; - services.ananicy.package = pkgs.ananicy-cpp; - services.ananicy.rulesProvider = pkgs.ananicy-rules-cachyos; + config = lib.mkIf config.modules.gaming.enable { + services.ananicy.enable = true; + services.ananicy.package = pkgs.ananicy-cpp; + services.ananicy.rulesProvider = pkgs.ananicy-rules-cachyos; - # Steam configuration - hardware.graphics.enable32Bit = true; - programs.steam = { - enable = true; - gamescopeSession.enable = true; - }; - - # Additionnal packages - environment.systemPackages = with pkgs; [ - faugus-launcher # Alternative launcher for multiple games platform - heroic - mangohud - prismlauncher # Minecraft launcher - jdk25_headless # Needed for minecraft 26.1 since it's not included inside prismlauncher for the moment + hardware.graphics.enable32Bit = true; + programs.steam = { + enable = true; + gamescopeSession.enable = true; + }; - unstable.gale # Modding platform - ]; + environment.systemPackages = with pkgs; [ + faugus-launcher + heroic + prismlauncher + unstable.gale + ]; + }; }; } diff --git a/modules/features/minecraft-servers/cobblestone.nix b/modules/features/minecraft-servers/cobblestone.nix new file mode 100644 index 0000000..42f7262 --- /dev/null +++ b/modules/features/minecraft-servers/cobblestone.nix @@ -0,0 +1,19 @@ +{ inputs, ... }: { + flake.nixosModules.mc-cobblestone = { pkgs, ... }: { + imports = [ inputs.self.nixosModules.minecraft-servers ]; + + services.minecraft-servers.servers.cobblestone = { + enable = true; + autoStart = true; + enableReload = true; + package = pkgs.minecraftServers.vanilla-26_1; + + serverProperties = { + motd = "Just the two of us!"; + server-port = 25565; + max-players = 20; + difficulty = 3; + }; + }; + }; +} diff --git a/modules/features/minecraft-servers/prismarine.nix b/modules/features/minecraft-servers/prismarine.nix index 9217dce..c519e44 100644 --- a/modules/features/minecraft-servers/prismarine.nix +++ b/modules/features/minecraft-servers/prismarine.nix @@ -3,7 +3,7 @@ imports = [ inputs.self.nixosModules.minecraft-servers ]; services.minecraft-servers.servers.prismarine = { - enable = false; + enable = true; autoStart = true; enableReload = true; package = pkgs.minecraftServers.vanilla-26_1; diff --git a/modules/hosts/loki/_gamingstation.nix b/modules/hosts/loki/_gamingstation.nix new file mode 100644 index 0000000..a7d8442 --- /dev/null +++ b/modules/hosts/loki/_gamingstation.nix @@ -0,0 +1,27 @@ +{ inputs, lib, config, pkgs, ... }: +{ + imports = [ inputs.self.nixosModules.gaming ]; + + config = lib.mkIf (config.specialisation != {}) { + # Autostart Steam Big Picture via systemd user service + systemd.user.services.steam-big-picture = { + description = "Steam Big Picture Mode"; + wantedBy = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + wants = [ "graphical-session.target" ]; + + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.steam}/bin/steam -tenfoot"; + Restart = "on-failure"; + RestartSec = 3; + }; + }; + + networking.firewall = { + enable = true; + allowedUDPPorts = [ 25565 ]; + allowedTCPPorts = [ 25565 ]; + }; + }; +} diff --git a/modules/hosts/loki/_workstation.nix b/modules/hosts/loki/_workstation.nix new file mode 100644 index 0000000..7516028 --- /dev/null +++ b/modules/hosts/loki/_workstation.nix @@ -0,0 +1,12 @@ +{ inputs, ... }: +{ + specialisation.workstation.configuration = { + system.nixos.tags = [ "workstation" ]; + + imports = [ inputs.self.nixosModules.development ]; + + # Little workaround to disabled the default gaming station when in a + # workstation specialisation. No distraction is allowed here! + modules.gaming.enable = false; + }; +} diff --git a/modules/hosts/loki/configuration.nix b/modules/hosts/loki/configuration.nix index b77fe3e..71b7cde 100644 --- a/modules/hosts/loki/configuration.nix +++ b/modules/hosts/loki/configuration.nix @@ -1,18 +1,18 @@ { inputs, ... }: { - flake.nixosModules.loki = { ... }: { + flake.nixosModules.loki = { pkgs, ... }: { imports = with inputs.self.nixosModules; with inputs.self.factory; [ - workstation-base + desktop-base nvidia-gpu cosmeak (autoLogin "cosmeak") screen-recording - gaming flatpak - development + ./_gamingstation.nix + ./_workstation.nix ]; nixpkgs.overlays = [ inputs.self.overlays.unstable ]; @@ -33,12 +33,19 @@ networking.networkmanager.enable = true; services.printing.enable = false; - networking.firewall = { - enable = true; - # Open ports for minecraft LAN - allowedUDPPorts = [ 25565 ]; - allowedTCPPorts = [ 25565 ]; - }; + # Gnone desktop - Temporary before transforming this PC into a gaming console with specializations + services.displayManager.gdm.enable = true; + services.desktopManager.gnome.enable = true; + programs.xwayland.enable = true; + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + qt.platformTheme = "gnome"; + + # We don't want extra packages, just the bare minimum + services.gnome.games.enable = false; + services.gnome.core-developer-tools.enable = false; + services.gnome.core-apps.enable = true; + environment.gnome.excludePackages = with pkgs; [ gnome-tour gnome-user-docs gnome-console gnome-software epiphany ]; + environment.systemPackages = with pkgs; [ ghostty gnome-tweaks gnomeExtensions.no-overview ]; }; hosts.loki = { diff --git a/modules/hosts/nanna/configuration.nix b/modules/hosts/nanna/configuration.nix index c08d5e0..bc24634 100644 --- a/modules/hosts/nanna/configuration.nix +++ b/modules/hosts/nanna/configuration.nix @@ -52,6 +52,7 @@ # Enable printing services.printing.enable = true; + services.ipp-usb.enable = true; # Localization time.timeZone = "Europe/Paris"; -- 2.51.2