diff options
| author | Sam <30577766+Samasaur1@users.noreply.github.com> | 2024-02-27 17:21:19 -0800 |
|---|---|---|
| committer | Sam <30577766+Samasaur1@users.noreply.github.com> | 2024-02-29 22:20:04 -0800 |
| commit | 0363c18c3704c44d4a282ecbd1455b325bc37a77 (patch) | |
| tree | 581daaeaa5d1ee332b44d2edcf24068385636f92 /modules/system | |
| parent | 6c06334f0843c7300d1678726bb607ce526f6b36 (diff) | |
`system.nvram`: init (internal)
Diffstat (limited to 'modules/system')
| -rw-r--r-- | modules/system/activation-scripts.nix | 1 | ||||
| -rw-r--r-- | modules/system/nvram.nix | 40 |
2 files changed, 41 insertions, 0 deletions
diff --git a/modules/system/activation-scripts.nix b/modules/system/activation-scripts.nix index 67d69be..68e01b5 100644 --- a/modules/system/activation-scripts.nix +++ b/modules/system/activation-scripts.nix @@ -69,6 +69,7 @@ in ${cfg.activationScripts.networking.text} ${cfg.activationScripts.keyboard.text} ${cfg.activationScripts.fonts.text} + ${cfg.activationScripts.nvram.text} ${cfg.activationScripts.postActivation.text} diff --git a/modules/system/nvram.nix b/modules/system/nvram.nix new file mode 100644 index 0000000..efc9c99 --- /dev/null +++ b/modules/system/nvram.nix @@ -0,0 +1,40 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.system; + + mkNvramVariables = + lib.attrsets.mapAttrsToList + (name: value: "nvram ${lib.escapeShellArg name}=${lib.escapeShellArg value}") + cfg.nvram.variables; +in + +{ + meta.maintainers = [ + lib.maintainers.samasaur or "samasaur" + ]; + + options = { + system.nvram.variables = lib.mkOption { + type = with lib.types; attrsOf str; + default = {}; + internal = true; + example = { + "StartupMute" = "%01"; + }; + description = lib.mdDoc '' + Non-volatile RAM variables to set. Removing a key-value pair from this + list will **not** return the variable to its previous value, but will + no longer set its value on system configuration activations. + ''; + }; + }; + + config = { + system.activationScripts.nvram.text = '' + echo "setting nvram variables..." >&2 + + ${builtins.concatStringsSep "\n" mkNvramVariables} + ''; + }; +} |
