summary refs log tree commit diff
path: root/pkgs/os-specific/linux/firewalld/default.nix
blob: 6b2e58038759f319f4457853b7bcee001a6d1d4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{ stdenv, lib, fetchFromGitHub
, autoreconfHook, docbook_xml_dtd_42, docbook_xsl, gettext, python3Packages
, intltool, libxslt, dbus, pkgconfig, iptables, ebtables, ipset, glib, kmod
, withKde ? true, plasma-nm ? null
}:

let
  slip = python3Packages.buildPythonPackage rec {
    name = "python-slip-${version}";
    version = "0.6.4";

    src = fetchFromGitHub {
      owner  = "nphilipp";
      repo   = "python-slip";
      rev    = name;
      sha256 = "07zyxy62738dzsvifm1241k0zx5l3xl6s5yfhyn88wc59fa8p570";
    };

    doCheck = false; # no tests

    buildPhase = ''
      runHook preBuild
      export PREFIX=$out
      make
      runHook postBuild
    '';

    installPhase = ''
      runHook preInstall
      make install
      runHook postInstall
    '';

  };

in python3Packages.buildPythonApplication rec {
  name = "firewalld-${version}";
  version = "0.4.4.4";

  src = fetchFromGitHub {
    owner  = "t-woerner";
    repo   = "firewalld";
    rev    = "v${version}";
    sha256 = "048flfcsi3ibp124k01hhf9bnbpyi3b92jgc96fhfvw6ns2l48qc";
  };

  doCheck = false; # no tests

  propagatedBuildInputs = with python3Packages; [
    dbus
    decorator
    pygobject3
    pyqt5
    six
    slip
  ];

  buildInputs = [
    autoreconfHook pkgconfig
    docbook_xml_dtd_42 docbook_xsl gettext intltool libxslt
    dbus ebtables glib ipset iptables
  ];

  preConfigure = ''
    patchShebangs .

    substituteInPlace doc/xml/*.xml \
      --replace "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" "${docbook_xml_dtd_42}/xml/dtd/docbook/docbookx.dtd"

    substituteInPlace src/firewall-applet \
      --replace /usr/bin/kde5-nm-connection-editor ${lib.getBin plasma-nm}/bin/kde5-nm-connection-editor

    export MODINFO=${kmod}/bin/modinfo
    export MODPROBE=${kmod}/bin/modprobe
    export RMMOD=${kmod}/bin/rmmod
  '';

  buildPhase = ''
    ./autogen.sh --prefix=$out
    make
  '';

  installPhase = ''
    make install $out
    cp -r config/{helpers,icmptypes,ipsets,services,zones} $out/etc/firewalld
  '';

  meta = with lib; {
    description = "A service daemon with D-Bus interface";
    license = licenses.gpl2;
    platforms = platforms.linux;
    maintainers = with maintainers; [ peterhoeg ];
  };
}