aboutsummaryrefslogtreecommitdiff
path: root/pkgs.nix
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2023-03-16 12:27:42 +0100
committerKarel Kočí <cynerd@email.cz>2023-03-16 12:32:36 +0100
commitdf7fdb5bc098ebf2220235b2337a1517267ef04d (patch)
treefe1b104e73f853b214223b37277e53bf89b9c25f /pkgs.nix
parent6f8f27349e074f2c9b6e7a359dad4f5656fc9db8 (diff)
downloadshellrc-df7fdb5bc098ebf2220235b2337a1517267ef04d.tar.gz
shellrc-df7fdb5bc098ebf2220235b2337a1517267ef04d.tar.bz2
shellrc-df7fdb5bc098ebf2220235b2337a1517267ef04d.zip
Rework the whole NixOS and packages
This uses now primarilly overlays and also variable NIX_PROFILES to chain-load shellrc from bashrc.d and zshrc.d.
Diffstat (limited to 'pkgs.nix')
-rw-r--r--pkgs.nix61
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