From e90d4cf86f7236628eabe8fe86352f43e751824b Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Tue, 17 Jun 2025 12:57:05 +0200 Subject: [PATCH] docs: add section on Nix flake --- docs/Developer Guide/!!!meta.json | 41 +++++++++- .../Building and deployment/Nix flake.md | 76 +++++++++++++++++++ 2 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 docs/Developer Guide/Developer Guide/Building and deployment/Nix flake.md diff --git a/docs/Developer Guide/!!!meta.json b/docs/Developer Guide/!!!meta.json index 96654d061..277572b7a 100644 --- a/docs/Developer Guide/!!!meta.json +++ b/docs/Developer Guide/!!!meta.json @@ -1720,6 +1720,45 @@ } ] }, + { + "isClone": false, + "noteId": "VHhyVRYK43gI", + "notePath": [ + "jdjRLhLV3TtI", + "VHhyVRYK43gI" + ], + "title": "Building and deployment", + "notePosition": 230, + "prefix": null, + "isExpanded": false, + "type": "text", + "mime": "text/html", + "attributes": [], + "format": "markdown", + "attachments": [], + "dirFileName": "Building and deployment", + "children": [ + { + "isClone": false, + "noteId": "Un4wj2Mak2Ky", + "notePath": [ + "jdjRLhLV3TtI", + "VHhyVRYK43gI", + "Un4wj2Mak2Ky" + ], + "title": "Nix flake", + "notePosition": 10, + "prefix": null, + "isExpanded": false, + "type": "text", + "mime": "text/html", + "attributes": [], + "format": "markdown", + "dataFileName": "Nix flake.md", + "attachments": [] + } + ] + }, { "isClone": false, "noteId": "ibAPHul7Efvr", @@ -1728,7 +1767,7 @@ "ibAPHul7Efvr" ], "title": "Old documentation", - "notePosition": 230, + "notePosition": 260, "prefix": null, "isExpanded": false, "type": "text", diff --git a/docs/Developer Guide/Developer Guide/Building and deployment/Nix flake.md b/docs/Developer Guide/Developer Guide/Building and deployment/Nix flake.md new file mode 100644 index 000000000..9268eed6e --- /dev/null +++ b/docs/Developer Guide/Developer Guide/Building and deployment/Nix flake.md @@ -0,0 +1,76 @@ +# Nix flake +Since TriliumNext 0.94.1, the desktop and server applications can be built using [Nix](https://nixos.org/). + +## System requirements + +Installation of Nix on Mac or Linux ([download page](https://nixos.org/download/)). About 3-4 gigabytes of additional storage space, for build artifacts. + +## Run directly + +Using [nix run](https://nix.dev/manual/nix/stable/command-ref/new-cli/nix3-run.html), the desktop app can be started as: `nix run github:TriliumNext/Notes/v0.95.0` + +Running the server requires explicitly specifying the desired package: `nix run github:TriliumNext/Notes/v0.95.0#server` + +Instead of a version (`v0.95.0` above), you can also specify a commit hash (or a branch name). This makes it easy to test development builds. + +## Install on NixOS + +Add to your `flake.nix`: + +``` +{ + inputs = { + nixpkgs.url = # ...; + trilium-notes = { + url = "github:TriliumNext/Notes/v0.95.0"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { + self, + # ... + trilium-notes, + ... + }: + { + nixosConfigurations = { + "nixos" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./configuration.nix + ]; + specialArgs = { + inherit + trilium-notes + ; + }; + }; + }; + }; +} + +``` + +Add to your `configuration.nix`: + +``` +{ + # ... + trilium-notes, + ... +}: + +{ + # ... + + services.trilium-server.package = trilium-notes.packages.x86_64-linux.server; + + environment.systemPackages = [ + trilium-notes.packages.x86_64-linux.desktop + ]; +} +``` + +The flake aims to be compatible with the latest NixOS stable and unstable. \ No newline at end of file