ctucx.git: nixfiles

ctucx' nixfiles

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
{ pkgs, lib, ... }:

{

  programs.bash = {
    enable               = true;
    enableVteIntegration = lib.mkIf pkgs.stdenv.isLinux true;

    historyFileSize = 999999;
    historyControl  = [ "ignoredups" "ignorespace" ];
    historyIgnore   = [ "ls" "clear" "exit" ];

    bashrcExtra = ''
      use() {
        declare -a all
        for p in "$@"; do
          all+=("''${NIXPKGS_PATH}#$p")
        done
        eval nix shell ''${all[@]}
      }
    '' + lib.optionalString pkgs.stdenv.isDarwin ''
      if [ "$TERM" != "dumb" ]; then
        source "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh"
        nullglobStatus=$(shopt -p nullglob)
        shopt -s nullglob
        for p in $NIX_PROFILES; do
          for m in "$p/etc/bash_completion.d/"*; do
            source $m
          done
        done
        eval "$nullglobStatus"
        unset nullglobStatus p m
      fi

      # Make bash check its window size after a process completes
      shopt -s checkwinsize

      eval "$(/opt/homebrew/bin/brew shellenv)"
    '';
  };

}