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 +} 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"; + }; + }; + } + ); + }; +}