Compare commits

..

5 Commits

Author SHA1 Message Date
Tom Alexander
3ecb2fc790
Enable optimized builds for steam deck. 2025-03-24 21:59:43 -04:00
Tom Alexander
44a49d7ac7
Add rpcs3 (PS3 emulator) to steam deck. 2025-03-24 21:59:43 -04:00
Tom Alexander
acfc9ac1a4
Add hydra as a distributed build machine. 2025-03-24 21:59:42 -04:00
Tom Alexander
e733dcdcbf
Add a target for the hydra server. 2025-03-23 18:19:49 -04:00
Tom Alexander
3099a18424
Enable optimization on odo. 2025-03-23 18:19:49 -04:00
22 changed files with 736 additions and 93 deletions

View File

@ -118,6 +118,14 @@
home.stateVersion = "24.11"; home.stateVersion = "24.11";
}; };
home-manager.users.root =
{ pkgs, ... }:
{
# The state version is required and should stay at the version you
# originally installed.
home.stateVersion = "24.11";
};
# Automatic garbage collection # Automatic garbage collection
nix.gc = lib.mkIf (!config.me.buildingIso) { nix.gc = lib.mkIf (!config.me.buildingIso) {
# Runs nix-collect-garbage --delete-older-than 5d # Runs nix-collect-garbage --delete-older-than 5d
@ -163,6 +171,7 @@
doas-sudo-shim # To support --use-remote-sudo for remote builds doas-sudo-shim # To support --use-remote-sudo for remote builds
dmidecode # Read SMBIOS information. dmidecode # Read SMBIOS information.
ipcalc ipcalc
gptfdisk # for cgdisk
]; ];
services.openssh = { services.openssh = {

View File

@ -135,11 +135,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1741955947, "lastModified": 1742588233,
"narHash": "sha256-2lbURKclgKqBNm7hVRtWh0A7NrdsibD0EaWhahUVhhY=", "narHash": "sha256-Fi5g8H5FXMSRqy+mU6gPG0v+C9pzjYbkkiePtz8+PpA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "4e12151c9e014e2449e0beca2c0e9534b96a26b4", "rev": "296ddc64627f4a6a4eb447852d7346b9dd16197d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -191,11 +191,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1741851582, "lastModified": 1742422364,
"narHash": "sha256-cPfs8qMccim2RBgtKGF+x9IBCduRvd/N5F4nYpU0TVE=", "narHash": "sha256-mNqIplmEohk5jRkqYqG19GA8MbQ/D4gQSK0Mu4LvfRQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "6607cf789e541e7873d40d3a8f7815ea92204f32", "rev": "a84ebe20c6bc2ecbcfb000a50776219f48d134cc",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -237,6 +237,22 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-unoptimized": {
"locked": {
"lastModified": 1742422364,
"narHash": "sha256-mNqIplmEohk5jRkqYqG19GA8MbQ/D4gQSK0Mu4LvfRQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a84ebe20c6bc2ecbcfb000a50776219f48d134cc",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks-nix": { "pre-commit-hooks-nix": {
"inputs": { "inputs": {
"flake-compat": [ "flake-compat": [
@ -272,6 +288,7 @@
"lanzaboote": "lanzaboote", "lanzaboote": "lanzaboote",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-b93b4e9b5": "nixpkgs-b93b4e9b5", "nixpkgs-b93b4e9b5": "nixpkgs-b93b4e9b5",
"nixpkgs-unoptimized": "nixpkgs-unoptimized",
"zsh-histdb": "zsh-histdb" "zsh-histdb": "zsh-histdb"
} }
}, },

View File

@ -32,6 +32,7 @@
impermanence.url = "github:nix-community/impermanence"; impermanence.url = "github:nix-community/impermanence";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-b93b4e9b5.url = "github:NixOS/nixpkgs/b93b4e9b527904aadf52dba6ca35efde2067cbd4"; nixpkgs-b93b4e9b5.url = "github:NixOS/nixpkgs/b93b4e9b527904aadf52dba6ca35efde2067cbd4";
nixpkgs-unoptimized.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager"; home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
lanzaboote = { lanzaboote = {
@ -58,6 +59,7 @@
{ {
self, self,
nixpkgs, nixpkgs,
nixpkgs-unoptimized,
nixpkgs-b93b4e9b5, nixpkgs-b93b4e9b5,
impermanence, impermanence,
home-manager, home-manager,
@ -73,6 +75,11 @@
pkgs-b93b4e9b5 = import nixpkgs-b93b4e9b5 { pkgs-b93b4e9b5 = import nixpkgs-b93b4e9b5 {
inherit system; inherit system;
}; };
pkgs-unoptimized = import nixpkgs-unoptimized {
inherit system;
hostPlatform.gcc.arch = "default";
hostPlatform.gcc.tune = "default";
};
}; };
modules = [ modules = [
impermanence.nixosModules.impermanence impermanence.nixosModules.impermanence
@ -142,6 +149,30 @@
} }
); );
}; };
hydra = {
main = nixpkgs.lib.nixosSystem (
base_x86_64_linux
// {
modules = base_x86_64_linux.modules ++ [
./hosts/hydra
];
}
);
iso = nixpkgs.lib.nixosSystem (
base_x86_64_linux
// {
modules = base_x86_64_linux.modules ++ [
./hosts/hydra
(nixpkgs + "/nixos/modules/installer/cd-dvd/iso-image.nix")
{
isoImage.makeEfiBootable = true;
isoImage.makeUsbBootable = true;
me.buildingIso = true;
}
];
}
);
};
}; };
in in
{ {
@ -149,5 +180,7 @@
iso.odo = systems.odo.iso.config.system.build.isoImage; iso.odo = systems.odo.iso.config.system.build.isoImage;
nixosConfigurations.neelix = systems.neelix.main; nixosConfigurations.neelix = systems.neelix.main;
iso.neelix = systems.neelix.iso.config.system.build.isoImage; iso.neelix = systems.neelix.iso.config.system.build.isoImage;
nixosConfigurations.hydra = systems.hydra.main;
iso.hydra = systems.hydra.iso.config.system.build.isoImage;
}; };
} }

View File

@ -0,0 +1,32 @@
{ config, pkgs, ... }:
{
imports = [
./hardware-configuration.nix
./disk-config.nix
./optimized_build.nix
];
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
networking.hostId = "fbd233d8";
networking.hostName = "hydra"; # Define your hostname.
time.timeZone = "America/New_York";
i18n.defaultLocale = "en_US.UTF-8";
me.secureBoot.enable = false;
# Mount tmpfs at /tmp
boot.tmp.useTmpfs = true;
me.emacs_flavor = "plainmacs";
me.graphical = false;
me.zsh.enable = true;
me.wireguard.activated = [ ];
me.wireguard.deactivated = [ ];
# Trust this key so nix running as root can ssh into hydra.
users.users.talexander.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB/IlYTQ0M5pFN5tdoswh37CDl/gbULI3h+SsKXCansh talexander@odo"
];
}

View File

@ -0,0 +1,140 @@
# Manual Step:
# Check if drive supports 4kn: nvme id-ns -H /dev/nvme0n1
# Format the drive to 4kn: nvme format --lbaf=1 /dev/nvme0n1
{
config,
lib,
pkgs,
...
}:
lib.mkIf (!config.me.buildingIso) {
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"umask=0077"
"noatime"
"discard"
];
};
};
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
};
};
};
};
};
zpool = {
zroot = {
type = "zpool";
# mode = "mirror";
# Workaround: cannot import 'zroot': I/O error in disko tests
options.cachefile = "none";
options = {
ashift = "12";
compatibility = "openzfs-2.2-freebsd";
autotrim = "on";
};
rootFsOptions = {
acltype = "posixacl";
atime = "off";
relatime = "off";
xattr = "sa";
mountpoint = "none";
compression = "lz4";
canmount = "off";
utf8only = "on";
dnodesize = "auto";
normalization = "formD";
};
datasets = {
"linux/nix" = {
type = "zfs_fs";
options.mountpoint = "none";
};
"linux/nix/root" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/";
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/root@blank$' || zfs snapshot zroot/linux/nix/root@blank";
};
"linux/nix/nix" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/nix";
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/nix@blank$' || zfs snapshot zroot/linux/nix/nix@blank";
options = {
recordsize = "1MiB";
compression = "lz4";
};
};
"linux/nix/home" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/home";
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/home@blank$' || zfs snapshot zroot/linux/nix/home@blank";
};
"linux/nix/persist" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/persist";
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/persist@blank$' || zfs snapshot zroot/linux/nix/persist@blank";
};
"linux/nix/state" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/state";
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot/linux/nix/state@blank$' || zfs snapshot zroot/linux/nix/state@blank";
};
};
};
};
};
# Make sure all persistent volumes are marked as neededForBoot
#
# Also mounts /home so it is mounted before the user home directories are created.
fileSystems."/persist".neededForBoot = true;
fileSystems."/state".neededForBoot = true;
fileSystems."/home".neededForBoot = true;
fileSystems."/".options = [
"noatime"
"norelatime"
];
fileSystems."/nix".options = [
"noatime"
"norelatime"
];
fileSystems."/persist".options = [
"noatime"
"norelatime"
];
fileSystems."/state".options = [
"noatime"
"norelatime"
];
fileSystems."/home".options = [
"noatime"
"norelatime"
];
}

View File

@ -0,0 +1,39 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.dhcpcd.enable = lib.mkForce true;
networking.useDHCP = lib.mkForce true;
networking.interfaces.enp0s2.useDHCP = lib.mkForce true;
# systemd.network.enable = true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View File

@ -0,0 +1,88 @@
{
config,
lib,
pkgs,
...
}:
{
imports = [ ];
config = lib.mkMerge [
{
nix.settings.system-features = lib.mkForce [
"gccarch-znver4"
"gccarch-x86-64-v3"
"gccarch-x86-64-v4"
"benchmark"
"big-parallel"
# "kvm"
# "nixos-test"
];
}
(lib.mkIf (!config.me.buildingIso) {
nix.settings.system-features = lib.mkForce [
"gccarch-znver4"
"gccarch-x86-64-v3"
"gccarch-x86-64-v4"
"benchmark"
"big-parallel"
# "kvm"
# "nixos-test"
];
# nixpkgs.hostPlatform = {
# gcc.arch = "alderlake";
# gcc.tune = "alderlake";
# system = "x86_64-linux";
# };
nixpkgs.overlays = [
(
final: prev:
let
optimizeWithFlags =
pkg: flags:
pkg.overrideAttrs (old: {
NIX_CFLAGS_COMPILE = [ (old.NIX_CFLAGS_COMPILE or "") ] ++ flags;
});
addConfig =
additionalConfig: pkg:
pkg.override (oldconfig: {
structuredExtraConfig = pkg.structuredExtraConfig // additionalConfig;
});
in
{
linux_znver4 =
addConfig
{
# Full preemption
PREEMPT = lib.mkOverride 60 lib.kernel.yes;
PREEMPT_VOLUNTARY = lib.mkOverride 60 lib.kernel.no;
# Google's BBRv3 TCP congestion Control
TCP_CONG_BBR = lib.kernel.yes;
DEFAULT_BBR = lib.kernel.yes;
# Preemptive Full Tickless Kernel at 300Hz
HZ = lib.kernel.freeform "300";
HZ_300 = lib.kernel.yes;
HZ_1000 = lib.kernel.no;
}
(
optimizeWithFlags prev.linux_6_13 [
"-march=znver4"
"-mtune=znver4"
]
);
}
)
];
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_znver4;
})
(lib.mkIf (config.me.buildingIso) {
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_6_13;
boot.supportedFilesystems = [ "zfs" ];
})
];
}

View File

@ -9,6 +9,7 @@
./hardware-configuration.nix ./hardware-configuration.nix
./disk-config.nix ./disk-config.nix
./optimized_build.nix ./optimized_build.nix
./distributed_build.nix
./power_management.nix ./power_management.nix
./screen_brightness.nix ./screen_brightness.nix
./wifi.nix ./wifi.nix

View File

@ -0,0 +1,32 @@
{
config,
lib,
pkgs,
...
}:
{
imports = [ ];
config = lib.mkMerge [
{
nix.distributedBuilds = true;
nix.buildMachines = [
{
hostName = "hydra";
systems = [
"x86_64-linux"
# "aarch64-linux"
];
maxJobs = 1;
speedFactor = 2;
supportedFeatures = [
# "nixos-test"
"benchmark"
"big-parallel"
# "kvm"
];
}
];
}
];
}

View File

@ -2,6 +2,7 @@
config, config,
lib, lib,
pkgs, pkgs,
pkgs-unoptimized,
... ...
}: }:
{ {
@ -25,11 +26,11 @@
# Keep ALL dependencies so we can rebuild offline. This DRASTICALLY increase disk usage, but disk space is cheap. # Keep ALL dependencies so we can rebuild offline. This DRASTICALLY increase disk usage, but disk space is cheap.
# system.includeBuildDependencies = true; # system.includeBuildDependencies = true;
# nixpkgs.hostPlatform = { nixpkgs.hostPlatform = {
# gcc.arch = "znver4"; gcc.arch = "znver4";
# gcc.tune = "znver4"; gcc.tune = "znver4";
# system = "x86_64-linux"; system = "x86_64-linux";
# }; };
nixpkgs.overlays = [ nixpkgs.overlays = [
( (
@ -77,6 +78,26 @@
# }); # });
} }
) )
(final: prev: {
haskellPackages = prev.haskellPackages.extend (
final': prev': {
crypton = pkgs-unoptimized.haskellPackages.crypton;
}
);
})
# (final: prev: {
# haskell = prev.haskell // {
# packageOverrides = final.lib.composeExtensions prev.haskell.packageOverrides (
# final': prev': {
# crypton = pkgs-unoptimized.haskellPackages.crypton;
# }
# );
# };
# })
(final: prev: {
redis = pkgs-unoptimized.redis;
gsl = pkgs-unoptimized.gsl;
})
]; ];
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_znver4; boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_znver4;

View File

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

View File

@ -30,5 +30,9 @@ Host brianai
ProxyJump talexander@mrmanager ProxyJump talexander@mrmanager
HostName 10.215.1.215 HostName 10.215.1.215
Host hydra
ProxyJump talexander@mrmanager
HostName 10.215.1.219
Host * Host *
Compression yes Compression yes

View File

@ -0,0 +1,9 @@
Host hydra
HostName ns1.fizz.buzz
Port 65122
User talexander
IdentitiesOnly yes
IdentityFile /persist/manual/ssh/root/keys/id_ed25519
Host *
Compression yes

View File

@ -2,6 +2,7 @@
config, config,
lib, lib,
pkgs, pkgs,
pkgs-unoptimized,
... ...
}: }:
@ -23,7 +24,7 @@
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
wabt wabt
wasm-bindgen-cli wasm-bindgen-cli
binaryen # for wasm-opt pkgs-unoptimized.binaryen # for wasm-opt
]; ];
} }
] ]

View File

@ -8,8 +8,10 @@
{ {
imports = [ imports = [
./roles/2ship2harkinian ./roles/2ship2harkinian
./roles/global_options
./roles/graphics ./roles/graphics
./roles/pcsx2 ./roles/pcsx2
./roles/rpcs3
./roles/shipwright ./roles/shipwright
./roles/sm64ex ./roles/sm64ex
./roles/steam_rom_manager ./roles/steam_rom_manager

View File

@ -10,7 +10,9 @@
config = { config = {
me.graphical = true; me.graphical = true;
me.optimizations.enable = true;
me.pcsx2.enable = true; me.pcsx2.enable = true;
me.rpcs3.enable = true;
me.ship2harkinian.enable = true; me.ship2harkinian.enable = true;
me.shipwright.enable = true; me.shipwright.enable = true;
me.sm64ex.enable = true; me.sm64ex.enable = true;

View File

@ -54,11 +54,28 @@ in
}; };
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: prev: { (
final: prev:
let
optimizeWithFlags =
pkg: flags:
pkg.overrideAttrs (old: {
NIX_CFLAGS_COMPILE = [ (old.NIX_CFLAGS_COMPILE or "") ] ++ flags;
});
original_package =
if config.me.optimizations.enable then
(optimizeWithFlags prev._2ship2harkinian [
"-march=znver2"
"-mtune=znver2"
])
else
prev._2ship2harkinian;
in
{
_2ship2harkinian = pkgs.buildEnv { _2ship2harkinian = pkgs.buildEnv {
name = prev._2ship2harkinian.name; name = prev._2ship2harkinian.name;
paths = [ paths = [
(config.lib.nixGL.wrap prev._2ship2harkinian) (config.lib.nixGL.wrap original_package)
]; ];
extraOutputsToInstall = [ extraOutputsToInstall = [
"man" "man"
@ -70,7 +87,8 @@ in
chmod 0555 $out/share/applications/2s2h.desktop chmod 0555 $out/share/applications/2s2h.desktop
''; '';
}; };
}) }
)
]; ];
}) })
] ]

View File

@ -0,0 +1,19 @@
{
config,
lib,
pkgs,
...
}:
{
imports = [ ];
options.me = {
optimizations.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to enable CPU optimizations (will trigger a rebuild from source).";
};
};
}

View File

@ -70,11 +70,28 @@ in
}; };
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: prev: { (
final: prev:
let
optimizeWithFlags =
pkg: flags:
pkg.overrideAttrs (old: {
NIX_CFLAGS_COMPILE = [ (old.NIX_CFLAGS_COMPILE or "") ] ++ flags;
});
original_package =
if config.me.optimizations.enable then
(optimizeWithFlags prev.pcsx2 [
"-march=znver2"
"-mtune=znver2"
])
else
prev.pcsx2;
in
{
pcsx2 = pkgs.buildEnv { pcsx2 = pkgs.buildEnv {
name = prev.pcsx2.name; name = prev.pcsx2.name;
paths = [ paths = [
(config.lib.nixGL.wrap prev.pcsx2) (config.lib.nixGL.wrap original_package)
]; ];
extraOutputsToInstall = [ extraOutputsToInstall = [
"man" "man"
@ -86,7 +103,8 @@ in
chmod 0555 $out/share/applications/PCSX2.desktop chmod 0555 $out/share/applications/PCSX2.desktop
''; '';
}; };
}) }
)
]; ];
}) })
] ]

View File

@ -0,0 +1,112 @@
# MANUAL: mkdir -p ~/.state/.cache/rpcs3 ~/.persist/.config/rpcs3/dev_hdd0 ~/.persist/.config/rpcs3/dev_hdd1 ~/.persist/.config/rpcs3/savestates ~/.persist/.config/rpcs3/dev_usb000 ~/.persist/.config/rpcs3/dev_flash
{
config,
lib,
pkgs,
...
}:
let
steam_rpcs3 = pkgs.writeScriptBin "steam_rpcs3" ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libglvnd}/lib"
exec ${pkgs.rpcs3}/bin/rpcs3
'';
in
{
imports = [ ];
options.me = {
rpcs3.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install rpcs3.";
};
};
config = lib.mkIf config.me.rpcs3.enable (
lib.mkMerge [
(lib.mkIf config.me.graphical {
home.packages = with pkgs; [
rpcs3
steam_rpcs3
];
# .config/rpcs3/config.yml
# .config/rpcs3/GuiConfigs/CurrentSettings.ini
home.persistence."/home/deck/.persist" = {
directories = [
{
directory = ".config/rpcs3/dev_hdd0";
method = "symlink";
}
{
directory = ".config/rpcs3/dev_hdd1";
method = "symlink";
}
{
directory = ".config/rpcs3/savestates";
method = "symlink";
}
{
directory = ".config/rpcs3/dev_usb000";
method = "symlink";
}
{
# Seems to be where the firmware is installed.
directory = ".config/rpcs3/dev_flash";
method = "symlink";
}
];
};
home.persistence."/home/deck/.state" = {
directories = [
{
directory = ".cache/rpcs3";
method = "symlink";
}
];
};
nixpkgs.overlays = [
(
final: prev:
let
optimizeWithFlags =
pkg: flags:
pkg.overrideAttrs (old: {
NIX_CFLAGS_COMPILE = [ (old.NIX_CFLAGS_COMPILE or "") ] ++ flags;
});
original_package =
if config.me.optimizations.enable then
(optimizeWithFlags prev.rpcs3 [
"-march=znver2"
"-mtune=znver2"
])
else
prev.rpcs3;
in
{
rpcs3 = pkgs.buildEnv {
name = prev.rpcs3.name;
paths = [
(config.lib.nixGL.wrap original_package)
];
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/rpcs3.desktop
'';
};
}
)
];
})
]
);
}

View File

@ -54,11 +54,30 @@ in
}; };
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: prev: { (
final: prev:
let
optimizeWithFlags =
pkg: flags:
pkg.overrideAttrs (old: {
NIX_CFLAGS_COMPILE = [ (old.NIX_CFLAGS_COMPILE or "") ] ++ flags;
});
original_package = prev.shipwright;
# Optimization is broken for shipwright, fails to build "The following attributes are overlapping"
# original_package =
# if !config.me.optimizations.enable then
# (optimizeWithFlags prev.shipwright [
# "-march=znver2"
# "-mtune=znver2"
# ])
# else
# prev.shipwright;
in
{
shipwright = pkgs.buildEnv { shipwright = pkgs.buildEnv {
name = prev.shipwright.name; name = prev.shipwright.name;
paths = [ paths = [
(config.lib.nixGL.wrap prev.shipwright) (config.lib.nixGL.wrap original_package)
]; ];
extraOutputsToInstall = [ extraOutputsToInstall = [
"man" "man"
@ -70,7 +89,8 @@ in
chmod 0555 $out/share/applications/soh.desktop chmod 0555 $out/share/applications/soh.desktop
''; '';
}; };
}) }
)
]; ];
}) })
] ]

View File

@ -52,7 +52,24 @@ in
}; };
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: prev: { (
final: prev:
let
optimizeWithFlags =
pkg: flags:
pkg.overrideAttrs (old: {
NIX_CFLAGS_COMPILE = [ (old.NIX_CFLAGS_COMPILE or "") ] ++ flags;
});
original_package =
if config.me.optimizations.enable then
(optimizeWithFlags prev.sm64ex [
"-march=znver2"
"-mtune=znver2"
])
else
prev.sm64ex;
in
{
sm64ex = sm64ex =
let let
desktop_item = pkgs.makeDesktopItem { desktop_item = pkgs.makeDesktopItem {
@ -70,7 +87,7 @@ in
pkgs.buildEnv { pkgs.buildEnv {
name = prev.sm64ex.name; name = prev.sm64ex.name;
paths = [ paths = [
(config.lib.nixGL.wrap prev.sm64ex) (config.lib.nixGL.wrap original_package)
]; ];
extraOutputsToInstall = [ extraOutputsToInstall = [
"man" "man"
@ -83,7 +100,8 @@ in
install -m 444 -D "${./files/icon.png}" $out/share/pixmaps/sm64ex.png install -m 444 -D "${./files/icon.png}" $out/share/pixmaps/sm64ex.png
''; '';
}; };
}) }
)
]; ];
}) })
] ]