yarn: deploy-rs

This commit is contained in:
Simon Gardling 2025-11-16 19:30:08 -05:00
parent 84136a4af6
commit ff84a3bb94
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
5 changed files with 214 additions and 35 deletions

View File

@ -33,11 +33,23 @@
services.kmscon.enable = true; services.kmscon.enable = true;
# Gamescope configuration for Steam Deck-like experience
programs = {
gamescope = {
enable = true;
capSysNice = true;
};
steam = {
enable = true;
gamescopeSession.enable = true;
};
};
services.greetd = { services.greetd = {
enable = true; enable = true;
settings = { settings = {
default_session = { default_session = {
command = "${lib.getExe pkgs.tuigreet} --time --cmd niri-session"; command = "${lib.getExe pkgs.tuigreet} --sessions --time";
user = username; user = username;
}; };
terminal.vt = lib.mkForce 2; terminal.vt = lib.mkForce 2;

View File

@ -25,20 +25,26 @@
fsType = "f2fs"; fsType = "f2fs";
options = [ "nofail" ]; options = [ "nofail" ];
}; };
networking.hostId = "abf570f9"; networking.hostId = "abf570f9";
services.openssh = { services.openssh = {
enable = true; enable = true;
ports = [ 22 ]; ports = [ 22 ];
settings = { settings = {
PasswordAuthentication = true; PasswordAuthentication = false;
AllowUsers = null; # Allows all users by default. Can be [ "user1" "user2" ] PermitRootLogin = "yes";
UseDns = true;
X11Forwarding = false;
PermitRootLogin = "yes"; # "yes", "without-password", "prohibit-password", "forced-commands-only", "no"
}; };
}; };
users.users.${username}.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4jL6gYOunUlUtPvGdML0cpbKSsPNqQ1jit4E7U1RyH" # laptop
];
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4jL6gYOunUlUtPvGdML0cpbKSsPNqQ1jit4E7U1RyH" # laptop
];
programs.steam = { programs.steam = {
remotePlay.openFirewall = true; remotePlay.openFirewall = true;
localNetworkGameTransfers.openFirewall = true; localNetworkGameTransfers.openFirewall = true;

130
flake.lock generated
View File

@ -15,6 +15,28 @@
"type": "github" "type": "github"
} }
}, },
"deploy-rs": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1762286984,
"narHash": "sha256-9I2H9x5We6Pl+DBYHjR1s3UT8wgwcpAH03kn9CqtdQc=",
"owner": "serokell",
"repo": "deploy-rs",
"rev": "9c870f63e28ec1e83305f7f6cb73c941e699f74f",
"type": "github"
},
"original": {
"owner": "serokell",
"repo": "deploy-rs",
"type": "github"
}
},
"disko": { "disko": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -62,11 +84,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762997295, "lastModified": 1763310170,
"narHash": "sha256-/4kxhVbD/wHVVg9B2srm1NzXEEmEI239JwMtyNYgZQQ=", "narHash": "sha256-XFB1UvfWL9JgJqBKicGe2f8+cW7zh1yMcgKof8dGlvw=",
"owner": "nix-community", "owner": "nix-community",
"repo": "emacs-overlay", "repo": "emacs-overlay",
"rev": "4897d454109bd9965a8372363169a5b676753094", "rev": "d33a3fae28a7f2c8ab0b6bdfd929eb73692ce06a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -76,6 +98,22 @@
} }
}, },
"flake-compat": { "flake-compat": {
"flake": false,
"locked": {
"lastModified": 1733328505,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1747046372, "lastModified": 1747046372,
@ -141,11 +179,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762964643, "lastModified": 1763313531,
"narHash": "sha256-RYHN8O/Aja59XDji6WSJZPkJpYVUfpSkyH+PEupBJqM=", "narHash": "sha256-yvdCYUL85zEDp2NzPUBmaNBXP6KnWEOhAk3j7PTfsKw=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "827f2a23373a774a8805f84ca5344654c31f354b", "rev": "3670a78eee49deebe4825fc8ecc46b172d1a8391",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -172,7 +210,7 @@
"lanzaboote": { "lanzaboote": {
"inputs": { "inputs": {
"crane": "crane", "crane": "crane",
"flake-compat": "flake-compat", "flake-compat": "flake-compat_2",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
@ -183,11 +221,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1762205063, "lastModified": 1763154177,
"narHash": "sha256-If6vQ+KvtKs3ARBO9G3l+4wFSCYtRBrwX1z+I+B61wQ=", "narHash": "sha256-LIIrMS2f2pPT2/BHs8dfGeupI23v5DNcoRz3W+iMsUA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "lanzaboote", "repo": "lanzaboote",
"rev": "88b8a563ff5704f4e8d8e5118fb911fa2110ca05", "rev": "70be03ab23d0988224e152f5b52e2fbf44a6d8ee",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -210,11 +248,11 @@
"xwayland-satellite-unstable": "xwayland-satellite-unstable" "xwayland-satellite-unstable": "xwayland-satellite-unstable"
}, },
"locked": { "locked": {
"lastModified": 1762938849, "lastModified": 1763289873,
"narHash": "sha256-ltM04Wy+vMm/EAwhGTl2BYjCgF+Kq4lltpDH9NEh264=", "narHash": "sha256-vzVbMit/Y8IdSYiN2jal77Bp0uRw3MNqSoqy0l4dYoo=",
"owner": "sodiboo", "owner": "sodiboo",
"repo": "niri-flake", "repo": "niri-flake",
"rev": "ea9b76cfa921d42a7502260b2d1296798089dfe6", "rev": "13d47ed15fc3d8cc98ad42525e85851faf15a47c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -243,11 +281,11 @@
"niri-unstable": { "niri-unstable": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1762881062, "lastModified": 1763286485,
"narHash": "sha256-j0Gxopn4jGYQae/90V2v4u4+Ec+gFLq3UbSaGfczpOM=", "narHash": "sha256-noCCGXkqQxHT+Pk723/poMqkbLHPtgENwg/kntlh2mA=",
"owner": "YaLTeR", "owner": "YaLTeR",
"repo": "niri", "repo": "niri",
"rev": "5b77107161c504376b962107913bf74b575703e7", "rev": "9dad215b9f384310dea53fbd1aa8010e42f779f4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -265,14 +303,14 @@
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"systems": "systems" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1762937100, "lastModified": 1763282415,
"narHash": "sha256-vVM8PKSd9MRRmeMQ4qOLIhsUtBnEozHXr8e20xvpX78=", "narHash": "sha256-Blb9l3DjFXjhYOqR7RoA/TQUS7BnBN4VufpRvG4XSlo=",
"owner": "marienz", "owner": "marienz",
"repo": "nix-doom-emacs-unstraightened", "repo": "nix-doom-emacs-unstraightened",
"rev": "e2cfa1ca0af3e6e5dc01bd5ba478e0c623251504", "rev": "b04d4b93dc60bc586224b28564b116f0692ce05c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -314,11 +352,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1762844143, "lastModified": 1762977756,
"narHash": "sha256-SlybxLZ1/e4T2lb1czEtWVzDCVSTvk9WLwGhmxFmBxI=", "narHash": "sha256-4PqRErxfe+2toFJFgcRKZ0UI9NSIOJa+7RXVtBhy4KE=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4", "rev": "c5ae371f1a6a7fd27823bc500d9390b38c05fa55",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -356,6 +394,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"deploy-rs": "deploy-rs",
"disko": "disko", "disko": "disko",
"emacs-overlay": "emacs-overlay", "emacs-overlay": "emacs-overlay",
"home-manager": "home-manager", "home-manager": "home-manager",
@ -377,11 +416,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1763001554, "lastModified": 1763260832,
"narHash": "sha256-wsfhRTuxu6f06RMmP4JWcq3wWRlmYtQaJZ6b3f+EJ94=", "narHash": "sha256-KMEJ9S7bZLvDIfVu2XdEJTZVYAc/arjFt5KnhGqwCOg=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "315d97eb753cee8e1aa039a5e622b84d32a454bb", "rev": "c3cea2a0ec0d5debbef4aa2a0cfe59bd0fb0aeeb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -405,6 +444,39 @@
"type": "github" "type": "github"
} }
}, },
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"xwayland-satellite-stable": { "xwayland-satellite-stable": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -448,11 +520,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1763007974, "lastModified": 1763317021,
"narHash": "sha256-XMgjrDIHonLqIjc1eMQkLeemGcNqqYU0Dq+zNmeMYOI=", "narHash": "sha256-UOP9AyuBvQCEzGe6u8FxuhnJU2ShUPU4G7z7zraFNoo=",
"owner": "0xc000022070", "owner": "0xc000022070",
"repo": "zen-browser-flake", "repo": "zen-browser-flake",
"rev": "eff1c79c78950ebb4ce70c3d51513e294cf30b52", "rev": "db2be18049b9159a33ee7083566040fca4254c03",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -57,6 +57,11 @@
url = "github:nix-community/impermanence"; url = "github:nix-community/impermanence";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs =
@ -66,6 +71,7 @@
lanzaboote, lanzaboote,
nixos-hardware, nixos-hardware,
home-manager, home-manager,
deploy-rs,
... ...
}@inputs: }@inputs:
let let
@ -78,6 +84,7 @@
in in
{ {
formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style; formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style;
nixosConfigurations = nixpkgs.lib.foldl' ( nixosConfigurations = nixpkgs.lib.foldl' (
config: hostname: config: hostname:
config config
@ -110,5 +117,14 @@
}; };
} }
) { } hostnames; ) { } hostnames;
# Deploy-rs configuration for yarn host only
deploy.nodes.yarn = {
hostname = "desktop";
profiles.system = {
user = "root";
path = deploy-rs.lib.${system}.activate.nixos self.nixosConfigurations.yarn;
};
};
}; };
} }

View File

@ -16,8 +16,81 @@
# https://github.com/NixOS/nixpkgs/pull/339370#issuecomment-2731336341 # https://github.com/NixOS/nixpkgs/pull/339370#issuecomment-2731336341
bs-manager bs-manager
# Steam session scripts
(writeShellScriptBin "steam-session" ''
#!/usr/bin/env bash
set -xeuo pipefail
gamescopeArgs=(
--adaptive-sync # VRR support
--hdr-enabled
--mangoapp # performance overlay
--rt
--steam
)
steamArgs=(
-pipewire-dmabuf
-tenfoot
)
mangoConfig=(
cpu_temp
gpu_temp
ram
vram
)
mangoVars=(
MANGOHUD=1
MANGOHUD_CONFIG="$(IFS=,; echo "''${mangoConfig[*]}")"
)
export "''${mangoVars[@]}"
exec gamescope "''${gamescopeArgs[@]}" -- steam "''${steamArgs[@]}"
'')
(writeShellScriptBin "steam-session-greetd" ''
#!/usr/bin/env bash
set -xeuo pipefail
# Set environment variables for Steam gaming session
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
# Kill any existing compositor
pkill niri || true
# Start Steam in Big Picture mode with gamescope
exec steam-session
'')
]; ];
# Create desktop entry for Steam session
xdg.dataFile."wayland-sessions/steam-session.desktop".text = ''
[Desktop Entry]
Name=Steam Session
Comment=Steam Deck-like gaming session with gamescope
Exec=${config.home.homeDirectory}/.nix-profile/bin/steam-session-greetd
Type=Application
DesktopNames=steam
'';
# Create desktop entry for Niri session
xdg.dataFile."wayland-sessions/niri-session.desktop".text = ''
[Desktop Entry]
Name=Niri Session
Comment=Niri Wayland compositor
Exec=${config.programs.niri.package}/bin/niri-session
Type=Application
DesktopNames=niri
'';
programs.obs-studio = { programs.obs-studio = {
enable = true; enable = true;
plugins = with pkgs.obs-studio-plugins; [ plugins = with pkgs.obs-studio-plugins; [