Synit: inline preserves-tools package
This commit is contained in:
parent
61b53003b4
commit
1650358036
|
@ -14,9 +14,24 @@ let
|
||||||
processesArgs = builtins.intersectAttrs processesFormalArgs
|
processesArgs = builtins.intersectAttrs processesFormalArgs
|
||||||
(args // { processManager = "synit"; } // extraParams);
|
(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;
|
processes = if exprFile == null then { } else processesFun processesArgs;
|
||||||
in pkgs.runCommand "synit-processes.pr" {
|
in pkgs.runCommand "synit-processes.pr" {
|
||||||
nativeBuildInputs = [ pkgs.preserves-tools ];
|
nativeBuildInputs = [ preserves-tools ];
|
||||||
env.config_inputs =
|
env.config_inputs =
|
||||||
pkgs.lib.strings.concatMapStringsSep " " (builtins.getAttr "pkg")
|
pkgs.lib.strings.concatMapStringsSep " " (builtins.getAttr "pkg")
|
||||||
(builtins.attrValues processes);
|
(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.
|
# Shell instructions that specify how the state of the process should be initialized.
|
||||||
, initialize ? ""
|
, initialize ? ""
|
||||||
# List of services that this configuration depends on.
|
# List of services that this configuration depends on.
|
||||||
|
@ -12,12 +12,12 @@
|
||||||
, require-service ? true }:
|
, require-service ? true }:
|
||||||
|
|
||||||
let
|
let
|
||||||
#quoteArgs =
|
env = environment // {
|
||||||
# map (arg: ''"${lib.replaceStrings [ ''"'' ] [ ''\"'' ] (toString arg)}"'');
|
PATH = lib.strings.makeBinPath (path ++ [ busybox ]);
|
||||||
|
};
|
||||||
|
|
||||||
processSpec = {
|
processSpec = {
|
||||||
inherit argv;
|
inherit argv env;
|
||||||
env = environment;
|
|
||||||
} // (lib.attrsets.optionalAttrs (directory != null) { dir = directory; });
|
} // (lib.attrsets.optionalAttrs (directory != null) { dir = directory; });
|
||||||
|
|
||||||
serviceName = "<daemon ${name}>";
|
serviceName = "<daemon ${name}>";
|
||||||
|
@ -50,7 +50,12 @@ in writeTextFile {
|
||||||
'';
|
'';
|
||||||
in ''
|
in ''
|
||||||
<depends-on ${serviceName} <service-state <daemon ${initializeName}> complete>>
|
<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 {
|
rec {
|
||||||
util = import ./util.nix { inherit lib; };
|
util = import ./util.nix { inherit lib; };
|
||||||
|
@ -6,7 +6,7 @@ rec {
|
||||||
toPreserves = util.toPreserves { };
|
toPreserves = util.toPreserves { };
|
||||||
|
|
||||||
createSynitDaemon = import ../../backends/synit/create-synit-daemon.nix {
|
createSynitDaemon = import ../../backends/synit/create-synit-daemon.nix {
|
||||||
inherit lib runtimeShell writeScript writeTextFile;
|
inherit lib busybox runtimeShell writeScript writeTextFile;
|
||||||
inherit toPreserves;
|
inherit toPreserves;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
generatedTargetSpecificArgs = {
|
generatedTargetSpecificArgs = {
|
||||||
inherit name description environment directory dependencies initialize;
|
inherit name description environment directory path dependencies initialize;
|
||||||
|
|
||||||
argv = map toString (if foregroundProcess != null then
|
argv = map toString (if foregroundProcess != null then
|
||||||
[ foregroundProcess ] ++ foregroundProcessArgs
|
[ foregroundProcess ] ++ foregroundProcessArgs
|
||||||
|
|
|
@ -115,7 +115,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
synit = import ../../backends/synit {
|
synit = import ../../backends/synit {
|
||||||
inherit (pkgs) lib runtimeShell undaemonize writeScript writeTextFile;
|
inherit (pkgs) lib busybox runtimeShell undaemonize writeScript writeTextFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
Loading…
Reference in New Issue