2023-06-11 23:09:59 +02:00
|
|
|
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
2023-12-24 17:01:41 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
inputs',
|
|
|
|
options,
|
2024-03-08 21:57:36 +01:00
|
|
|
config,
|
2023-12-24 17:01:41 +01:00
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit
|
|
|
|
(lib)
|
2023-06-11 23:09:59 +02:00
|
|
|
singleton
|
2023-12-24 17:01:41 +01:00
|
|
|
mkForce
|
|
|
|
mapAttrs
|
|
|
|
mkOverride
|
|
|
|
filter
|
|
|
|
;
|
2023-06-11 23:09:59 +02:00
|
|
|
|
2024-09-04 23:22:09 +02:00
|
|
|
kernelPackages = pkgs.linuxKernel.packages.linux_6_10;
|
|
|
|
|
|
|
|
zfs_2_2_6 = args:
|
|
|
|
(pkgs.callPackage
|
|
|
|
(
|
|
|
|
{
|
|
|
|
callPackage,
|
|
|
|
kernel ? null,
|
|
|
|
stdenv,
|
|
|
|
linuxKernel,
|
|
|
|
nixosTests,
|
|
|
|
...
|
|
|
|
} @ args: let
|
|
|
|
stdenv' =
|
|
|
|
if kernel == null
|
|
|
|
then stdenv
|
|
|
|
else kernel.stdenv;
|
|
|
|
in (callPackage "${inputs'.nixpkgs}/pkgs/os-specific/linux/zfs/generic.nix" args {
|
|
|
|
# You have to ensure that in `pkgs/top-level/linux-kernels.nix`
|
|
|
|
# this attribute is the correct one for this package.
|
|
|
|
kernelModuleAttribute = "zfs_2_2";
|
|
|
|
# check the release notes for compatible kernels
|
|
|
|
kernelCompatible = kernel: kernel.kernelOlder "6.11";
|
|
|
|
|
|
|
|
# this package should point to the latest release.
|
|
|
|
version = "2.2.6";
|
|
|
|
|
|
|
|
tests = [
|
|
|
|
nixosTests.zfs.installer
|
|
|
|
nixosTests.zfs.series_2_2
|
|
|
|
];
|
|
|
|
|
|
|
|
hash = "sha256-wkgoYg6uQOHVq8a9sJXzO/QXJ6q28l7JXWkC+BFvOb0=";
|
|
|
|
})
|
|
|
|
)
|
|
|
|
args)
|
|
|
|
.overrideAttrs (old: {
|
|
|
|
postInstall = lib.pipe old.postInstall [
|
|
|
|
(lib.splitString "\n")
|
|
|
|
(lib.filter (line: line != "(cd $out/share/bash-completion/completions; ln -s zfs zpool)"))
|
|
|
|
lib.concatLines
|
|
|
|
];
|
|
|
|
});
|
2023-12-24 17:01:41 +01:00
|
|
|
in {
|
2023-06-11 23:09:59 +02:00
|
|
|
environment.systemPackages = [
|
|
|
|
kernelPackages.turbostat
|
|
|
|
];
|
2024-09-11 21:03:03 +02:00
|
|
|
environment.variables.NOUVEAU_USE_ZINK = "1";
|
2023-06-11 23:09:59 +02:00
|
|
|
|
|
|
|
hardware.cpu.intel.updateMicrocode = true;
|
|
|
|
|
|
|
|
boot = {
|
2023-10-03 16:55:14 +02:00
|
|
|
initrd.systemd.enable = true;
|
2023-06-11 23:09:59 +02:00
|
|
|
initrd.availableKernelModules = [
|
|
|
|
"xhci_pci"
|
|
|
|
"ahci"
|
|
|
|
"usb_storage"
|
|
|
|
"sr_mod"
|
|
|
|
"rtsx_pci_sdmmc"
|
|
|
|
"nvme"
|
|
|
|
"vmd"
|
|
|
|
];
|
2024-05-04 21:45:44 +02:00
|
|
|
initrd.kernelModules = [
|
|
|
|
"dm_crypt"
|
|
|
|
"encrypted_keys"
|
|
|
|
"trusted"
|
|
|
|
"nhpoly1305_avx2"
|
|
|
|
"nhpoly1305_sse2"
|
|
|
|
"nhpoly1305"
|
|
|
|
"crypto_null"
|
|
|
|
"polyval_clmulni"
|
|
|
|
"polyval_generic"
|
|
|
|
"gf128mul"
|
|
|
|
"dm_mod"
|
|
|
|
"crypto_simd"
|
|
|
|
"cryptd"
|
|
|
|
"adiantum"
|
|
|
|
"libpoly1305"
|
|
|
|
"libchacha20poly1305"
|
|
|
|
"chacha_x86_64"
|
|
|
|
"libchacha"
|
|
|
|
"poly1305_x86_64"
|
|
|
|
];
|
2024-10-27 12:39:31 +01:00
|
|
|
|
|
|
|
extraModulePackages = [
|
|
|
|
(config.boot.kernelPackages.tuxedo-keyboard.overrideAttrs (
|
|
|
|
final: prev: {
|
|
|
|
version = "v4.8.0";
|
|
|
|
src = pkgs.fetchFromGitLab {
|
|
|
|
owner = "tuxedocomputers/development/packages";
|
|
|
|
repo = "tuxedo-drivers";
|
|
|
|
rev = final.version;
|
|
|
|
hash = "sha256-MN3p51Y9yqHc69BK8Wu8NtW18DdRIyxEYjH+Tqn/SXk=";
|
|
|
|
};
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p "$out/lib/modules/${config.boot.kernelPackages.kernel.modDirVersion}"
|
|
|
|
|
|
|
|
for module in $(find . -name '*.ko'); do
|
|
|
|
mv $module $out/lib/modules/${config.boot.kernelPackages.kernel.modDirVersion}
|
|
|
|
done
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
))
|
|
|
|
];
|
2024-05-04 21:45:44 +02:00
|
|
|
kernelModules = [
|
|
|
|
"kvm-intel"
|
2024-10-27 12:39:31 +01:00
|
|
|
"tuxedo_keyboard"
|
2024-05-04 21:45:44 +02:00
|
|
|
];
|
2023-06-11 23:09:59 +02:00
|
|
|
|
|
|
|
kernelParams = [
|
|
|
|
"zfs.zfs_arc_max=8589934592"
|
|
|
|
"zfs.zfs_arc_sys_free=3221225472"
|
2024-03-09 17:06:11 +01:00
|
|
|
"nouveau.config=NvGspRm=1"
|
2023-06-11 23:09:59 +02:00
|
|
|
];
|
|
|
|
kernelPackages = kernelPackages;
|
|
|
|
|
2024-09-04 23:22:09 +02:00
|
|
|
zfs.package = zfs_2_2_6 {
|
|
|
|
configFile = "user";
|
|
|
|
};
|
|
|
|
zfs.modulePackage = zfs_2_2_6 {
|
|
|
|
configFile = "kernel";
|
|
|
|
kernel = config.boot.kernelPackages.kernel;
|
|
|
|
};
|
2023-06-11 23:09:59 +02:00
|
|
|
};
|
|
|
|
hardware.enableRedistributableFirmware = true;
|
|
|
|
|
2024-10-06 21:04:35 +02:00
|
|
|
chaotic.mesa-git = {
|
|
|
|
enable = true;
|
|
|
|
fallbackSpecialisation = false;
|
|
|
|
};
|
2024-06-02 17:25:12 +02:00
|
|
|
|
2024-07-03 21:18:06 +02:00
|
|
|
specialisation.nvidia.configuration = {config, ...}: {
|
2024-06-02 17:25:12 +02:00
|
|
|
environment.variables.NIXOS_SPECIALISATION = "nvidia";
|
|
|
|
boot.loader.grub.enable = mkOverride 0 false;
|
2024-10-06 21:04:35 +02:00
|
|
|
boot.kernelPackages = mkForce pkgs.linuxPackages_6_6;
|
2024-06-02 17:25:12 +02:00
|
|
|
boot.kernelParams = [
|
|
|
|
"nvidia.NVreg_EnableS0ixPowerManagement=1"
|
|
|
|
"nvidia.NVreg_S0ixPowerManagementVideoMemoryThreshold=2048"
|
|
|
|
];
|
|
|
|
chaotic.mesa-git.enable = mkForce false;
|
2024-09-04 23:22:09 +02:00
|
|
|
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
|
2024-10-06 21:04:35 +02:00
|
|
|
version = "550.120";
|
2024-09-04 23:22:09 +02:00
|
|
|
|
2024-10-06 21:04:35 +02:00
|
|
|
sha256_64bit = "sha256-gBkoJ0dTzM52JwmOoHjMNwcN2uBN46oIRZHAX8cDVpc=";
|
2024-09-04 23:22:09 +02:00
|
|
|
sha256_aarch64 = "";
|
2024-10-06 21:04:35 +02:00
|
|
|
openSha256 = "sha256-O3OrGGDR+xrpfyPVQ04aM3eGI6aWuZfRzmaPjMfnGIg=";
|
|
|
|
settingsSha256 = "sha256-fPfIPwpIijoUpNlAUt9C8EeXR5In633qnlelL+btGbU=";
|
|
|
|
persistencedSha256 = "sha256-ztEemWt0VR+cQbxDmMnAbEVfThdvASHni4SJ0dTZ2T4=";
|
2024-09-04 23:22:09 +02:00
|
|
|
};
|
2024-06-02 17:25:12 +02:00
|
|
|
|
|
|
|
hardware.nvidia = {
|
2024-08-14 15:58:37 +02:00
|
|
|
open = true;
|
2024-06-02 17:25:12 +02:00
|
|
|
nvidiaPersistenced = true;
|
|
|
|
|
|
|
|
powerManagement.enable = true;
|
|
|
|
powerManagement.finegrained = true;
|
|
|
|
|
|
|
|
prime.reverseSync.enable = false;
|
|
|
|
prime.offload.enable = true;
|
|
|
|
|
|
|
|
modesetting.enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
services.xserver.videoDrivers = mkForce ["nvidia"];
|
|
|
|
};
|
2023-06-11 23:09:59 +02:00
|
|
|
}
|