diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bf1a81..8986f1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,3 +51,6 @@ jobs: - name: Build the project run: npm run build + + - name: Build examples + run: find examples -maxdepth 2 -type f -iname package.json -execdir "npm install && npm build" \; diff --git a/.gitignore b/.gitignore index b32b3d8..c38ed6e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /.psa* /.vscode/ /.spago/ +/.direnv/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0a1d2cd --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1655122334, + "narHash": "sha256-Rwwvo9TDCH0a4m/Jvoq5wZ3FLSLiVLBD1FFfN/3XawA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e1a1cfb56504d1b82a3953bfb0632b37a1ca8d30", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ca752d9 --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "Provide an environment for working in this repo"; + + # to handle mac and linux + inputs.flake-utils.url = "github:numtide/flake-utils"; + + # we want to use a consistent nixpkgs across developers. + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + outputs = all@{ self, nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + }; + packages = + let + # everything we want available in our development environment that isn't managed by + # npm, spago + # we do not differentiate between libraries needed for building and tools at the moment. + sharedPackages = with pkgs; [ + nodejs-16_x + ]; + in + sharedPackages; + in { + # produce our actual shell + devShell = pkgs.mkShell rec { + # make our packages available + buildInputs = packages; + }; + } + ); +} diff --git a/tools/publish-shell.nix b/tools/publish-shell.nix new file mode 100644 index 0000000..38ec253 --- /dev/null +++ b/tools/publish-shell.nix @@ -0,0 +1,32 @@ +# Universal shell for PureScript repos +{ pkgs ? import (builtins.fetchGit { + # https://github.com/NixOS/nixpkgs/releases/tag/21.11 + url = "https://github.com/nixos/nixpkgs/"; + ref = "refs/tags/21.11"; + rev = "a7ecde854aee5c4c7cd6177f54a99d2c1ff28a31"; + }) {} +}: +let + easy-ps-src = builtins.fetchGit { + url = "https://github.com/justinwoo/easy-purescript-nix.git"; + ref = "master"; + rev = "0ad5775c1e80cdd952527db2da969982e39ff592"; + }; + easy-ps = import easy-ps-src { inherit pkgs; }; +in +pkgs.mkShell { + nativeBuildInputs = [ + easy-ps.purs-0_15_0 + easy-ps.spago + easy-ps.pulp-16_0_0-0 + easy-ps.psc-package + easy-ps.purs-tidy + pkgs.nodejs-16_x + pkgs.nodePackages.bower + ]; + LC_ALL = "C.UTF-8"; # https://github.com/purescript/spago/issues/507 + # https://github.com/purescript/spago#install-autocompletions-for-bash + shellHook = '' + source <(spago --bash-completion-script `which spago`) + ''; +}