optionally apply chezmoi dots with home-manager

This commit is contained in:
Tyler Starr 2024-09-29 08:48:38 -07:00
parent db02ef369c
commit bf6de61404
7 changed files with 50 additions and 1 deletions

View File

@ -35,6 +35,10 @@
}; };
programs = { programs = {
kitty.enable = true; kitty.enable = true;
chezmoi = {
enable = true;
apply = true;
};
}; };
services = { services = {
samba-client.enable = true; samba-client.enable = true;

View File

@ -54,6 +54,10 @@
}; };
programs = { programs = {
kitty.enable = true; kitty.enable = true;
chezmoi = {
enable = true;
apply = true;
};
}; };
services = { services = {
peripherals.enable = true; peripherals.enable = true;

View File

@ -37,6 +37,10 @@
}; };
programs = { programs = {
kitty.enable = true; kitty.enable = true;
chezmoi = {
enable = true;
apply = true;
};
}; };
services = { services = {
peripherals.enable = true; peripherals.enable = true;

View File

@ -96,6 +96,12 @@
devel = { devel = {
tooling.enable = true; tooling.enable = true;
}; };
programs = {
chezmoi = {
enable = true;
apply = true;
};
};
services = { services = {
jellyfin.enable = true; jellyfin.enable = true;
}; };

View File

@ -50,6 +50,12 @@ in
python.enable = true; python.enable = true;
tooling.enable = true; tooling.enable = true;
}; };
programs = {
chezmoi = {
enable = true;
apply = true;
};
};
system = { system = {
ssh.enable = true; ssh.enable = true;
terminal.enable = true; terminal.enable = true;

View File

@ -0,0 +1,25 @@
{ config, lib, pkgs, user, home-manager, ... }:
let cfg = config.modules.programs.chezmoi;
in {
options.modules.programs.chezmoi = with lib; {
enable = lib.mkEnableOption "chezmoi";
apply = lib.mkOption {
type = with types; bool;
default = false;
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
chezmoi # Manages your dotfiles across multiple machines, ensuring consistency and version control
];
# Optionally apply chezmoi dotfiles with home-manager activation
home-manager.users.${user} = lib.mkIf cfg.apply {
home.activation.chezmoi = home-manager.lib.hm.dag.entryAfter [ "installPackages" ] ''
run ${pkgs.chezmoi}/bin/chezmoi apply --force
'';
};
};
}

View File

@ -1,4 +1,4 @@
{ ... }: { ... }:
{ {
imports = [ ./kitty.nix ]; imports = [ ./chezmoi.nix ./kitty.nix ];
} }