Merge branch 'steam_deck' into nix

This commit is contained in:
Tom Alexander 2025-02-16 09:18:07 -05:00
commit e3a7a410c4
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
17 changed files with 675 additions and 19 deletions

View File

@ -20,4 +20,12 @@
];
};
};
home-manager.users.talexander =
{ pkgs, ... }:
{
home.file.".ssh/config" = {
source = ./files/ssh_config;
};
};
}

View File

@ -0,0 +1,34 @@
Host poudriere
ProxyJump talexander@mrmanager
HostName 10.215.1.203
Host controller0
ProxyJump talexander@mrmanager
HostName 10.215.1.204
Host controller1
ProxyJump talexander@mrmanager
HostName 10.215.1.205
Host controller2
ProxyJump talexander@mrmanager
HostName 10.215.1.206
Host worker0
ProxyJump talexander@mrmanager
HostName 10.215.1.207
Host worker1
ProxyJump talexander@mrmanager
HostName 10.215.1.208
Host worker2
ProxyJump talexander@mrmanager
HostName 10.215.1.209
Host brianai
ProxyJump talexander@mrmanager
HostName 10.215.1.215
Host *
Compression yes

View File

@ -1,12 +1,83 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1739314552,
"narHash": "sha256-ggVf2BclyIW3jexc/uvgsgJH4e2cuG6Nyg54NeXgbFI=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "83bd3a26ac0526ae04fa74df46738bb44b89dcdd",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"impermanence": {
"locked": {
"lastModified": 1737831083,
"narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "impermanence",
"type": "github"
}
},
"nixgl": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1713543440,
"narHash": "sha256-lnzZQYG0+EXl/6NkGpyIz+FEOc/DSEG57AP1VsdeNrM=",
"owner": "nix-community",
"repo": "nixGL",
"rev": "310f8e49a149e4c9ea52f1adf70cdc768ec53f8a",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixGL",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1739019272,
"narHash": "sha256-7Fu7oazPoYCbDzb9k8D/DdbKrC3aU1zlnc39Y8jy/s8=",
"lastModified": 1739138025,
"narHash": "sha256-M4ilIfGxzbBZuURokv24aqJTbdjPA9K+DtKUzrJaES4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "fa35a3c8e17a3de613240fea68f876e5b4896aec",
"rev": "b2243f41e860ac85c0b446eadc6930359b294e79",
"type": "github"
},
"original": {
@ -18,6 +89,9 @@
},
"root": {
"inputs": {
"home-manager": "home-manager",
"impermanence": "impermanence",
"nixgl": "nixgl",
"nixpkgs": "nixpkgs"
}
}

View File

@ -3,34 +3,52 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixgl.url = "github:nix-community/nixGL";
nixgl.inputs.nixpkgs.follows = "nixpkgs";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence = {
url = "github:nix-community/impermanence";
};
};
outputs =
{
nixpkgs,
nixgl,
home-manager,
impermanence,
...
}:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
pkgs = import nixpkgs {
inherit system;
overlays = [ nixgl.overlay ];
};
in
# pkgs = nixpkgs.legacyPackages.${system};
{
packages.${system}.default = pkgs.buildEnv {
name = "default";
paths = [
pkgs.emacs
pkgs.mg
pkgs.steam-rom-manager
defaultPackage.${system} = home-manager.defaultPackage.${system};
homeConfigurations."deck" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = { inherit nixgl; };
modules = [
{ nixpkgs.overlays = [ nixgl.overlay ]; }
impermanence.homeManagerModules.impermanence
./hosts/deck
./home.nix
];
};
formatter.${system} = pkgs.nixfmt-rfc-style;
# formatter.${system} = pkgs.alejandra;
};
# nixConfig = {
# experimental-features = [
# "nix-command"
# "flakes"
# ];
# };
nixConfig = {
experimental-features = [
"nix-command"
"flakes"
];
};
}

View File

@ -0,0 +1,52 @@
# TODO: Optimize for znver2
{
config,
pkgs,
nixgl,
...
}:
{
imports = [
./roles/2ship2harkinian
./roles/graphics
./roles/shipwright
./roles/sm64ex
./roles/steam_rom_manager
./util/unfree_polyfill
];
home.username = "deck";
home.homeDirectory = "/home/deck";
home.stateVersion = "24.11";
programs.home-manager.enable = true;
# enable flakes
nix = {
package = pkgs.nix;
settings.experimental-features = [
"nix-command"
"flakes"
];
};
# Automatic garbage collection
nix.gc = {
# Runs nix-collect-garbage --delete-older-than 30d
automatic = true;
randomizedDelaySec = "14m";
options = "--delete-older-than 30d";
};
nix.settings.auto-optimise-store = true;
home.packages = with pkgs; [
pkgs.nixgl.nixGLIntel
(pkgs.nixgl.nixGLCommon pkgs.nixgl.nixGLIntel)
pkgs.nixgl.nixVulkanIntel
];
# This would keep build-time dependencies so I can rebuild while offline.
# nix.settings = {
# keep-outputs = true;
# keep-derivations = true;
# };
}

View File

@ -0,0 +1,18 @@
{
config,
lib,
pkgs,
...
}:
{
imports = [ ];
config = {
me.graphical = true;
me.ship2harkinian.enable = true;
me.shipwright.enable = true;
me.sm64ex.enable = true;
me.steam_rom_manager.enable = true; # Steam rom manager UI does not render. I think it wants to be in an AppImage.
};
}

View File

@ -0,0 +1,78 @@
# MANUAL: mkdir -p ~/.persist/.local/share/2ship/saves
{
config,
lib,
pkgs,
...
}:
let
steam_2s2h = pkgs.writeScriptBin "steam_2s2h" ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libglvnd}/lib"
exec ${pkgs._2ship2harkinian}/bin/2s2h
'';
in
{
imports = [ ];
options.me = {
ship2harkinian.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install 2ship2harkinian.";
};
};
config = lib.mkIf config.me.ship2harkinian.enable (
lib.mkMerge [
{
allowedUnfree = [ "2ship2harkinian" ];
}
(lib.mkIf config.me.graphical {
home.packages = with pkgs; [
_2ship2harkinian
steam_2s2h
];
home.file.".local/share/2ship/2ship2harkinian.json" = {
source = ./files/2ship2harkinian.json;
};
home.persistence."/home/deck/.persist" = {
directories = [
{
directory = ".local/share/2ship/saves";
method = "symlink";
}
];
};
home.persistence."/home/deck/.state" = {
files = [
".local/share/2ship/mm.o2r"
];
};
nixpkgs.overlays = [
(final: prev: {
_2ship2harkinian = pkgs.buildEnv {
name = prev._2ship2harkinian.name;
paths = [
(config.lib.nixGL.wrap prev._2ship2harkinian)
];
extraOutputsToInstall = [
"man"
"doc"
"info"
];
# We have to use 555 instead of the normal 444 here because the .desktop file ends up inside $HOME on steam deck and desktop files must be either not in $HOME or must be executable, otherwise KDE Plasma refuses to execute them.
postBuild = ''
chmod 0555 $out/share/applications/2s2h.desktop
'';
};
})
];
})
]
);
}

View File

@ -0,0 +1,15 @@
{
"CVars": {
"gInterpolationFPS": 60,
"gSettings": {
"InternalResolution": 2.0,
"MSAAValue": 2,
"OpenMenuBar": 0
}
},
"Window": {
"Fullscreen": {
"Enabled": true
}
}
}

View File

@ -0,0 +1,30 @@
{
config,
lib,
pkgs,
...
}:
{
imports = [ ];
options.me = {
blank.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install blank.";
};
};
config = lib.mkIf config.me.blank.enable (
lib.mkMerge [
{
home.packages = with pkgs; [
];
}
(lib.mkIf config.me.graphical {
})
]
);
}

View File

@ -0,0 +1,43 @@
{
config,
lib,
pkgs,
nixgl,
...
}:
{
imports = [ ];
options.me.graphics_card_type = lib.mkOption {
type = lib.types.nullOr (
lib.types.enum [
"amd"
"intel"
"nvidia"
]
);
default = null;
example = "amd";
description = "What graphics card type is in the computer.";
};
options.me.graphical = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install graphical programs.";
};
config = (
lib.mkMerge [
(lib.mkIf config.me.graphical {
nixGL.packages = nixgl.packages;
# home.packages = with pkgs; [
# mesa-demos # for glxgears
# vulkan-tools # for vkcube
# ];
})
]
);
}

View File

@ -0,0 +1,78 @@
# MANUAL: mkdir -p ~/.persist/.local/share/soh/Save
{
config,
lib,
pkgs,
...
}:
let
steam_shipwright = pkgs.writeScriptBin "steam_soh" ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libglvnd}/lib"
exec ${pkgs.shipwright}/bin/soh
'';
in
{
imports = [ ];
options.me = {
shipwright.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install shipwright.";
};
};
config = lib.mkIf config.me.shipwright.enable (
lib.mkMerge [
{
allowedUnfree = [ "shipwright" ];
}
(lib.mkIf config.me.graphical {
home.packages = with pkgs; [
shipwright
steam_shipwright
];
home.file.".local/share/soh/shipofharkinian.json" = {
source = ./files/shipofharkinian.json;
};
home.persistence."/home/deck/.persist" = {
directories = [
{
directory = ".local/share/soh/Save";
method = "symlink";
}
];
};
home.persistence."/home/deck/.state" = {
files = [
".local/share/soh/oot.otr"
];
};
nixpkgs.overlays = [
(final: prev: {
shipwright = pkgs.buildEnv {
name = prev.shipwright.name;
paths = [
(config.lib.nixGL.wrap prev.shipwright)
];
extraOutputsToInstall = [
"man"
"doc"
"info"
];
# We have to use 555 instead of the normal 444 here because the .desktop file ends up inside $HOME on steam deck and desktop files must be either not in $HOME or must be executable, otherwise KDE Plasma refuses to execute them.
postBuild = ''
chmod 0555 $out/share/applications/soh.desktop
'';
};
})
];
})
]
);
}

View File

@ -0,0 +1,19 @@
{
"CVars": {
"gInternalResolution": 2.0,
"gInterpolationFPS": 60,
"gMSAAValue": 2,
"gMatchRefreshRate": 0,
"gOnFileSelectNameEntry": 0,
"gOpenWindows": {
"modalWindowEnabled": 1
},
"gZFightingMode": 0
},
"ConfigVersion": 2,
"Window": {
"Fullscreen": {
"Enabled": true
}
}
}

View File

@ -0,0 +1,91 @@
{
config,
lib,
pkgs,
...
}:
let
steam_sm64ex = pkgs.writeScriptBin "steam_sm64ex" ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libglvnd}/lib"
exec ${pkgs.sm64ex}/bin/sm64ex
'';
in
{
imports = [ ];
options.me = {
sm64ex.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install sm64ex.";
};
};
config = lib.mkIf config.me.sm64ex.enable (
lib.mkMerge [
(lib.mkIf config.me.graphical {
allowedUnfree = [ "sm64ex" ];
home.packages = with pkgs; [
sm64ex
steam_sm64ex
];
# nixpkgs.overlays = [
# (final: prev: {
# sm4ex = prev.sm64ex.override {
# baseRom.name = "SuperMario64.z64";
# };
# })
# ];
home.file.".local/share/sm64ex/sm64config.txt" = {
source = ./files/sm64config.txt;
};
home.persistence."/home/deck/.persist" = {
files = [
".local/share/sm64ex/sm64_save_file.bin"
];
};
nixpkgs.overlays = [
(final: prev: {
sm64ex =
let
desktop_item = pkgs.makeDesktopItem {
name = "sm64ex";
desktopName = "Super Mario 64";
comment = "A PC Port of Super Mario 64.";
categories = [
"Game"
];
icon = "sm64ex";
type = "Application";
exec = "sm64ex";
};
in
pkgs.buildEnv {
name = prev.sm64ex.name;
paths = [
(config.lib.nixGL.wrap prev.sm64ex)
];
extraOutputsToInstall = [
"man"
"doc"
"info"
];
# We have to use 555 instead of the normal 444 here because the .desktop file ends up inside $HOME on steam deck and desktop files must be either not in $HOME or must be executable, otherwise KDE Plasma refuses to execute them.
postBuild = ''
install -m 555 -D "${desktop_item}/share/applications/"* -t $out/share/applications/
install -m 444 -D "${./files/icon.png}" $out/share/pixmaps/sm64ex.png
'';
};
})
];
})
]
);
}

View File

@ -0,0 +1 @@
fullscreen true

View File

@ -0,0 +1,33 @@
{
stdenv,
config,
lib,
pkgs,
...
}:
let
package = (pkgs.callPackage ./package.nix { });
in
{
imports = [ ];
options.me = {
steam_rom_manager.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install steam_rom_manager.";
};
};
config = lib.mkIf config.me.steam_rom_manager.enable (
lib.mkMerge [
(lib.mkIf config.me.graphical {
home.packages = with pkgs; [
package
];
})
]
);
}

View File

@ -0,0 +1,49 @@
{
stdenv,
lib,
pkgs,
makeDesktopItem,
}:
let
version = "2.5.29";
icon = pkgs.fetchurl {
url = "https://github.com/SteamGridDB/steam-rom-manager/blob/master/src/assets/icons/512x512.png?raw=true";
hash = "sha256-Nx29nJ2+44AYrTLP+CNmDJFAf2sjrH7sfYhg9fJx2qo=";
};
in
stdenv.mkDerivation {
name = "steam-rom-manager";
src = pkgs.fetchurl {
url = "https://github.com/SteamGridDB/steam-rom-manager/releases/download/v${version}/Steam-ROM-Manager-${version}.AppImage";
hash = "sha256-6ZJ+MGIgr2osuQuqD6N9NnPiJFNq/HW6ivG8tyXUhvs=";
};
phases = [
"installPhase"
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install --mode=0755 $src $out/bin/steam-rom-manager
runHook postInstall
'';
# We have to use 555 instead of the normal 444 here because the .desktop file ends up inside $HOME on steam deck and desktop files must be either not in $HOME or must be executable, otherwise KDE Plasma refuses to execute them.
postInstall = ''
mkdir -p $out/share/{applications,pixmaps}
install -m 555 -D "$desktopItem/share/applications/"* -t $out/share/applications/
install -m 444 -D "${icon}" $out/share/pixmaps/steamrommanager.png
'';
desktopItem = makeDesktopItem {
name = "steam-rom-manager";
desktopName = "Steam Rom Manager";
comment = "Manage additional entries in the Steam launcher.";
categories = [
"Application"
"Utility"
];
icon = "steamrommanager";
type = "Application";
exec = "steam-rom-manager";
};
}

View File

@ -0,0 +1,15 @@
{ config, lib, ... }:
let
inherit (builtins) elem;
inherit (lib) getName mkOption;
inherit (lib.types) listOf str;
in
{
# Pending https://github.com/NixOS/nixpkgs/issues/55674
options.allowedUnfree = mkOption {
type = listOf str;
default = [ ];
};
config.nixpkgs.config.allowUnfreePredicate = p: elem (getName p) config.allowedUnfree;
}