nix-packages/packages/journalctl-last-invocation/package.nix

31 lines
664 B
Nix
Raw Permalink Normal View History

{ pkgs , stdenv } :
2025-03-10 23:54:40 +01:00
with pkgs ;
with stdenv ;
mkDerivation {
pname = "journalctl-last-invocation" ;
version = "2025-03-10" ;
phases = [ "createSourcesPhase" "installPhase" ] ;
2025-03-10 23:54:40 +01:00
createSourcesPhase = ''
# Same directory structure that `unpackPhase` would use
mkdir -p /build/source
cat <<- EOF > /build/source/journalctl-last-invocation
2025-03-10 23:54:40 +01:00
#!${bash}/bin/sh
exec ${systemd}/bin/journalctl _SYSTEMD_INVOCATION_ID=\$( ${systemd}/bin/systemctl show --value --property=InvocationID \$1 )
EOF
'' ;
installPhase = ''
mkdir -p $out/bin
cp /build/source/journalctl-last-invocation $out/bin/
2025-03-10 23:54:40 +01:00
chmod +x $out/bin/journalctl-last-invocation
2025-03-10 23:54:40 +01:00
'' ;
}