From 1be9f5ff9e45cc60fa15354722c055c31a882918 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Wed, 14 Dec 2022 00:54:06 +1000 Subject: [PATCH] add archivebox --- flake.lock | 8 ++-- hosts/box/default.nix | 1 + hosts/curve/default.nix | 2 +- hosts/profiles/archivebox/default.nix | 59 +++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 hosts/profiles/archivebox/default.nix diff --git a/flake.lock b/flake.lock index 492fc954..7c35f30f 100644 --- a/flake.lock +++ b/flake.lock @@ -312,11 +312,11 @@ "vimwiki-cli": "vimwiki-cli" }, "locked": { - "lastModified": 1670394895, - "narHash": "sha256-MlkPVWWHcUPzNYRiJ+32vQL7iVS+aswGECxL8bUE5xM=", + "lastModified": 1670936403, + "narHash": "sha256-alrM0QG1eXYJTjgQ/4Ahmw95FZ435cIHXwDNdq/mLUM=", "ref": "main", - "rev": "9730a8abbde76aa409f39a1f5128744d4e191cad", - "revCount": 447, + "rev": "3c9d0c5471affee1b426a0159b13201df41cad6c", + "revCount": 455, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, diff --git a/hosts/box/default.nix b/hosts/box/default.nix index 9a18e474..1e9104ec 100644 --- a/hosts/box/default.nix +++ b/hosts/box/default.nix @@ -18,6 +18,7 @@ ../profiles/calibre ../profiles/wallabag ../profiles/finance + ../profiles/archivebox ]; # For some reason this doesn't work in the profile, but does over here?? diff --git a/hosts/curve/default.nix b/hosts/curve/default.nix index bed6ab09..2bc0b0d0 100644 --- a/hosts/curve/default.nix +++ b/hosts/curve/default.nix @@ -72,7 +72,7 @@ mossnet.backup = { enable = true; name = "curve"; - paths = [ "/home/anish" ]; + paths = [ "/home/anish/usr" ]; }; # enable adb diff --git a/hosts/profiles/archivebox/default.nix b/hosts/profiles/archivebox/default.nix new file mode 100644 index 00000000..e5d53ae1 --- /dev/null +++ b/hosts/profiles/archivebox/default.nix @@ -0,0 +1,59 @@ +{ config, options, lib, pkgs, ... }: +with lib; +let + # cfg = config.services.archivebox; + dataDir = "/var/lib/archivebox"; + user = "archivebox"; + port = "8123"; +in +{ + systemd.services.archivebox-install = { + description = "archivebox install service"; + wantedBy = [ "multi-user.target" ]; + path = with pkgs; [ coreutils archivebox ]; + + serviceConfig = { + User = user; + Type = "oneshot"; + RemainAfterExit = "yes"; + PermissionsStartOnly = true; + }; + + preStart = '' + mkdir -p "${dataDir}" + chown ${user} "${dataDir}" + ''; + + script = '' + echo "Setting up wallabag files in ${dataDir} ..." + cd "${dataDir}" + + archivebox init + ''; + }; + + systemd.services.archivebox-server = { + description = "archivebox server service"; + wantedBy = [ "multi-user.target" ]; + path = with pkgs; [ coreutils archivebox ]; + + serviceConfig = { + User = user; + Type = "oneshot"; + RemainAfterExit = "yes"; + PermissionsStartOnly = true; + }; + + preStart = '' + mkdir -p "${dataDir}" + chown ${user} "${dataDir}" + ''; + + script = '' + echo "Setting up wallabag files in ${dataDir} ..." + cd "${dataDir}" + + archivebox server 0.0.0.0:${port} + ''; + }; +}