Merge pull request 'Revert "upgrade bcachefs kernel"' (#120) from dont-upgrade-bcachefs into main
Reviewed-on: #120
This commit is contained in:
commit
2a1161d2bd
3 changed files with 11 additions and 94 deletions
|
@ -20,7 +20,6 @@
|
|||
./services/postgres.nix
|
||||
./services/woodpecker-agent.nix
|
||||
./users/remote-build.nix
|
||||
../modules/bcachefs.nix
|
||||
];
|
||||
hardware.cpu.amd.updateMicrocode = true;
|
||||
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sr_mod" "k10temp"];
|
||||
|
@ -30,7 +29,7 @@
|
|||
config.boot.kernelPackages.zenpower
|
||||
];
|
||||
|
||||
boot.kernelPackages = lib.mkForce (pkgs.linuxPackagesFor pkgs.linux-bcachefs);
|
||||
boot.kernelPackages = lib.mkForce pkgs.linuxPackages_testing_bcachefs;
|
||||
boot.supportedFilesystems = lib.mkForce ["bcachefs" "vfat"];
|
||||
|
||||
fileSystems."/" = {
|
||||
|
|
20
flake.lock
20
flake.lock
|
@ -1226,11 +1226,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1687708750,
|
||||
"narHash": "sha256-3kOrSanzNn+BFqV+AmpQoxSlZXolnCt9GL6P5mBlE/E=",
|
||||
"lastModified": 1687677942,
|
||||
"narHash": "sha256-HaHbNHFvX9BbQ4QGButNYK3uWkpA0PoMEZ7PZ/l0S14=",
|
||||
"ref": "main",
|
||||
"rev": "b15e4ae106af506fec5a1549c7250ce7f6d8d7d5",
|
||||
"revCount": 922,
|
||||
"rev": "b5e19754995075ef621c2acf808d306135a99bd3",
|
||||
"revCount": 916,
|
||||
"type": "git",
|
||||
"url": "https://git.chir.rs/darkkirb/nix-packages.git"
|
||||
},
|
||||
|
@ -1553,11 +1553,11 @@
|
|||
},
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1687708260,
|
||||
"narHash": "sha256-yDKHrL1nRIwe7d81WZoUKpjCsqk0/mJwjlq+InarGZo=",
|
||||
"lastModified": 1687677983,
|
||||
"narHash": "sha256-eaVk+DZ4fVbF/u4hdygHCtS1qfxMvP0bWawwPhTwIAg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "06429924a77c374940b0ac0c87d669ccda48cdc5",
|
||||
"rev": "c07741265292d6fc5b0e499072ea9f4b1124744b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1583,11 +1583,11 @@
|
|||
},
|
||||
"nur_2": {
|
||||
"locked": {
|
||||
"lastModified": 1687703991,
|
||||
"narHash": "sha256-qobiIdBXPNWHEembddq5EIwg8MFYtl5JVZY4yR4pD5c=",
|
||||
"lastModified": 1687666225,
|
||||
"narHash": "sha256-ldABbbs4tP6SGigIc3ihm1962thOpZ9wT9NpX2vHaKc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "ff6e6849d68109e7feefe1346def311bb4d8c3a7",
|
||||
"rev": "e9ad8e2cc54478c5e537822a24d2f80772e4574b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
utils,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
bootFs = filterAttrs (n: fs: (fs.fsType == "bcachefs") && (utils.fsNeededForBoot fs)) config.fileSystems;
|
||||
|
||||
mountCommand = pkgs.runCommand "mount.bcachefs" {} ''
|
||||
mkdir -p $out/bin
|
||||
cat > $out/bin/mount.bcachefs <<EOF
|
||||
#!/bin/sh
|
||||
exec "/bin/bcachefs" mount "\$@"
|
||||
EOF
|
||||
chmod +x $out/bin/mount.bcachefs
|
||||
'';
|
||||
|
||||
commonFunctions = ''
|
||||
prompt() {
|
||||
local name="$1"
|
||||
printf "enter passphrase for $name: "
|
||||
}
|
||||
tryUnlock() {
|
||||
local name="$1"
|
||||
local path="$2"
|
||||
if bcachefs unlock -c $path > /dev/null 2> /dev/null; then # test for encryption
|
||||
prompt $name
|
||||
until bcachefs unlock $path 2> /dev/null; do # repeat until successfully unlocked
|
||||
printf "unlocking failed!\n"
|
||||
prompt $name
|
||||
done
|
||||
printf "unlocking successful.\n"
|
||||
fi
|
||||
}
|
||||
'';
|
||||
|
||||
openCommand = name: fs: let
|
||||
# we need only unlock one device manually, and cannot pass multiple at once
|
||||
# remove this adaptation when bcachefs implements mounting by filesystem uuid
|
||||
# also, implement automatic waiting for the constituent devices when that happens
|
||||
# bcachefs does not support mounting devices with colons in the path, ergo we don't (see #49671)
|
||||
firstDevice = head (splitString ":" fs.device);
|
||||
in ''
|
||||
tryUnlock ${name} ${firstDevice}
|
||||
'';
|
||||
in {
|
||||
config = mkIf (elem "bcachefs" config.boot.supportedFilesystems) (mkMerge [
|
||||
{
|
||||
# We do not want to include bachefs in the fsPackages for systemd-initrd
|
||||
# because we provide the unwrapped version of mount.bcachefs
|
||||
# through the extraBin option, which will make it available for use.
|
||||
system.fsPackages = lib.optional (!config.boot.initrd.systemd.enable) pkgs.bcachefs-tools;
|
||||
environment.systemPackages = lib.optional (config.boot.initrd.systemd.enable) pkgs.bcachefs-tools;
|
||||
|
||||
# use kernel package with bcachefs support until it's in mainline
|
||||
boot.kernelPackages = pkgs.linuxPackages_testing_bcachefs;
|
||||
}
|
||||
|
||||
(mkIf ((elem "bcachefs" config.boot.initrd.supportedFilesystems) || (bootFs != {})) {
|
||||
# chacha20 and poly1305 are required only for decryption attempts
|
||||
boot.initrd.availableKernelModules = ["bcachefs" "sha256" "chacha20" "poly1305"];
|
||||
|
||||
boot.initrd.systemd.extraBin = {
|
||||
"bcachefs" = "${pkgs.bcachefs-tools}/bin/bcachefs";
|
||||
"mount.bcachefs" = "${mountCommand}/bin/mount.bcachefs";
|
||||
};
|
||||
|
||||
boot.initrd.extraUtilsCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
|
||||
copy_bin_and_libs ${pkgs.bcachefs-tools}/bin/bcachefs
|
||||
copy_bin_and_libs ${mountCommand}/bin/mount.bcachefs
|
||||
'';
|
||||
boot.initrd.extraUtilsCommandsTest = ''
|
||||
$out/bin/bcachefs version
|
||||
'';
|
||||
|
||||
boot.initrd.postDeviceCommands = commonFunctions + concatStrings (mapAttrsToList openCommand bootFs);
|
||||
})
|
||||
]);
|
||||
disabledModules = ["tasks/filesystems/bcachefs.nix"];
|
||||
}
|
Loading…
Reference in a new issue