2024-02-08 20:53:22 +01:00
|
|
|
{
|
|
|
|
repoFlake,
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
repoHttps ? "https://gitlab.com/steveeJ/dotfiles.git",
|
|
|
|
repoSsh ? "git@gitlab.com:/steveeJ/dotfiles.git",
|
|
|
|
...
|
|
|
|
}: let
|
2024-01-24 00:24:04 +00:00
|
|
|
repoBareLocal =
|
|
|
|
pkgs.runCommand "fetchbare"
|
2024-02-08 20:53:22 +01:00
|
|
|
{
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
outputHash = "0000000000000000000000000000000000000000000000000000";
|
|
|
|
} ''
|
2024-01-24 00:24:04 +00:00
|
|
|
(
|
|
|
|
set -xe
|
|
|
|
export GIT_SSL_CAINFO=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt
|
|
|
|
export SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt
|
|
|
|
${pkgs.git}/bin/git clone --mirror ${repoHttps} $out
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
vcshActivationScript = pkgs.writeScript "activation-script" ''
|
|
|
|
export HOST=$(hostname -s)
|
|
|
|
|
|
|
|
function set_remotes {
|
|
|
|
${pkgs.vcsh}/bin/vcsh dotfiles remote set-url origin $1
|
|
|
|
${pkgs.vcsh}/bin/vcsh dotfiles remote set-url --push origin $2
|
|
|
|
}
|
|
|
|
|
|
|
|
if ! test -d $HOME/.config/vcsh/repo.d/dotfiles.git; then
|
|
|
|
echo Cloning dotfiles for $HOST...
|
|
|
|
${pkgs.vcsh}/bin/vcsh clone -b $HOST ${repoBareLocal} dotfiles
|
|
|
|
set_remotes ${repoHttps} ${repoSsh}
|
|
|
|
else
|
|
|
|
set_remotes ${repoBareLocal} ${repoSsh}
|
|
|
|
echo Updating dotfiles for $HOST...
|
|
|
|
${pkgs.vcsh}/bin/vcsh pull $HOST || true
|
|
|
|
set_remotes ${repoHttps} ${repoSsh}
|
|
|
|
fi
|
|
|
|
'';
|
2024-02-08 20:53:22 +01:00
|
|
|
in {
|
2022-01-15 20:34:30 +01:00
|
|
|
# TODO: fix the dotfiles
|
|
|
|
# home.activation.vcsh = config.lib.dag.entryAfter["linkGeneration"] ''
|
|
|
|
# $DRY_RUN_CMD ${vcshActivationScript}
|
|
|
|
# '';
|
2018-11-04 14:52:52 +01:00
|
|
|
}
|