mirror of
https://github.com/lightly-toasted/nix-config.git
synced 2025-12-10 03:49:44 +00:00
feat(y2q): add glances
- Add glances runit service
This commit is contained in:
parent
179c67f058
commit
b4bbf014a8
3 changed files with 61 additions and 0 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
inputs.nixvim.homeModules.nixvim
|
inputs.nixvim.homeModules.nixvim
|
||||||
|
|
||||||
|
../modules/runit
|
||||||
../modules/cli/git.nix
|
../modules/cli/git.nix
|
||||||
../modules/cli/ripgrep.nix
|
../modules/cli/ripgrep.nix
|
||||||
../modules/cli/btop.nix
|
../modules/cli/btop.nix
|
||||||
|
|
|
||||||
50
home/modules/runit/default.nix
Normal file
50
home/modules/runit/default.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = (
|
||||||
|
let
|
||||||
|
servicesPath = ./services;
|
||||||
|
serviceModules = builtins.attrNames (builtins.readDir (servicesPath));
|
||||||
|
in
|
||||||
|
map (module: servicesPath + "/${module}") serviceModules
|
||||||
|
);
|
||||||
|
|
||||||
|
options.runit = {
|
||||||
|
services = lib.mkOption {
|
||||||
|
type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: {
|
||||||
|
options = {
|
||||||
|
script = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Shell commands executed as the service's main process";
|
||||||
|
};
|
||||||
|
log.enable = lib.mkEnableOption "Enable logging";
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
default = {};
|
||||||
|
description = "User-level runit services under ~/runit/services/";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
home.file = lib.mkMerge (
|
||||||
|
lib.mapAttrsToList (serviceName: sCfg:
|
||||||
|
{
|
||||||
|
# run script
|
||||||
|
"runit/services/${serviceName}/run" = {
|
||||||
|
text = sCfg.script;
|
||||||
|
executable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# logging
|
||||||
|
"runit/services/${serviceName}/log/run" = lib.mkIf sCfg.log.enable {
|
||||||
|
text = ''
|
||||||
|
#!/bin/sh
|
||||||
|
exec svlogd -t ./main
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
) config.runit.services
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
10
home/modules/runit/services/glances.nix
Normal file
10
home/modules/runit/services/glances.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
runit.services.glances = {
|
||||||
|
script = ''
|
||||||
|
#!/bin/bash
|
||||||
|
${pkgs.glances}/bin/glances -w
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue