mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 07:53:19 +00:00
29027fd1e1
Using pkgs.lib on the spine of module evaluation is problematic because the pkgs argument depends on the result of module evaluation. To prevent an infinite recursion, pkgs and some of the modules are evaluated twice, which is inefficient. Using ‘with lib’ prevents this problem.
60 lines
1.0 KiB
Nix
60 lines
1.0 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
pcmciaUtils = pkgs.pcmciaUtils.passthru.function {
|
|
inherit (config.hardware.pcmcia) firmware config;
|
|
};
|
|
|
|
in
|
|
|
|
|
|
{
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
hardware.pcmcia = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Enable this option to support PCMCIA card.
|
|
'';
|
|
};
|
|
|
|
firmware = mkOption {
|
|
type = types.listOf types.path;
|
|
default = [];
|
|
description = ''
|
|
List of firmware used to handle specific PCMCIA card.
|
|
'';
|
|
};
|
|
|
|
config = mkOption {
|
|
default = null;
|
|
description = ''
|
|
Path to the configuration file which maps the memory, IRQs
|
|
and ports used by the PCMCIA hardware.
|
|
'';
|
|
};
|
|
};
|
|
|
|
};
|
|
|
|
###### implementation
|
|
|
|
config = mkIf config.hardware.pcmcia.enable {
|
|
|
|
boot.kernelModules = [ "pcmcia" ];
|
|
|
|
services.udev.packages = [ pcmciaUtils ];
|
|
|
|
environment.systemPackages = [ pcmciaUtils ];
|
|
|
|
};
|
|
|
|
}
|