From 5d9f7dbec2660c6975d8150d01fab5bc9961b0ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 13 Oct 2022 14:10:55 +0200 Subject: Add ability to include this in profile The modification to load bashrc and zshrc from profiles is required. The following code show the required settings in NixOS to make this work. shellInit = dir: concatMapStrings (v: '' for file in ${v}/etc/${dir}/*; do [ -f "$file" ] || continue . "$file" done '') config.environment.profiles; environment.etc."bashrc.local".text = shellInit "bashrc.d"; environment.etc."zshrc.local".text = shellInit "zshrc.d"; --- flake.nix | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 0ecb3f5..5acb8dc 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,43 @@ zshrc = loadrc ./zshrc.d; packages = pkgs: rec { - shellrc-completion = pkgs.stdenv.mkDerivation { + shellrc-generic = pkgs.stdenvNoCC.mkDerivation { + name = "shellrc-profile"; + src = ./.; + installPhase = '' + mkdir -p "$out/etc/shellrc" + cp -r ./shellrc.d/. "$out/etc/shellrc/" + ''; + }; + shellrc-bashrc = pkgs.stdenvNoCC.mkDerivation { + name = "shellrc-profile-bash"; + src = ./.; + shellrc = shellrc-generic; + installPhase = '' + mkdir -p "$out/etc/bashrc.d" + cp -r ./bashrc.d/. "$out/etc/bashrc.d/" + cat >"$out/etc/bashrc.d/shellrc" <"$out/etc/zshrc.d/shellrc" <