diff --git a/pkgs/by-name/fi/firewalld/add-config-path-env-var.patch b/pkgs/by-name/fi/firewalld/add-config-path-env-var.patch new file mode 100644 index 000000000000..bba877e5593a --- /dev/null +++ b/pkgs/by-name/fi/firewalld/add-config-path-env-var.patch @@ -0,0 +1,12 @@ +--- a/src/firewall/config/__init__.py.in ++++ b/src/firewall/config/__init__.py.in +@@ -80,7 +80,8 @@ + FIREWALLD_POLICIES = path + "/policies" + + +-set_default_config_paths("/usr/lib/firewalld") ++import os ++set_default_config_paths(os.environ.get("NIX_FIREWALLD_CONFIG_PATH", "/usr/lib/firewalld")) + + FIREWALLD_LOGFILE = "/var/log/firewalld" + diff --git a/pkgs/by-name/fi/firewalld/package.nix b/pkgs/by-name/fi/firewalld/package.nix index 5fe266ea17e3..59c62cdfd2d8 100644 --- a/pkgs/by-name/fi/firewalld/package.nix +++ b/pkgs/by-name/fi/firewalld/package.nix @@ -2,20 +2,27 @@ lib, stdenv, fetchFromGitHub, - autoreconfHook, - bash, + autoconf, + automake, docbook_xml_dtd_42, docbook-xsl-nons, glib, gobject-introspection, gtk3, intltool, + ipset, + iptables, + kdePackages, + kmod, libnotify, libxml2, libxslt, + networkmanager, networkmanagerapplet, pkg-config, python3, + qt6, + sysctl, wrapGAppsNoGuiHook, withGui ? false, }: @@ -30,8 +37,7 @@ let pygobject3 ] ++ lib.optionals withGui [ - pyqt5 - pyqt5-sip + pyqt6 ] ); in @@ -47,27 +53,32 @@ stdenv.mkDerivation rec { }; patches = [ + ./add-config-path-env-var.patch ./respect-xml-catalog-files-var.patch + ./specify-localedir.patch ]; postPatch = '' - substituteInPlace src/firewall/config/__init__.py.in \ - --replace "/usr/share" "$out/share" + substituteInPlace config/xmlschema/check.sh \ + --replace-fail /usr/bin/ "" - for file in config/firewall-{applet,config}.desktop.in; do - substituteInPlace $file \ - --replace "/usr/bin/" "$out/bin/" + for file in src/{firewall-offline-cmd.in,firewall/config/__init__.py.in} \ + config/firewall-{applet,config}.desktop.in; do + substituteInPlace $file \ + --replace-fail /usr "$out" done '' + lib.optionalString withGui '' substituteInPlace src/firewall-applet.in \ - --replace "/usr/bin/nm-connection-editor" "${networkmanagerapplet}/bin/nm-connection-editor" + --replace-fail "/usr/bin/systemsettings" "${kdePackages.systemsettings}/bin/systemsettings" \ + --replace-fail "/usr/bin/nm-connection-editor" "${networkmanagerapplet}/bin/nm-connection-editor" ''; nativeBuildInputs = [ - autoreconfHook + autoconf + automake docbook_xml_dtd_42 docbook-xsl-nons glib @@ -77,40 +88,78 @@ stdenv.mkDerivation rec { pkg-config python3 python3.pkgs.wrapPython + wrapGAppsNoGuiHook ] ++ lib.optionals withGui [ - gobject-introspection - wrapGAppsNoGuiHook + qt6.wrapQtAppsHook ]; buildInputs = [ - bash glib + gobject-introspection + ipset + iptables + kmod + networkmanager + pythonPath + sysctl ] ++ lib.optionals withGui [ gtk3 libnotify - pythonPath + qt6.qtbase ]; - dontWrapGApps = true; - - preFixup = lib.optionalString withGui '' - makeWrapperArgs+=("''${gappsWrapperArgs[@]}") + preConfigure = '' + ./autogen.sh ''; + ac_cv_path_MODPROBE = lib.getExe' kmod "modprobe"; + ac_cv_path_RMMOD = lib.getExe' kmod "rmmod"; + ac_cv_path_SYSCTL = lib.getExe' sysctl "sysctl"; + + configureFlags = [ + "--with-iptables=${lib.getExe' iptables "iptables"}" + "--with-iptables-restore=${lib.getExe' iptables "iptables-restore"}" + "--with-ip6tables=${lib.getExe' iptables "ip6tables"}" + "--with-ip6tables-restore=${lib.getExe' iptables "ip6tables-restore"}" + "--with-ebtables=${lib.getExe' iptables "ebtables"}" + "--with-ebtables-restore=${lib.getExe' iptables "ebtables-restore"}" + "--with-ipset=${lib.getExe' ipset "ipset"}" + ]; + + postInstall = + '' + rm -r $out/share/firewalld/testsuite + '' + + lib.optionalString (!withGui) '' + rm $out/bin/firewall-{applet,config} + ''; + + dontWrapGApps = true; + dontWrapQtApps = true; + + preFixup = + '' + makeWrapperArgs+=("''${gappsWrapperArgs[@]}") + '' + + lib.optionalString withGui '' + makeWrapperArgs+=("''${qtWrapperArgs[@]}") + ''; + postFixup = '' - chmod +x $out/share/firewalld/*.py $out/share/firewalld/testsuite/python/*.py $out/share/firewalld/testsuite/{,integration/}testsuite - patchShebangs --host $out/share/firewalld/testsuite/{,integration/}testsuite $out/share/firewalld/*.py + chmod +x $out/share/firewalld/*.py + patchShebangs --host $out/share/firewalld/*.py wrapPythonProgramsIn "$out/bin" "$out ${pythonPath}" - wrapPythonProgramsIn "$out/share/firewalld/testsuite/python" "$out ${pythonPath}" ''; - meta = with lib; { + meta = { description = "Firewall daemon with D-Bus interface"; - homepage = "https://github.com/firewalld/firewalld"; - license = licenses.gpl2Plus; - maintainers = [ ]; + homepage = "https://firewalld.org"; + downloadPage = "https://github.com/firewalld/firewalld/releases"; + license = lib.licenses.gpl2Plus; + maintainers = with lib.maintainers; [ prince213 ]; + platforms = lib.platforms.linux; }; } diff --git a/pkgs/by-name/fi/firewalld/specify-localedir.patch b/pkgs/by-name/fi/firewalld/specify-localedir.patch new file mode 100644 index 000000000000..57e79da4d0b1 --- /dev/null +++ b/pkgs/by-name/fi/firewalld/specify-localedir.patch @@ -0,0 +1,12 @@ +--- a/src/firewall/config/__init__.py.in ++++ b/src/firewall/config/__init__.py.in +@@ -19,6 +19,9 @@ + DOMAIN = "firewalld" + import gettext + ++locale.bindtextdomain(DOMAIN, "/usr/share/locale") ++gettext.bindtextdomain(DOMAIN, "/usr/share/locale") ++ + gettext.install(domain=DOMAIN) + + from . import dbus # noqa: F401