From 602281b1321fbab6d9af34ad816317ff19fa14cc Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Tue, 14 Dec 2021 19:51:22 +0100 Subject: [PATCH] rtl, cl-rest: add /bin to pkg output --- modules/rtl.nix | 5 +++-- pkgs/cl-rest/default.nix | 16 +++++++++++++--- pkgs/rtl/default.nix | 16 +++++++++++++--- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/modules/rtl.nix b/modules/rtl.nix index 095fe4a..5bbba94 100644 --- a/modules/rtl.nix +++ b/modules/rtl.nix @@ -105,6 +105,7 @@ let cfg = config.services.rtl; nbLib = config.nix-bitcoin.lib; + nbPkgs = config.nix-bitcoin.pkgs; secretsDir = config.nix-bitcoin.secretsDir; node = { isLnd, index }: '' @@ -223,7 +224,7 @@ in { install -D -o ${cfg.user} -g ${cfg.group} ${lnd.networkDir}/admin.macaroon \ '${cfg.dataDir}/macaroons/admin.macaroon' ''); - ExecStart = "${pkgs.nodejs}/bin/node ${config.nix-bitcoin.pkgs.rtl}/lib/node_modules/rtl/rtl"; + ExecStart = "${nbPkgs.rtl}/bin/rtl"; # Show "rtl" instead of "node" in the journal SyslogIdentifier = "rtl"; User = cfg.user; @@ -247,7 +248,7 @@ in { StateDirectory = "cl-rest"; # cl-rest reads the config file from the working directory WorkingDirectory = cl-rest.dataDir; - ExecStart = "${pkgs.nodejs}/bin/node ${config.nix-bitcoin.pkgs.cl-rest}/lib/node_modules/c-lightning-rest/cl-rest"; + ExecStart = "${nbPkgs.cl-rest}/bin/cl-rest"; # Show "cl-rest" instead of "node" in the journal SyslogIdentifier = "cl-rest"; User = cfg.user; diff --git a/pkgs/cl-rest/default.nix b/pkgs/cl-rest/default.nix index b7931b7..90cda20 100644 --- a/pkgs/cl-rest/default.nix +++ b/pkgs/cl-rest/default.nix @@ -1,5 +1,15 @@ -{ pkgs }: +{ pkgs, makeWrapper }: let - nodePackages = import ./composition.nix { inherit pkgs; inherit (pkgs) nodejs; }; + inherit (pkgs) nodejs; + nodePackages = import ./composition.nix { inherit pkgs nodejs; }; in -nodePackages.package +nodePackages.package.overrideAttrs (old: { + nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ + makeWrapper + ]; + + postInstall = '' + makeWrapper ${nodejs}/bin/node $out/bin/cl-rest \ + --add-flags $out/lib/node_modules/c-lightning-rest/cl-rest + ''; +}) diff --git a/pkgs/rtl/default.nix b/pkgs/rtl/default.nix index b7931b7..bc3605b 100644 --- a/pkgs/rtl/default.nix +++ b/pkgs/rtl/default.nix @@ -1,5 +1,15 @@ -{ pkgs }: +{ pkgs, makeWrapper }: let - nodePackages = import ./composition.nix { inherit pkgs; inherit (pkgs) nodejs; }; + inherit (pkgs) nodejs; + nodePackages = import ./composition.nix { inherit pkgs nodejs; }; in -nodePackages.package +nodePackages.package.overrideAttrs (old: { + nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ + makeWrapper + ]; + + postInstall = '' + makeWrapper ${nodejs}/bin/node $out/bin/rtl \ + --add-flags $out/lib/node_modules/rtl/rtl + ''; +})