nix: compile deps with the same elixir version
This commit is contained in:
parent
ed89285fc8
commit
7cf7b03966
4 changed files with 242 additions and 38 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -18,5 +18,6 @@ erl_crash.dump
|
|||
|
||||
# nix
|
||||
/.direnv
|
||||
.pre-commit-config.yaml
|
||||
/.elixir_ls
|
||||
/result
|
||||
|
|
137
flake.lock
137
flake.lock
|
@ -1,5 +1,21 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
|
@ -18,6 +34,39 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-root": {
|
||||
"locked": {
|
||||
"lastModified": 1680964220,
|
||||
"narHash": "sha256-dIdTYcf+KW9a4pKHsEbddvLVSfR1yiAJynzg2x0nfWg=",
|
||||
"owner": "srid",
|
||||
"repo": "flake-root",
|
||||
"rev": "f1c0b93d05bdbea6c011136ba1a135c80c5b326c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "srid",
|
||||
"repo": "flake-root",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1685518550,
|
||||
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -40,11 +89,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1688859638,
|
||||
"narHash": "sha256-GyRhX8GlTQqDWx43uBFEYEQ/WKEqDwjzABHxUCatAno=",
|
||||
"lastModified": 1690720142,
|
||||
"narHash": "sha256-GywuiZjBKfFkntQwpNQfL+Ksa2iGjPprBGL0/psgRZM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d485da9d0034a72ceb9679c2ab0156c073f66b82",
|
||||
"rev": "3acb5c4264c490e7714d503c7166a3fde0c51324",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -72,11 +121,91 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1685801374,
|
||||
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks-nix": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"gitignore": [
|
||||
"gitignore"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1690743255,
|
||||
"narHash": "sha256-dsJzQsyJGWCym1+LMyj2rbYmvjYmzeOrk7ypPrSFOPo=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "fcbf4705d98398d084e6cb1c826a0b90a91d22d7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-root": "flake-root",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks-nix": "pre-commit-hooks-nix",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689620039,
|
||||
"narHash": "sha256-BtNwghr05z7k5YMdq+6nbue+nEalvDepuA7qdQMAKoQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "719c2977f958c41fa60a928e2fbc50af14844114",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
103
flake.nix
103
flake.nix
|
@ -2,45 +2,87 @@
|
|||
description = "weewx-proxy development environment";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
# Tools
|
||||
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
|
||||
flake-root.url = "github:srid/flake-root";
|
||||
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
gitignore = {
|
||||
url = "github:hercules-ci/gitignore.nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
pre-commit-hooks-nix = {
|
||||
url = "github:cachix/pre-commit-hooks.nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.gitignore.follows = "gitignore";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = inputs@{ flake-parts, gitignore, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
systems = [ "aarch64-darwin" "x86_64-linux" "aarch64-linux" ];
|
||||
|
||||
perSystem = { pkgs, lib, self', ... }:
|
||||
imports = [
|
||||
inputs.flake-root.flakeModule
|
||||
inputs.treefmt-nix.flakeModule
|
||||
inputs.pre-commit-hooks-nix.flakeModule
|
||||
];
|
||||
|
||||
perSystem = { pkgs, config, lib, self', ... }:
|
||||
let
|
||||
pname = "weewx-proxy";
|
||||
version = "0.0.1";
|
||||
|
||||
erlang = pkgs.beam.interpreters.erlangR26;
|
||||
beamPackages = pkgs.beam.packagesWith erlang;
|
||||
elixir = beamPackages.elixir_1_15;
|
||||
beamPackagesPrev = pkgs.beam.packagesWith erlang;
|
||||
elixir = beamPackagesPrev.elixir_1_15;
|
||||
|
||||
beamPackages = beamPackagesPrev // rec {
|
||||
inherit erlang elixir;
|
||||
hex = beamPackagesPrev.hex.override { inherit elixir; };
|
||||
buildMix = beamPackagesPrev.buildMix.override { inherit elixir erlang hex; };
|
||||
mixRelease = beamPackagesPrev.mixRelease.override { inherit erlang elixir; };
|
||||
};
|
||||
|
||||
inherit (pkgs.stdenv) isDarwin;
|
||||
inherit (gitignore.lib) gitignoreSource;
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = (with pkgs; [
|
||||
erlang
|
||||
elixir
|
||||
treefmt = {
|
||||
inherit (config.flake-root) projectRootFile;
|
||||
flakeCheck = false;
|
||||
|
||||
beamPackages.elixir-ls
|
||||
mix2nix
|
||||
mosquitto
|
||||
]) ++ lib.optionals isDarwin (with pkgs.darwin.apple_sdk.frameworks; [
|
||||
CoreFoundation
|
||||
CoreServices
|
||||
]);
|
||||
programs = {
|
||||
mix-format = {
|
||||
enable = true;
|
||||
package = elixir;
|
||||
};
|
||||
|
||||
ERL_INCLUDE_PATH = "${erlang}/lib/erlang/usr/include";
|
||||
nixpkgs-fmt.enable = true;
|
||||
shfmt.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
pre-commit = {
|
||||
check.enable = false;
|
||||
|
||||
settings = {
|
||||
excludes = [ "mix.nix" ];
|
||||
|
||||
hooks = {
|
||||
deadnix.enable = true;
|
||||
statix.enable = true;
|
||||
treefmt.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
packages.default = beamPackages.mixRelease {
|
||||
|
@ -54,6 +96,9 @@
|
|||
name = pname;
|
||||
tag = "v${version}";
|
||||
config = {
|
||||
Env = [
|
||||
"LANG=C.UTF-8"
|
||||
];
|
||||
ExposedPorts = { "4040/tcp" = { }; };
|
||||
Entrypoint = [ "${self'.packages.default}/bin/weewx_proxy" ];
|
||||
Cmd = [ "start" ];
|
||||
|
@ -61,6 +106,34 @@
|
|||
};
|
||||
|
||||
apps.default = { type = "app"; program = "${self'.packages.default}/bin/weewx_proxy"; };
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
name = pname;
|
||||
|
||||
nativeBuildInputs = [
|
||||
erlang
|
||||
elixir
|
||||
] ++ lib.optionals isDarwin (with pkgs.darwin.apple_sdk.frameworks;
|
||||
[
|
||||
CoreFoundation
|
||||
CoreServices
|
||||
]);
|
||||
|
||||
packages = [
|
||||
beamPackages.elixir-ls
|
||||
pkgs.mix2nix
|
||||
pkgs.mosquitto
|
||||
];
|
||||
|
||||
inputsFrom = [
|
||||
config.flake-root.devShell
|
||||
config.treefmt.build.devShell
|
||||
config.pre-commit.devShell
|
||||
];
|
||||
|
||||
ERL_INCLUDE_PATH = "${erlang}/lib/erlang/usr/include";
|
||||
TREEFMT_CONFIG_FILE = config.treefmt.build.configFile;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
39
mix.nix
39
mix.nix
|
@ -1,4 +1,4 @@
|
|||
{ lib, beamPackages, overrides ? (x: y: {}) }:
|
||||
{ lib, beamPackages, overrides ? (x: y: { }) }:
|
||||
|
||||
let
|
||||
buildRebar3 = lib.makeOverridable beamPackages.buildRebar3;
|
||||
|
@ -18,7 +18,7 @@ let
|
|||
sha256 = "0ha6vmf5p3xlbf5w1msa89frhvfk535rnyfybz9wdmh6vdms8v96";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
cowboy = buildErlangMk rec {
|
||||
|
@ -57,7 +57,7 @@ let
|
|||
sha256 = "1c4dgi8canscyjgddp22mjc69znvwy44wk3r7jrl2wvs6vv76fqn";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
dialyxir = buildMix rec {
|
||||
|
@ -83,7 +83,7 @@ let
|
|||
sha256 = "18gr9cvjar9rrmcj0crgwjb4np4adfbwcaxijajhwpjzvamwfq04";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
erlex = buildMix rec {
|
||||
|
@ -96,7 +96,7 @@ let
|
|||
sha256 = "0x8c1j62y748ldvlh46sxzv5514rpzm809vxn594vd7y25by5lif";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
gen_state_machine = buildMix rec {
|
||||
|
@ -109,7 +109,7 @@ let
|
|||
sha256 = "05gdy0cxsmg3j43xmd6vm3nzsi8vlk94kdzn15rypg5yfhjnan8a";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
hackney = buildRebar3 rec {
|
||||
|
@ -161,7 +161,7 @@ let
|
|||
sha256 = "18d70i31bz11nr6vgsjn5prvhkvwqbyf3xq22ck5cnsnzp6ixc7v";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
metrics = buildRebar3 rec {
|
||||
|
@ -174,7 +174,7 @@ let
|
|||
sha256 = "05lz15piphyhvvm3d1ldjyw0zsrvz50d2m5f2q3s8x2gvkfrmc39";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
mime = buildMix rec {
|
||||
|
@ -187,7 +187,7 @@ let
|
|||
sha256 = "0p50h0ki8ay5sraiqxiajgwy1829bvyagj65bj9wjny4cnin83fs";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
mimerl = buildRebar3 rec {
|
||||
|
@ -200,7 +200,7 @@ let
|
|||
sha256 = "08wkw73dy449n68ssrkz57gikfzqk3vfnf264s31jn5aa1b5hy7j";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
parse_trans = buildRebar3 rec {
|
||||
|
@ -213,7 +213,7 @@ let
|
|||
sha256 = "12w8ai6b5s6b4hnvkav7hwxd846zdd74r32f84nkcmjzi1vrbk87";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
plug = buildMix rec {
|
||||
|
@ -252,7 +252,7 @@ let
|
|||
sha256 = "0hnqgzc3zas7j7wycgnkkdhaji5farkqccy2n4p1gqj5ccfrlm16";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
ranch = buildRebar3 rec {
|
||||
|
@ -265,7 +265,7 @@ let
|
|||
sha256 = "1rfz5ld54pkd2w25jadyznia2vb7aw9bclck21fizargd39wzys9";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
ssl_verify_fun = buildRebar3 rec {
|
||||
|
@ -278,7 +278,7 @@ let
|
|||
sha256 = "1y37pj5q6gk1vrnwg1vraws9yihrv9g4133w2qq1sh1piw71jk7y";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
systemd = buildRebar3 rec {
|
||||
|
@ -304,7 +304,7 @@ let
|
|||
sha256 = "1mgyx9zw92g6w8fp9pblm3b0bghwxwwcbslrixq23ipzisfwxnfs";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
tortoise311 = buildMix rec {
|
||||
|
@ -330,7 +330,7 @@ let
|
|||
sha256 = "0v8v3l8j7g3ran3f9gc2nc1mkj6kwfdr6kshm2cf3r0zlv1xa2y5";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
tz = buildMix rec {
|
||||
|
@ -343,7 +343,7 @@ let
|
|||
sha256 = "0s4yggr8d5192qkzrzx85xpgz6pg233hn14ll1w2f0qyvlc0cjr2";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
|
||||
unicode_util_compat = buildRebar3 rec {
|
||||
|
@ -356,8 +356,9 @@ let
|
|||
sha256 = "08952lw8cjdw8w171lv8wqbrxc4rcmb3jhkrdb7n06gngpbfdvi5";
|
||||
};
|
||||
|
||||
beamDeps = [];
|
||||
beamDeps = [ ];
|
||||
};
|
||||
};
|
||||
in self
|
||||
in
|
||||
self
|
||||
|
||||
|
|
Loading…
Reference in a new issue