aboutsummaryrefslogtreecommitdiff
path: root/nixos.nix
blob: c642d802035a1e12c73ea6e0ca1b16b72768a6ae (plain)
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
overlays: {
  config,
  lib,
  pkgs,
  ...
}:
with lib; let
  cnf = config.programs.shellrc;
  zshEnable = config.programs.zsh.enable;
in {
  options.programs.shellrc = mkEnableOption "shellrc";

  config = mkMerge [
    {
      nixpkgs.overlays = overlays;
    }
    (mkIf cnf {
      # Disable default prompt as we have our own
      programs.bash.promptInit = "";
      programs.zsh.promptInit = ""; # Disable default prompt as we have our own

      programs.bash.interactiveShellInit = ''
        eval $(/run/current-system/sw/bin/shellrc-bash)
      '';
      programs.zsh.interactiveShellInit = mkIf zshEnable ''
        eval $(/run/current-system/sw/bin/shellrc-zsh)
      '';

      environment.systemPackages = with pkgs; [shellrc-bash] ++ (optional zshEnable shellrc-zsh);
    })
  ];
}