nixpkgs/pkgs/by-name/fi/firewalld/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

105 lines
2.3 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, autoreconfHook
, bash
, docbook_xml_dtd_42
, docbook-xsl-nons
, glib
, gobject-introspection
, gtk3
, intltool
, libnotify
, libxml2
, libxslt
, networkmanagerapplet
, pkg-config
, python3
, wrapGAppsNoGuiHook
, withGui ? false
}:
let
pythonPath = python3.withPackages (ps: with ps; [
dbus-python
nftables
pygobject3
] ++ lib.optionals withGui [
pyqt5
pyqt5-sip
]);
in
stdenv.mkDerivation rec {
pname = "firewalld";
version = "2.2.3";
src = fetchFromGitHub {
owner = "firewalld";
repo = "firewalld";
rev = "v${version}";
sha256 = "sha256-ugDleco/Ep+10ku+5xcW4zq/RrhruZCRlX0zKeXzLhg=";
};
patches = [
./respect-xml-catalog-files-var.patch
];
postPatch = ''
substituteInPlace src/firewall/config/__init__.py.in \
--replace "/usr/share" "$out/share"
for file in config/firewall-{applet,config}.desktop.in; do
substituteInPlace $file \
--replace "/usr/bin/" "$out/bin/"
done
'' + lib.optionalString withGui ''
substituteInPlace src/firewall-applet.in \
--replace "/usr/bin/nm-connection-editor" "${networkmanagerapplet}/bin/nm-conenction-editor"
'';
nativeBuildInputs = [
autoreconfHook
docbook_xml_dtd_42
docbook-xsl-nons
glib
intltool
libxml2
libxslt
pkg-config
python3
python3.pkgs.wrapPython
] ++ lib.optionals withGui [
gobject-introspection
wrapGAppsNoGuiHook
];
buildInputs = [
bash
glib
] ++ lib.optionals withGui [
gtk3
libnotify
pythonPath
];
dontWrapGApps = true;
preFixup = lib.optionalString withGui ''
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
'';
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
wrapPythonProgramsIn "$out/bin" "$out ${pythonPath}"
wrapPythonProgramsIn "$out/share/firewalld/testsuite/python" "$out ${pythonPath}"
'';
meta = with lib; {
description = "Firewall daemon with D-Bus interface";
homepage = "https://github.com/firewalld/firewalld";
license = licenses.gpl2Plus;
maintainers = [ ];
};
}