nixos/roles/home/zsh.nix
2023-03-27 17:48:21 +02:00

31 lines
607 B
Nix

{ config, pkgs, lib, ... }:
let
inherit (pkgs.lib) optionalString;
# not having the attribute users means
# we cannot change the default shell (e.g. this is not a NixOS host)
exec_zsh = ''
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
exec ${pkgs.zsh}/bin/zsh
'';
in
{
programs.zsh = {
enable = true;
oh-my-zsh = {
enable = true;
plugins = [ "git" "sudo" "docker" "docker-compose" "adb" "systemd" ];
theme = "bira";
};
};
home.file.".bashrc".text = ''
${optionalString (!builtins.hasAttr "users" config) "${exec_zsh}"}
'';
}