use jovian-nixos + fixup niri display session handling

This commit is contained in:
Simon Gardling 2025-11-21 10:14:31 -05:00
parent 236cb914c5
commit 4e46b7fd3a
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
7 changed files with 97 additions and 44 deletions

View File

@ -6,6 +6,7 @@
system, system,
hostname, hostname,
inputs, inputs,
niri-package,
... ...
}: }:
{ {
@ -33,6 +34,9 @@
services.kmscon.enable = true; services.kmscon.enable = true;
# Add niri to display manager session packages
services.displayManager.sessionPackages = [ niri-package ];
# Gamescope configuration for Steam Deck-like experience # Gamescope configuration for Steam Deck-like experience
programs = { programs = {
gamescope = { gamescope = {
@ -45,26 +49,6 @@
}; };
}; };
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${lib.getExe pkgs.tuigreet} --sessions /etc/xdg/wayland-sessions/ --time";
user = username;
};
terminal.vt = lib.mkForce 2;
};
};
environment.etc."xdg/wayland-sessions/niri-session.desktop".text = ''
[Desktop Entry]
Name=Niri Session
Comment=Niri Wayland compositor
Exec=niri-session
Type=Application
DesktopNames=niri
'';
system.activationScripts = { system.activationScripts = {
# FIX: https://github.com/NixOS/nix/issues/2982 # FIX: https://github.com/NixOS/nix/issues/2982
"profile-channel-dummy".text = '' "profile-channel-dummy".text = ''
@ -97,6 +81,9 @@
]; ];
}; };
# allow unfree packages for jovian-nixos
nixpkgs.config.allowUnfree = true;
# kernel options # kernel options
boot = { boot = {
kernelPackages = pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;

View File

@ -25,26 +25,4 @@
goverlay goverlay
yad yad
]; ];
# Create steam session script
environment.etc."steam-session-greetd".source = pkgs.writeShellScript "steam-session-greetd" ''
export STEAM_RUNTIME=1
export SDL_VIDEODRIVER=wayland
export QT_QPA_PLATFORM=wayland
export GDK_BACKEND=wayland
export XDG_CURRENT_DESKTOP=Steam
export XDG_SESSION_TYPE=wayland
exec ${pkgs.gamescope}/bin/gamescope --adaptive-sync --hdr-enabled --rt --steam -- ${pkgs.steam}/bin/steam -pipewire-dmabuf -tenfoot
'';
# Create system-wide session files
environment.etc."xdg/wayland-sessions/steam-session.desktop".text = ''
[Desktop Entry]
Name=Steam Session
Comment=Steam Deck-like gaming session with gamescope
Exec=/etc/steam-session-greetd
Type=Application
DesktopNames=steam
'';
} }

View File

@ -34,4 +34,25 @@
# disable framework kernel module # disable framework kernel module
# https://github.com/NixOS/nixos-hardware/issues/1330 # https://github.com/NixOS/nixos-hardware/issues/1330
hardware.framework.enableKmod = false; hardware.framework.enableKmod = false;
# Greetd display manager
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${lib.getExe pkgs.tuigreet} --sessions /etc/xdg/wayland-sessions/ --time";
user = username;
};
terminal.vt = lib.mkForce 2;
};
};
environment.etc."xdg/wayland-sessions/niri-session.desktop".text = ''
[Desktop Entry]
Name=Niri Session
Comment=Niri Wayland compositor
Exec=niri-session
Type=Application
DesktopNames=niri
'';
} }

View File

@ -18,6 +18,7 @@
inputs.nixos-hardware.nixosModules.common-cpu-amd-zenpower inputs.nixos-hardware.nixosModules.common-cpu-amd-zenpower
inputs.impermanence.nixosModules.impermanence inputs.impermanence.nixosModules.impermanence
inputs.disko.nixosModules.disko inputs.disko.nixosModules.disko
inputs.jovian-nixos.nixosModules.default
]; ];
fileSystems."/media/games" = { fileSystems."/media/games" = {
@ -58,4 +59,17 @@
systemd.services.lactd.wantedBy = [ "multi-user.target" ]; systemd.services.lactd.wantedBy = [ "multi-user.target" ];
systemd.services.lactd.serviceConfig.ExecStartPre = "${lib.getExe pkgs.bash} -c \"sleep 3s\""; systemd.services.lactd.serviceConfig.ExecStartPre = "${lib.getExe pkgs.bash} -c \"sleep 3s\"";
jovian = {
devices.steamdeck.enable = false;
steam = {
enable = true;
autoStart = true;
desktopSession = "niri";
user = username;
};
};
# Disable gamescope from common.nix to avoid conflict with jovian-nixos
programs.gamescope.enable = lib.mkForce false;
} }

44
flake.lock generated
View File

@ -186,6 +186,27 @@
"type": "github" "type": "github"
} }
}, },
"jovian-nixos": {
"inputs": {
"nix-github-actions": "nix-github-actions",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1763640802,
"narHash": "sha256-TAsO9p2cF/Wm6sYWPqvC/mBzMBzG119XLB6T0XwU2NU=",
"owner": "Jovian-Experiments",
"repo": "Jovian-NixOS",
"rev": "4b1c28efe3b31e00c427e651b398d8251dd29812",
"type": "github"
},
"original": {
"owner": "Jovian-Experiments",
"repo": "Jovian-NixOS",
"type": "github"
}
},
"lanzaboote": { "lanzaboote": {
"inputs": { "inputs": {
"crane": "crane", "crane": "crane",
@ -309,6 +330,28 @@
"type": "github" "type": "github"
} }
}, },
"nix-github-actions": {
"inputs": {
"nixpkgs": [
"jovian-nixos",
"nixpkgs"
]
},
"locked": {
"lastModified": 1729697500,
"narHash": "sha256-VFTWrbzDlZyFHHb1AlKRiD/qqCJIripXKiCSFS8fAOY=",
"owner": "zhaofengli",
"repo": "nix-github-actions",
"rev": "e418aeb728b6aa5ca8c5c71974e7159c2df1d8cf",
"type": "github"
},
"original": {
"owner": "zhaofengli",
"ref": "matrix-name",
"repo": "nix-github-actions",
"type": "github"
}
},
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1762847253, "lastModified": 1762847253,
@ -371,6 +414,7 @@
"emacs-overlay": "emacs-overlay", "emacs-overlay": "emacs-overlay",
"home-manager": "home-manager", "home-manager": "home-manager",
"impermanence": "impermanence", "impermanence": "impermanence",
"jovian-nixos": "jovian-nixos",
"lanzaboote": "lanzaboote", "lanzaboote": "lanzaboote",
"niri": "niri", "niri": "niri",
"nix-doom-emacs-unstraightened": "nix-doom-emacs-unstraightened", "nix-doom-emacs-unstraightened": "nix-doom-emacs-unstraightened",

View File

@ -60,6 +60,11 @@
url = "github:serokell/deploy-rs"; url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
jovian-nixos = {
url = "github:Jovian-Experiments/Jovian-NixOS";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs =
@ -70,6 +75,7 @@
nixos-hardware, nixos-hardware,
home-manager, home-manager,
deploy-rs, deploy-rs,
jovian-nixos,
... ...
}@inputs: }@inputs:
let let
@ -79,6 +85,7 @@
"mreow" "mreow"
"yarn" "yarn"
]; ];
niri-package = inputs.niri.packages.${system}.niri-unstable;
in in
{ {
formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style; formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style;
@ -93,6 +100,7 @@
inputs inputs
username username
hostname hostname
niri-package
; ;
}; };
modules = [ modules = [
@ -103,7 +111,7 @@
# home-manager.useGlobalPkgs = true; # home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { home-manager.extraSpecialArgs = {
inherit inputs hostname username; inherit inputs hostname username niri-package;
homeDirectory = "/home/${username}"; homeDirectory = "/home/${username}";
stateVersion = config.system.stateVersion; stateVersion = config.system.stateVersion;
}; };

View File

@ -3,6 +3,7 @@
pkgs, pkgs,
lib, lib,
inputs, inputs,
niri-package,
... ...
}: }:
let let
@ -22,7 +23,7 @@ in
]; ];
programs.niri = { programs.niri = {
package = pkgs.niri-unstable; package = niri-package;
settings = { settings = {
prefer-no-csd = true; prefer-no-csd = true;