Attempt fixing the backup and restore scripts
This has required to eschew the `wrapProgram` script as they then go on to figure out their "installed" location via `dirname` which now points to the nixstore location. Thus leading to the backup being bogus and also not written. Fortunately all of the interesting programs are shell scripts, so we can just prepend some text to them. Another issue was that we were deleting the `lst` file that OH was relying on to clean up the backup afterwards.
This commit is contained in:
committed by
Simonas Kazlauskas
parent
c5143fbe60
commit
63c1d89dda
12
flake.lock
generated
12
flake.lock
generated
@@ -5,11 +5,11 @@
|
|||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1689068808,
|
"lastModified": 1701680307,
|
||||||
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -20,11 +20,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1690716044,
|
"lastModified": 1703383890,
|
||||||
"narHash": "sha256-5rhZK0YMQOK+FaOC72leFXUFuCBxKH5SRzUQqpePqQE=",
|
"narHash": "sha256-3LNEli9ET6L+bdj7fxo4yLOKnfAYSGxUMBWt0Yx7oUQ=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "b1b263e5f7f899704c6b592f2096bc8f719dc181",
|
"rev": "6586ea5fb647f22ff7f671003a888ffbc0950a7e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
15
openhab.nix
15
openhab.nix
@@ -7,6 +7,8 @@
|
|||||||
lib,
|
lib,
|
||||||
makeWrapper,
|
makeWrapper,
|
||||||
procps,
|
procps,
|
||||||
|
zip,
|
||||||
|
unzip,
|
||||||
stdenv,
|
stdenv,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@@ -23,7 +25,7 @@ in stdenv.mkDerivation rec {
|
|||||||
nativeBuildInputs = [ makeWrapper ];
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
buildInputs = [ bash ];
|
buildInputs = [ bash ];
|
||||||
outputs = [ "out" ];
|
outputs = [ "out" ];
|
||||||
extraPath = lib.makeBinPath [ jdk-openhab gawk coreutils procps ];
|
extraPath = lib.makeBinPath [ jdk-openhab gawk coreutils procps zip unzip ];
|
||||||
wrappedExecutables = [
|
wrappedExecutables = [
|
||||||
"start.sh"
|
"start.sh"
|
||||||
"start_debug.sh"
|
"start_debug.sh"
|
||||||
@@ -53,12 +55,15 @@ in stdenv.mkDerivation rec {
|
|||||||
"$out/"*.bat \
|
"$out/"*.bat \
|
||||||
"$out/runtime/bin/"*.bat \
|
"$out/runtime/bin/"*.bat \
|
||||||
"$out/runtime/bin/"*.ps1 \
|
"$out/runtime/bin/"*.ps1 \
|
||||||
"$out/runtime/bin/"*.psm1 \
|
"$out/runtime/bin/"*.psm1
|
||||||
"$out/runtime/bin/"*.lst
|
|
||||||
|
|
||||||
for exe in $wrappedExecutables; do
|
for exe in $wrappedExecutables; do
|
||||||
echo "Wrapping $exe…"
|
echo "Rewriting $exe…"
|
||||||
wrapProgram $out/$exe --prefix PATH ':' $extraPath
|
cat - $out/$exe > "$out/$exe".new << EOF
|
||||||
|
#!${bash}/bin/sh
|
||||||
|
export PATH="\''$PATH:$extraPath"
|
||||||
|
EOF
|
||||||
|
mv "$out/$exe".new "$out/$exe"
|
||||||
done
|
done
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
|
|||||||
Reference in New Issue
Block a user