This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
, doerg-temml-worker
|
||||
, ibm-plex-web
|
||||
, test-emacs ? callPackage ./test-emacs.nix {}
|
||||
, fake-git
|
||||
, fake-git ? null
|
||||
, our-tex
|
||||
, makeWrapper
|
||||
, writeText
|
||||
@@ -33,7 +33,7 @@ let
|
||||
];
|
||||
|
||||
doerg-config = writeText "doerg-extra-config.edn" ''
|
||||
#:net.deertopia.doerg
|
||||
#:net.deertopia.doerg.config
|
||||
{:ibm-plex-web "${ibm-plex-web}"
|
||||
:latex "${lib.getExe' our-tex "xelatex"}"
|
||||
:dvisvgm "${lib.getExe' our-tex "dvisvgm"}"
|
||||
@@ -74,4 +74,5 @@ in mkCljBin' {
|
||||
clojure -M:test
|
||||
'';
|
||||
passthru = { inherit plex our-tex test-emacs; };
|
||||
meta.mainProgram = "doerg";
|
||||
}
|
||||
|
||||
27
flake.nix
27
flake.nix
@@ -14,17 +14,18 @@
|
||||
"x86_64-linux"
|
||||
];
|
||||
|
||||
each-system = f: nixpkgs.lib.genAttrs supportedSystems (system: f rec {
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
inputs.sydpkgs.overlays.default
|
||||
clj-nix.overlays.default
|
||||
self.overlays.default
|
||||
];
|
||||
|
||||
each-system = f: nixpkgs.lib.genAttrs supportedSystems (system: f rec {
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
inherit (pkgs) lib;
|
||||
inherit system;
|
||||
inherit system overlays;
|
||||
});
|
||||
in {
|
||||
# Exposed as a REPL convenience.
|
||||
@@ -36,13 +37,17 @@
|
||||
});
|
||||
|
||||
overlays.default = final: prev:
|
||||
let graal = x: final.mkGraalBin { cljDrv = x; };
|
||||
let
|
||||
# is this really the correct way to satisfy our
|
||||
# dependencies? lmfao
|
||||
final' = final.appendOverlays overlays;
|
||||
graal = x: final'.mkGraalBin { cljDrv = x; };
|
||||
in {
|
||||
ibm-plex-web = final.callPackage ./ibm-plex-web.nix {};
|
||||
doerg = final.callPackage ./. {};
|
||||
doerg-parser = final.callPackage ./doerg-parser {};
|
||||
doerg-temml-worker = final.callPackage ./doerg-temml-worker {};
|
||||
our-tex = final.callPackage ./our-tex.nix {};
|
||||
ibm-plex-web = final'.callPackage ./ibm-plex-web.nix {};
|
||||
doerg = final'.callPackage ./. {};
|
||||
doerg-parser = final'.callPackage ./doerg-parser {};
|
||||
doerg-temml-worker = final'.callPackage ./doerg-temml-worker {};
|
||||
our-tex = final'.callPackage ./our-tex.nix {};
|
||||
};
|
||||
|
||||
checks = each-system ({ pkgs, system, ... }: {
|
||||
@@ -52,6 +57,8 @@
|
||||
(pkgs.lib.attrValues self.packages.${system});
|
||||
});
|
||||
|
||||
nixosModules.default = import ./module.nix { inherit self; };
|
||||
|
||||
devShells = each-system ({ pkgs, system, ... }: {
|
||||
default = pkgs.mkShell {
|
||||
inputsFrom = [
|
||||
|
||||
64
module.nix
Normal file
64
module.nix
Normal file
@@ -0,0 +1,64 @@
|
||||
{ self, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.doerg;
|
||||
doerg-config = pkgs.writeText "doerg-config.edn" ''
|
||||
#:net.deertopia.doerg.config
|
||||
{:org-roam-db-path "${cfg.databasePath}"
|
||||
:state-directory "${cfg.stateDir}"}
|
||||
'';
|
||||
|
||||
inherit (lib) types;
|
||||
in {
|
||||
options.services.doerg = {
|
||||
enable = lib.mkEnableOption "Doerg";
|
||||
org-roam-db-sync.enable = lib.mkEnableOption "Org-roam db sync";
|
||||
port = lib.mkOption {
|
||||
default = 21984;
|
||||
type = lib.types.port;
|
||||
description = ''
|
||||
The port on which Doerg will listen.
|
||||
'';
|
||||
};
|
||||
stateDir = lib.mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/private/doerg";
|
||||
description = "Daemon's state directory.";
|
||||
};
|
||||
orgDir = lib.mkOption {
|
||||
type = types.path;
|
||||
description = "Org roam directory.";
|
||||
};
|
||||
package = lib.mkPackageOption pkgs "doerg" {};
|
||||
databasePath = lib.mkOption {
|
||||
type = types.path;
|
||||
description = "Org roam database path";
|
||||
default = cfg.orgDir + "org-roam.db";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
nixpkgs.overlays = [ self.overlays.default ];
|
||||
|
||||
systemd.services.doerg = {
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
environment.DOERG_CONFIG = doerg-config;
|
||||
serviceConfig = {
|
||||
# WorkingDirectory = cfg.stateDir;
|
||||
StateDirectory = "doerg";
|
||||
ExecStart = lib.getExe cfg.package;
|
||||
DynamicUser = true;
|
||||
ProtectSystem = "strict";
|
||||
PrivateTmp = true;
|
||||
BindReadOnlyPaths = [
|
||||
cfg.orgDir
|
||||
cfg.databasePath
|
||||
"/nix"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
#:net.deertopia.doerg.config
|
||||
{:ibm-plex-web #or [#xdg-data-dir "ibm-plex-web"
|
||||
#env IBM_PLEX_WEB]
|
||||
{:ibm-plex-web #or [#env IBM_PLEX_WEB
|
||||
#xdg-data-dir "ibm-plex-web"]
|
||||
:latex "xelatex"
|
||||
:dvisvgm "dvisvgm"
|
||||
:debug-unimplemented? #profile {:dev true :default false}
|
||||
:doerg-temml-worker
|
||||
#profile {:dev #file "../../../../doerg-temml-worker/index.js"
|
||||
:default "doerg-temml-worker"}
|
||||
|
||||
@@ -18,8 +18,10 @@
|
||||
calling `compute` with no arguments only if stale? is logical true."
|
||||
[& {:keys [file stale? compute]}]
|
||||
(when (or (not *use-cache?*) stale?)
|
||||
(let [r (compute)]
|
||||
(let [r (compute)
|
||||
dir (fs/parent file)]
|
||||
(assert (string? r))
|
||||
(fs/create-dirs (fs/parent file))
|
||||
(when-not (fs/exists? dir)
|
||||
(fs/create-dirs dir))
|
||||
(spit file r)))
|
||||
file)
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
"Aero tag to search for a directory on $XDG_DATA_DIRS."
|
||||
(some #(let [x (fs/path % value)]
|
||||
(and (fs/exists? x) x))
|
||||
(fs/split-paths (System/getenv "XDG_DATA_DIRS"))))
|
||||
(some-> (System/getenv "XDG_DATA_DIRS")
|
||||
fs/split-paths)))
|
||||
|
||||
(defmethod aero/reader 'file
|
||||
[{:keys [source]} tag value]
|
||||
|
||||
Reference in New Issue
Block a user