mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-06 00:51:04 +01:00
nix-your-shell: build-time nushell config generation
This commit is contained in:
parent
dde05a0b10
commit
287cbbbf80
2 changed files with 16 additions and 20 deletions
|
|
@ -25,22 +25,21 @@ in {
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
fish.interactiveShellInit = lib.mkIf cfg.enableFishIntegration ''
|
fish.interactiveShellInit = lib.mkIf cfg.enableFishIntegration ''
|
||||||
${cfg.package}/bin/nix-your-shell fish | source
|
${lib.getExe cfg.package} fish | source
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nushell = lib.mkIf cfg.enableNushellIntegration {
|
nushell = lib.mkIf cfg.enableNushellIntegration {
|
||||||
extraEnv = ''
|
|
||||||
mkdir ${config.xdg.cacheHome}/nix-your-shell
|
|
||||||
${cfg.package}/bin/nix-your-shell nu | save --force ${config.xdg.cacheHome}/nix-your-shell/init.nu
|
|
||||||
'';
|
|
||||||
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
source ${config.xdg.cacheHome}/nix-your-shell/init.nu
|
source ${
|
||||||
|
pkgs.runCommand "nix-your-shell-nushell-config" { } ''
|
||||||
|
${lib.getExe cfg.package} nu >> "$out"
|
||||||
|
''
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
zsh.initContent = lib.mkIf cfg.enableZshIntegration ''
|
zsh.initContent = lib.mkIf cfg.enableZshIntegration ''
|
||||||
${cfg.package}/bin/nix-your-shell zsh | source /dev/stdin
|
${lib.getExe cfg.package} zsh | source /dev/stdin
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{ pkgs, config, ... }:
|
{ lib, pkgs, realPkgs, config, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
programs = {
|
programs = {
|
||||||
|
|
@ -13,6 +13,8 @@
|
||||||
zsh.enable = true;
|
zsh.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_module.args.pkgs = lib.mkForce realPkgs;
|
||||||
|
|
||||||
nmt.script = let
|
nmt.script = let
|
||||||
nushellConfigDir = if pkgs.stdenv.isDarwin && !config.xdg.enable then
|
nushellConfigDir = if pkgs.stdenv.isDarwin && !config.xdg.enable then
|
||||||
"home-files/Library/Application Support/nushell"
|
"home-files/Library/Application Support/nushell"
|
||||||
|
|
@ -20,23 +22,18 @@
|
||||||
"home-files/.config/nushell";
|
"home-files/.config/nushell";
|
||||||
in ''
|
in ''
|
||||||
assertFileExists home-files/.config/fish/config.fish
|
assertFileExists home-files/.config/fish/config.fish
|
||||||
assertFileContains \
|
assertFileRegex \
|
||||||
home-files/.config/fish/config.fish \
|
home-files/.config/fish/config.fish \
|
||||||
'@nix-your-shell@/bin/nix-your-shell fish | source'
|
'/nix/store/[^/]*-nix-your-shell-[^/]*/bin/nix-your-shell fish | source'
|
||||||
|
|
||||||
assertFileExists ${nushellConfigDir}/config.nu
|
assertFileExists ${nushellConfigDir}/config.nu
|
||||||
assertFileContains \
|
assertFileRegex \
|
||||||
${nushellConfigDir}/config.nu \
|
${nushellConfigDir}/config.nu \
|
||||||
'source ${config.xdg.cacheHome}/nix-your-shell/init.nu'
|
'source /nix/store/[^/]*-nix-your-shell-nushell-config'
|
||||||
|
|
||||||
assertFileExists ${nushellConfigDir}/env.nu
|
|
||||||
assertFileContains \
|
|
||||||
${nushellConfigDir}/env.nu \
|
|
||||||
'@nix-your-shell@/bin/nix-your-shell nu | save --force ${config.xdg.cacheHome}/nix-your-shell/init.nu'
|
|
||||||
|
|
||||||
assertFileExists home-files/.zshrc
|
assertFileExists home-files/.zshrc
|
||||||
assertFileContains \
|
assertFileRegex \
|
||||||
home-files/.zshrc \
|
home-files/.zshrc \
|
||||||
'@nix-your-shell@/bin/nix-your-shell zsh | source /dev/stdin'
|
'/nix/store/[^/]*-nix-your-shell-[^/]*/bin/nix-your-shell zsh | source /dev/stdin'
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue