nixpkgs/pkgs/by-name/pc/pcmciaUtils/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

71 lines
1.9 KiB
Nix

{
config,
lib,
stdenv,
fetchurl,
bison,
flex,
sysfsutils,
kmod,
udev,
firmware ? config.pcmciaUtils.firmware or [ ], # Special pcmcia cards.
configOpts ? config.pcmciaUtils.config or null, # Special hardware (map memory & port & irq)
}: # used to generate postInstall script.
# FIXME: should add an option to choose between hotplug and udev.
stdenv.mkDerivation rec {
pname = "pcmciautils";
version = "018";
src = fetchurl {
url = "https://kernel.org/pub/linux/utils/kernel/pcmcia/pcmciautils-${version}.tar.gz";
sha256 = "0sfm3w2n73kl5w7gb1m6q8gy5k4rgwvzz79n6yhs9w3sag3ix8sk";
};
buildInputs = [
udev
bison
sysfsutils
kmod
flex
];
patchPhase =
''
sed -i "
s,/sbin/modprobe,${kmod}&,;
s,/lib/udev/,$out/sbin/,;
" udev/* # fix-color */
sed -i "
s,/lib/firmware,$out&,;
s,/etc/pcmcia,$out&,;
" src/{startup.c,pcmcia-check-broken-cis.c} # fix-color */
''
+ (lib.optionalString (firmware == [ ]) ''sed -i "s,STARTUP = true,STARTUP = false," Makefile'')
+ (lib.optionalString (configOpts != null) "ln -sf ${configOpts} ./config/config.opts");
makeFlags = [ "LEX=flex" ];
installFlags = [
"INSTALL=install"
"DESTDIR=${placeholder "out"}"
];
postInstall = lib.concatMapStrings (path: ''
for f in : $(find ${path} -type f); do
test "$f" == ":" && continue;
mkdir -p $(dirname $out/lib/firmware/$\{f#${path}});
ln -s $f $out/lib/firmware/$\{f#${path}};
done;
'') firmware;
meta = {
homepage = "https://www.kernel.org/pub/linux/utils/kernel/pcmcia/";
longDescription = "
PCMCIAutils contains the initialization tools necessary to allow
the PCMCIA subsystem to behave (almost) as every other
hotpluggable bus system.
";
license = lib.licenses.gpl2Only;
platforms = lib.platforms.linux;
};
}