mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 05:05:29 +03:00
Add pcmcia job.
Test the new option style. svn path=/nixos/trunk/; revision=12742
This commit is contained in:
parent
5cc80c8e51
commit
6e6f867a0a
2 changed files with 71 additions and 0 deletions
|
@ -2914,4 +2914,7 @@ root ALL=(ALL) SETENV: ALL
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
require = [
|
||||||
|
(import ../upstart-jobs/pcmcia.nix)
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
68
upstart-jobs/pcmcia.nix
Normal file
68
upstart-jobs/pcmcia.nix
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
pkgs: config:
|
||||||
|
|
||||||
|
###### 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;
|
||||||
|
decription = ''
|
||||||
|
Path to the configuration file which map the memory, irq
|
||||||
|
and ports used by the PCMCIA hardware.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
let
|
||||||
|
ifEnable = arg:
|
||||||
|
if config.hardware.pcmcia.enable then arg
|
||||||
|
else if builtins.isList arg then []
|
||||||
|
else if builtins.isAttrs arg then {}
|
||||||
|
else null;
|
||||||
|
|
||||||
|
pcmciaUtils = pkgs.pcmciaUtils.meta.function {
|
||||||
|
inherit (config.hardware.pcmcia) firmware config;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
require = options;
|
||||||
|
|
||||||
|
boot = {
|
||||||
|
kernelModules = ifEnable [ "pcmcia" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
udev = {
|
||||||
|
addUdevPkgs = ifEnable [ pcmciaUtils ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
extraPackages = ifEnable [ pcmciaUtils ];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue