From af3c7b2f2b1fddf6dec20e9f4ecea355a3d1b1ab Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 3 Apr 2025 17:15:53 +0100 Subject: [PATCH] Add wiki-push and wiki-pull scripts --- home/opdavies/hosts/PW05CH3L.nix | 40 +++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/home/opdavies/hosts/PW05CH3L.nix b/home/opdavies/hosts/PW05CH3L.nix index 1f9d7f86..335b3926 100644 --- a/home/opdavies/hosts/PW05CH3L.nix +++ b/home/opdavies/hosts/PW05CH3L.nix @@ -1,3 +1,10 @@ +{ + config, + lib, + pkgs, + ... +}: + { homeManagerModules = { direnv.enable = true; @@ -12,7 +19,34 @@ tmux-sessionizer.enable = true; }; - home.sessionVariables = { - WAYLAND_DISPLAY = ""; - }; + home = + let + remoteIpAddress = "192.168.1.111"; + wikiPath = "${config.xdg.userDirs.documents}/wiki"; + in + { + packages = [ + (pkgs.writeShellApplication { + name = "wiki-pull"; + + text = '' + ${lib.getExe pkgs.rsync} -avz --update \ + ${remoteIpAddress}:${wikiPath}/ ${wikiPath} "$@" + ''; + }) + + (pkgs.writeShellApplication { + name = "wiki-push"; + + text = '' + ${lib.getExe pkgs.rsync} -avz --update \ + ${wikiPath}/ ${remoteIpAddress}:${wikiPath} "$@" + ''; + }) + ]; + + sessionVariables = { + WAYLAND_DISPLAY = ""; + }; + }; }