Add get-notes in home-manager activation script

This commit is contained in:
Sam 2024-07-19 11:26:32 +01:00
parent 7440a6662f
commit 82b0838f5c
2 changed files with 19 additions and 0 deletions

View File

@ -4,6 +4,7 @@
./alacritty.nix
./zotero.nix
./fontconfig.nix
./notes.nix
];
# Global packages for desktop environments

View File

@ -0,0 +1,18 @@
{ pkgs, config, lib, ... }:
let
user = config.home.username;
in
{
home.activation.get-notes = lib.hm.dag.entryAfter [ "installPackages" ] ''
notes_dir=/home/${user}/.local/share/notes
remote=git@git.bitlab21.com:sam/notes
if [ -d "$notes_dir" ];
then
cd "$notes_dir"
[ ! -d .git ] && PATH="${pkgs.git}/bin:${pkgs.openssh}/bin:$PATH" git clone "$remote" "$notes_dir"
else
mkdir -p "$notes_dir" && PATH="${pkgs.git}/bin:${pkgs.openssh}/bin:$PATH" git clone "$remote" "$notes_dir"
fi
exit 0
'';
}