non-interactive: add missing udev rules (#163)

non-interactive: add missing udev rules

* Update nix/zfs-minimal.nix

Co-authored-by: Gary Guo <gary@garyguo.net>
This commit is contained in:
Mic92 2024-01-03 09:53:53 +00:00 committed by mergify[bot]
parent b858bab86b
commit a337c75e33
2 changed files with 43 additions and 29 deletions

View file

@ -1,13 +1,18 @@
# This module optimizes for non-interactive deployments by remove some store paths # This module optimizes for non-interactive deployments by remove some store paths
# which are primarily useful for interactive installations. # which are primarily useful for interactive installations.
{ config, lib, pkgs, ... }: { { lib, pkgs, ... }:
{
disabledModules = [ disabledModules = [
# This module adds values to multiple lists (systemPackages, supportedFilesystems) # This module adds values to multiple lists (systemPackages, supportedFilesystems)
# which are impossible/unpractical to remove, so we disable the entire module. # which are impossible/unpractical to remove, so we disable the entire module.
"profiles/base.nix" "profiles/base.nix"
]; ];
imports = [
./zfs-minimal.nix
];
# among others, this prevents carrying a stdenv with gcc in the image # among others, this prevents carrying a stdenv with gcc in the image
system.extraDependencies = lib.mkForce [ ]; system.extraDependencies = lib.mkForce [ ];
@ -21,10 +26,6 @@
environment.defaultPackages = lib.mkForce [ environment.defaultPackages = lib.mkForce [
pkgs.rsync pkgs.rsync
pkgs.parted pkgs.parted
(pkgs.zfs.override {
# this overrides saves 10MB
samba = pkgs.coreutils;
})
pkgs.gptfdisk pkgs.gptfdisk
]; ];
@ -42,28 +43,9 @@
"vfat" "vfat"
"xfs" "xfs"
]; ];
boot = { boot.kernelModules = [
kernelModules = [ # we have to explicitly enable this, otherwise it is not loaded even when creating a raid:
"zfs" # https://github.com/nix-community/nixos-anywhere/issues/249
# we have to explicitly enable this, otherwise it is not loaded even when creating a raid: "dm-raid"
# https://github.com/nix-community/nixos-anywhere/issues/249 ];
"dm-raid"
];
extraModulePackages = [
(config.boot.kernelPackages.zfs.override {
inherit (config.boot.zfs) removeLinuxDRM;
})
];
};
boot.kernelPatches = lib.optional (config.boot.zfs.removeLinuxDRM && pkgs.stdenv.hostPlatform.system == "aarch64-linux") {
name = "export-neon-symbols-as-gpl";
patch = pkgs.fetchpatch {
url = "https://github.com/torvalds/linux/commit/aaeca98456431a8d9382ecf48ac4843e252c07b3.patch";
hash = "sha256-L2g4G1tlWPIi/QRckMuHDcdWBcKpObSWSRTvbHRIwIk=";
revert = true;
};
};
networking.hostId = lib.mkDefault "8425e349";
} }

32
nix/zfs-minimal.nix Normal file
View file

@ -0,0 +1,32 @@
{ config, lib, pkgs, ... }:
# incorperate a space-optimized version of zfs
let
zfs = pkgs.zfs.override {
# this overrides saves 10MB
samba = pkgs.coreutils;
};
in
{
services.udev.packages = [ zfs ]; # to hook zvol naming, etc.
# unsure if need this, but in future udev rules could potentially point to systemd services.
systemd.packages = [ zfs ];
environment.defaultPackages = lib.mkForce [ zfs ]; # this merges with outer noninteractive module.
boot.kernelModules = [ "zfs" ];
boot.extraModulePackages = [
(config.boot.kernelPackages.zfs.override {
inherit (config.boot.zfs) removeLinuxDRM;
})
];
boot.kernelPatches = lib.optional (config.boot.zfs.removeLinuxDRM && pkgs.stdenv.hostPlatform.system == "aarch64-linux") {
name = "export-neon-symbols-as-gpl";
patch = pkgs.fetchpatch {
url = "https://github.com/torvalds/linux/commit/aaeca98456431a8d9382ecf48ac4843e252c07b3.patch";
hash = "sha256-L2g4G1tlWPIi/QRckMuHDcdWBcKpObSWSRTvbHRIwIk=";
revert = true;
};
};
networking.hostId = lib.mkDefault "8425e349";
}