swapspace: patch paths to binaries and install systemd unit file
This will be useful when creating a NixOS module for this program.
This commit is contained in:
parent
b0004e6c97
commit
82dd065f7a
|
@ -1,4 +1,4 @@
|
||||||
{ lib, stdenv, fetchFromGitHub, autoreconfHook, installShellFiles }:
|
{ lib, stdenv, fetchFromGitHub, autoreconfHook, installShellFiles, util-linux }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "swapspace";
|
pname = "swapspace";
|
||||||
|
@ -16,8 +16,23 @@ stdenv.mkDerivation rec {
|
||||||
installShellFiles
|
installShellFiles
|
||||||
];
|
];
|
||||||
|
|
||||||
|
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:'
|
||||||
|
'';
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
installManPage doc/swapspace.8
|
installManPage doc/swapspace.8
|
||||||
|
install --mode=444 -D 'swapspace.service' "$out/etc/systemd/system/swapspace.service"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
|
Loading…
Reference in a new issue