summaryrefslogtreecommitdiffstats
path: root/nixos/modules/tasks/filesystems/ntfs.nix
blob: 271680b560749c82287eda7274c03d03b02c437a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
  config,
  lib,
  pkgs,
  ...
}:
let
  ntfsEnabled = config.boot.supportedFilesystems.ntfs or false;
  ntfs3gEnabled = config.boot.supportedFilesystems.ntfs-3g or false;
  ntfsPlusSupported = config.boot.kernelPackages.kernelAtLeast "7.1";
  initrdSupport = config.boot.initrd.supportedFilesystems.ntfs or false;
in
{
  config = lib.mkMerge [
    (lib.mkIf (ntfsEnabled && ntfsPlusSupported && !ntfs3gEnabled) {
      system.fsPackages = [ pkgs.ntfsprogs-plus ];

      boot.initrd.availableKernelModules = lib.optionals initrdSupport [ "ntfs" ];
    })

    (lib.mkIf (ntfs3gEnabled || (ntfsEnabled && !ntfsPlusSupported)) {
      system.fsPackages = [ pkgs.ntfs3g ];

      boot.initrd.availableKernelModules = lib.optionals initrdSupport [ "ntfs3" ];
    })
  ];
}