nixos/uptime-kuma: Add additional lockdown settings to systemd unit (#361452)
[NixPkgs.git] / pkgs / by-name / fd / fdtools / package.nix
blob6f0d205203df8a27683c719187ae7fa2ff335385
1 { stdenv, lib, fetchurl, skawarePackages }:
3 let
4   pname = "fdtools";
5   # When you update, check whether we can drop the skalibs pin.
6   version = "2020.05.04";
7   sha256 = "0lnafcp4yipi0dl8gh33zjs8wlpz0mim8mwmiz9s49id0b0fmlla";
8   skalibs = skawarePackages.skalibs_2_10;
10 in stdenv.mkDerivation {
11   inherit pname version;
13   src = fetchurl {
14     url = "https://code.dogmap.org/fdtools/releases/fdtools-${version}.tar.bz2";
15     inherit sha256;
16   };
18   patches = [ ./new-skalibs.patch ];
19   outputs = [ "bin" "lib" "dev" "doc" "out" ];
21   buildInputs = [
22     # temporary, until fdtools catches up to skalibs
23     skalibs
24   ];
26   configurePhase = ''
27     cd fdtools-${version}
28     sed -e 's|gcc|$CC|' \
29       conf-compile/defaults/host_link.sh \
30       > conf-compile/host_link.sh
31     sed -e 's|gcc|$CC|' \
32       conf-compile/defaults/host_compile.sh \
33       > conf-compile/host_compile.sh
35     echo "${skalibs.lib}/lib/skalibs/sysdeps" \
36       > conf-compile/depend_skalibs_sysdeps
37   '';
39   buildPhase = ''
40     bash package/build
41   '';
43   installPhase = ''
44     mkdir -p $bin/bin
45     tools=( grabconsole multitee pipecycle recvfd seek0 sendfd setblock setstate statfile vc-get vc-lock vc-switch )
47     for t in "''${tools[@]}"; do
48       mv "command/$t" "$bin/bin/$t"
49     done
51     mkdir -p $lib/lib
52     mkdir -p $dev/include
53     docdir=$doc/share/doc/fdtools
54     mkdir -p $docdir
56     mv library/fdtools.a $lib/lib/fdtools.a
57     mv include/fdtools.h $dev/include/fdtools.h
59     ${skawarePackages.cleanPackaging.commonFileActions {
60        noiseFiles = [
61          "conf-compile/**/*"
62          "src/**/*"
63          "src/.**/*"
64          "compile/**/*"
65          "package/{build,check,compile,elsewhere,install,install_commands,own,run,sharing,upgrade,upgrade_version,url_src,url_src_latest,versions}"
66        ];
67        docFiles = [
68          "package/INSTALL"
69          "package/LICENSE"
70          "package/README"
71        ];
72     }} $docdir
74     ${skawarePackages.cleanPackaging.checkForRemainingFiles}
76     # we don’t use this, but nixpkgs requires it
77     touch $out
78   '';
80   meta = {
81     homepage = "https://code.dogmap.org/fdtools/";
82     description = "Set of utilities for working with file descriptors";
83     license = lib.licenses.gpl2Only;
84     platforms = lib.platforms.linux;
85     maintainers = [ lib.maintainers.Profpatsch ];
86   };