aboutsummaryrefslogtreecommitdiffstats
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix87
1 files changed, 48 insertions, 39 deletions
diff --git a/flake.nix b/flake.nix
index f0afc44..dfb0698 100644
--- a/flake.nix
+++ b/flake.nix
@@ -11,52 +11,61 @@
treefmt-nix.url = "github:numtide/treefmt-nix";
};
- outputs =
- { self,
- nixpkgs,
- flake-parts,
- treefmt-nix,
- ...
- }@inputs:
+ outputs = { self, nixpkgs, flake-parts, treefmt-nix, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
- perSystem =
- { pkgs, system, ... }:
- let
- treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
- in
- {
- # This sets `pkgs` to a nixpkgs with allowUnfree option set.
- _module.args.pkgs = import nixpkgs {
- inherit system;
- config.allowUnfree = true;
- };
+ perSystem = { pkgs, system, ... }:
+ let
+ erlang = pkgs.erlang_28;
+
+ buildRebar3 = pkgs.beamPackages.buildRebar3 {
+ pname = "domino";
+ version = "0.1.0";
+ src = ./.;
+ beam = erlang;
+ generate-lock = true;
+ name = "domino";
+ buildInputs = [ pkgs.rebar3 ];
- # nix build
- packages = {
- hello = pkgs.hello;
- default = pkgs.hello;
+ meta = with pkgs.lib; {
+ description = "Domino Erlang Server";
+ license = pkgs.lib.licenses.mit;
+ platforms = pkgs.lib.platforms.all;
};
+ };
+
+ in {
+ # This sets `pkgs` to a nixpkgs with allowUnfree option set.
+ _module.args.pkgs = import nixpkgs {
+ inherit system;
+ config.allowUnfree = true;
+ };
- devShells =
- {
- default = pkgs.mkShell {
- packages = with pkgs; [
- erlang_28
- erlang-language-platform
- rebar3
- ];
- };
- };
-
- # nix fmt
- formatter = treefmtEval.config.build.wrapper;
-
- # nix flake check --all-systems
- checks = {
- formatting = treefmtEval.config.build.check self;
+ # nix build
+ packages = {
+ domino = buildRebar3;
+ default = buildRebar3;
+ };
+
+ # Define devShell for Erlang + Rebar3
+ devShells = {
+ default = pkgs.mkShell {
+ packages = with pkgs; [
+ erlang_28
+ erlang-language-platform
+ rebar3
+ ];
};
};
+
+ # Formatter setup for Nix files
+ formatter = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
+
+ # nix flake check --all-systems
+ checks = {
+ formatting = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
+ };
+ };
};
}