aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: beda2d22f476cf0b7bdd0eed5d5573b1540c6c04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
  description = "Moe-Counter Compatible Website Hit Counter";

  inputs = {
    flake-utils.url = "github:numtide/flake-utils";
    nix-gleam.url = "github:arnarg/nix-gleam";
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

    gitignore = {
      url = "github:hercules-ci/gitignore.nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs =
    {
      flake-utils,
      gitignore,
      nix-gleam,
      nixpkgs,
      self,
      ...
    }:
    flake-utils.lib.eachDefaultSystem (
      system:
      let
        inherit (gitignore.lib) gitignoreSource;

        pkgs = import nixpkgs {
          inherit system;

          overlays = [
            nix-gleam.overlays.default
          ];
        };
      in
      {
        packages = {
          default = pkgs.buildGleamApplication {
            src = gitignoreSource ./.;

            rebar3Package = pkgs.rebar3WithPlugins {
              plugins = with pkgs.beamPackages; [ pc ];
            };
          };

          mayu = self.packages.${system}.default;
        };

        devShells.default = pkgs.mkShell {
          buildInputs = with pkgs; [
            gleam
            rebar3
	    erlang
          ];
        };
      }
    );
}