From 8f8ed82ac1d4c7b0914935a21a8027bdae70669f Mon Sep 17 00:00:00 2001 From: xezo360hye Date: Tue, 6 Aug 2024 17:30:23 +0300 Subject: [PATCH] feat: Add package option and installation, improve styling --- nethack.nix | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/nethack.nix b/nethack.nix index dd3c59c..af7fd73 100644 --- a/nethack.nix +++ b/nethack.nix @@ -1,8 +1,4 @@ -{ - config, - lib, - ... -}: +{ config, lib, pkgs, ... }: with lib; with types; @@ -56,6 +52,12 @@ in options.programs.nethack = { enable = mkEnableOption "nethack configuration"; + package = mkOption { + type = types.package; + default = pkgs.nethack; + description = "Nethack package to install"; + }; + nethack_options = mkOption { type = attrsOf (oneOf [bool int str]); default = {}; @@ -199,10 +201,20 @@ in }; # }}} - config = { - home.file.".nethackrc" = with config.programs.nethack; { - inherit enable; - text = generateNethackrc config.programs.nethack; + config = let + cfg = config.programs.nethack; + in { + home = { + packages = mkIf cfg.enable [ + cfg.package + ]; + + file = { + ".nethackrc" = { + inherit (cfg) enable; + text = generateNethackrc cfg; + }; + }; }; }; }