Compare commits
21 Commits
3e80452235
...
install_fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
504f8ecf09 | ||
|
|
7254bc8c7c | ||
|
|
a32f6bf0d1 | ||
|
|
996cb27a89 | ||
|
|
9008d9b7c6 | ||
|
|
38a1168a32 | ||
|
|
3a4344a112 | ||
|
|
18cb758986 | ||
|
|
e28c7f8968 | ||
|
|
5c17148635 | ||
|
|
199bb38dfb | ||
|
|
5af4a95940 | ||
|
|
daf35778c5 | ||
|
|
1866cf6290 | ||
|
|
23ef4d50b9 | ||
|
|
4aec400388 | ||
|
|
f211282376 | ||
|
|
96a96a0bc4 | ||
|
|
554a6aff65 | ||
|
|
14c5c7d0fd | ||
|
|
22f9a0efcd |
@@ -32,6 +32,7 @@
|
|||||||
./roles/graphics
|
./roles/graphics
|
||||||
./roles/hydra
|
./roles/hydra
|
||||||
./roles/iso
|
./roles/iso
|
||||||
|
./roles/iso_mount
|
||||||
./roles/kanshi
|
./roles/kanshi
|
||||||
./roles/kodi
|
./roles/kodi
|
||||||
./roles/kubernetes
|
./roles/kubernetes
|
||||||
@@ -44,10 +45,12 @@
|
|||||||
./roles/nix_index
|
./roles/nix_index
|
||||||
./roles/nix_worker
|
./roles/nix_worker
|
||||||
./roles/nvme
|
./roles/nvme
|
||||||
|
./roles/optimized_build
|
||||||
./roles/pcsx2
|
./roles/pcsx2
|
||||||
./roles/python
|
./roles/python
|
||||||
./roles/qemu
|
./roles/qemu
|
||||||
./roles/reset
|
./roles/reset
|
||||||
|
./roles/rpcs3
|
||||||
./roles/rust
|
./roles/rust
|
||||||
./roles/shikane
|
./roles/shikane
|
||||||
./roles/shipwright
|
./roles/shipwright
|
||||||
@@ -69,9 +72,14 @@
|
|||||||
./roles/zfs
|
./roles/zfs
|
||||||
./roles/zrepl
|
./roles/zrepl
|
||||||
./roles/zsh
|
./roles/zsh
|
||||||
|
./util/install_files
|
||||||
./util/unfree_polyfill
|
./util/unfree_polyfill
|
||||||
];
|
];
|
||||||
|
|
||||||
|
me.install.user.talexander.file."/home/talexander/flake.nix" = {
|
||||||
|
source = ./flake.nix;
|
||||||
|
};
|
||||||
|
|
||||||
nix.settings.experimental-features = [
|
nix.settings.experimental-features = [
|
||||||
"nix-command"
|
"nix-command"
|
||||||
"flakes"
|
"flakes"
|
||||||
@@ -84,6 +92,16 @@
|
|||||||
# Use nixos-rebuild-ng
|
# Use nixos-rebuild-ng
|
||||||
# system.rebuild.enableNg = true;
|
# system.rebuild.enableNg = true;
|
||||||
|
|
||||||
|
# Keep outputs so we can build offline.
|
||||||
|
nix.extraOptions = ''
|
||||||
|
keep-outputs = true
|
||||||
|
keep-derivations = true
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Technically only needed when building the ISO because nix detects ZFS in the filesystem list normally. I basically always want this so I'm just setting it to always be on.
|
||||||
|
boot.supportedFilesystems.zfs = true;
|
||||||
|
# TODO: Is this different from boot.supportedFilesystems = [ "zfs" ]; ?
|
||||||
|
|
||||||
services.getty = {
|
services.getty = {
|
||||||
autologinUser = "talexander"; # I use full disk encryption so the user password is irrelevant.
|
autologinUser = "talexander"; # I use full disk encryption so the user password is irrelevant.
|
||||||
autologinOnce = true;
|
autologinOnce = true;
|
||||||
|
|||||||
24
nix/configuration/flake.lock
generated
24
nix/configuration/flake.lock
generated
@@ -39,11 +39,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1745812220,
|
"lastModified": 1746729224,
|
||||||
"narHash": "sha256-hotBG0EJ9VmAHJYF0yhWuTVZpENHvwcJ2SxvIPrXm+g=",
|
"narHash": "sha256-9R4sOLAK1w3Bq54H3XOJogdc7a6C2bLLmatOQ+5pf5w=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "disko",
|
"repo": "disko",
|
||||||
"rev": "d0c543d740fad42fe2c035b43c9d41127e073c78",
|
"rev": "85555d27ded84604ad6657ecca255a03fd878607",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -154,11 +154,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1746369725,
|
"lastModified": 1746981801,
|
||||||
"narHash": "sha256-m3ai7LLFYsymMK0uVywCceWfUhP0k3CALyFOfcJACqE=",
|
"narHash": "sha256-+Bfr0KqZV6gZdA7e2kupeoawozaLIHLuiPtC54uxbFc=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "1a1793f6d940d22c6e49753548c5b6cb7dc5545d",
|
"rev": "ff915842e4a2e63c4c8c5c08c6870b9d5b3c3ee9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -210,11 +210,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1746232882,
|
"lastModified": 1746663147,
|
||||||
"narHash": "sha256-MHmBH2rS8KkRRdoU/feC/dKbdlMkcNkB5mwkuipVHeQ=",
|
"narHash": "sha256-Ua0drDHawlzNqJnclTJGf87dBmaO/tn7iZ+TCkTRpRc=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "7a2622e2c0dbad5c4493cb268aba12896e28b008",
|
"rev": "dda3dcd3fe03e991015e9a74b22d35950f264a54",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -258,11 +258,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-unoptimized": {
|
"nixpkgs-unoptimized": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1746232882,
|
"lastModified": 1746663147,
|
||||||
"narHash": "sha256-MHmBH2rS8KkRRdoU/feC/dKbdlMkcNkB5mwkuipVHeQ=",
|
"narHash": "sha256-Ua0drDHawlzNqJnclTJGf87dBmaO/tn7iZ+TCkTRpRc=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "7a2622e2c0dbad5c4493cb268aba12896e28b008",
|
"rev": "dda3dcd3fe03e991015e9a74b22d35950f264a54",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -36,9 +36,24 @@
|
|||||||
time.timeZone = "America/New_York";
|
time.timeZone = "America/New_York";
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
|
||||||
me.optimizations.enable = true;
|
|
||||||
me.secureBoot.enable = false;
|
me.secureBoot.enable = false;
|
||||||
|
|
||||||
|
me.optimizations = {
|
||||||
|
enable = true;
|
||||||
|
arch = "znver4";
|
||||||
|
system_features = [
|
||||||
|
"gccarch-znver4"
|
||||||
|
"gccarch-skylake"
|
||||||
|
# "gccarch-alderlake" missing WAITPKG
|
||||||
|
"gccarch-x86-64-v3"
|
||||||
|
"gccarch-x86-64-v4"
|
||||||
|
"benchmark"
|
||||||
|
"big-parallel"
|
||||||
|
"kvm"
|
||||||
|
"nixos-test"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# Mount tmpfs at /tmp
|
# Mount tmpfs at /tmp
|
||||||
boot.tmp.useTmpfs = true;
|
boot.tmp.useTmpfs = true;
|
||||||
|
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
{
|
|
||||||
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"
|
|
||||||
];
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = {
|
|
||||||
gcc.arch = "znver4";
|
|
||||||
gcc.tune = "znver4";
|
|
||||||
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_14 [
|
|
||||||
"-march=znver4"
|
|
||||||
"-mtune=znver4"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_znver4;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -24,7 +24,6 @@
|
|||||||
imports = [
|
imports = [
|
||||||
./wrapped-disk-config.nix
|
./wrapped-disk-config.nix
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./optimized_build.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
|
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
|
||||||
@@ -35,9 +34,24 @@
|
|||||||
time.timeZone = "America/New_York";
|
time.timeZone = "America/New_York";
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
|
||||||
me.optimizations.enable = false;
|
|
||||||
me.secureBoot.enable = true;
|
me.secureBoot.enable = true;
|
||||||
|
|
||||||
|
me.optimizations = {
|
||||||
|
enable = false;
|
||||||
|
arch = "znver4";
|
||||||
|
system_features = [
|
||||||
|
"gccarch-znver4"
|
||||||
|
"gccarch-skylake"
|
||||||
|
# "gccarch-alderlake" missing WAITPKG
|
||||||
|
"gccarch-x86-64-v3"
|
||||||
|
"gccarch-x86-64-v4"
|
||||||
|
"benchmark"
|
||||||
|
"big-parallel"
|
||||||
|
"kvm"
|
||||||
|
"nixos-test"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# Mount tmpfs at /tmp
|
# Mount tmpfs at /tmp
|
||||||
boot.tmp.useTmpfs = true;
|
boot.tmp.useTmpfs = true;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
imports = [
|
imports = [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./disk-config.nix
|
./disk-config.nix
|
||||||
./optimized_build.nix
|
|
||||||
./power_management.nix
|
./power_management.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -15,9 +14,22 @@
|
|||||||
time.timeZone = "America/New_York";
|
time.timeZone = "America/New_York";
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
|
||||||
me.optimizations.enable = false;
|
|
||||||
me.secureBoot.enable = false;
|
me.secureBoot.enable = false;
|
||||||
|
|
||||||
|
me.optimizations = {
|
||||||
|
enable = false;
|
||||||
|
arch = "alderlake";
|
||||||
|
system_features = [
|
||||||
|
"gccarch-alderlake"
|
||||||
|
"gccarch-x86-64-v3"
|
||||||
|
"gccarch-x86-64-v4"
|
||||||
|
"benchmark"
|
||||||
|
"big-parallel"
|
||||||
|
"kvm"
|
||||||
|
"nixos-test"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# Early KMS
|
# Early KMS
|
||||||
boot.initrd.kernelModules = [ "i915" ];
|
boot.initrd.kernelModules = [ "i915" ];
|
||||||
|
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
imports = [ ];
|
|
||||||
|
|
||||||
config = lib.mkMerge [
|
|
||||||
{ }
|
|
||||||
(lib.mkIf (!config.me.optimizations.enable) {
|
|
||||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_6_13;
|
|
||||||
})
|
|
||||||
(lib.mkIf (config.me.optimizations.enable) {
|
|
||||||
nixpkgs.hostPlatform = {
|
|
||||||
gcc.arch = "alderlake";
|
|
||||||
gcc.tune = "alderlake";
|
|
||||||
system = "x86_64-linux";
|
|
||||||
};
|
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
(
|
|
||||||
self: super:
|
|
||||||
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_me =
|
|
||||||
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 super.linux_6_12 [
|
|
||||||
"-march=alderlake"
|
|
||||||
"-mtune=alderlake"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_me;
|
|
||||||
})
|
|
||||||
(lib.mkIf (!config.me.buildingIso) {
|
|
||||||
nix.settings.system-features = lib.mkForce [
|
|
||||||
"gccarch-alderlake"
|
|
||||||
"gccarch-x86-64-v3"
|
|
||||||
"benchmark"
|
|
||||||
"big-parallel"
|
|
||||||
"kvm"
|
|
||||||
"nixos-test"
|
|
||||||
];
|
|
||||||
})
|
|
||||||
(lib.mkIf (config.me.buildingIso) {
|
|
||||||
boot.supportedFilesystems = [ "zfs" ];
|
|
||||||
})
|
|
||||||
];
|
|
||||||
}
|
|
||||||
12
nix/configuration/hosts/odo/SELF_BUILD
Executable file
12
nix/configuration/hosts/odo/SELF_BUILD
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
: "${JOBS:="1"}"
|
||||||
|
|
||||||
|
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||||
|
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||||
|
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||||
|
nixos-rebuild build --show-trace --use-remote-sudo --max-jobs "$JOBS" --flake "$DIR/../../#odo" "${@}" |& nom
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
imports = [
|
imports = [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./wrapped-disk-config.nix
|
./wrapped-disk-config.nix
|
||||||
./optimized_build.nix
|
|
||||||
./distributed_build.nix
|
./distributed_build.nix
|
||||||
./power_management.nix
|
./power_management.nix
|
||||||
./screen_brightness.nix
|
./screen_brightness.nix
|
||||||
@@ -24,9 +23,24 @@
|
|||||||
time.timeZone = "America/New_York";
|
time.timeZone = "America/New_York";
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
|
||||||
me.optimizations.enable = true;
|
|
||||||
me.secureBoot.enable = true;
|
me.secureBoot.enable = true;
|
||||||
|
|
||||||
|
me.optimizations = {
|
||||||
|
enable = true;
|
||||||
|
arch = "znver4";
|
||||||
|
system_features = [
|
||||||
|
"gccarch-znver4"
|
||||||
|
"gccarch-skylake"
|
||||||
|
# "gccarch-alderlake" missing WAITPKG
|
||||||
|
"gccarch-x86-64-v3"
|
||||||
|
"gccarch-x86-64-v4"
|
||||||
|
"benchmark"
|
||||||
|
"big-parallel"
|
||||||
|
"kvm"
|
||||||
|
"nixos-test"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# Early KMS
|
# Early KMS
|
||||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||||
|
|
||||||
@@ -61,6 +75,7 @@
|
|||||||
me.gpg.enable = true;
|
me.gpg.enable = true;
|
||||||
me.graphical = true;
|
me.graphical = true;
|
||||||
me.graphics_card_type = "amd";
|
me.graphics_card_type = "amd";
|
||||||
|
me.iso_mount.enable = true;
|
||||||
me.kanshi.enable = false;
|
me.kanshi.enable = false;
|
||||||
me.kubernetes.enable = true;
|
me.kubernetes.enable = true;
|
||||||
me.latex.enable = true;
|
me.latex.enable = true;
|
||||||
@@ -71,6 +86,7 @@
|
|||||||
me.pcsx2.enable = true;
|
me.pcsx2.enable = true;
|
||||||
me.python.enable = true;
|
me.python.enable = true;
|
||||||
me.qemu.enable = true;
|
me.qemu.enable = true;
|
||||||
|
me.rpcs3.enable = true;
|
||||||
me.rust.enable = true;
|
me.rust.enable = true;
|
||||||
me.shikane.enable = true;
|
me.shikane.enable = true;
|
||||||
me.sops.enable = true;
|
me.sops.enable = true;
|
||||||
|
|||||||
@@ -1,131 +0,0 @@
|
|||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
pkgs-unoptimized,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
imports = [ ];
|
|
||||||
|
|
||||||
config = lib.mkMerge [
|
|
||||||
{ }
|
|
||||||
(lib.mkIf (!config.me.optimizations.enable) {
|
|
||||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_6_14;
|
|
||||||
})
|
|
||||||
(lib.mkIf (config.me.optimizations.enable) {
|
|
||||||
nixpkgs.hostPlatform = {
|
|
||||||
gcc.arch = "znver4";
|
|
||||||
gcc.tune = "znver4";
|
|
||||||
system = "x86_64-linux";
|
|
||||||
};
|
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
(
|
|
||||||
final: prev:
|
|
||||||
let
|
|
||||||
addConfig =
|
|
||||||
additionalConfig: pkg:
|
|
||||||
pkg.override (oldconfig: {
|
|
||||||
structuredExtraConfig = pkg.structuredExtraConfig // additionalConfig;
|
|
||||||
});
|
|
||||||
in
|
|
||||||
{
|
|
||||||
linux_me = 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;
|
|
||||||
} prev.linux_6_14;
|
|
||||||
# gsl = prev.gsl.overrideAttrs (old: {
|
|
||||||
# # gsl tests fails when optimizations are enabled.
|
|
||||||
# # > FAIL: cholesky_invert unscaled hilbert ( 4, 4)[0,2]: 2.55795384873636067e-13 0
|
|
||||||
# # > (2.55795384873636067e-13 observed vs 0 expected) [28259614]
|
|
||||||
# doCheck = false;
|
|
||||||
# });
|
|
||||||
}
|
|
||||||
)
|
|
||||||
(final: prev: {
|
|
||||||
haskellPackages = prev.haskellPackages.extend (
|
|
||||||
final': prev': {
|
|
||||||
inherit (pkgs-unoptimized.haskellPackages)
|
|
||||||
crypton
|
|
||||||
crypton-connection
|
|
||||||
crypton-x509
|
|
||||||
crypton-x509-store
|
|
||||||
crypton-x509-system
|
|
||||||
crypton-x509-validation
|
|
||||||
hspec-wai
|
|
||||||
http-client-tls
|
|
||||||
http2
|
|
||||||
pandoc
|
|
||||||
pandoc-cli
|
|
||||||
pandoc-lua-engine
|
|
||||||
pandoc-server
|
|
||||||
servant-server
|
|
||||||
tls
|
|
||||||
wai-app-static
|
|
||||||
wai-extra
|
|
||||||
warp
|
|
||||||
;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
})
|
|
||||||
(final: prev: {
|
|
||||||
inherit (pkgs-unoptimized)
|
|
||||||
gsl
|
|
||||||
redis
|
|
||||||
valkey
|
|
||||||
;
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_me;
|
|
||||||
})
|
|
||||||
(lib.mkIf (!config.me.buildingIso) {
|
|
||||||
nix.settings.system-features = lib.mkForce [
|
|
||||||
"gccarch-znver4"
|
|
||||||
"gccarch-skylake"
|
|
||||||
# "gccarch-alderlake" missing WAITPKG
|
|
||||||
"gccarch-x86-64-v3"
|
|
||||||
"gccarch-x86-64-v4"
|
|
||||||
"benchmark"
|
|
||||||
"big-parallel"
|
|
||||||
"kvm"
|
|
||||||
"nixos-test"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Keep ALL dependencies so we can rebuild offline. This DRASTICALLY increase disk usage, but disk space is cheap.
|
|
||||||
# system.includeBuildDependencies = true;
|
|
||||||
|
|
||||||
# This also should enable building offline? TODO: test.
|
|
||||||
nix.extraOptions = ''
|
|
||||||
keep-outputs = true
|
|
||||||
keep-derivations = true
|
|
||||||
'';
|
|
||||||
|
|
||||||
# # building ON
|
|
||||||
# nixpkgs.localSystem = { system = "aarch64-linux"; };
|
|
||||||
# # building FOR
|
|
||||||
# nixpkgs.crossSystem = { system = "aarch64-linux"; };
|
|
||||||
|
|
||||||
# nixpkgs.config = {
|
|
||||||
# replaceStdenv = ({ pkgs }: pkgs.clangStdenv);
|
|
||||||
# };
|
|
||||||
# or maybe an overlay
|
|
||||||
# stdenv = prev.clangStdenv;
|
|
||||||
|
|
||||||
})
|
|
||||||
(lib.mkIf (config.me.buildingIso) {
|
|
||||||
boot.supportedFilesystems.zfs = true;
|
|
||||||
})
|
|
||||||
];
|
|
||||||
}
|
|
||||||
12
nix/configuration/hosts/quark/SELF_BUILD
Executable file
12
nix/configuration/hosts/quark/SELF_BUILD
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
: "${JOBS:="1"}"
|
||||||
|
|
||||||
|
nix flake update zsh-histdb --flake "$DIR/../../"
|
||||||
|
nix flake update ansible-sshjail --flake "$DIR/../../"
|
||||||
|
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||||
|
nixos-rebuild build --show-trace --use-remote-sudo --max-jobs "$JOBS" --flake "$DIR/../../#quark" "${@}" |& nom
|
||||||
@@ -9,11 +9,11 @@
|
|||||||
./disk-config.nix
|
./disk-config.nix
|
||||||
./distributed_build.nix
|
./distributed_build.nix
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./optimized_build.nix
|
|
||||||
./power_management.nix
|
./power_management.nix
|
||||||
./wifi.nix
|
./wifi.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
config = {
|
||||||
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
|
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
|
||||||
networking.hostId = "47ee7d7c";
|
networking.hostId = "47ee7d7c";
|
||||||
|
|
||||||
@@ -22,9 +22,25 @@
|
|||||||
time.timeZone = "America/New_York";
|
time.timeZone = "America/New_York";
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
|
||||||
me.optimizations.enable = true;
|
|
||||||
me.secureBoot.enable = true;
|
me.secureBoot.enable = true;
|
||||||
|
|
||||||
|
me.optimizations = {
|
||||||
|
enable = true;
|
||||||
|
arch = "znver5";
|
||||||
|
system_features = [
|
||||||
|
"gccarch-znver4"
|
||||||
|
"gccarch-znver5"
|
||||||
|
"gccarch-skylake"
|
||||||
|
# "gccarch-alderlake" missing WAITPKG
|
||||||
|
"gccarch-x86-64-v3"
|
||||||
|
"gccarch-x86-64-v4"
|
||||||
|
"benchmark"
|
||||||
|
"big-parallel"
|
||||||
|
"kvm"
|
||||||
|
"nixos-test"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# Early KMS
|
# Early KMS
|
||||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||||
|
|
||||||
@@ -34,6 +50,9 @@
|
|||||||
# Enable TRIM
|
# Enable TRIM
|
||||||
# services.fstrim.enable = lib.mkDefault true;
|
# services.fstrim.enable = lib.mkDefault true;
|
||||||
|
|
||||||
|
# RPCS3 has difficulty with znver5
|
||||||
|
me.rpcs3.config.Core."Use LLVM CPU" = "znver4";
|
||||||
|
|
||||||
me.alacritty.enable = true;
|
me.alacritty.enable = true;
|
||||||
me.ansible.enable = true;
|
me.ansible.enable = true;
|
||||||
me.ares.enable = true;
|
me.ares.enable = true;
|
||||||
@@ -51,6 +70,7 @@
|
|||||||
me.gpg.enable = true;
|
me.gpg.enable = true;
|
||||||
me.graphical = true;
|
me.graphical = true;
|
||||||
me.graphics_card_type = "amd";
|
me.graphics_card_type = "amd";
|
||||||
|
me.iso_mount.enable = true;
|
||||||
me.kanshi.enable = false;
|
me.kanshi.enable = false;
|
||||||
me.kubernetes.enable = true;
|
me.kubernetes.enable = true;
|
||||||
me.latex.enable = true;
|
me.latex.enable = true;
|
||||||
@@ -62,6 +82,7 @@
|
|||||||
me.pcsx2.enable = true;
|
me.pcsx2.enable = true;
|
||||||
me.python.enable = true;
|
me.python.enable = true;
|
||||||
me.qemu.enable = true;
|
me.qemu.enable = true;
|
||||||
|
me.rpcs3.enable = true;
|
||||||
me.rust.enable = true;
|
me.rust.enable = true;
|
||||||
me.shikane.enable = true;
|
me.shikane.enable = true;
|
||||||
me.sops.enable = true;
|
me.sops.enable = true;
|
||||||
@@ -88,4 +109,5 @@
|
|||||||
me.sm64ex.enable = true;
|
me.sm64ex.enable = true;
|
||||||
me.shipwright.enable = true;
|
me.shipwright.enable = true;
|
||||||
me.ship2harkinian.enable = true;
|
me.ship2harkinian.enable = true;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,5 @@
|
|||||||
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
|
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
|
||||||
# networking.interfaces.wlp58s0.useDHCP = lib.mkDefault true;
|
# networking.interfaces.wlp58s0.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,126 +0,0 @@
|
|||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
pkgs-unoptimized,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
imports = [ ];
|
|
||||||
|
|
||||||
config = lib.mkMerge [
|
|
||||||
{ }
|
|
||||||
(lib.mkIf (!config.me.optimizations.enable) {
|
|
||||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_6_14;
|
|
||||||
})
|
|
||||||
(lib.mkIf (config.me.optimizations.enable) {
|
|
||||||
nixpkgs.hostPlatform = {
|
|
||||||
gcc.arch = "znver5";
|
|
||||||
gcc.tune = "znver5";
|
|
||||||
system = "x86_64-linux";
|
|
||||||
};
|
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
(
|
|
||||||
final: prev:
|
|
||||||
let
|
|
||||||
addConfig =
|
|
||||||
additionalConfig: pkg:
|
|
||||||
pkg.override (oldconfig: {
|
|
||||||
structuredExtraConfig = pkg.structuredExtraConfig // additionalConfig;
|
|
||||||
});
|
|
||||||
in
|
|
||||||
{
|
|
||||||
linux_me = 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;
|
|
||||||
} prev.linux_6_14;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
(final: prev: {
|
|
||||||
haskellPackages = prev.haskellPackages.extend (
|
|
||||||
final': prev': {
|
|
||||||
inherit (pkgs-unoptimized.haskellPackages)
|
|
||||||
crypton
|
|
||||||
crypton-connection
|
|
||||||
crypton-x509
|
|
||||||
crypton-x509-store
|
|
||||||
crypton-x509-system
|
|
||||||
crypton-x509-validation
|
|
||||||
hspec-wai
|
|
||||||
http-client-tls
|
|
||||||
http2
|
|
||||||
pandoc
|
|
||||||
pandoc-cli
|
|
||||||
pandoc-lua-engine
|
|
||||||
pandoc-server
|
|
||||||
servant-server
|
|
||||||
tls
|
|
||||||
wai-app-static
|
|
||||||
wai-extra
|
|
||||||
warp
|
|
||||||
;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
})
|
|
||||||
(final: prev: {
|
|
||||||
inherit (pkgs-unoptimized)
|
|
||||||
gsl
|
|
||||||
redis
|
|
||||||
valkey
|
|
||||||
;
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_me;
|
|
||||||
})
|
|
||||||
(lib.mkIf (!config.me.buildingIso) {
|
|
||||||
nix.settings.system-features = lib.mkForce [
|
|
||||||
"gccarch-znver4"
|
|
||||||
"gccarch-znver5"
|
|
||||||
"gccarch-skylake"
|
|
||||||
# "gccarch-alderlake" missing WAITPKG
|
|
||||||
"gccarch-x86-64-v3"
|
|
||||||
"gccarch-x86-64-v4"
|
|
||||||
"benchmark"
|
|
||||||
"big-parallel"
|
|
||||||
"kvm"
|
|
||||||
"nixos-test"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Keep ALL dependencies so we can rebuild offline. This DRASTICALLY increase disk usage, but disk space is cheap.
|
|
||||||
# system.includeBuildDependencies = true;
|
|
||||||
|
|
||||||
# This also should enable building offline? TODO: test.
|
|
||||||
nix.extraOptions = ''
|
|
||||||
keep-outputs = true
|
|
||||||
keep-derivations = true
|
|
||||||
'';
|
|
||||||
|
|
||||||
# # building ON
|
|
||||||
# nixpkgs.localSystem = { system = "aarch64-linux"; };
|
|
||||||
# # building FOR
|
|
||||||
# nixpkgs.crossSystem = { system = "aarch64-linux"; };
|
|
||||||
|
|
||||||
# nixpkgs.config = {
|
|
||||||
# replaceStdenv = ({ pkgs }: pkgs.clangStdenv);
|
|
||||||
# };
|
|
||||||
# or maybe an overlay
|
|
||||||
# stdenv = prev.clangStdenv;
|
|
||||||
|
|
||||||
})
|
|
||||||
(lib.mkIf (config.me.buildingIso) {
|
|
||||||
boot.supportedFilesystems.zfs = true;
|
|
||||||
})
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# Check memory errors with: ras-mc-ctl --error-count
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ in
|
|||||||
"doc"
|
"doc"
|
||||||
"info"
|
"info"
|
||||||
];
|
];
|
||||||
buildInputs = [ final.makeWrapper ];
|
nativeBuildInputs = [ final.makeWrapper ];
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
wrapProgram $out/bin/emacs --prefix PATH : ${
|
wrapProgram $out/bin/emacs --prefix PATH : ${
|
||||||
lib.makeBinPath [
|
lib.makeBinPath [
|
||||||
|
|||||||
@@ -60,8 +60,8 @@
|
|||||||
(unless (treesit-ready-p 'rust) (treesit-install-language-grammar 'rust))
|
(unless (treesit-ready-p 'rust) (treesit-install-language-grammar 'rust))
|
||||||
:config
|
:config
|
||||||
;; Add keybindings for interacting with Cargo
|
;; Add keybindings for interacting with Cargo
|
||||||
(use-package cargo
|
;; (use-package cargo
|
||||||
:hook (rust-ts-mode . cargo-minor-mode))
|
;; :hook (rust-ts-mode . cargo-minor-mode))
|
||||||
)
|
)
|
||||||
|
|
||||||
(use-package toml-ts-mode
|
(use-package toml-ts-mode
|
||||||
|
|||||||
@@ -8,15 +8,6 @@
|
|||||||
{
|
{
|
||||||
imports = [ ];
|
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).";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# options.me.graphics_card_type = lib.mkOption {
|
# options.me.graphics_card_type = lib.mkOption {
|
||||||
# type = lib.types.nullOr (
|
# type = lib.types.nullOr (
|
||||||
# lib.types.enum [
|
# lib.types.enum [
|
||||||
|
|||||||
45
nix/configuration/roles/iso_mount/default.nix
Normal file
45
nix/configuration/roles/iso_mount/default.nix
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
iso_mount =
|
||||||
|
(pkgs.writeScriptBin "iso_mount" (builtins.readFile ./files/iso_mount.bash)).overrideAttrs
|
||||||
|
(old: {
|
||||||
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||||
|
|
||||||
|
});
|
||||||
|
iso_unmount =
|
||||||
|
(pkgs.writeScriptBin "iso_unmount" (builtins.readFile ./files/iso_unmount.bash)).overrideAttrs
|
||||||
|
(old: {
|
||||||
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
iso_mount.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install iso_mount.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.iso_mount.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
environment.systemPackages = [
|
||||||
|
iso_mount
|
||||||
|
iso_unmount
|
||||||
|
];
|
||||||
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
8
nix/configuration/roles/iso_mount/files/iso_mount.bash
Normal file
8
nix/configuration/roles/iso_mount/files/iso_mount.bash
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Mount a full-disk image as a loopback device so you can mount individual partitions from inside of it.
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
exec udisksctl loop-setup -r -f "${@}"
|
||||||
8
nix/configuration/roles/iso_mount/files/iso_unmount.bash
Normal file
8
nix/configuration/roles/iso_mount/files/iso_unmount.bash
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Mount a full-disk image as a loopback device so you can mount individual partitions from inside of it.
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
exec udisksctl loop-delete "${@}"
|
||||||
@@ -33,7 +33,7 @@ let
|
|||||||
.overrideAttrs
|
.overrideAttrs
|
||||||
(old: {
|
(old: {
|
||||||
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||||
buildInputs = [ pkgs.makeWrapper ];
|
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
wrapProgram $out/bin/decrypt_k8s_secret --prefix PATH : ${
|
wrapProgram $out/bin/decrypt_k8s_secret --prefix PATH : ${
|
||||||
lib.makeBinPath [
|
lib.makeBinPath [
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||||||
|
|
||||||
: ${VIDEO_BITRATE:="1M"} # Only for encoding modes targeting bitrate
|
: ${VIDEO_BITRATE:="1M"} # Only for encoding modes targeting bitrate
|
||||||
: ${AUDIO_BITRATE:="192k"}
|
: ${AUDIO_BITRATE:="192k"}
|
||||||
|
: ${SPEED:="1"}
|
||||||
|
|
||||||
############## Setup #########################
|
############## Setup #########################
|
||||||
|
|
||||||
@@ -62,6 +63,8 @@ function copy {
|
|||||||
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# benchmark vulkan decode:
|
||||||
|
# ffmpeg -init_hw_device "vulkan=vk:0" -hwaccel vulkan -hwaccel_output_format vulkan -i INPUT -f null - -benchmark
|
||||||
function convert {
|
function convert {
|
||||||
local args=()
|
local args=()
|
||||||
local acceleration_type="$1" # "software" or "hardware"
|
local acceleration_type="$1" # "software" or "hardware"
|
||||||
@@ -99,11 +102,23 @@ function convert {
|
|||||||
if [ "$acceleration_type" == "software" ]; then
|
if [ "$acceleration_type" == "software" ]; then
|
||||||
true
|
true
|
||||||
elif [ "$acceleration_type" == "hardware" ]; then
|
elif [ "$acceleration_type" == "hardware" ]; then
|
||||||
|
if [ "$codec" == "h264" ]; then
|
||||||
|
args+=(-init_hw_device vulkan)
|
||||||
|
elif [ "$codec" == "av1" ]; then
|
||||||
args+=(-vaapi_device /dev/dri/renderD128)
|
args+=(-vaapi_device /dev/dri/renderD128)
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
args+=(-i "$file_to_cast")
|
args+=(-i "$file_to_cast")
|
||||||
|
|
||||||
|
if [ "$SPEED" != "1" ]; then
|
||||||
|
local audio_speed video_speed
|
||||||
|
video_speed=$(bc -l <<< "1/${SPEED}")
|
||||||
|
audio_speed=$(bc -l <<< "${SPEED}/1")
|
||||||
|
args+=(-filter:v "setpts=${video_speed}*PTS")
|
||||||
|
args+=(-filter:a "atempo=${audio_speed}")
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$codec" == "h264" ]; then
|
if [ "$codec" == "h264" ]; then
|
||||||
if [ "$acceleration_type" == "software" ]; then
|
if [ "$acceleration_type" == "software" ]; then
|
||||||
args+=(-c:v h264)
|
args+=(-c:v h264)
|
||||||
@@ -111,7 +126,7 @@ function convert {
|
|||||||
args+=(-b:v "$VIDEO_BITRATE")
|
args+=(-b:v "$VIDEO_BITRATE")
|
||||||
elif [ "$acceleration_type" == "hardware" ]; then
|
elif [ "$acceleration_type" == "hardware" ]; then
|
||||||
args+=(-vf 'format=nv12|vaapi,hwupload')
|
args+=(-vf 'format=nv12|vaapi,hwupload')
|
||||||
args+=(-c:v h264_vaapi)
|
args+=(-c:v h264_vulkan)
|
||||||
args+=(-profile:v high)
|
args+=(-profile:v high)
|
||||||
args+=(-b:v "$VIDEO_BITRATE")
|
args+=(-b:v "$VIDEO_BITRATE")
|
||||||
fi
|
fi
|
||||||
@@ -119,12 +134,14 @@ function convert {
|
|||||||
if [ "$acceleration_type" == "software" ]; then
|
if [ "$acceleration_type" == "software" ]; then
|
||||||
args+=(-c:v libsvtav1)
|
args+=(-c:v libsvtav1)
|
||||||
args+=(-preset 4) # [0-13] default 10, lower = higher quality / slower encode
|
args+=(-preset 4) # [0-13] default 10, lower = higher quality / slower encode
|
||||||
args+=(-crf 20) # [0-63] default 35, lower = higher quality / larger file
|
# args+=(-crf 20) # [0-63] default 35, lower = higher quality / larger file
|
||||||
# Parameters: https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/Docs/Parameters.md
|
# Parameters: https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/Docs/Parameters.md
|
||||||
# fast-decode [0-2] default 0 (off), higher = faster decode
|
# fast-decode [0-2] default 0 (off), higher = faster decode
|
||||||
# tune [0-2] default 1, Specifies whether to use PSNR or VQ as the tuning metric [0 = VQ, 1 = PSNR, 2 = SSIM]
|
# tune [0-2] default 1, Specifies whether to use PSNR or VQ as the tuning metric [0 = VQ, 1 = PSNR, 2 = SSIM]
|
||||||
# film-grain-denoise, setting to 0 uses the original frames instead of denoising the film grain
|
# film-grain-denoise, setting to 0 uses the original frames instead of denoising the film grain
|
||||||
args+=(-svtav1-params "fast-decode=1:film-grain-denoise=0")
|
# rc 1 = vbr 2 = cbr
|
||||||
|
# tbr = average bitrate
|
||||||
|
args+=(-svtav1-params "fast-decode=1:film-grain-denoise=0:tbr=${VIDEO_BITRATE}:rc=1:passes=2")
|
||||||
elif [ "$acceleration_type" == "hardware" ]; then
|
elif [ "$acceleration_type" == "hardware" ]; then
|
||||||
# -c:v av1_amf -quality quality
|
# -c:v av1_amf -quality quality
|
||||||
args+=(-vf 'format=nv12|vaapi,hwupload')
|
args+=(-vf 'format=nv12|vaapi,hwupload')
|
||||||
@@ -206,32 +223,4 @@ function encode_webcam {
|
|||||||
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
"rtsp://$USERNAME:$PASSWORD@172.16.16.251:8554/fetch"
|
||||||
}
|
}
|
||||||
|
|
||||||
function speed_up_preprocess_vp8 {
|
|
||||||
local file_to_cast file_to_save
|
|
||||||
file_to_cast="$1"
|
|
||||||
file_to_save="$2"
|
|
||||||
|
|
||||||
set -x
|
|
||||||
|
|
||||||
# -bf 0 :: Disable b-frames because webrtc doesn't support h264 streams with b-frames.
|
|
||||||
# -strict -2 :: Enable support for experimental codecs like opus.
|
|
||||||
# -b:v 2M :: Target 2 megabit/s
|
|
||||||
# -crf 10 :: Target a quality level and adjust bitrate accordingly. This should be preferred, but ideally both should be used.
|
|
||||||
# Could also use -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]"
|
|
||||||
</dev/null exec ffmpeg \
|
|
||||||
-i "$file_to_cast" \
|
|
||||||
-filter:v "setpts=0.66666666*PTS" \
|
|
||||||
-filter:a "atempo=1.5" \
|
|
||||||
-c:v vp8 \
|
|
||||||
-b:v 2M \
|
|
||||||
-crf 10 \
|
|
||||||
-bf 0 \
|
|
||||||
-c:a opus \
|
|
||||||
-b:a 320k \
|
|
||||||
-ar 48000 \
|
|
||||||
-strict -2 \
|
|
||||||
"$file_to_save"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main "${@}"
|
main "${@}"
|
||||||
|
|||||||
150
nix/configuration/roles/optimized_build/default.nix
Normal file
150
nix/configuration/roles/optimized_build/default.nix
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
pkgs-unoptimized,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
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).";
|
||||||
|
};
|
||||||
|
|
||||||
|
optimizations.arch = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = null;
|
||||||
|
example = "znver4";
|
||||||
|
description = "The CPU arch for which programs should be optimized.";
|
||||||
|
};
|
||||||
|
|
||||||
|
optimizations.system_features = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
example = [
|
||||||
|
"gccarch-znver4"
|
||||||
|
"gccarch-znver5"
|
||||||
|
"gccarch-skylake"
|
||||||
|
# "gccarch-alderlake" missing WAITPKG
|
||||||
|
"gccarch-x86-64-v3"
|
||||||
|
"gccarch-x86-64-v4"
|
||||||
|
"benchmark"
|
||||||
|
"big-parallel"
|
||||||
|
"kvm"
|
||||||
|
"nixos-test"
|
||||||
|
];
|
||||||
|
description = "The list of CPU features that should be enabled on this machine.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkMerge [
|
||||||
|
(lib.mkIf (!config.me.optimizations.enable) (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_6_14;
|
||||||
|
}
|
||||||
|
]
|
||||||
|
))
|
||||||
|
(lib.mkIf config.me.optimizations.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_me;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = {
|
||||||
|
gcc.arch = config.me.optimizations.arch;
|
||||||
|
gcc.tune = config.me.optimizations.arch;
|
||||||
|
system = "x86_64-linux";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Uncomment on of these to enable cross compiling:
|
||||||
|
# nixpkgs.buildPlatform = builtins.currentSystem;
|
||||||
|
# nixpkgs.buildPlatform = {
|
||||||
|
# gcc.arch = "znver4";
|
||||||
|
# gcc.tune = "znver4";
|
||||||
|
# system = "x86_64-linux";
|
||||||
|
# };
|
||||||
|
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(
|
||||||
|
final: prev:
|
||||||
|
let
|
||||||
|
addConfig =
|
||||||
|
additionalConfig: pkg:
|
||||||
|
pkg.override (oldconfig: {
|
||||||
|
structuredExtraConfig = pkg.structuredExtraConfig // additionalConfig;
|
||||||
|
});
|
||||||
|
in
|
||||||
|
{
|
||||||
|
linux_me = 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;
|
||||||
|
} prev.linux_6_14;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
(final: prev: {
|
||||||
|
haskellPackages = prev.haskellPackages.extend (
|
||||||
|
final': prev': {
|
||||||
|
inherit (pkgs-unoptimized.haskellPackages)
|
||||||
|
crypto-token
|
||||||
|
crypton
|
||||||
|
crypton-connection
|
||||||
|
crypton-x509
|
||||||
|
crypton-x509-store
|
||||||
|
crypton-x509-system
|
||||||
|
crypton-x509-validation
|
||||||
|
hspec-wai
|
||||||
|
http-client-tls
|
||||||
|
http2
|
||||||
|
pandoc
|
||||||
|
pandoc-cli
|
||||||
|
pandoc-lua-engine
|
||||||
|
pandoc-server
|
||||||
|
servant-server
|
||||||
|
tls
|
||||||
|
tls-session-manager
|
||||||
|
wai-app-static
|
||||||
|
wai-extra
|
||||||
|
warp
|
||||||
|
warp-tls
|
||||||
|
;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
})
|
||||||
|
(final: prev: {
|
||||||
|
inherit (pkgs-unoptimized)
|
||||||
|
gsl
|
||||||
|
redis
|
||||||
|
valkey
|
||||||
|
nix-serve-ng
|
||||||
|
;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
||||||
|
]
|
||||||
|
))
|
||||||
|
(lib.mkIf (config.me.optimizations.system_features != [ ]) (
|
||||||
|
lib.mkMerge [
|
||||||
|
{
|
||||||
|
nix.settings.system-features = lib.mkForce config.me.optimizations.system_features;
|
||||||
|
}
|
||||||
|
]
|
||||||
|
))
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
170
nix/configuration/roles/rpcs3/default.nix
Normal file
170
nix/configuration/roles/rpcs3/default.nix
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
rpcs3_config_yaml = settingsFormat.generate "config.yml" config.me.rpcs3.config;
|
||||||
|
settingsFormat = pkgs.formats.yaml { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me = {
|
||||||
|
rpcs3.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
example = true;
|
||||||
|
description = "Whether we want to install rpcs3.";
|
||||||
|
};
|
||||||
|
|
||||||
|
rpcs3.config = lib.mkOption rec {
|
||||||
|
apply = lib.recursiveUpdate default;
|
||||||
|
inherit (settingsFormat) type;
|
||||||
|
default = {
|
||||||
|
Core = {
|
||||||
|
"Use LLVM CPU" = lib.mkIf (config.me.optimizations.enable) config.me.optimizations.arch;
|
||||||
|
};
|
||||||
|
VFS = {
|
||||||
|
"Enable /host_root/" = false;
|
||||||
|
};
|
||||||
|
Video = {
|
||||||
|
"Write Color Buffers" = true;
|
||||||
|
VSync = true;
|
||||||
|
"Performance Overlay" = {
|
||||||
|
Enabled = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
Miscellaneous = {
|
||||||
|
"Pause emulation on RPCS3 focus loss" = true;
|
||||||
|
"Start games in fullscreen mode" = true;
|
||||||
|
"Pause Emulation During Home Menu" = false; # true makes the home menu slow
|
||||||
|
};
|
||||||
|
};
|
||||||
|
example = null;
|
||||||
|
description = "RPCS3's config.yml in nix form.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.me.rpcs3.enable (
|
||||||
|
lib.mkMerge [
|
||||||
|
(lib.mkIf config.me.graphical {
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
rpcs3
|
||||||
|
];
|
||||||
|
|
||||||
|
security.pam.loginLimits = [
|
||||||
|
{
|
||||||
|
domain = "@wheel";
|
||||||
|
item = "memlock";
|
||||||
|
type = "hard";
|
||||||
|
value = "unlimited";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
domain = "@wheel";
|
||||||
|
item = "memlock";
|
||||||
|
type = "soft";
|
||||||
|
value = "unlimited";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
home-manager.users.talexander =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
home.file.".config/rpcs3/config.yml" = lib.mkIf (config.me.rpcs3.config != null) {
|
||||||
|
source = rpcs3_config_yaml;
|
||||||
|
};
|
||||||
|
home.file.".config/rpcs3/GuiConfigs/CurrentSettings.ini" = {
|
||||||
|
source = ./files/CurrentSettings.ini;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.persistence."/persist" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
users.talexander = {
|
||||||
|
directories = [
|
||||||
|
{
|
||||||
|
# Location of ROMs.
|
||||||
|
directory = ".config/rpcs3/games";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
directory = ".config/rpcs3/dev_hdd0";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
directory = ".config/rpcs3/dev_hdd1";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
directory = ".config/rpcs3/savestates";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
directory = ".config/rpcs3/dev_usb000";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# Seems to be where the firmware is installed.
|
||||||
|
directory = ".config/rpcs3/dev_flash";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# Controller config.
|
||||||
|
directory = ".config/rpcs3/input_configs";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# Game icons.
|
||||||
|
directory = ".config/rpcs3/Icons";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
files = [
|
||||||
|
{
|
||||||
|
# play times and recently played
|
||||||
|
file = ".config/rpcs3/GuiConfigs/persistent_settings.dat";
|
||||||
|
parentDirectory = {
|
||||||
|
mode = "0755";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
|
||||||
|
hideMounts = true;
|
||||||
|
users.talexander = {
|
||||||
|
directories = [
|
||||||
|
{
|
||||||
|
# Game saves
|
||||||
|
directory = ".cache/rpcs3";
|
||||||
|
user = "talexander";
|
||||||
|
group = "talexander";
|
||||||
|
mode = "0755";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
5
nix/configuration/roles/rpcs3/files/CurrentSettings.ini
Normal file
5
nix/configuration/roles/rpcs3/files/CurrentSettings.ini
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[Meta]
|
||||||
|
currentStylesheet=Darker Style by TheMitoSan
|
||||||
|
|
||||||
|
[main_window]
|
||||||
|
infoBoxEnabledWelcome=false
|
||||||
@@ -131,7 +131,7 @@ in
|
|||||||
++ [
|
++ [
|
||||||
prev.rustup
|
prev.rustup
|
||||||
];
|
];
|
||||||
buildInputs = [ pkgs.makeWrapper ];
|
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
(lib.mkIf config.me.graphical {
|
(lib.mkIf config.me.graphical {
|
||||||
allowedUnfree = [
|
allowedUnfree = [
|
||||||
"vscode"
|
"vscode"
|
||||||
|
"vscode-x86_64-unknown-linux-gnu-with-extensions"
|
||||||
"vscode-with-extensions"
|
"vscode-with-extensions"
|
||||||
"vscode-extension-ms-vscode-remote-remote-ssh"
|
"vscode-extension-ms-vscode-remote-remote-ssh"
|
||||||
];
|
];
|
||||||
@@ -33,6 +34,7 @@
|
|||||||
ms-python.python
|
ms-python.python
|
||||||
ms-azuretools.vscode-docker
|
ms-azuretools.vscode-docker
|
||||||
ms-vscode-remote.remote-ssh
|
ms-vscode-remote.remote-ssh
|
||||||
|
esbenp.prettier-vscode
|
||||||
]
|
]
|
||||||
# ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
|
# ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
|
||||||
# {
|
# {
|
||||||
|
|||||||
@@ -31,6 +31,10 @@
|
|||||||
"editor.defaultFormatter": "hashicorp.terraform",
|
"editor.defaultFormatter": "hashicorp.terraform",
|
||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true
|
||||||
},
|
},
|
||||||
|
"[typescript]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
"black-formatter.importStrategy": "fromEnvironment",
|
"black-formatter.importStrategy": "fromEnvironment",
|
||||||
"workbench.statusBar.visible": false,
|
"workbench.statusBar.visible": false,
|
||||||
"git.openRepositoryInParentFolders": "never",
|
"git.openRepositoryInParentFolders": "never",
|
||||||
|
|||||||
179
nix/configuration/util/install_files/default.nix
Normal file
179
nix/configuration/util/install_files/default.nix
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
home-manager,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
attrNames
|
||||||
|
filter
|
||||||
|
flatten
|
||||||
|
;
|
||||||
|
makeFileOption =
|
||||||
|
prefix:
|
||||||
|
lib.mkOption {
|
||||||
|
type = lib.types.attrsOf (
|
||||||
|
lib.types.submodule (
|
||||||
|
{ name, config, ... }:
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
defaultText = "${prefix}.‹path›.enable";
|
||||||
|
example = false;
|
||||||
|
description = "Whether we want to install this file.";
|
||||||
|
};
|
||||||
|
method = lib.mkOption {
|
||||||
|
type = lib.types.enum [
|
||||||
|
"symlink"
|
||||||
|
"overwrite"
|
||||||
|
"initialize"
|
||||||
|
# "bind_mount" TODO: for directories?
|
||||||
|
];
|
||||||
|
default = "symlink";
|
||||||
|
defaultText = "${prefix}.‹path›.method";
|
||||||
|
example = "overwrite";
|
||||||
|
description = "The way in which the file should be installed.";
|
||||||
|
};
|
||||||
|
mode = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "0444";
|
||||||
|
defaultText = "${prefix}.‹path›.mode";
|
||||||
|
example = "0750";
|
||||||
|
description = "The read, write, execute permission flags.";
|
||||||
|
};
|
||||||
|
source = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
defaultText = "${prefix}.‹path›.source";
|
||||||
|
example = ./files/foo.txt;
|
||||||
|
description = "The source file to install into the destination.";
|
||||||
|
};
|
||||||
|
target = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
defaultText = "${prefix}.‹path›.target";
|
||||||
|
example = ".local/share/foo/bar.txt";
|
||||||
|
description = "The path where the file should be written.";
|
||||||
|
};
|
||||||
|
group = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = null;
|
||||||
|
defaultText = "${prefix}.‹path›.group";
|
||||||
|
example = ".local/share/foo/bar.txt";
|
||||||
|
description = "The group that should own the file.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
target = lib.mkDefault name;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
defaultText = "${prefix}.‹path›";
|
||||||
|
default = { };
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
{
|
||||||
|
".config/foo/bar.txt" = {
|
||||||
|
source = ./files/bar.txt
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ ];
|
||||||
|
|
||||||
|
options.me.install = {
|
||||||
|
user = lib.mkOption {
|
||||||
|
type = lib.types.attrsOf (
|
||||||
|
lib.types.submodule (
|
||||||
|
{ name, config, ... }:
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
defaultText = "me.install.user.‹username›.enable";
|
||||||
|
example = false;
|
||||||
|
description = "Whether we want to install files in this user's home directory.";
|
||||||
|
};
|
||||||
|
target_username = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
defaultText = "me.install.file.‹username›.target_username";
|
||||||
|
example = "root";
|
||||||
|
description = "The username for the user whose home directory will contain the file.";
|
||||||
|
};
|
||||||
|
file = makeFileOption "me.install.user.‹username›.file";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
target_username = lib.mkDefault name;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
defaultText = "me.install.user.‹username›";
|
||||||
|
default = { };
|
||||||
|
# TODO: example
|
||||||
|
};
|
||||||
|
# TODO: Global option owned by root?
|
||||||
|
# file = makeFileOption "me.install.file";
|
||||||
|
};
|
||||||
|
|
||||||
|
config =
|
||||||
|
let
|
||||||
|
cfg = config.me.install;
|
||||||
|
active_install_users = filter (username: cfg.user."${username}".enable) (attrNames cfg.user);
|
||||||
|
install_commands = flatten (
|
||||||
|
builtins.map (
|
||||||
|
username:
|
||||||
|
let
|
||||||
|
active_install_file_targets = filter (target: cfg.user."${username}".file."${target}".enable) (
|
||||||
|
attrNames cfg.user."${username}".file
|
||||||
|
);
|
||||||
|
in
|
||||||
|
builtins.map (
|
||||||
|
target:
|
||||||
|
let
|
||||||
|
target_config = cfg.user."${username}".file."${target}";
|
||||||
|
source = lib.strings.escapeShellArg "${target_config.source}";
|
||||||
|
destination = lib.strings.escapeShellArg "${target_config.target}";
|
||||||
|
mode = lib.strings.escapeShellArg "${target_config.mode}";
|
||||||
|
escaped_username = lib.strings.escapeShellArg "${username}";
|
||||||
|
escaped_group =
|
||||||
|
if target_config.group == null then
|
||||||
|
"$(id -g ${escaped_username})"
|
||||||
|
else
|
||||||
|
(lib.strings.escapeShellArg "${target_config.group}");
|
||||||
|
in
|
||||||
|
''
|
||||||
|
$DRY_RUN_CMD install $VERBOSE_ARG -D --compare -o ${escaped_username} -g ${escaped_group} -m ${mode} ${source} ${destination}
|
||||||
|
''
|
||||||
|
) active_install_file_targets
|
||||||
|
) active_install_users
|
||||||
|
);
|
||||||
|
|
||||||
|
in
|
||||||
|
lib.mkMerge [
|
||||||
|
(lib.mkIf (install_commands != [ ]) ({
|
||||||
|
systemd.services.me-install-file = {
|
||||||
|
enable = true;
|
||||||
|
description = "me-install-file";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
wants = [ "multi-user.target" ];
|
||||||
|
after = [ "multi-user.target" ];
|
||||||
|
unitConfig.DefaultDependencies = "no";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = "yes";
|
||||||
|
};
|
||||||
|
script = (lib.strings.concatStringsSep "\n" install_commands);
|
||||||
|
};
|
||||||
|
}))
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -10,6 +10,9 @@ let
|
|||||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libglvnd}/lib"
|
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libglvnd}/lib"
|
||||||
exec ${pkgs.rpcs3}/bin/rpcs3 "''${@}"
|
exec ${pkgs.rpcs3}/bin/rpcs3 "''${@}"
|
||||||
'';
|
'';
|
||||||
|
rpcs3_config_yaml = settingsFormat.generate "config.yml" config.me.rpcs3.config;
|
||||||
|
settingsFormat = pkgs.formats.yaml { };
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
@@ -21,6 +24,33 @@ in
|
|||||||
example = true;
|
example = true;
|
||||||
description = "Whether we want to install rpcs3.";
|
description = "Whether we want to install rpcs3.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
rpcs3.config = lib.mkOption rec {
|
||||||
|
apply = lib.recursiveUpdate default;
|
||||||
|
inherit (settingsFormat) type;
|
||||||
|
default = {
|
||||||
|
Core = {
|
||||||
|
"Use LLVM CPU" = "znver2";
|
||||||
|
};
|
||||||
|
VFS = {
|
||||||
|
"Enable /host_root/" = false;
|
||||||
|
};
|
||||||
|
Video = {
|
||||||
|
"Write Color Buffers" = true;
|
||||||
|
VSync = true;
|
||||||
|
"Performance Overlay" = {
|
||||||
|
Enabled = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
Miscellaneous = {
|
||||||
|
"Pause emulation on RPCS3 focus loss" = true;
|
||||||
|
"Start games in fullscreen mode" = true;
|
||||||
|
"Pause Emulation During Home Menu" = false; # true makes the home menu slow
|
||||||
|
};
|
||||||
|
};
|
||||||
|
example = null;
|
||||||
|
description = "RPCS3's config.yml in nix form.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.me.rpcs3.enable (
|
config = lib.mkIf config.me.rpcs3.enable (
|
||||||
@@ -31,15 +61,25 @@ in
|
|||||||
steam_rpcs3
|
steam_rpcs3
|
||||||
];
|
];
|
||||||
|
|
||||||
# .config/rpcs3/config.yml
|
home.file.".config/rpcs3/config.yml" = lib.mkIf (config.me.rpcs3.config != null) {
|
||||||
# .config/rpcs3/GuiConfigs/CurrentSettings.ini
|
source = rpcs3_config_yaml;
|
||||||
|
};
|
||||||
|
home.file.".config/rpcs3/GuiConfigs/CurrentSettings.ini" = {
|
||||||
|
source = ./files/CurrentSettings.ini;
|
||||||
|
};
|
||||||
|
|
||||||
me.persist.directories = [
|
me.persist.directories = [
|
||||||
|
".config/rpcs3/games" # Location of ROMs.
|
||||||
".config/rpcs3/dev_hdd0"
|
".config/rpcs3/dev_hdd0"
|
||||||
".config/rpcs3/dev_hdd1"
|
".config/rpcs3/dev_hdd1"
|
||||||
".config/rpcs3/savestates"
|
".config/rpcs3/savestates"
|
||||||
".config/rpcs3/dev_usb000"
|
".config/rpcs3/dev_usb000"
|
||||||
".config/rpcs3/dev_flash" # Seems to be where the firmware is installed.
|
".config/rpcs3/dev_flash" # Seems to be where the firmware is installed.
|
||||||
|
".config/rpcs3/input_configs" # Controller config.
|
||||||
|
".config/rpcs3/Icons" # Game icons.
|
||||||
|
];
|
||||||
|
me.persist.files = [
|
||||||
|
".config/rpcs3/GuiConfigs/persistent_settings.dat" # play times and recently played
|
||||||
];
|
];
|
||||||
me.state.directories = [ ".cache/rpcs3" ];
|
me.state.directories = [ ".cache/rpcs3" ];
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
[Meta]
|
||||||
|
currentStylesheet=Darker Style by TheMitoSan
|
||||||
|
|
||||||
|
[main_window]
|
||||||
|
infoBoxEnabledWelcome=false
|
||||||
@@ -24,21 +24,12 @@ in
|
|||||||
config = lib.mkIf config.me.steam_rom_manager.enable (
|
config = lib.mkIf config.me.steam_rom_manager.enable (
|
||||||
lib.mkMerge [
|
lib.mkMerge [
|
||||||
(lib.mkIf config.me.graphical {
|
(lib.mkIf config.me.graphical {
|
||||||
home.packages = with pkgs; [
|
home.packages = [
|
||||||
package
|
package
|
||||||
];
|
];
|
||||||
|
|
||||||
me.persist.directories = [ ".config/steam-rom-manager/userData" ];
|
me.persist.directories = [ ".config/steam-rom-manager/userData" ];
|
||||||
|
|
||||||
home.persistence."/home/deck/.persist" = {
|
|
||||||
directories = [
|
|
||||||
{
|
|
||||||
directory = ".config/steam-rom-manager/userData";
|
|
||||||
method = "symlink";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# TODO: Install a fully configured /home/deck/.persist/.config/steam-rom-manager/userData/userConfigurations.json (which contains the parser definitions) and /home/deck/.persist/.config/steam-rom-manager/userData/userSettings.json (which contains the applications settings like steam directory).
|
# TODO: Install a fully configured /home/deck/.persist/.config/steam-rom-manager/userData/userConfigurations.json (which contains the parser definitions) and /home/deck/.persist/.config/steam-rom-manager/userData/userSettings.json (which contains the applications settings like steam directory).
|
||||||
# TODO: Maybe only persist /home/deck/.persist/.config/steam-rom-manager/userData/artworkBackups and /home/deck/.persist/.config/steam-rom-manager/userData/artworkCache.json after the parser config is being installed.
|
# TODO: Maybe only persist /home/deck/.persist/.config/steam-rom-manager/userData/artworkBackups and /home/deck/.persist/.config/steam-rom-manager/userData/artworkCache.json after the parser config is being installed.
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,12 @@
|
|||||||
example = [ ".local/share/dolphin-emu/Wii" ];
|
example = [ ".local/share/dolphin-emu/Wii" ];
|
||||||
description = "List of folders relative to the home directory to persist.";
|
description = "List of folders relative to the home directory to persist.";
|
||||||
};
|
};
|
||||||
|
persist.files = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
example = [ ".local/share/foo.sqlite3" ];
|
||||||
|
description = "List of files relative to the home directory to persist.";
|
||||||
|
};
|
||||||
state.directories = lib.mkOption {
|
state.directories = lib.mkOption {
|
||||||
type = lib.types.listOf lib.types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
@@ -50,6 +56,11 @@
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
(lib.mkIf (config.me.persist.files != [ ]) {
|
||||||
|
home.persistence."/home/deck/.persist" = {
|
||||||
|
files = config.me.persist.files;
|
||||||
|
};
|
||||||
|
})
|
||||||
(lib.mkIf (config.me.state.directories != [ ]) {
|
(lib.mkIf (config.me.state.directories != [ ]) {
|
||||||
home.persistence."/home/deck/.state" = {
|
home.persistence."/home/deck/.state" = {
|
||||||
directories = (
|
directories = (
|
||||||
|
|||||||
Reference in New Issue
Block a user