this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: move sync notes logic from Makefile to nix

Khue Doan 98c2c31d 62340343

+21 -2
+21 -2
users/khuedoan/default.nix
··· 111 111 Service = { 112 112 Type = "oneshot"; 113 113 WorkingDirectory = "%h/Documents/notes"; 114 - Environment = "PATH=/run/current-system/sw/bin:/usr/bin:/bin"; 115 - ExecStart = "make sync"; 114 + Environment = [ 115 + "HOSTNAME=%H" 116 + "GIT_SSH_COMMAND=/run/current-system/sw/bin/ssh" 117 + ]; 118 + ExecStart = "${pkgs.writeTextFile { 119 + name = "sync-notes"; 120 + executable = true; 121 + text = '' 122 + #!${pkgs.bash}/bin/sh 123 + set -eu 124 + 125 + if [ -n "$(${pkgs.git}/bin/git status --porcelain)" ]; then 126 + ${pkgs.git}/bin/git add --all 127 + if ! ${pkgs.git}/bin/git diff --cached --quiet; then 128 + ${pkgs.git}/bin/git commit -m "Update notes from $HOSTNAME" 129 + fi 130 + fi 131 + ${pkgs.git}/bin/git pull --rebase --strategy-option theirs 132 + ${pkgs.git}/bin/git push 133 + ''; 134 + }}"; 116 135 }; 117 136 }; 118 137 timers.sync-notes = {