nix/home: handle dotfiles via vcsh
This commit is contained in:
parent
48b35e16c7
commit
4081bc6328
3 changed files with 33 additions and 0 deletions
|
@ -10,6 +10,7 @@ in {
|
|||
imports = [
|
||||
../profiles/common.nix
|
||||
../profiles/qtile-desktop.nix
|
||||
../profiles/dotfiles.nix
|
||||
../programs/emacs.nix
|
||||
../programs/firefox.nix
|
||||
../programs/chromium.nix
|
||||
|
|
|
@ -8,6 +8,7 @@ in {
|
|||
imports = [
|
||||
../profiles/common.nix
|
||||
../profiles/qtile-desktop.nix
|
||||
../profiles/dotfiles.nix
|
||||
../programs/emacs.nix
|
||||
../programs/firefox.nix
|
||||
../programs/chromium.nix
|
||||
|
|
31
nix/home-manager/profiles/dotfiles.nix
Normal file
31
nix/home-manager/profiles/dotfiles.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{ pkgs
|
||||
, config
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
repoHttps = "https://gitlab.com/steveeJ/dotfiles.git";
|
||||
repoSsh = "git@gitlab.com:/steveeJ/dotfiles.git";
|
||||
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
|
||||
''};
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue