KO
|
EN
gitlite — search
Search
#python
#php
#python3
#javascript
#unity
#machine-learning
#go
#golang
#postgresql
#html
#arduino
#c
nix-gleam
★ 67
Open GitHub ↗
Generic nix builder for gleam applications
Download README (.md)
Explore Similar Repositories
mui-querybuilder
:
Query builder for React applications based on Material UI v4.
strapi-plugin-webpage-builder
:
Add GrapesJS builder to your own strapi application
buildGradleApplication
:
A Nix builder function for packaging Gradle applications.
wabur
:
Web Application Builder using Ruby
PythonFMXBuilder
:
An application builder for Python using DelphiFMX for Python for targeting Android.
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
nix-gleam
?
Download (.md)
# nix-gleam Generic nix builder for gleam applications. Gleam will create a `manifest.toml` file for every project which acts as a lock file and contains package name, version and a sha256 checksum of the package for every dependency. This is enough info for the builder to fetch all dependencies using `fetchHex` in nix. ## Usage Currently there is only 1 builder which builds a gleam application and supports both `erlang` and `javascript` target (but hard-coded to use nodejs runtime). ### buildGleamApplication In `flake.nix`: ```nix { description = "My gleam application"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nix-gleam = { url = "github:arnarg/nix-gleam"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { nixpkgs, nix-gleam, ... }: let inherit (nixpkgs) lib; forEachSystem = lib.genAttrs lib.systems.flakeExposed; in { packages = forEachSystem (system: { default = nix-gleam.packages.${system}.buildGleamApplication { # The pname and version will be read from the `gleam.toml` # file generated by gleam. # But this can be overwritten here too: # pname = "my-app"; # version = "1.2.3"; # The target is read from the `gleam.toml` file too. # Default is "erlang" if nothing is specified but # this can also be overwritten here too: # target = "javascript"; # Erlang package can be overridden but defaults to # `pkgs.erlang`. # erlangPackage = pkgs.erlang_nox; src = ./.; }; }); }; } ```` ## Examples ### Monorepo In a monorepo example where sub-directories `backend`, `frontend` and `shared` are all different gleam packages where `backend` and `frontend` have a local path dependency `shared`, the following `flake.nix` can be used in the root of the monorepo. ```nix { description = "My gleam monorepo"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nix-gleam = { url = "github:arnarg/nix-gleam"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { nixpkgs, nix-gleam, ... }: let inherit (nixpkgs) lib; forEachSystem = lib.genAttrs lib.systems.flakeExposed; in { packages = forEachSystem (system: let inherit (nix-gleam.packages.${system}) buildGleamApplication; in { # Backend application backend = buildGleamApplication { src = ./backend; # Inform the builder to use `./shared` # as a local package. localPackages = [./shared]; }; # Frontend application frontend = buildGleamApplication { src = ./frontend; # Inform the builder to use `./shared` # as a local package. localPackages = [./shared]; }; } ); }; } ``` ### Rebar3 plugins Some dependencies will take in erlang dependencies that might need rebar3 plugins to build and will produce build errors like: ``` Errors loading plugin pc. Run rebar3 with DEBUG=1 set to see errors. ``` In such cases rebar3 package used in the build can be overwritten with `rebar3Package`. ```nix { description = "My gleam application"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nix-gleam = { url = "github:arnarg/nix-gleam"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { nixpkgs, nix-gleam, ... }: let inherit (nixpkgs) lib; forEachSystem = f: lib.genAttrs (import systems) ( system: f { inherit system; pkgs = nixpkgs.packages.${system}; } ); in { packages = forEachSystem ({ pkgs, system} : { default = nix-gleam.packages.${system}.buildGleamApplication { src = ./.; # Overrides the rebar3 package used, adding # plugins using `rebar3WithPlugins`. rebar3Package = pkgs.rebar3WithPlugins { plugins = with pkgs.beamPackages; [pc]; }; }; }); }; } ```