forked from github/quartz
73 lines
2.2 KiB
Nix
73 lines
2.2 KiB
Nix
{
|
|
description = "Org-garden — org-roam to website publishing pipeline";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = import nixpkgs { inherit system; };
|
|
fs = pkgs.lib.fileset;
|
|
|
|
# Emacs with ox-hugo — needed at runtime by the escript
|
|
# (export_org_files calls `emacs --batch` with ox-hugo).
|
|
emacsWithOxHugo = (pkgs.emacsPackagesFor pkgs.emacs-nox).emacsWithPackages
|
|
(epkgs: [ epkgs.ox-hugo ]);
|
|
|
|
# Pre-fetched Hex/Mix dependencies.
|
|
# src is filtered to mix.exs + mix.lock so source edits don't
|
|
# invalidate this derivation.
|
|
mixDeps = pkgs.beamPackages.fetchMixDeps {
|
|
pname = "org-garden-mix-deps";
|
|
version = "0.1.0";
|
|
src = fs.toSource {
|
|
root = ./.;
|
|
fileset = fs.unions [
|
|
./mix.exs
|
|
./mix.lock
|
|
];
|
|
};
|
|
sha256 = "sha256-si7JAomY1HZ33m6ihUJP5i6PO39CE1clYvuMtn0CbPU=";
|
|
};
|
|
|
|
# Compiled org-garden escript (without runtime wrappers).
|
|
# Note: escript name is org_garden (from app: :org_garden in mix.exs)
|
|
orgGardenEscript = pkgs.beamPackages.mixRelease {
|
|
pname = "org-garden";
|
|
version = "0.1.0";
|
|
src = ./.;
|
|
|
|
escriptBinName = "org_garden";
|
|
mixFodDeps = mixDeps;
|
|
|
|
stripDebug = true;
|
|
};
|
|
|
|
# Wrapped org-garden that puts emacs (with ox-hugo) on PATH so
|
|
# the escript's System.cmd("emacs", ...) calls succeed.
|
|
orgGardenApp = pkgs.writeShellApplication {
|
|
name = "org-garden";
|
|
runtimeInputs = [ emacsWithOxHugo pkgs.inotify-tools pkgs.nodejs_22 ];
|
|
text = ''
|
|
exec ${orgGardenEscript}/bin/org_garden "$@"
|
|
'';
|
|
};
|
|
in
|
|
{
|
|
packages.default = orgGardenApp;
|
|
packages.escript = orgGardenEscript;
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = [
|
|
pkgs.elixir
|
|
pkgs.inotify-tools
|
|
emacsWithOxHugo
|
|
pkgs.nodejs_22
|
|
];
|
|
};
|
|
});
|
|
}
|