30 lines
654 B
Nix
30 lines
654 B
Nix
{ pkgs, stdenv }:
|
|
|
|
with pkgs;
|
|
with stdenv;
|
|
|
|
mkDerivation {
|
|
pname = "journalctl-last-invocation";
|
|
version = "2026-04-29";
|
|
|
|
phases = [ "createSourcesPhase" "installPhase" ];
|
|
|
|
createSourcesPhase = ''
|
|
# Same directory structure that `unpackPhase` would use.
|
|
mkdir -p /build/source
|
|
|
|
cat <<- EOF > /build/source/journalctl-last-invocation
|
|
#!${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/
|
|
|
|
chmod +x $out/bin/journalctl-last-invocation
|
|
'';
|
|
}
|