2008-12-04 07:48:27 -08:00
|
|
|
{pkgs, config, ...}:
|
2008-08-27 07:01:17 -07:00
|
|
|
|
|
|
|
###### interface
|
|
|
|
let
|
|
|
|
inherit (pkgs.lib) mkOption
|
|
|
|
mergeEnableOption mergeListOption;
|
|
|
|
|
|
|
|
options = {
|
|
|
|
hardware = {
|
|
|
|
pcmcia = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
merge = mergeEnableOption;
|
|
|
|
description = ''
|
|
|
|
Enable this option to support PCMCIA card.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
firmware = mkOption {
|
|
|
|
default = [];
|
|
|
|
merge = mergeListOption;
|
|
|
|
description = ''
|
|
|
|
List of firmware used to handle specific PCMCIA card.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkOption {
|
|
|
|
default = null;
|
2008-08-27 14:22:49 -07:00
|
|
|
description = ''
|
2008-08-27 07:01:17 -07:00
|
|
|
Path to the configuration file which map the memory, irq
|
|
|
|
and ports used by the PCMCIA hardware.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
let
|
2008-11-22 17:29:25 -08:00
|
|
|
inherit (pkgs.lib) mkIf;
|
2008-08-27 07:01:17 -07:00
|
|
|
|
2008-11-04 13:24:58 -08:00
|
|
|
pcmciaUtils = pkgs.pcmciaUtils.passthru.function {
|
2008-08-27 07:01:17 -07:00
|
|
|
inherit (config.hardware.pcmcia) firmware config;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
2008-11-22 17:29:25 -08:00
|
|
|
|
|
|
|
mkIf config.hardware.pcmcia.enable {
|
|
|
|
require = [
|
2009-05-19 16:14:45 -07:00
|
|
|
# ../upstart-jobs/udev.nix
|
|
|
|
# ? # config.environment.extraPackages
|
2008-11-22 17:29:25 -08:00
|
|
|
options
|
|
|
|
];
|
2008-08-27 07:01:17 -07:00
|
|
|
|
2009-08-10 12:05:20 -07:00
|
|
|
boot.kernelModules = [ "pcmcia" ];
|
2008-08-27 07:01:17 -07:00
|
|
|
|
2009-08-10 12:05:20 -07:00
|
|
|
services.udev.packages = [ pcmciaUtils ];
|
2008-08-27 07:01:17 -07:00
|
|
|
|
2009-08-10 12:05:20 -07:00
|
|
|
environment.systemPackages = [ pcmciaUtils ];
|
2008-08-27 07:01:17 -07:00
|
|
|
}
|