2022-05-30 20:07:43 +00:00
|
|
|
{ config, pkgs, lib, ... }: {
|
|
|
|
|
|
|
|
home-manager.users.${config.user} = {
|
|
|
|
|
|
|
|
home.activation = {
|
|
|
|
|
|
|
|
# Always clone dotfiles repository if it doesn't exist
|
2022-05-30 20:14:02 +00:00
|
|
|
cloneDotfiles =
|
|
|
|
config.home-manager.users.${config.user}.lib.dag.entryAfter
|
|
|
|
[ "writeBoundary" ] ''
|
|
|
|
if [ ! -d "${config.dotfilesPath}" ]; then
|
2022-06-04 14:29:36 +00:00
|
|
|
$DRY_RUN_CMD mkdir --parents $VERBOSE_ARG $(dirname "${config.dotfilesPath}")
|
|
|
|
$DRY_RUN_CMD ${pkgs.git}/bin/git clone ${config.dotfilesRepo} "${config.dotfilesPath}"
|
2022-05-30 20:14:02 +00:00
|
|
|
fi
|
|
|
|
'';
|
2022-05-30 20:07:43 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2022-06-14 23:03:16 +00:00
|
|
|
programs.fish = let
|
|
|
|
system = if pkgs.stdenv.isDarwin then "darwin" else "nixos";
|
2022-06-19 14:02:06 +00:00
|
|
|
sudo = if pkgs.stdenv.isDarwin then "" else "doas";
|
2022-06-14 23:03:16 +00:00
|
|
|
in {
|
2022-06-19 14:02:06 +00:00
|
|
|
shellAbbrs = {
|
|
|
|
nr = "rebuild-${system}";
|
|
|
|
nro = "rebuild-${system} offline";
|
|
|
|
};
|
2022-06-14 23:03:16 +00:00
|
|
|
functions = {
|
2022-06-19 14:02:06 +00:00
|
|
|
"rebuild-${system}" = {
|
2022-06-14 23:03:16 +00:00
|
|
|
body = ''
|
2022-06-19 14:02:06 +00:00
|
|
|
if test "$argv[1]" = "offline"
|
|
|
|
set option "--option substitute false"
|
|
|
|
end
|
2022-06-14 23:03:16 +00:00
|
|
|
pushd ${config.dotfilesPath}
|
|
|
|
git add --all
|
|
|
|
popd
|
2022-06-19 14:02:06 +00:00
|
|
|
echo "${sudo} ${system}-rebuild switch $option --flake ${config.dotfilesPath}"
|
|
|
|
${sudo} ${system}-rebuild switch $option --flake ${config.dotfilesPath}
|
2022-06-14 23:03:16 +00:00
|
|
|
'';
|
|
|
|
};
|
2022-06-14 22:17:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-05-30 20:07:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|