diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index c3e6b0b343de..a7f4f98e663d 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -501,6 +501,12 @@ github = "silmarp"; githubId = 67292496; }; + stijnruts = { + name = "Stijn Ruts"; + email = "nix@stijnruts.be"; + github = "StijnRuts"; + githubId = 1696566; + }; swarsel = { name = "Leon Schwarzäugl"; email = "leon@swarsel.win"; diff --git a/modules/misc/news/2025/08/2025-08-29_11-51-35.nix b/modules/misc/news/2025/08/2025-08-29_11-51-35.nix new file mode 100644 index 000000000000..23c9c36eb59c --- /dev/null +++ b/modules/misc/news/2025/08/2025-08-29_11-51-35.nix @@ -0,0 +1,12 @@ +{ + time = "2025-08-29T09:51:35+00:00"; + condition = true; + message = '' + A new module is available: 'programs.process-compose' + + Process Compose, a simple and flexible scheduler and orchestrator + to manage non-containerized applications + + The module supports configuring settings.yaml, theme.yaml, and shortcuts.yaml + ''; +} diff --git a/modules/programs/process-compose.nix b/modules/programs/process-compose.nix new file mode 100644 index 000000000000..15a17918f623 --- /dev/null +++ b/modules/programs/process-compose.nix @@ -0,0 +1,162 @@ +{ + config, + lib, + pkgs, + ... +}: +let + inherit (lib) mkOption; + yamlFormat = pkgs.formats.yaml { }; +in +{ + meta.maintainers = [ lib.hm.maintainers.stijnruts ]; + + options.programs.process-compose = { + enable = lib.mkEnableOption "Process Compose, a simple and flexible scheduler and orchestrator to manage non-containerized applications"; + + package = lib.mkPackageOption pkgs "process-compose" { nullable = true; }; + + settings = mkOption { + type = yamlFormat.type; + default = { }; + example = { + theme = "Cobalt"; + sort = { + by = "NAME"; + isReversed = false; + }; + disable_exit_confirmation = false; + }; + description = '' + Written to {file}`$XDG_CONFIG_HOME/process-compose/settings.yaml` + + See + ''; + }; + + theme = mkOption { + type = yamlFormat.type; + default = { }; + example = { + body = { + fgColor = "white"; + bgColor = "black"; + secondaryTextColor = "yellow"; + tertiaryTextColor = "green"; + borderColor = "white"; + }; + stat_table = { + keyFgColor = "yellow"; + valueFgColor = "white"; + logoColor = "yellow"; + }; + proc_table = { + fgColor = "lightskyblue"; + fgWarning = "yellow"; + fgPending = "grey"; + fgCompleted = "lightgreen"; + fgError = "red"; + headerFgColor = "white"; + }; + help = { + fgColor = "black"; + keyColor = "white"; + hlColor = "green"; + categoryFgColor = "lightskyblue"; + }; + dialog = { + fgColor = "cadetblue"; + bgColor = "black"; + buttonFgColor = "black"; + buttonBgColor = "lightskyblue"; + buttonFocusFgColor = "black"; + buttonFocusBgColor = "dodgerblue"; + labelFgColor = "yellow"; + fieldFgColor = "black"; + fieldBgColor = "lightskyblue"; + }; + }; + description = '' + Written to {file}`$XDG_CONFIG_HOME/process-compose/theme.yaml` + + See + ''; + }; + + shortcuts = mkOption { + type = yamlFormat.type; + default = { }; + example = { + log_follow = { + toggle_description = { + false = "Follow Off"; + true = "Follow On"; + }; + shortcut = "F5"; + }; + log_screen = { + toggle_description = { + false = "Half Screen"; + true = "Full Screen"; + }; + shortcut = "F4"; + }; + log_wrap = { + toggle_description = { + false = "Wrap Off"; + true = "Wrap On"; + }; + shortcut = "F6"; + }; + process_restart = { + description = "Restart"; + shortcut = "Ctrl-R"; + }; + process_screen = { + toggle_description = { + false = "Half Screen"; + true = "Full Screen"; + }; + shortcut = "F8"; + }; + process_start = { + description = "Start"; + shortcut = "F7"; + }; + process_stop = { + description = "Stop"; + shortcut = "F9"; + }; + quit = { + description = "Quit"; + shortcut = "F10"; + }; + }; + description = '' + Written to {file}`$XDG_CONFIG_HOME/process-compose/shortcuts.yaml` + + See + ''; + }; + }; + + config = + let + cfg = config.programs.process-compose; + in + lib.mkIf cfg.enable { + home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; + + xdg.configFile = { + "process-compose/settings.yaml" = lib.mkIf (cfg.settings != { }) { + source = yamlFormat.generate "process-compose-settings" cfg.settings; + }; + "process-compose/theme.yaml" = lib.mkIf (cfg.theme != { }) { + source = yamlFormat.generate "process-compose-theme" { style = cfg.theme; }; + }; + "process-compose/shortcuts.yaml" = lib.mkIf (cfg.shortcuts != { }) { + source = yamlFormat.generate "process-compose-shortcuts" { shortcuts = cfg.shortcuts; }; + }; + }; + }; +} diff --git a/tests/modules/programs/process-compose/default.nix b/tests/modules/programs/process-compose/default.nix new file mode 100644 index 000000000000..fd03b8080491 --- /dev/null +++ b/tests/modules/programs/process-compose/default.nix @@ -0,0 +1 @@ +{ process-compose = ./process-compose.nix; } diff --git a/tests/modules/programs/process-compose/expected-settings.yaml b/tests/modules/programs/process-compose/expected-settings.yaml new file mode 100644 index 000000000000..4501f8144eb9 --- /dev/null +++ b/tests/modules/programs/process-compose/expected-settings.yaml @@ -0,0 +1,5 @@ +disable_exit_confirmation: false +sort: + by: NAME + isReversed: false +theme: Cobalt diff --git a/tests/modules/programs/process-compose/expected-shortcuts.yaml b/tests/modules/programs/process-compose/expected-shortcuts.yaml new file mode 100644 index 000000000000..cdbb528d5b30 --- /dev/null +++ b/tests/modules/programs/process-compose/expected-shortcuts.yaml @@ -0,0 +1,33 @@ +shortcuts: + log_follow: + shortcut: F5 + toggle_description: + 'false': Follow Off + 'true': Follow On + log_screen: + shortcut: F4 + toggle_description: + 'false': Half Screen + 'true': Full Screen + log_wrap: + shortcut: F6 + toggle_description: + 'false': Wrap Off + 'true': Wrap On + process_restart: + description: Restart + shortcut: Ctrl-R + process_screen: + shortcut: F8 + toggle_description: + 'false': Half Screen + 'true': Full Screen + process_start: + description: Start + shortcut: F7 + process_stop: + description: Stop + shortcut: F9 + quit: + description: Quit + shortcut: F10 diff --git a/tests/modules/programs/process-compose/expected-theme.yaml b/tests/modules/programs/process-compose/expected-theme.yaml new file mode 100644 index 000000000000..c138b666de35 --- /dev/null +++ b/tests/modules/programs/process-compose/expected-theme.yaml @@ -0,0 +1,33 @@ +style: + body: + bgColor: black + borderColor: white + fgColor: white + secondaryTextColor: yellow + tertiaryTextColor: green + dialog: + bgColor: black + buttonBgColor: lightskyblue + buttonFgColor: black + buttonFocusBgColor: dodgerblue + buttonFocusFgColor: black + fgColor: cadetblue + fieldBgColor: lightskyblue + fieldFgColor: black + labelFgColor: yellow + help: + categoryFgColor: lightskyblue + fgColor: black + hlColor: green + keyColor: white + proc_table: + fgColor: lightskyblue + fgCompleted: lightgreen + fgError: red + fgPending: grey + fgWarning: yellow + headerFgColor: white + stat_table: + keyFgColor: yellow + logoColor: yellow + valueFgColor: white diff --git a/tests/modules/programs/process-compose/process-compose.nix b/tests/modules/programs/process-compose/process-compose.nix new file mode 100644 index 000000000000..87c5ece1b8eb --- /dev/null +++ b/tests/modules/programs/process-compose/process-compose.nix @@ -0,0 +1,109 @@ +{ + programs.process-compose = { + enable = true; + settings = { + theme = "Cobalt"; + sort = { + by = "NAME"; + isReversed = false; + }; + disable_exit_confirmation = false; + }; + theme = { + body = { + fgColor = "white"; + bgColor = "black"; + secondaryTextColor = "yellow"; + tertiaryTextColor = "green"; + borderColor = "white"; + }; + stat_table = { + keyFgColor = "yellow"; + valueFgColor = "white"; + logoColor = "yellow"; + }; + proc_table = { + fgColor = "lightskyblue"; + fgWarning = "yellow"; + fgPending = "grey"; + fgCompleted = "lightgreen"; + fgError = "red"; + headerFgColor = "white"; + }; + help = { + fgColor = "black"; + keyColor = "white"; + hlColor = "green"; + categoryFgColor = "lightskyblue"; + }; + dialog = { + fgColor = "cadetblue"; + bgColor = "black"; + buttonFgColor = "black"; + buttonBgColor = "lightskyblue"; + buttonFocusFgColor = "black"; + buttonFocusBgColor = "dodgerblue"; + labelFgColor = "yellow"; + fieldFgColor = "black"; + fieldBgColor = "lightskyblue"; + }; + }; + shortcuts = { + log_follow = { + toggle_description = { + false = "Follow Off"; + true = "Follow On"; + }; + shortcut = "F5"; + }; + log_screen = { + toggle_description = { + false = "Half Screen"; + true = "Full Screen"; + }; + shortcut = "F4"; + }; + log_wrap = { + toggle_description = { + false = "Wrap Off"; + true = "Wrap On"; + }; + shortcut = "F6"; + }; + process_restart = { + description = "Restart"; + shortcut = "Ctrl-R"; + }; + process_screen = { + toggle_description = { + false = "Half Screen"; + true = "Full Screen"; + }; + shortcut = "F8"; + }; + process_start = { + description = "Start"; + shortcut = "F7"; + }; + process_stop = { + description = "Stop"; + shortcut = "F9"; + }; + quit = { + description = "Quit"; + shortcut = "F10"; + }; + }; + }; + + nmt.script = '' + assertFileExists home-files/.config/process-compose/settings.yaml + assertFileContent home-files/.config/process-compose/settings.yaml ${./expected-settings.yaml} + + assertFileExists home-files/.config/process-compose/theme.yaml + assertFileContent home-files/.config/process-compose/theme.yaml ${./expected-theme.yaml} + + assertFileExists home-files/.config/process-compose/shortcuts.yaml + assertFileContent home-files/.config/process-compose/shortcuts.yaml ${./expected-shortcuts.yaml} + ''; +}