nixos/common/dotfiles.nix
Ivan Bushchik a23bb49688
Revisiting dotfiles installation
Signed-off-by: Ivan Bushchik <ivabus@ivabus.dev>
2024-01-02 17:24:50 +03:00

41 lines
1.3 KiB
Nix

{ config, pkgs, lib, ... }:
let
dotfiles = builtins.fetchGit {
url = "https://github.com/ivabus/dotfiles";
rev = "a13b0d425230661e1942484fcdfb5646abb4fddb";
};
theme = builtins.fetchurl {
url =
"https://raw.githubusercontent.com/ivabus/ivabus-zsh-theme/master/ivabus.zsh-theme";
};
highlighting = builtins.fetchGit {
url = "https://github.com/zsh-users/zsh-syntax-highlighting.git";
# Just install the latest and don't care about updating
ref = "master";
};
in {
# Option to disable dotfiles for development
options.my.users.ivabus.dotfiles.enable =
lib.mkEnableOption "Enable automatic dotfiles installation";
config.my.users.ivabus.dotfiles.enable = lib.mkDefault true;
config.home-manager = lib.mkIf
(config.my.users.ivabus.enable && config.my.users.ivabus.dotfiles.enable) ({
users.ivabus = {
home.file = {
".config" = {
source = "${dotfiles}/configs";
recursive = true;
};
".config/zsh/themes/ivabus.zsh-theme" = { source = theme; };
".config/zsh/plugins/zsh-syntax-highlighting/" = {
source = highlighting;
recursive = true;
};
".profile" = { source = "${dotfiles}/configs/.profile"; };
".zshrc" = { source = "${dotfiles}/configs/.zshrc"; };
};
};
});
}