30 lines
800 B
Nix
Raw Normal View History

{ config, lib, pkgs, user, home-manager, ... }:
let cfg = config.modules.programs.chezmoi;
in {
options.modules.programs.chezmoi = with lib; {
2024-09-30 10:35:46 -07:00
enable = lib.mkOption {
type = with types; bool;
default = true;
};
apply = lib.mkOption {
type = with types; bool;
default = false;
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
2024-12-05 12:41:02 -08:00
chezmoi # Manage your dotfiles across multiple machines, securely
];
home-manager.users.${user} = lib.mkIf cfg.apply {
home.activation.chezmoi = home-manager.lib.hm.dag.entryAfter [ "installPackages" ] ''
2024-09-29 09:18:01 -07:00
_saved_path=$PATH
PATH="${pkgs.git}/bin:$PATH"
run ${pkgs.chezmoi}/bin/chezmoi apply --force
2024-09-29 09:18:01 -07:00
PATH=$_saved_path
'';
};
};
}