mirror of
https://gitlab.com/rensa-nix/devtools.git
synced 2026-02-02 07:15:08 +01:00
feat: add basic process compose module
This commit is contained in:
parent
a4295c3cdb
commit
25fb9162ff
4 changed files with 84 additions and 0 deletions
47
lib/modules/process_compose.nix
Normal file
47
lib/modules/process_compose.nix
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption mkIf types;
|
||||
cfg = config.process-compose;
|
||||
|
||||
configFile = (pkgs.formats.yaml {}).generate "process-compose.yaml" cfg.config;
|
||||
pcAlias = pkgs.writeTextFile {
|
||||
name = "pc-alias";
|
||||
destination = "/bin/${cfg.alias}";
|
||||
executable = true;
|
||||
text =
|
||||
# sh
|
||||
''
|
||||
${pkgs.process-compose}/bin/process-compose --config "${configFile}" ''${@:1}
|
||||
'';
|
||||
};
|
||||
in {
|
||||
options.process-compose = {
|
||||
enable =
|
||||
mkEnableOption "Process-Compose"
|
||||
// {
|
||||
default = cfg.config != {};
|
||||
};
|
||||
alias = mkOption {
|
||||
type = types.str;
|
||||
default = "pc";
|
||||
description = ''
|
||||
Alias for `process-compose`.
|
||||
'';
|
||||
};
|
||||
config = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
description = ''
|
||||
Configure process-compose here.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
packages = [pcAlias];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue