diff options
Diffstat (limited to 'pkgs.nix')
-rw-r--r-- | pkgs.nix | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/pkgs.nix b/pkgs.nix new file mode 100644 index 0000000..f171859 --- /dev/null +++ b/pkgs.nix @@ -0,0 +1,61 @@ +{pkgs}: let + shellrcPkgs = { + shellrc-generic = pkgs.stdenvNoCC.mkDerivation { + name = "shellrc-generic"; + src = ./.; + installPhase = '' + mkdir -p "$out/etc/shellrc.d" + cp -r ./shellrc.d/. "$out/etc/shellrc.d/" + ''; + }; + shellrc-desktop = pkgs.stdenvNoCC.mkDerivation { + name = "shellrc-desktop"; + src = ./.; + installPhase = '' + mkdir -p "$out/etc/shellrc.d" + cp -r ./shellrc-desktop.d/. "$out/etc/shellrc.d/" + ''; + }; + shellrc-bash = pkgs.stdenvNoCC.mkDerivation { + name = "shellrc-bash"; + src = ./.; + propagatedBuildInputs = [shellrcPkgs.shellrc-generic]; + installPhase = '' + mkdir -p "$out/etc/bashrc.d" + cp -r ./bashrc.d/. "$out/etc/bashrc.d/" + cat >"$out/etc/bashrc.d/shellrc" <<EOF + # Load ShellRC files + for p in $NIX_PROFILES; do + for sh in $p/etc/shellrc.d/*; do + [ -r "\$sh" ] && . "\$sh" + done + done + EOF + for comp in bash-completion/*; do + installShellCompletion --bash --name "''${comp##*/}.bash" "$comp" + done + ''; + }; + shellrc-zsh = pkgs.stdenvNoCC.mkDerivation { + name = "shellrc-zsh"; + src = ./.; + propagatedBuildInputs = [shellrcPkgs.shellrc-generic]; + installPhase = '' + mkdir -p "$out/etc/zshrc.d" + cp -r ./zshrc.d/. "$out/etc/zshrc.d/" + cat >"$out/etc/zshrc.d/shellrc" <<EOF + # Load ShellRC files + for p in $NIX_PROFILES; do + for sh in $p/etc/shellrc.d/*; do + [ -r "\$sh" ] && . "\$sh" + done + done + EOF + for comp in zsh-completion/*; do + installShellCompletion --zsh --name "''${comp##*/}" "$comp" + done + ''; + }; + }; +in + shellrcPkgs |