From a8f8f48320c64bd4e3a266a850bbfde2c6fe3a04 Mon Sep 17 00:00:00 2001 From: Jian Lin <75130626+jian-lin@users.noreply.github.com> Date: Thu, 10 Aug 2023 00:40:43 +0800 Subject: [PATCH] mu: add package option (#4325) --- modules/programs/mu.nix | 8 ++++++-- tests/modules/programs/mu/basic-configuration.nix | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/programs/mu.nix b/modules/programs/mu.nix index 835be361a..04b0558e3 100644 --- a/modules/programs/mu.nix +++ b/modules/programs/mu.nix @@ -29,6 +29,8 @@ in { programs.mu = { enable = mkEnableOption "mu, a maildir indexer and searcher"; + package = mkPackageOption pkgs "mu" { }; + # No options/config file present for mu, and program author will not be # adding one soon. See https://github.com/djcb/mu/issues/882 for more # information about this. @@ -42,7 +44,7 @@ in { }; config = mkIf cfg.enable { - home.packages = [ pkgs.mu ]; + home.packages = [ cfg.package ]; home.activation.runMuInit = let maildirOption = genCmdMaildir config.accounts.email.maildirBasePath; @@ -52,7 +54,9 @@ in { # In theory, mu is the only thing that creates that directory, and it is # only created during the initial index. if [[ ! -d "${dbLocation}" ]]; then - $DRY_RUN_CMD ${pkgs.mu}/bin/mu init ${maildirOption} ${myAddresses} $VERBOSE_ARG; + $DRY_RUN_CMD ${ + getExe cfg.package + } init ${maildirOption} ${myAddresses} $VERBOSE_ARG; fi ''; }; diff --git a/tests/modules/programs/mu/basic-configuration.nix b/tests/modules/programs/mu/basic-configuration.nix index 4b315c2e9..70b66fb9a 100644 --- a/tests/modules/programs/mu/basic-configuration.nix +++ b/tests/modules/programs/mu/basic-configuration.nix @@ -12,7 +12,7 @@ programs.mu.enable = true; - test.stubs.mu = { }; + test.stubs.mu = { name = "mu"; }; nmt.script = '' assertFileContains activate \