aboutsummaryrefslogtreecommitdiff
path: root/nixos.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos.nix')
-rw-r--r--nixos.nix49
1 files changed, 8 insertions, 41 deletions
diff --git a/nixos.nix b/nixos.nix
index 4dc23c9..ca4edd2 100644
--- a/nixos.nix
+++ b/nixos.nix
@@ -8,56 +8,23 @@ with lib; let
cnf = config.programs.shellrc;
zshEnable = config.programs.zsh.enable;
in {
- options = {
- programs.shellrc = {
- enable = mkOption {
- type = types.bool;
- default = true;
- description = "If shellrc should be enabled.";
- };
- desktop = mkOption {
- type = types.bool;
- default = false;
- description = "If shellrc's desktop specific files should be used.";
- };
- };
- };
+ 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
- environment.pathsToLink = ["/etc/shellrc.d" "/etc/bashrc.d"] ++ optional zshEnable "/etc/zshrc.d";
programs.bash.interactiveShellInit = ''
- # Load files provided by packages
- for p in $NIX_PROFILES; do
- [ -e $p/etc/bashrc.d ] || continue
- for file in $p/etc/bashrc.d/*; do
- [ -f "$file" ] || continue
- . "$file"
- done
- done
+ eval $(${pkgs.shellrc-bash}/bin/shellrc-bash)
'';
programs.zsh.interactiveShellInit = mkIf zshEnable ''
- # Load files provided by packages
- for p in ''${=NIX_PROFILES}; do
- [ -e $p/etc/zshrc.d ] || continue
- for file in $p/etc/zshrc.d/*; do
- [ -f "$file" ] || continue
- . "$file"
- done
- done
+ eval $(${pkgs.shellrc-zsh}/bin/shellrc-zsh)
'';
- }
- (mkIf cnf.enable {
- environment.systemPackages =
- [pkgs.shellrc-generic pkgs.shellrc-bash]
- ++ optional cnf.desktop pkgs.shellrc-desktop
- ++ optional zshEnable pkgs.shellrc-zsh;
-
- # Disable default prompt as we have our own
- programs.bash.promptInit = "";
- programs.zsh.promptInit = ""; # Disable default prompt as we have our own
})
];
}