2023-04-04 11:20:32 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, autoreconfHook, installShellFiles, util-linux }:
|
2022-09-14 19:31:49 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "swapspace";
|
2022-10-09 21:32:30 +00:00
|
|
|
version = "1.18";
|
2022-09-14 19:31:49 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Tookmund";
|
|
|
|
repo = "Swapspace";
|
|
|
|
rev = "v${version}";
|
2022-10-09 21:32:30 +00:00
|
|
|
sha256 = "sha256-tzsw10cpu5hldkm0psWcFnWToWQejout/oGHJais6yw=";
|
2022-09-14 19:31:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
autoreconfHook
|
|
|
|
installShellFiles
|
|
|
|
];
|
|
|
|
|
2023-04-04 11:20:32 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace 'swapspace.service' \
|
|
|
|
--replace '/usr/local/sbin/' "$out/bin/"
|
|
|
|
substituteInPlace 'src/support.c' \
|
|
|
|
--replace '/sbin/swapon' '${lib.getBin util-linux}/bin/swapon' \
|
|
|
|
--replace '/sbin/swapoff' '${lib.getBin util-linux}/bin/swapoff'
|
|
|
|
substituteInPlace 'src/swaps.c' \
|
|
|
|
--replace 'mkswap' '${lib.getBin util-linux}/bin/mkswap'
|
|
|
|
|
|
|
|
# Don't create empty directory $out/var/lib/swapspace
|
|
|
|
substituteInPlace 'Makefile.am' \
|
|
|
|
--replace 'install-data-local:' 'do-not-execute:'
|
|
|
|
'';
|
|
|
|
|
2022-09-14 19:31:49 +00:00
|
|
|
postInstall = ''
|
|
|
|
installManPage doc/swapspace.8
|
2023-04-04 11:20:32 +00:00
|
|
|
install --mode=444 -D 'swapspace.service' "$out/etc/systemd/system/swapspace.service"
|
2022-09-14 19:31:49 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Dynamic swap manager for Linux";
|
|
|
|
homepage = "https://github.com/Tookmund/Swapspace";
|
|
|
|
license = licenses.gpl2Only;
|
|
|
|
platforms = platforms.linux;
|
2023-04-07 22:29:37 +00:00
|
|
|
maintainers = with maintainers; [ misuzu Luflosi ];
|
2022-09-14 19:31:49 +00:00
|
|
|
};
|
|
|
|
}
|