dotfiles/vcsh: populate nix store with dotfiles mirror
This commit is contained in:
parent
a71fe67e78
commit
e7f6744be5
5 changed files with 49 additions and 22 deletions
|
@ -4,28 +4,10 @@
|
|||
}:
|
||||
|
||||
let
|
||||
repoHttps = "https://gitlab.com/steveeJ/dotfiles.git";
|
||||
repoSsh = "git@gitlab.com:/steveeJ/dotfiles.git";
|
||||
vcshActivationScript = pkgs.callPackage ./dotfiles/vcsh.nix {};
|
||||
|
||||
in {
|
||||
home.activation.vcsh = config.lib.dag.entryAfter["linkGeneration"] ''
|
||||
$DRY_RUN_CMD ${pkgs.writeScript "activation-script" ''
|
||||
set -e
|
||||
export HOST=$(hostname -s)
|
||||
|
||||
function set_remotes {
|
||||
${pkgs.vcsh}/bin/vcsh dotfiles remote set-url origin ${repoHttps}
|
||||
${pkgs.vcsh}/bin/vcsh dotfiles remote set-url --push origin ${repoSsh}
|
||||
}
|
||||
|
||||
if ! test -d $HOME/.config/vcsh/repo.d/dotfiles.git; then
|
||||
echo Cloning dotfiles for $HOST...
|
||||
${pkgs.vcsh}/bin/vcsh clone -b $HOST ${repoHttps}
|
||||
set_remotes
|
||||
else
|
||||
echo Updating dotfiles for $HOST...
|
||||
set_remotes
|
||||
${pkgs.vcsh}/bin/vcsh pull $HOST
|
||||
fi
|
||||
''};
|
||||
$DRY_RUN_CMD ${vcshActivationScript}
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue