diff --git a/default.nix b/default.nix index 0ff1be2..281268a 100644 --- a/default.nix +++ b/default.nix @@ -27,10 +27,8 @@ let else throw "Unsupported platform: only darwin and linux are supported"; - name = if pkgs.lib.isDerivation path then path.name else builtins.baseNameOf path; - overrideEnv = name: value: if value == null then "" else "export ${name}='${value}'"; in -pkgs.runCommand "bundle-${name}" +pkgs.runCommand "bundle" { nativeBuildInputs = cfg.deps ++ [ pkgs.nukeReferences ]; } @@ -39,10 +37,10 @@ pkgs.runCommand "bundle-${name}" export bin_dir='${bin_dir}' export exe_dir='${exe_dir}' export lib_dir='${lib_dir}' - ${if builtins.pathExists "${path}/bin" then '' + if [[ -d "${path}/bin" ]]; then find '${path}/bin' -type f -executable -print0 | xargs -0 --max-args 1 ${cfg.script} "$out" - '' else '' + else ${cfg.script} "$out" ${pkgs.lib.escapeShellArg path} - ''} + fi find $out -empty -type d -delete ''