2 description = "PureScript Protobuf";
5 nixpkgs.url = github:NixOS/nixpkgs/nixos-24.11;
7 url = "github:numtide/flake-utils";
10 url = "github:thomashoneyman/purescript-overlay";
11 inputs.nixpkgs.follows = "nixpkgs";
14 url = "github:jeslie0/mkSpagoDerivation";
15 inputs.nixpkgs.follows = "nixpkgs";
19 outputs = { self, nixpkgs, ... }@inputs:
21 supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
23 forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
25 library-src = ./library/src;
27 nixpkgsFor = forAllSystems (system: import nixpkgs {
30 overlays = builtins.attrValues self.overlays ++ [
31 inputs.purescript-overlay.overlays.default
32 inputs.mkSpagoDerivation.overlays.default
33 (prev: final: import ./nix/protobuf.nix final)
35 purescript-protobuf-library = prev.mkSpagoDerivation {
36 name = "purescript-protobuf-library";
38 nativeBuildInputs = with prev; [ purs spago-unstable ];
39 buildPhase = "spago build";
40 installPhase = "mkdir $out; cp -r output/* $out/";
44 purescript-protobuf-plugin = prev.mkSpagoDerivation {
45 name = "purescript-protobuf-plugin";
47 nativeBuildInputs = with prev; [ purs spago-unstable purs-backend-es esbuild];
49 spago build --purs-args '${prev.purescript-protobuf-library.src}/src/**/*.purs'
51 installPhase = "mkdir $out; cp -r output/* $out/";
55 purescript-protobuf-conformance = prev.mkSpagoDerivation {
56 name = "purescript-protobuf-conformance";
58 nativeBuildInputs = with prev; [ purs spago-unstable purs-backend-es esbuild];
60 spago build --purs-args '${prev.purescript-protobuf-library.src}/src/**/*.purs'
62 installPhase = "mkdir $out; cp -r output/* $out/";
66 protoc-gen-purescript = prev.writeScriptBin "protoc-gen-purescript" ''
67 ${prev.nodejs}/bin/node --input-type=module -e "import {main} from '${final.purescript-protobuf-plugin}/Main/index.js'; main();"
69 conformance-purescript = prev.writeScriptBin "conformance-purescript" ''
71 ${prev.nodejs}/bin/node --abort-on-uncaught-exception --trace-sigint --trace-uncaught --input-type=module -e "import {main} from '${final.purescript-protobuf-conformance}/Main/index.js'; main();"
82 packages = forAllSystems (system:
83 let pkgs = nixpkgsFor.${system}; in {
84 protoc-gen-purescript = pkgs.protoc-gen-purescript;
85 conformance-purescript = pkgs.conformance-purescript;
86 protobuf_v3_9_2 = pkgs.protobuf_v3_9_2;
87 protobuf_v3_14_0 = pkgs.protobuf_v3_14_0;
88 protobuf_v3_15_8 = pkgs.protobuf_v3_15_8;
89 protobuf_v3_20_1 = pkgs.protobuf_v3_20_1;
90 protobuf_v3_21_0 = pkgs.protobuf_v3_21_0;
91 protobuf_v21_10 = pkgs.protobuf_v21_10;
92 protobuf_v23_2 = pkgs.protobuf_v23_2;
93 protobuf_v24_4 = pkgs.protobuf_v24_4;
94 protobuf_v28_2 = pkgs.protobuf_v28_2;
95 protobuf_local = pkgs.protobuf_local;
98 devShells = forAllSystems (system:
99 let pkgs = nixpkgsFor.${system}; in {
100 default = pkgs.mkShell {
101 name = "purescript-protobuf-devshell";
102 inputsFrom = builtins.attrValues self.packages.${system};
103 buildInputs = with pkgs; [
106 purs-tidy-bin.purs-tidy-0_10_0
108 purescript-language-server
110 # If MacOS then we use the protobuf from nixpkgs.
111 # Else we use our own protobuf.
112 (if stdenv.isDarwin then protobuf else protobuf_local)
114 protoc-gen-purescript
117 # spago sources not working for whole project, TODO something like:
118 # export PURS_IDE_SOURCES=$(cd plugin;spago sources)
120 source <(spago --bash-completion-script `which spago`)
121 source <(node --completion-bash)
122 echo "PureScript Protobuf development environment"
131 echo "To build the protoc compiler plugin, run:"
133 echo " cd plugin; spago build"
135 echo "To compile PureScript .purs files from .proto files, run for example:"
137 echo " protoc --purescript_out=. google/protobuf/timestamp.proto"
143 apps = forAllSystems (system:
144 let pkgs = nixpkgsFor.${system}; in {
147 program = "${pkgs.protobuf_local}/bin/protoc";
149 protoc-gen-purescript = {
151 program = "${pkgs.protoc-gen-purescript}/bin/protoc-gen-purescript";
153 conformance_test_runner = {
155 program = "${pkgs.protobuf_local}/bin/conformance_test_runner";
157 conformance-purescript = {
159 program = "${pkgs.conformance-purescript}/bin/conformance-purescript";
163 conformance-run = pkgs.writeScriptBin "conformance" ''
166 ${pkgs.protobuf_local}/bin/conformance_test_runner --enforce_recommended ${pkgs.conformance-purescript}/bin/conformance-purescript
171 program = "${conformance-run}/bin/conformance";
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list