From 849bdb056feb8e064396970f79c8962b20b0c07f Mon Sep 17 00:00:00 2001 From: Chris Wells Date: Tue, 3 Sep 2024 12:13:30 -0500 Subject: Re-doing a bunch of this --- modules/kfmon/default.nix | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 modules/kfmon/default.nix (limited to 'modules/kfmon') diff --git a/modules/kfmon/default.nix b/modules/kfmon/default.nix new file mode 100644 index 0000000..8557a3e --- /dev/null +++ b/modules/kfmon/default.nix @@ -0,0 +1,59 @@ +{ config, pkgs, lib, ... }: +with builtins // lib; +let + cfg = config.kfmon; + ini = pkgs.formats.ini {}; +in { + options.kfmon = { + enable = mkEnableOption "KFMon"; + + package = mkPackageOption pkgs "kfmon" {}; + + path = mkOption { + type = types.str; + readOnly = true; + internal = true; + default = ".adds/kfmon"; + }; + + devicePath = mkOption { + type = types.str; + readOnly = true; + internal = true; + default = "/mnt/onboard/${cfg.path}"; + }; + + file = mkOption { + default = {}; + type = types.attrsOf (types.submodule (pkgs.callPackage ../lib/file-type.nix {})); + }; + + _allFiles = mkOption { + type = types.package; + internal = true; + readOnly = true; + default = (pkgs.callPackage ../lib/merge-files.nix {}) (attrValues file); + }; + + configs = mkOption { + type = types.attrsOf ini.type; + default = {}; + description = '' + KFMon .ini config files. Do not touch this unless you know what you're doing! + ''; + }; + }; + + config = { + kfmon.file = mapAttrs' (n: v: { + name = "kfmon-config-${n}"; + value = { + text = generators.toINI {} v; + target = + let + fixedN = if isSuffix ".ini" n then n else "${n}.ini"; + in "config/${fixedN}"; + }; + }); + }; +}; -- cgit v1.2.3