summaryrefslogtreecommitdiffstats
path: root/nixos/modules/hardware/pcmcia.nix
blob: 955a039a3096316a113b46f0506479498e8d40fd (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
  config,
  lib,
  pkgs,
  ...
}:
let
  pcmciautils = pkgs.pcmciautils.overrideAttrs {
    inherit (config.hardware.pcmcia) firmware config;
  };
in

{
  ###### interface
  options = {

    hardware.pcmcia = {
      enable = lib.mkOption {
        type = lib.types.bool;
        default = false;
        description = ''
          Enable this option to support PCMCIA card.
        '';
      };

      firmware = lib.mkOption {
        type = lib.types.listOf lib.types.path;
        default = [ ];
        description = ''
          List of firmware used to handle specific PCMCIA card.
        '';
      };

      config = lib.mkOption {
        default = null;
        type = lib.types.nullOr lib.types.path;
        description = ''
          Path to the configuration file which maps the memory, IRQs
          and ports used by the PCMCIA hardware.
        '';
      };
    };
  };

  ###### implementation

  config = lib.mkIf config.hardware.pcmcia.enable {

    boot.kernelModules = [ "pcmcia" ];

    services.udev.packages = [ pcmciautils ];

    environment.systemPackages = [ pcmciautils ];

  };

}