From 8503f7aeb172ea4b2ccb897faa9c65f3299791e5 Mon Sep 17 00:00:00 2001 From: kdam0 Date: Tue, 14 Mar 2023 18:11:02 -0400 Subject: nextcloud stuff --- nixpkgs/.config/nixpkgs/home.nix | 53 ++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/nixpkgs/.config/nixpkgs/home.nix b/nixpkgs/.config/nixpkgs/home.nix index b216ec1..7fea2c4 100644 --- a/nixpkgs/.config/nixpkgs/home.nix +++ b/nixpkgs/.config/nixpkgs/home.nix @@ -8,9 +8,10 @@ enable = true; defaultKeymap = "viins"; initExtra = '' - source ~/.p10k.zsh + source ${config.home.homeDirectory}/.p10k.zsh ''; shellAliases = { + l = "ls -l"; ll = "ls -al"; ".." = "cd .."; up = "sudo nixos-rebuild switch"; @@ -18,6 +19,7 @@ chm = "nvim ~/.config/nixpkgs/home.nix"; cnix = "nvim ~/.config/nixpkgs/configuration.nix"; gst = "git status"; + v = "nvim $@"; }; zplug = { enable = true; @@ -32,6 +34,9 @@ home.packages = [ # Window environment (pkgs.dwl.override { + # trying to supply config.home.homeDirectory here leads to "impure" usage. + # so disabling it for now + # conf = (builtins.readFile "${config.home.homeDirectory}/.config/dwl/config.h"); conf = ./dwl/config.h; }) pkgs.somebar @@ -78,16 +83,38 @@ defaultCacheTtl = 1800; enableSshSupport = true; }; - #systemd.user.timers = { - # my-timer = { - # Unit = { - # Description = "Example description"; - # Documentation = [ "man:example(1)" "man:example(5)" ]; - # }; - # - # Timer = { - # nCalender = "weekly"; - # }; - # }; - #}; + + systemd.user.services = { + nextcloud-sync = { + Unit = { + Description = "Auto sync Nextcloud"; + After = "network-online.target"; + }; + Service = { + Type = "simple"; + EnvironmentFile = "${config.home.homeDirectory}/.nextcloud.env"; + ExecStart = '' + ${pkgs.nextcloud-client}/bin/nextcloudcmd \ + -h --non-interactive \ + --user "''${NEXTCLOUD_USER}" \ + --password "''${NEXTCLOUD_PASSWORD}" \ + ''${NEXTCLOUD_DIR} \ + ''${NEXTCLOUD_URL} + ''; + TimeoutStopSec = "180"; + KillMode = "process"; + KillSignal = "SIGINT"; + }; + Install.WantedBy = ["multi-user.target"]; + }; + }; + + systemd.user.timers = { + nextcloud-sync = { + Unit.Description = "Automatic sync files with Nextcloud when booted up after 5 minutes then rerun every 10 minutes"; + Timer.OnUnitActiveSec = "10min"; + Install.WantedBy = ["multi-user.target" "timers.target"]; + }; + }; + systemd.user.startServices = true; } -- cgit v1.2.3