Compare commits
5 Commits
15c209fdd9
...
3ecb2fc790
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3ecb2fc790 | ||
![]() |
44a49d7ac7 | ||
![]() |
acfc9ac1a4 | ||
![]() |
e733dcdcbf | ||
![]() |
3099a18424 |
@ -118,6 +118,14 @@
|
||||
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
|
||||
nix.gc = lib.mkIf (!config.me.buildingIso) {
|
||||
# Runs nix-collect-garbage --delete-older-than 5d
|
||||
@ -163,6 +171,7 @@
|
||||
doas-sudo-shim # To support --use-remote-sudo for remote builds
|
||||
dmidecode # Read SMBIOS information.
|
||||
ipcalc
|
||||
gptfdisk # for cgdisk
|
||||
];
|
||||
|
||||
services.openssh = {
|
||||
|
29
nix/configuration/flake.lock
generated
29
nix/configuration/flake.lock
generated
@ -135,11 +135,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1741955947,
|
||||
"narHash": "sha256-2lbURKclgKqBNm7hVRtWh0A7NrdsibD0EaWhahUVhhY=",
|
||||
"lastModified": 1742588233,
|
||||
"narHash": "sha256-Fi5g8H5FXMSRqy+mU6gPG0v+C9pzjYbkkiePtz8+PpA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "4e12151c9e014e2449e0beca2c0e9534b96a26b4",
|
||||
"rev": "296ddc64627f4a6a4eb447852d7346b9dd16197d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -191,11 +191,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1741851582,
|
||||
"narHash": "sha256-cPfs8qMccim2RBgtKGF+x9IBCduRvd/N5F4nYpU0TVE=",
|
||||
"lastModified": 1742422364,
|
||||
"narHash": "sha256-mNqIplmEohk5jRkqYqG19GA8MbQ/D4gQSK0Mu4LvfRQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6607cf789e541e7873d40d3a8f7815ea92204f32",
|
||||
"rev": "a84ebe20c6bc2ecbcfb000a50776219f48d134cc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -237,6 +237,22 @@
|
||||
"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": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
@ -272,6 +288,7 @@
|
||||
"lanzaboote": "lanzaboote",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-b93b4e9b5": "nixpkgs-b93b4e9b5",
|
||||
"nixpkgs-unoptimized": "nixpkgs-unoptimized",
|
||||
"zsh-histdb": "zsh-histdb"
|
||||
}
|
||||
},
|
||||
|
@ -32,6 +32,7 @@
|
||||
impermanence.url = "github:nix-community/impermanence";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
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.inputs.nixpkgs.follows = "nixpkgs";
|
||||
lanzaboote = {
|
||||
@ -58,6 +59,7 @@
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
nixpkgs-unoptimized,
|
||||
nixpkgs-b93b4e9b5,
|
||||
impermanence,
|
||||
home-manager,
|
||||
@ -73,6 +75,11 @@
|
||||
pkgs-b93b4e9b5 = import nixpkgs-b93b4e9b5 {
|
||||
inherit system;
|
||||
};
|
||||
pkgs-unoptimized = import nixpkgs-unoptimized {
|
||||
inherit system;
|
||||
hostPlatform.gcc.arch = "default";
|
||||
hostPlatform.gcc.tune = "default";
|
||||
};
|
||||
};
|
||||
modules = [
|
||||
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
|
||||
{
|
||||
@ -149,5 +180,7 @@
|
||||
iso.odo = systems.odo.iso.config.system.build.isoImage;
|
||||
nixosConfigurations.neelix = systems.neelix.main;
|
||||
iso.neelix = systems.neelix.iso.config.system.build.isoImage;
|
||||
nixosConfigurations.hydra = systems.hydra.main;
|
||||
iso.hydra = systems.hydra.iso.config.system.build.isoImage;
|
||||
};
|
||||
}
|
||||
|
32
nix/configuration/hosts/hydra/default.nix
Normal file
32
nix/configuration/hosts/hydra/default.nix
Normal 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"
|
||||
];
|
||||
}
|
140
nix/configuration/hosts/hydra/disk-config.nix
Normal file
140
nix/configuration/hosts/hydra/disk-config.nix
Normal 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"
|
||||
];
|
||||
}
|
39
nix/configuration/hosts/hydra/hardware-configuration.nix
Normal file
39
nix/configuration/hosts/hydra/hardware-configuration.nix
Normal 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";
|
||||
}
|
88
nix/configuration/hosts/hydra/optimized_build.nix
Normal file
88
nix/configuration/hosts/hydra/optimized_build.nix
Normal 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" ];
|
||||
})
|
||||
];
|
||||
}
|
@ -9,6 +9,7 @@
|
||||
./hardware-configuration.nix
|
||||
./disk-config.nix
|
||||
./optimized_build.nix
|
||||
./distributed_build.nix
|
||||
./power_management.nix
|
||||
./screen_brightness.nix
|
||||
./wifi.nix
|
||||
|
32
nix/configuration/hosts/odo/distributed_build.nix
Normal file
32
nix/configuration/hosts/odo/distributed_build.nix
Normal 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"
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
config,
|
||||
lib,
|
||||
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.
|
||||
# system.includeBuildDependencies = true;
|
||||
|
||||
# nixpkgs.hostPlatform = {
|
||||
# gcc.arch = "znver4";
|
||||
# gcc.tune = "znver4";
|
||||
# system = "x86_64-linux";
|
||||
# };
|
||||
nixpkgs.hostPlatform = {
|
||||
gcc.arch = "znver4";
|
||||
gcc.tune = "znver4";
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
|
||||
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;
|
||||
|
@ -28,4 +28,12 @@
|
||||
source = ./files/ssh_config;
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users.root =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.file.".ssh/config" = {
|
||||
source = ./files/ssh_config_root;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -30,5 +30,9 @@ Host brianai
|
||||
ProxyJump talexander@mrmanager
|
||||
HostName 10.215.1.215
|
||||
|
||||
Host hydra
|
||||
ProxyJump talexander@mrmanager
|
||||
HostName 10.215.1.219
|
||||
|
||||
Host *
|
||||
Compression yes
|
||||
|
9
nix/configuration/roles/ssh/files/ssh_config_root
Normal file
9
nix/configuration/roles/ssh/files/ssh_config_root
Normal 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
|
@ -2,6 +2,7 @@
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
pkgs-unoptimized,
|
||||
...
|
||||
}:
|
||||
|
||||
@ -23,7 +24,7 @@
|
||||
environment.systemPackages = with pkgs; [
|
||||
wabt
|
||||
wasm-bindgen-cli
|
||||
binaryen # for wasm-opt
|
||||
pkgs-unoptimized.binaryen # for wasm-opt
|
||||
];
|
||||
}
|
||||
]
|
||||
|
@ -8,8 +8,10 @@
|
||||
{
|
||||
imports = [
|
||||
./roles/2ship2harkinian
|
||||
./roles/global_options
|
||||
./roles/graphics
|
||||
./roles/pcsx2
|
||||
./roles/rpcs3
|
||||
./roles/shipwright
|
||||
./roles/sm64ex
|
||||
./roles/steam_rom_manager
|
||||
|
@ -10,7 +10,9 @@
|
||||
|
||||
config = {
|
||||
me.graphical = true;
|
||||
me.optimizations.enable = true;
|
||||
me.pcsx2.enable = true;
|
||||
me.rpcs3.enable = true;
|
||||
me.ship2harkinian.enable = true;
|
||||
me.shipwright.enable = true;
|
||||
me.sm64ex.enable = true;
|
||||
|
@ -54,23 +54,41 @@ in
|
||||
};
|
||||
|
||||
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
|
||||
'';
|
||||
};
|
||||
})
|
||||
(
|
||||
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 {
|
||||
name = prev._2ship2harkinian.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/2s2h.desktop
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
})
|
||||
]
|
||||
|
@ -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).";
|
||||
};
|
||||
};
|
||||
}
|
@ -70,23 +70,41 @@ in
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
pcsx2 = pkgs.buildEnv {
|
||||
name = prev.pcsx2.name;
|
||||
paths = [
|
||||
(config.lib.nixGL.wrap prev.pcsx2)
|
||||
];
|
||||
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/PCSX2.desktop
|
||||
'';
|
||||
};
|
||||
})
|
||||
(
|
||||
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 {
|
||||
name = prev.pcsx2.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/PCSX2.desktop
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
})
|
||||
]
|
||||
|
112
nix/steam_deck/configuration/roles/rpcs3/default.nix
Normal file
112
nix/steam_deck/configuration/roles/rpcs3/default.nix
Normal 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
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
@ -54,23 +54,43 @@ in
|
||||
};
|
||||
|
||||
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
|
||||
'';
|
||||
};
|
||||
})
|
||||
(
|
||||
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 {
|
||||
name = prev.shipwright.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/soh.desktop
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
})
|
||||
]
|
||||
|
@ -52,38 +52,56 @@ in
|
||||
};
|
||||
|
||||
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"
|
||||
(
|
||||
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 =
|
||||
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 original_package)
|
||||
];
|
||||
icon = "sm64ex";
|
||||
type = "Application";
|
||||
exec = "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
|
||||
'';
|
||||
};
|
||||
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
|
||||
'';
|
||||
};
|
||||
})
|
||||
}
|
||||
)
|
||||
];
|
||||
})
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user