mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-04-16 13:28:12 +00:00
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 {
|
||||
pname = "swapspace";
|
||||
@ -16,8 +16,23 @@ stdenv.mkDerivation rec {
|
||||
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 = ''
|
||||
installManPage doc/swapspace.8
|
||||
install --mode=444 -D 'swapspace.service' "$out/etc/systemd/system/swapspace.service"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
|
Loading…
Reference in New Issue
Block a user