Synit: inline preserves-tools package
This commit is contained in:
parent
61b53003b4
commit
1650358036
|
@ -14,9 +14,24 @@ let
|
|||
processesArgs = builtins.intersectAttrs processesFormalArgs
|
||||
(args // { processManager = "synit"; } // extraParams);
|
||||
|
||||
preserves-tools = if builtins.hasAttr "preserves-tools" pkgs then
|
||||
builtins.trace
|
||||
"not using inlined preserves-tools package because it is already in nixpkgs"
|
||||
pkgs.preserves-tools
|
||||
else
|
||||
pkgs.rustPlatform.buildRustPackage rec {
|
||||
pname = "preserves-tools";
|
||||
version = "4.992.2";
|
||||
src = pkgs.fetchCrate {
|
||||
inherit pname version;
|
||||
hash = "sha256-1IX6jTAH6qWE8X7YtIka5Z4y70obiVotOXzRnu+Z6a0=";
|
||||
};
|
||||
cargoHash = "sha256-D/ZCKRqZtPoCJ9t+5+q1Zm79z3K6Rew4eyuyDiGVGUs=";
|
||||
};
|
||||
|
||||
processes = if exprFile == null then { } else processesFun processesArgs;
|
||||
in pkgs.runCommand "synit-processes.pr" {
|
||||
nativeBuildInputs = [ pkgs.preserves-tools ];
|
||||
nativeBuildInputs = [ preserves-tools ];
|
||||
env.config_inputs =
|
||||
pkgs.lib.strings.concatMapStringsSep " " (builtins.getAttr "pkg")
|
||||
(builtins.attrValues processes);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ lib, runtimeShell, toPreserves, writeScript, writeTextFile }:
|
||||
{ lib, busybox, runtimeShell, toPreserves, writeScript, writeTextFile }:
|
||||
|
||||
{ name, description, argv, environment, directory
|
||||
{ name, description, argv, environment, directory, path
|
||||
# Shell instructions that specify how the state of the process should be initialized.
|
||||
, initialize ? ""
|
||||
# List of services that this configuration depends on.
|
||||
|
@ -12,12 +12,12 @@
|
|||
, require-service ? true }:
|
||||
|
||||
let
|
||||
#quoteArgs =
|
||||
# map (arg: ''"${lib.replaceStrings [ ''"'' ] [ ''\"'' ] (toString arg)}"'');
|
||||
env = environment // {
|
||||
PATH = lib.strings.makeBinPath (path ++ [ busybox ]);
|
||||
};
|
||||
|
||||
processSpec = {
|
||||
inherit argv;
|
||||
env = environment;
|
||||
inherit argv env;
|
||||
} // (lib.attrsets.optionalAttrs (directory != null) { dir = directory; });
|
||||
|
||||
serviceName = "<daemon ${name}>";
|
||||
|
@ -50,7 +50,12 @@ in writeTextFile {
|
|||
'';
|
||||
in ''
|
||||
<depends-on ${serviceName} <service-state <daemon ${initializeName}> complete>>
|
||||
<daemon ${initializeName} <one-shot [ "${script}" ]>>
|
||||
<daemon ${initializeName} {
|
||||
argv: [ "${script}" ]
|
||||
env: ${toPreserves env}
|
||||
readyOnStart: #f
|
||||
restart: on-error
|
||||
}>
|
||||
''))
|
||||
|
||||
+ ''
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, runtimeShell, writeScript, writeTextFile, undaemonize }:
|
||||
{ lib, busybox, runtimeShell, writeScript, writeTextFile, undaemonize }:
|
||||
|
||||
rec {
|
||||
util = import ./util.nix { inherit lib; };
|
||||
|
@ -6,7 +6,7 @@ rec {
|
|||
toPreserves = util.toPreserves { };
|
||||
|
||||
createSynitDaemon = import ../../backends/synit/create-synit-daemon.nix {
|
||||
inherit lib runtimeShell writeScript writeTextFile;
|
||||
inherit lib busybox runtimeShell writeScript writeTextFile;
|
||||
inherit toPreserves;
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
let
|
||||
generatedTargetSpecificArgs = {
|
||||
inherit name description environment directory dependencies initialize;
|
||||
inherit name description environment directory path dependencies initialize;
|
||||
|
||||
argv = map toString (if foregroundProcess != null then
|
||||
[ foregroundProcess ] ++ foregroundProcessArgs
|
||||
|
|
|
@ -115,7 +115,7 @@ let
|
|||
};
|
||||
|
||||
synit = import ../../backends/synit {
|
||||
inherit (pkgs) lib runtimeShell undaemonize writeScript writeTextFile;
|
||||
inherit (pkgs) lib busybox runtimeShell undaemonize writeScript writeTextFile;
|
||||
};
|
||||
|
||||
in
|
||||
|
|
Loading…
Reference in New Issue