diff --git a/modules/programs/nix-your-shell.nix b/modules/programs/nix-your-shell.nix index 58dc07a17..fcdd48003 100644 --- a/modules/programs/nix-your-shell.nix +++ b/modules/programs/nix-your-shell.nix @@ -22,29 +22,45 @@ in enableNushellIntegration = lib.hm.shell.mkNushellIntegrationOption { inherit config; }; enableZshIntegration = lib.hm.shell.mkZshIntegrationOption { inherit config; }; + + nix-output-monitor = { + enable = lib.mkEnableOption '' + [nix-output-monitor](https://github.com/maralorn/nix-output-monitor). + Pipe your nix-build output through the nix-output-monitor a.k.a nom to get additional information while building + ''; + + package = lib.mkPackageOption pkgs "nix-output-monitor" { }; + }; }; config = lib.mkIf cfg.enable { - home.packages = [ cfg.package ]; + home.packages = [ + cfg.package + (lib.mkIf cfg.nix-output-monitor.enable cfg.nix-output-monitor.package) + ]; - programs = { - fish.interactiveShellInit = lib.mkIf cfg.enableFishIntegration '' - ${lib.getExe cfg.package} fish | source - ''; + programs = + let + nom = if cfg.nix-output-monitor.enable then "--nom" else ""; + in + { + fish.interactiveShellInit = lib.mkIf cfg.enableFishIntegration '' + ${lib.getExe cfg.package} ${nom} fish | source + ''; - nushell = lib.mkIf cfg.enableNushellIntegration { - extraConfig = '' - source ${ - pkgs.runCommand "nix-your-shell-nushell-config.nu" { } '' - ${lib.getExe cfg.package} nu >> "$out" - '' - } + nushell = lib.mkIf cfg.enableNushellIntegration { + extraConfig = '' + source ${ + pkgs.runCommand "nix-your-shell-nushell-config.nu" { } '' + ${lib.getExe cfg.package} ${nom} nu >> "$out" + '' + } + ''; + }; + + zsh.initContent = lib.mkIf cfg.enableZshIntegration '' + ${lib.getExe cfg.package} ${nom} zsh | source /dev/stdin ''; }; - - zsh.initContent = lib.mkIf cfg.enableZshIntegration '' - ${lib.getExe cfg.package} zsh | source /dev/stdin - ''; - }; }; } diff --git a/tests/modules/programs/nix-your-shell/enable-shells.nix b/tests/modules/programs/nix-your-shell/enable-shells.nix index a0999e171..a0523e3c5 100644 --- a/tests/modules/programs/nix-your-shell/enable-shells.nix +++ b/tests/modules/programs/nix-your-shell/enable-shells.nix @@ -13,6 +13,7 @@ enableFishIntegration = true; enableNushellIntegration = true; enableZshIntegration = true; + nix-output-monitor.enable = true; }; fish.enable = true; nushell.enable = true; @@ -33,7 +34,7 @@ assertFileExists home-files/.config/fish/config.fish assertFileRegex \ home-files/.config/fish/config.fish \ - '/nix/store/[^/]*-nix-your-shell-[^/]*/bin/nix-your-shell fish | source' + '/nix/store/[^/]*-nix-your-shell-[^/]*/bin/nix-your-shell --nom fish | source' assertFileExists ${nushellConfigDir}/config.nu assertFileRegex \ @@ -43,6 +44,6 @@ assertFileExists home-files/.zshrc assertFileRegex \ home-files/.zshrc \ - '/nix/store/[^/]*-nix-your-shell-[^/]*/bin/nix-your-shell zsh | source /dev/stdin' + '/nix/store/[^/]*-nix-your-shell-[^/]*/bin/nix-your-shell --nom zsh | source /dev/stdin' ''; }