make kitaab update a user unit, use user path
This commit is contained in:
		
							parent
							
								
									16c975db35
								
							
						
					
					
						commit
						03b1edc941
					
				|  | @ -6,5 +6,6 @@ | |||
|     ../profiles/desktop | ||||
|     ../profiles/email | ||||
|     ../profiles/cal | ||||
|     ../profiles/sync/kitaab | ||||
|   ]; | ||||
| } | ||||
|  |  | |||
|  | @ -59,6 +59,7 @@ | |||
|     pandoc | ||||
|     taskwarrior-tui | ||||
|     python3Packages.howdoi | ||||
|     vimwiki-cli | ||||
| 
 | ||||
|     (pkgs.writeScriptBin "jq-repl" '' | ||||
|       #!/usr/bin/env bash | ||||
|  |  | |||
							
								
								
									
										32
									
								
								home/profiles/sync/kitaab/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								home/profiles/sync/kitaab/default.nix
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,32 @@ | |||
| { pkgs, ... }: | ||||
| 
 | ||||
| let | ||||
|   name = "kitaab-sync"; | ||||
|   # Note this will fail if index.wiki is open in vim while this runs | ||||
|   mkStartScript = name: pkgs.writeShellScript "${name}.sh" '' | ||||
|     set -euo pipefail | ||||
|     PATH=/run/current-system/sw/bin:/etc/profiles/per-user/anish/bin: | ||||
|     cd /home/anish/kitaab | ||||
|     vimwiki tags rebuild | ||||
|     git add -A | ||||
|     git diff-index --quiet HEAD || git commit -m 'syncing kitaab' # if nothing, don't exit 1 | ||||
|     git push | ||||
|     exit 0 | ||||
|   ''; | ||||
| in | ||||
| { | ||||
|   systemd.user.services.kitaab-sync = { | ||||
|     Service = { | ||||
|       ExecStart = "${mkStartScript name}"; | ||||
|     }; | ||||
|   }; | ||||
|   systemd.user.timers.kitaab-sync = { | ||||
|     Install = { | ||||
|       WantedBy = [ "timers.target" ]; | ||||
|       PartOf = [ "kitaab-sync.service" ]; | ||||
|     }; | ||||
|     Timer = { | ||||
|       OnCalendar = [ "hourly" ]; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  | @ -6,7 +6,6 @@ | |||
|     ../profiles/core | ||||
|     ../profiles/bluetooth | ||||
|     ../profiles/music | ||||
|     ../profiles/sync/kitaab | ||||
|     ../profiles/sync/cal | ||||
|     ../profiles/wifi | ||||
|     ../profiles/desktop | ||||
|  |  | |||
|  | @ -1,27 +0,0 @@ | |||
| { pkgs, ... }: | ||||
| 
 | ||||
| { | ||||
|   systemd.services.kitaab-sync = { | ||||
|     serviceConfig.Type = "oneshot"; | ||||
|     path = [ | ||||
|       pkgs.git | ||||
|       pkgs.openssh | ||||
|       pkgs.coreutils | ||||
|     ]; | ||||
|     script = '' | ||||
|       cd /home/anish/kitaab | ||||
|       git add -A | ||||
|       git diff-index --quiet HEAD || git commit -m 'syncing kitaab' # if nothing, don't exit 1 | ||||
|       git push | ||||
|       exit 0 | ||||
|     ''; | ||||
|     serviceConfig = { | ||||
|       User = "anish"; | ||||
|     }; | ||||
|   }; | ||||
|   systemd.timers.kitaab-sync = { | ||||
|     wantedBy = [ "timers.target" ]; | ||||
|     partOf = [ "kitaab-sync.service" ]; | ||||
|     timerConfig.OnCalendar = [ "hourly" ]; | ||||
|   }; | ||||
| } | ||||
		Loading…
	
		Reference in a new issue