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
24 changes: 15 additions & 9 deletions fixtures/example/deps.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
pkgs,
lib,
beamPackages,
cmake,
extend,
lexbor,
fetchFromGitHub,
overrides ? (x: y: { }),
overrideFenixOverlay ? null,
pkg-config,
vips,
writeText,
}:

let
Expand All @@ -12,7 +18,7 @@ let

workarounds = {
portCompiler = _unusedArgs: old: {
buildPlugins = [ pkgs.beamPackages.pc ];
buildPlugins = [ beamPackages.pc ];
};

rustlerPrecompiled =
Expand All @@ -22,7 +28,7 @@ let
}:
old:
let
extendedPkgs = pkgs.extend fenixOverlay;
extendedPkgs = extend fenixOverlay;
fenixOverlay =
if overrideFenixOverlay == null then
import "${
Expand Down Expand Up @@ -118,7 +124,7 @@ let
'';

preBuild = ''
install -Dm644 -t _build/c/third_party/lexbor/$LEXBOR_GIT_SHA/build ${pkgs.lexbor}/lib/liblexbor_static.a
install -Dm644 -t _build/c/third_party/lexbor/$LEXBOR_GIT_SHA/build ${lexbor}/lib/liblexbor_static.a
'';
};
};
Expand Down Expand Up @@ -210,7 +216,7 @@ let
name = "bandit";
appConfigPath = ./config;

src = pkgs.fetchFromGitHub {
src = fetchFromGitHub {
owner = "mtrudel";
repo = "bandit";
rev = "4f15f029e7aa17f8e7f98d55b0e94c684dee0971";
Expand Down Expand Up @@ -803,7 +809,7 @@ let
in
drv;

heroicons = pkgs.fetchFromGitHub {
heroicons = fetchFromGitHub {
owner = "tailwindlabs";
repo = "heroicons";
rev = "88ab3a0d790e6a47404cba02800a6b25d2afae50";
Expand Down Expand Up @@ -918,7 +924,7 @@ let
name = "lazy_html";
appConfigPath = ./config;

nativeBuildInputs = with pkgs; [
nativeBuildInputs = [
cmake
lexbor
];
Expand Down Expand Up @@ -1489,7 +1495,7 @@ let
};

patches = [
(pkgs.writeText "unicode-accessible-data-dir.patch" ''
(writeText "unicode-accessible-data-dir.patch" ''
diff --git a/lib/unicode.ex b/lib/unicode.ex
index 8224c3c..3c0bb3a 100644
--- a/lib/unicode.ex
Expand Down Expand Up @@ -1577,7 +1583,7 @@ let

VIX_COMPILATION_MODE = "PLATFORM_PROVIDED_LIBVIPS";

nativeBuildInputs = with pkgs; [
nativeBuildInputs = [
pkg-config
vips
];
Expand Down
15 changes: 2 additions & 13 deletions fixtures/example/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,14 @@
let
src = ./.;

erlang = pkgs.beam.interpreters.erlang_28;
beamUpstream = pkgs.beam.packagesWith erlang;
elixir = beamUpstream.elixir_1_19;

beamPackages = beamUpstream // rec {
inherit erlang elixir;
hex = beamUpstream.hex.override { inherit elixir; };
buildMix = beamUpstream.buildMix.override { inherit elixir erlang hex; };
};
beamPackages = pkgs.beamMinimal28Packages.extend (_: prev: { elixir = prev.elixir_1_19; });

mixNixDeps = pkgs.callPackages ./deps.nix {
beamPackages = beamPackages;
};
in
beamPackages.buildMix {
inherit
src
elixir
;
inherit src;

name = "example";
version = "0.1.0";
Expand Down
14 changes: 10 additions & 4 deletions lib/deps_nix.ex
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,17 @@ defmodule DepsNix do
output,
"""
{
pkgs,
lib,
beamPackages,
cmake,
extend,
lexbor,
fetchFromGitHub,
overrides ? (x: y: { }),
overrideFenixOverlay ? null,
pkg-config,
vips,
writeText,
}:

let
Expand All @@ -221,7 +227,7 @@ defmodule DepsNix do

workarounds = {
portCompiler = _unusedArgs: old: {
buildPlugins = [ pkgs.beamPackages.pc ];
buildPlugins = [ beamPackages.pc ];
};

rustlerPrecompiled =
Expand All @@ -231,7 +237,7 @@ defmodule DepsNix do
}:
old:
let
extendedPkgs = pkgs.extend fenixOverlay;
extendedPkgs = extend fenixOverlay;
fenixOverlay =
if overrideFenixOverlay == null then
import "${
Expand Down Expand Up @@ -331,7 +337,7 @@ defmodule DepsNix do
preBuild = ''
install -Dm644 \
-t _build/c/third_party/lexbor/$LEXBOR_GIT_SHA/build \
${pkgs.lexbor}/lib/liblexbor_static.a
${lexbor}/lib/liblexbor_static.a
'';
};
};
Expand Down
6 changes: 3 additions & 3 deletions lib/deps_nix/derivation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ defmodule DepsNix.Derivation do

VIX_COMPILATION_MODE = "PLATFORM_PROVIDED_LIBVIPS";

nativeBuildInputs = with pkgs; [
nativeBuildInputs = [
pkg-config
vips
];
Expand All @@ -183,7 +183,7 @@ defmodule DepsNix.Derivation do
inherit version;
name = "#{drv.name}";#{format_app_config_path(drv)}

nativeBuildInputs = with pkgs; [
nativeBuildInputs = [
cmake
lexbor
];
Expand Down Expand Up @@ -222,7 +222,7 @@ defmodule DepsNix.Derivation do


patches = [
(pkgs.writeText "unicode-accessible-data-dir.patch" ''
(writeText "unicode-accessible-data-dir.patch" ''
diff --git a/lib/unicode.ex b/lib/unicode.ex
index 8224c3c..3c0bb3a 100644
--- a/lib/unicode.ex
Expand Down
2 changes: 1 addition & 1 deletion lib/deps_nix/fetch_from_github.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defmodule DepsNix.FetchFromGitHub do
defimpl String.Chars do
def to_string(%DepsNix.FetchFromGitHub{} = g) do
"""
pkgs.fetchFromGitHub {
fetchFromGitHub {
owner = "#{g.owner}";
repo = "#{g.repo}";
rev = "#{g.rev}";
Expand Down
1 change: 1 addition & 0 deletions shells/local.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ mkShell {
};
in
[
beamPackages.hex
elixir_1_19
elixir-ls
gh
Expand Down
2 changes: 1 addition & 1 deletion test/deps_nix/derivation_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ defmodule DepsNix.DerivationTest do
app_config_path: "foo"
}
|> to_string() == """
heroicons = pkgs.fetchFromGitHub {
heroicons = fetchFromGitHub {
owner = "tailwindlabs";
repo = "heroicons";
rev = "88ab3a0d790e6a47404cba02800a6b25d2afae50";
Expand Down
2 changes: 1 addition & 1 deletion test/deps_nix/fetch_from_github_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule DepsNix.FetchFromGitHubTest do
}
|> to_string() ==
"""
pkgs.fetchFromGitHub {
fetchFromGitHub {
owner = "sstoltze";
repo = "tds";
rev = "somegithash";
Expand Down
6 changes: 3 additions & 3 deletions test/deps_nix/special_treatment_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule DepsNix.SpecialTreatmentTest do
};

patches = [
(pkgs.writeText "unicode-accessible-data-dir.patch" ''
(writeText "unicode-accessible-data-dir.patch" ''
diff --git a/lib/unicode.ex b/lib/unicode.ex
index 8224c3c..3c0bb3a 100644
--- a/lib/unicode.ex
Expand Down Expand Up @@ -144,7 +144,7 @@ defmodule DepsNix.SpecialTreatmentTest do

VIX_COMPILATION_MODE = "PLATFORM_PROVIDED_LIBVIPS";

nativeBuildInputs = with pkgs; [
nativeBuildInputs = [
pkg-config
vips
];
Expand Down Expand Up @@ -191,7 +191,7 @@ defmodule DepsNix.SpecialTreatmentTest do
name = "lazy_html";
appConfigPath = ./config;

nativeBuildInputs = with pkgs; [
nativeBuildInputs = [
cmake
lexbor
];
Expand Down
Loading