feat: Add package option and installation, improve styling

This commit is contained in:
xezo360hye 2024-08-06 17:30:23 +03:00
parent 56ff4000d9
commit 8f8ed82ac1

View File

@ -1,8 +1,4 @@
{ { config, lib, pkgs, ... }:
config,
lib,
...
}:
with lib; with lib;
with types; with types;
@ -56,6 +52,12 @@ in
options.programs.nethack = { options.programs.nethack = {
enable = mkEnableOption "nethack configuration"; enable = mkEnableOption "nethack configuration";
package = mkOption {
type = types.package;
default = pkgs.nethack;
description = "Nethack package to install";
};
nethack_options = mkOption { nethack_options = mkOption {
type = attrsOf (oneOf [bool int str]); type = attrsOf (oneOf [bool int str]);
default = {}; default = {};
@ -199,10 +201,20 @@ in
}; };
# }}} # }}}
config = { config = let
home.file.".nethackrc" = with config.programs.nethack; { cfg = config.programs.nethack;
inherit enable; in {
text = generateNethackrc config.programs.nethack; home = {
packages = mkIf cfg.enable [
cfg.package
];
file = {
".nethackrc" = {
inherit (cfg) enable;
text = generateNethackrc cfg;
};
};
}; };
}; };
} }