From 1943c907c8da825b50bf1f1b0e53b903da63f8b6 Mon Sep 17 00:00:00 2001 From: James Andariese Date: Sun, 4 Aug 2024 04:20:16 +0000 Subject: [PATCH] change to writeShellApplication (#1) use writeShellApplication to enable the automatic setting of PATH for dependencies. Reviewed-on: https://git.strudelline.net/cascade/docker-node-red/pulls/1 --- docker.nix | 20 +++++++++++++++++--- flake.nix | 4 ---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docker.nix b/docker.nix index 74b699d..c6baf2e 100644 --- a/docker.nix +++ b/docker.nix @@ -1,6 +1,20 @@ { config, pkgs, ...}: -pkgs.dockerTools.streamLayeredImage { - name = "node-red"; - config.Cmd = [ "${pkgs.nodePackages.node-red}/bin/node-red" ]; +let +name = "node-red"; +entrypoint = pkgs.writeShellApplication { + inherit name; + + runtimeInputs = with pkgs; with nodePackages; [ + node-red + ungoogled-chromium + ]; + + text = '' + node-red + ''; +}; +in pkgs.dockerTools.streamLayeredImage { + inherit name; + config.Cmd = [ "${entrypoint}/bin/entrypoint" ]; } diff --git a/flake.nix b/flake.nix index 40a9e5f..1c766b7 100644 --- a/flake.nix +++ b/flake.nix @@ -11,10 +11,6 @@ lib = nixpkgs.lib; pkgs = nixpkgs.legacyPackages.${system}; streamImage = pkgs.callPackage (import ./docker.nix) {}; - #pkgs.dockerTools.streamLayeredImage { - # name = "node-red"; - # config.Cmd = [ "${pkgs.nodePackages.node-red}/bin/node-red" ]; - #}; in {