From 0057396b6ef0bcd0a82f7da170c053833e16afc6 Mon Sep 17 00:00:00 2001 From: JJJHolscher Date: Tue, 7 Jul 2026 14:44:27 +0200 Subject: [PATCH 1/2] flake.nix for easy installing from nix --- flake.nix | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 flake.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..aedbe6a --- /dev/null +++ b/flake.nix @@ -0,0 +1,48 @@ +{ + description = "Cosma — a document graph visualization tool"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = + { self, nixpkgs }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system nixpkgs.legacyPackages.${system}); + in + { + packages = forAllSystems ( + system: pkgs: { + default = pkgs.buildNpmPackage { + pname = "cosma"; + version = "2.6.1"; + src = ./.; + nodejs = pkgs.nodejs_22; + + # Use package-lock.json instead of flake.lock for dependency locking. + npmDeps = pkgs.importNpmLock { npmRoot = ./.; }; + npmConfigHook = pkgs.importNpmLock.npmConfigHook; + + # Skip install lifecycle scripts during `npm ci`. + npmFlags = [ "--ignore-scripts" ]; + + npmBuildScript = "prepare"; + + meta = { + description = "Document graph visualization tool"; + homepage = "https://cosma.arthurperret.fr/"; + license = with pkgs.lib.licenses; [ + gpl3Plus + cecill21 + ]; + mainProgram = "cosma"; + }; + }; + } + ); + }; +} From 4e53faa543e097aa63b2f7c400ef8cd8324017c0 Mon Sep 17 00:00:00 2001 From: JJJHolscher Date: Tue, 7 Jul 2026 15:02:58 +0200 Subject: [PATCH 2/2] flake.lock --- flake.lock | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..13ef078 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1783224372, + "narHash": "sha256-8i/87eeoqiGE4yOTjwSA3Eh/ziJRQEmd/unYU+K27sk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d407951447dcd00442e97087bf374aad70c04cea", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +}