nixpkgs/pkgs/by-name/tu/tuna/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

65 lines
1.5 KiB
Nix

{
lib,
python3,
fetchurl,
glib,
gobject-introspection,
gtk3,
wrapGAppsHook3,
}:
python3.pkgs.buildPythonApplication rec {
pname = "tuna";
version = "0.19";
pyproject = true;
src = fetchurl {
url = "https://git.kernel.org/pub/scm/utils/tuna/tuna.git/snapshot/tuna-v${version}.tar.gz";
hash = "sha256-t10CxtwnTOg1uQgm6mTrNUIU8LkXJ3BkTycjWteQvuU=";
};
postPatch = ''
mv tuna-cmd.py tuna/cmd.py
substituteInPlace setup.py \
--replace-fail 'packages = ["tuna", "tuna/gui"],' \
'packages = ["tuna", "tuna/gui"], entry_points={"console_scripts":["tuna=tuna.cmd:main"]},'
substituteInPlace tuna/tuna_gui.py \
--replace-fail "self.binpath + 'pkexec'" "'/run/wrappers/bin/pkexec'" \
--replace-fail 'tuna_glade_dirs = [".", "tuna", "/usr/share/tuna"]' "tuna_glade_dirs = [ \"$out/share/tuna\" ]"
'';
build-system = with python3.pkgs; [ setuptools ];
nativeBuildInputs = [
glib.dev
gobject-introspection
gtk3
wrapGAppsHook3
];
dependencies = with python3.pkgs; [
pygobject3
python-linux-procfs
ethtool
];
postInstall = ''
mkdir -p $out/share/tuna
cp tuna/tuna_gui.glade $out/share/tuna/
'';
# contains no tests
doCheck = false;
pythonImportsCheck = [ "tuna" ];
meta = with lib; {
description = "Thread and IRQ affinity setting GUI and cmd line tool";
mainProgram = "tuna";
homepage = "https://git.kernel.org/pub/scm/utils/tuna/tuna.git";
license = licenses.gpl2Plus;
platforms = platforms.linux;
};
}