mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
nix-your-shell: Allow using nom for nix commands
This commit is contained in:
parent
cb68b5cd6a
commit
6ce2e18007
2 changed files with 36 additions and 19 deletions
|
|
@ -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
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue