diff options
author | Luflosi <luflosi@luflosi.de> | 2021-02-10 00:37:24 +0100 |
---|---|---|
committer | Luflosi <luflosi@luflosi.de> | 2022-01-27 15:18:45 +0100 |
commit | 26a695399a0e8bc40c502655c3d147f1791e774f (patch) | |
tree | 66ccbde6a0d419408e00cfc432efec3b15cadcb4 /nixos/modules | |
parent | a4e916ad037be7c36c4b2381b8b522233e5ab939 (diff) | |
download | nixpkgs-26a695399a0e8bc40c502655c3d147f1791e774f.tar nixpkgs-26a695399a0e8bc40c502655c3d147f1791e774f.tar.gz nixpkgs-26a695399a0e8bc40c502655c3d147f1791e774f.tar.bz2 nixpkgs-26a695399a0e8bc40c502655c3d147f1791e774f.tar.lz nixpkgs-26a695399a0e8bc40c502655c3d147f1791e774f.tar.xz nixpkgs-26a695399a0e8bc40c502655c3d147f1791e774f.tar.zst nixpkgs-26a695399a0e8bc40c502655c3d147f1791e774f.zip |
nixos/apfs: init
Add the final missing pieces for full APFS support.
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/system/boot/stage-1-init.sh | 3 | ||||
-rw-r--r-- | nixos/modules/tasks/filesystems.nix | 2 | ||||
-rw-r--r-- | nixos/modules/tasks/filesystems/apfs.nix | 22 |
4 files changed, 27 insertions, 1 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index c2b1e886686..6b20e86978c 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -1162,6 +1162,7 @@ ./tasks/cpu-freq.nix ./tasks/encrypted-devices.nix ./tasks/filesystems.nix + ./tasks/filesystems/apfs.nix ./tasks/filesystems/bcachefs.nix ./tasks/filesystems/btrfs.nix ./tasks/filesystems/cifs.nix diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh index f86d4641228..8fcc1f02972 100644 --- a/nixos/modules/system/boot/stage-1-init.sh +++ b/nixos/modules/system/boot/stage-1-init.sh @@ -282,6 +282,9 @@ checkFS() { # Don't check resilient COWs as they validate the fs structures at mount time if [ "$fsType" = btrfs -o "$fsType" = zfs -o "$fsType" = bcachefs ]; then return 0; fi + # Skip fsck for apfs as the fsck utility does not support repairing the filesystem (no -a option) + if [ "$fsType" = apfs ]; then return 0; fi + # Skip fsck for nilfs2 - not needed by design and no fsck tool for this filesystem. if [ "$fsType" = nilfs2 ]; then return 0; fi diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix index 225bcbe58e0..f3da6771197 100644 --- a/nixos/modules/tasks/filesystems.nix +++ b/nixos/modules/tasks/filesystems.nix @@ -250,7 +250,7 @@ in environment.etc.fstab.text = let - fsToSkipCheck = [ "none" "bindfs" "btrfs" "zfs" "tmpfs" "nfs" "vboxsf" "glusterfs" ]; + fsToSkipCheck = [ "none" "bindfs" "btrfs" "zfs" "tmpfs" "nfs" "vboxsf" "glusterfs" "apfs" ]; skipCheck = fs: fs.noCheck || fs.device == "none" || builtins.elem fs.fsType fsToSkipCheck; # https://wiki.archlinux.org/index.php/fstab#Filepath_spaces escape = string: builtins.replaceStrings [ " " "\t" ] [ "\\040" "\\011" ] string; diff --git a/nixos/modules/tasks/filesystems/apfs.nix b/nixos/modules/tasks/filesystems/apfs.nix new file mode 100644 index 00000000000..2f2be351df6 --- /dev/null +++ b/nixos/modules/tasks/filesystems/apfs.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + inInitrd = any (fs: fs == "apfs") config.boot.initrd.supportedFilesystems; + +in + +{ + config = mkIf (any (fs: fs == "apfs") config.boot.supportedFilesystems) { + + system.fsPackages = [ pkgs.apfsprogs ]; + + boot.extraModulePackages = [ config.boot.kernelPackages.apfs ]; + + boot.initrd.kernelModules = mkIf inInitrd [ "apfs" ]; + + # Don't copy apfsck into the initramfs since it does not support repairing the filesystem + }; +} |