Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions fixtures/example/deps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
rustlerPrecompiledOverrides ? { },
stdenv,
pkg-config,
sqlite,
vips,
writeText,
}:
Expand Down Expand Up @@ -684,6 +685,36 @@ let
in
drv.override (workarounds.rustlerPrecompiled { } drv);

exqlite =
let
version = "0.40.0";
drv = buildMix {
inherit version;
name = "exqlite";
appConfigPath = ./config;

env.EXQLITE_USE_SYSTEM = "1";

buildInputs = [
sqlite
];

src = fetchHex {
inherit version;
pkg = "exqlite";
sha256 = "f83350f2d29a38be1fd38f39081dd36f41fc51bbacf0f4c2927d01308ae331d0";
};

beamDeps = [
cc_precompiler
db_connection
elixir_make
table
];
};
in
drv.override (workarounds.elixirMake { } drv);

fine =
let
version = "0.1.4";
Expand Down
1 change: 1 addition & 0 deletions fixtures/example/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ defmodule Example.MixProject do
{:ex_cldr_numbers, "~> 2.33"},
{:ex_keccak, "~> 0.7.6"},
{:explorer, "~> 0.12.0"},
{:exqlite, "~> 0.40"},
{:fun_with_flags, "~> 1.12.0"},
{:heroicons,
github: "tailwindlabs/heroicons",
Expand Down
1 change: 1 addition & 0 deletions fixtures/example/mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"ex_nar": {:hex, :ex_nar, "0.3.0", "3136d019241afc97a5da8e43613a56ac0ae30dad12df5d3bc66547e55e7453e0", [:mix], [], "hexpm", "cbb42d047764feac6c411efddcadc31866e9a998dd6e2bc1eb428cec1c49fdcd"},
"ex_secp256k1": {:hex, :ex_secp256k1, "0.7.6", "49ea3b07dbc55e2b339e2cd54c6fcb3434620e2de1dfbb4b4f41351384119579", [:mix], [{:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.8", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "b84c9c4d85b47410cd951222b4d2b644cdbff96f4f83bc5ac96ee15d850a113c"},
"explorer": {:hex, :explorer, "0.12.0", "d55c9884386c74bf9324a3d075603346185177d577276504f7d6579e5a8ea49a", [:mix], [{:adbc, "~> 0.12", [hex: :adbc, repo: "hexpm", optional: true]}, {:aws_signature, "~> 0.3", [hex: :aws_signature, repo: "hexpm", optional: false]}, {:decimal, "~> 3.1", [hex: :decimal, repo: "hexpm", optional: false]}, {:nx, "~> 0.4", [hex: :nx, repo: "hexpm", optional: true]}, {:rustler, "~> 0.38", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.7", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}, {:table, "~> 0.1.2", [hex: :table, repo: "hexpm", optional: false]}, {:table_rex, "~> 4.1", [hex: :table_rex, repo: "hexpm", optional: false]}], "hexpm", "3ebc3f84f6f9f829c31f107bc3c2cb484705163d9cb7c62ed2e0405913360595"},
"exqlite": {:hex, :exqlite, "0.40.0", "d63cb394a588ecbe73f19c56fbbcf397bf6488b5872fcddc9383fb375cf6131d", [:make, :mix], [{:cc_precompiler, "~> 0.1", [hex: :cc_precompiler, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.8", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "f83350f2d29a38be1fd38f39081dd36f41fc51bbacf0f4c2927d01308ae331d0"},
"finch": {:hex, :finch, "0.19.0", "c644641491ea854fc5c1bbaef36bfc764e3f08e7185e1f084e35e0672241b76d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc5324ce209125d1e2fa0fcd2634601c52a787aff1cd33ee833664a5af4ea2b6"},
"fine": {:hex, :fine, "0.1.4", "b19a89c1476c7c57afb5f9314aed5960b5bc95d5277de4cb5ee8e1d1616ce379", [:mix], [], "hexpm", "be3324cc454a42d80951cf6023b9954e9ff27c6daa255483b3e8d608670303f5"},
"fsm": {:hex, :fsm, "0.3.1", "087aa9b02779a84320dc7a2d8464452b5308e29877921b2bde81cdba32a12390", [:mix], [], "hexpm", "fbf0d53f89e9082b326b0b5828b94b4c549ff9d1452bbfd00b4d1ac082208e96"},
Expand Down
1 change: 1 addition & 0 deletions lib/deps_nix.ex
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ defmodule DepsNix do
rustlerPrecompiledOverrides ? { },
stdenv,
pkg-config,
sqlite,
vips,
writeText,
}:
Expand Down
22 changes: 22 additions & 0 deletions lib/deps_nix/derivation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,28 @@ defmodule DepsNix.Derivation do
"""
end

def to_string(%DepsNix.Derivation{name: :exqlite} = drv) do
"""
exqlite =
let
version = "#{drv.version}";
drv = #{drv.builder} {
inherit version;
name = "#{drv.name}";#{format_app_config_path(drv)}

env.EXQLITE_USE_SYSTEM = "1";

buildInputs = [
sqlite
];

src = #{src(drv.src)}#{beam_deps(drv.beam_deps)}
};
in
drv#{override(drv)};
"""
end

def to_string(%DepsNix.Derivation{name: :lazy_html} = drv) do
"""
lazy_html =
Expand Down
47 changes: 47 additions & 0 deletions test/deps_nix/special_treatment_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,53 @@ defmodule DepsNix.SpecialTreatmentTest do
"""
end

test "exqlite builds against sqlite from nixpkgs" do
assert %Derivation{
builder: "buildMix",
name: :exqlite,
version: "0.33.0",
src: %FetchHex{
pkg: :exqlite,
version: "0.33.0",
sha256: "9acde72b27bdfeadeb51f790f7a6cc0d06cf555718c05cf57e43c5cf93d8471b"
},
beam_deps: [
:cc_precompiler,
:elixir_make
],
app_config_path: "./config"
}
|> to_string() == """
exqlite =
let
version = "0.33.0";
drv = buildMix {
inherit version;
name = "exqlite";
appConfigPath = ./config;

env.EXQLITE_USE_SYSTEM = "1";

buildInputs = [
sqlite
];

src = fetchHex {
inherit version;
pkg = "exqlite";
sha256 = "9acde72b27bdfeadeb51f790f7a6cc0d06cf555718c05cf57e43c5cf93d8471b";
};

beamDeps = [
cc_precompiler
elixir_make
];
};
in
drv.override (workarounds.elixirMake { } drv);
"""
end

test "rustler_precompiled dependencies get automatically overridden" do
assert %Derivation{
builder: "buildMix",
Expand Down
Loading