Gio

Gio

Hello

On a new project I did the following, but it wouldn’t compile without errors.
I also tried using the library locally, but had the same issue. {:hidraw, path: "../hidraw"}


First I added {:hidraw, "~> 0.2.2"} to the dependencies.

❯ mix deps.get

Resolving Hex dependencies…
Resolution completed in 0.134s
New:
hidraw 0.2.2
Unchanged:
bandit 1.10.3
cc_precompiler 0.1.11
db_connection 2.9.0
decimal 2.3.0
dns_cluster 0.2.0
ecto 3.13.5
ecto_sql 3.13.4
elixir_make 0.9.0
esbuild 0.10.0
expo 1.1.1
file_system 1.1.1
finch 0.21.0
fine 0.1.4
gettext 1.0.2
hpax 1.0.3
idna 6.1.1
jason 1.4.4
lazy_html 0.1.10
mime 2.0.7
mint 1.7.1
nimble_options 1.1.1
nimble_pool 1.1.0
phoenix 1.8.4
phoenix_ecto 4.7.0
phoenix_html 4.3.0
phoenix_live_dashboard 0.8.7
phoenix_live_reload 1.6.2
phoenix_live_view 1.1.24
phoenix_pubsub 2.2.0
phoenix_template 1.0.4
plug 1.19.1
plug_crypto 2.1.1
postgrex 0.22.0
req 0.5.17
swoosh 1.22.1
tailwind 0.4.1
telemetry 1.3.0
telemetry_metrics 1.1.0
telemetry_poller 1.3.0
thousand_island 1.4.3
unicode_util_compat 0.7.1
websock 0.5.3
websock_adapter 0.5.9

* Getting hidraw (Hex package)

❯ mix deps.compile
==> elixir_make
Compiling 8 files (.ex)
Generated elixir_make app
==> hidraw
Unchecked dependencies for environment prod:

* elixir_make (Hex package)
  the dependency build is outdated, please run “MIX_ENV=prod mix deps.compile”
  could not compile dependency :hidraw, “mix compile” failed. Errors may have been logged above. You can recompile this dependency with “mix deps.compile hidraw --force”, update it with “mix deps.update hidraw” or clean it with “mix deps.clean hidraw”
  ==> phoenix_hidraw_error
  \*\* (Mix) Can’t continue due to errors on dependencies

I could ‘temporarily fix’ it locally by running 2x mix deps.compile hidraw. But I’m looking for a solution which will let me use deps_nix without any issues.

   ❯ mix deps.compile hidraw
==> elixir_make
Compiling 8 files (.ex)
Generated elixir_make app
==> hidraw
Unchecked dependencies for environment prod:
* elixir_make (Hex package)
  could not find an app file at "/phoenix_hidraw_error/_build/dev/lib/elixir_make/ebin/elixir_make.app". This may happen if the dependency was not yet compiled or the dependency indeed has no app file (then you can pass app: false as option)
could not compile dependency :hidraw, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile hidraw --force", update it with "mix deps.update hidraw" or clean it with "mix deps.clean hidraw"
==> phoenix_hidraw_error
** (Mix) Can't continue due to errors on dependencies

❯ mix deps.compile hidraw
==> hidraw
mkdir -p /phoenix_hidraw_error/_build/dev/lib/hidraw/obj
mkdir -p /phoenix_hidraw_error/_build/dev/lib/hidraw/priv
gcc -c -I/nix/store/j106gi4wjl8kqr1yxgw35arb4jih4iw4-erlang-28.3.1/lib/erlang/usr/include -std=gnu99 -o /phoenix_hidraw_error/_build/dev/lib/hidraw/obj/erlcmd.o src/erlcmd.c
gcc -c -I/nix/store/j106gi4wjl8kqr1yxgw35arb4jih4iw4-erlang-28.3.1/lib/erlang/usr/include -std=gnu99 -o /phoenix_hidraw_error/_build/dev/lib/hidraw/obj/hidraw.o src/hidraw.c
gcc -c -I/nix/store/j106gi4wjl8kqr1yxgw35arb4jih4iw4-erlang-28.3.1/lib/erlang/usr/include -std=gnu99 -o /phoenix_hidraw_error/_build/dev/lib/hidraw/obj/hidraw_enum.o src/hidraw_enum.c
src/hidraw_enum.c: In function âfind_hidraw_devicesâ:
src/hidraw_enum.c:130:30: warning: â%sâ directive output may be truncated writing up to 255 bytes into a region of size 59 [-Wformat-truncation=]
  130 |                          "%s/%s", DEV, namelist[i]->d_name);
      |                              ^~
In file included from /nix/store/1k8f0lkj10gsbb1fh0idr1423l37yj69-glibc-2.40-218-dev/include/stdio.h:970,
                 from src/hidraw_enum.c:29:
In function âsnprintfâ,
    inlined from âfind_hidraw_devicesâ at src/hidraw_enum.c:129:3:
/nix/store/1k8f0lkj10gsbb1fh0idr1423l37yj69-glibc-2.40-218-dev/include/bits/stdio2.h:68:10: note: â__builtin___snprintf_chkâ output between 6 and 261 bytes into a destination of size 64
   68 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   69 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   70 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
gcc /phoenix_hidraw_error/_build/dev/lib/hidraw/obj/erlcmd.o /phoenix_hidraw_error/_build/dev/lib/hidraw/obj/hidraw.o /phoenix_hidraw_error/_build/dev/lib/hidraw/obj/hidraw_enum.o -L/nix/store/j106gi4wjl8kqr1yxgw35arb4jih4iw4-erlang-28.3.1/lib/erlang/usr/lib -lei  -o /phoenix_hidraw_error/_build/dev/lib/hidraw/priv/hidraw
echo "Not crosscompiling. To test locally, the port binary needs extra permissions."; echo "Set SUDO=sudo to set permissions. The default is to skip this step."; echo "SUDO_ASKPASS=/usr/bin/ssh-askpass"; echo "SUDO=true"; SUDO_ASKPASS=/usr/bin/ssh-askpass true -- sh -c 'chown root:root  /phoenix_hidraw_error/_build/dev/lib/hidraw/priv/hidraw; chmod +s  /phoenix_hidraw_error/_build/dev/lib/hidraw/priv/hidraw'
Not crosscompiling. To test locally, the port binary needs extra permissions.
Set SUDO=sudo to set permissions. The default is to skip this step.
SUDO_ASKPASS=/usr/bin/ssh-askpass
SUDO=true
Compiling 1 file (.ex)
    warning: using single-quoted strings to represent charlists is deprecated.
    Use ~c"" if you indeed want a charlist or use "" instead.
    You may run "mix format --migrate" to change all single-quoted
    strings to use the ~c sigil and fix this warning.
    │
  9 │     executable = :code.priv_dir(:hidraw) ++ '/hidraw'
    │                                             ~
    │
    └─ lib/hidraw.ex:9:45

    warning: using single-quoted strings to represent charlists is deprecated.
    Use ~c"" if you indeed want a charlist or use "" instead.
    You may run "mix format --migrate" to change all single-quoted
    strings to use the ~c sigil and fix this warning.
    │
 34 │     executable = :code.priv_dir(:hidraw) ++ '/hidraw'
    │                                             ~
    │
    └─ lib/hidraw.ex:34:45
❯ uname -a
Linux sl-p16 6.18.13 #1-NixOS SMP PREEMPT_DYNAMIC Thu Feb 19 15:31:37 UTC 2026 x86_64 GNU/Linux
Generated hidraw app


❯ elixir --version
Erlang/OTP 28 \[erts-16.2\] \[source\] \[64-bit\] \[smp:32:32\] \[ds:32:32:10\] \[async-threads:1\] \[jit:ns\]

Elixir 1.19.5 (compiled with Erlang/OTP 28)

❯ uname -a
Linux laptop 6.18.13 [#1](/nerves-web-kiosk/hidraw/issues/1)-NixOS SMP PREEMPT_DYNAMIC Thu Feb 19 15:31:37 UTC 2026 x86_64 GNU/Linux

Showing Posts 1 to 9

Gio

Gio OP

The following does run, But why? and How can this be solved.
I’d expect we can run compile once for all deps. Apparently the order isn’t right?

rm -rf _build deps
mix deps.get
mix deps.compile elixir_make
mix deps.compile
NobbZ

NobbZ

As nix is involved, it might help to give us a full reproducer.

I can not see anything obvious in the posted output, though I do not know anything about hidraw or how it gets used, to spin up an appropriate shell spontaniously.

Gio

Gio OP

NobbZ

NobbZ

Sorry, I can not reproduce your issue.

nix build fails with an error about daisy-UI, while entering the devshell fails with the following:

error:
       … while calling the 'derivationStrict' builtin
         at «nix-internal»/derivation-internal.nix:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       … while evaluating derivation 'devenv-shell'
         whose name attribute is located at «github:NixOS/nixpkgs/c217913993d6c6f6805c3b1a3bda5e639adfde6d?narHash=sha256-D1PA3xQv/s4W3lnR9yJFSld8UOLr0a/cBWMQMXS%2B1Qg%3D»/pkgs/stdenv/generic/make-derivation.nix:541:13

       … while evaluating attribute 'DEVENV_DOTFILE' of derivation 'devenv-shell'

       … while evaluating definitions from `/nix/store/0752bxc8by5dkayj70wzsjrnkd8l6a3i-source/src/modules/top-level.nix':

       … while evaluating the option `perSystem.x86_64-linux.devenv.shells.default.devenv.dotfile':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: string 'flake.nix
       priv
       mix.exs
       config
       assets
       VERSION
       flake.lock
       README.md
       nix
       AGENTS.md
       lib
       test
       mix.lock
       deps.nix
       /.devenv' doesn't represent an absolute path

As I am not using devenv myself, I have no interest in debugging this, and like to ask you to make the shell usable, such that I can reproduce your issue.

hauleth

hauleth

Have you used --impure flag?

NobbZ

NobbZ

No. I just allowed direnv and assumed it will be setup correctly.


Even with an abomination of a nix develop call, constructed based on your mention of --impure, the contents of the .envrc and the fact that I usually disable IFD, the error remains.

$ nix develop --impure --option allow-import-from-derivation true --override-input devenv-root file+file://$PWD
warning: Git tree '/home/nmelzer/tmp/phoenix_hidraw_error' is dirty
warning: not writing modified lock file of flake 'git+file:///home/nmelzer/tmp/phoenix_hidraw_error':
• Updated input 'devenv-root':
    'file:///dev/null?narHash=sha256-d6xi4mKdjkX2JFicDIv5niSzpyI0m/Hnm8GGAIU04kY%3D'
  → 'file:///home/nmelzer/tmp/phoenix_hidraw_error?narHash=sha256-2LAUW83UrJ9wgeybm478CtrcwpcKOBCoQ4MTCBtQKwM%3D'
error:
       … while calling the 'derivationStrict' builtin
         at «nix-internal»/derivation-internal.nix:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|
       … while evaluating derivation 'devenv-shell'
         whose name attribute is located at /nix/store/59c65vmrl55gcgqaam9pxrcvqkrgvd9g-source/pkgs/stdenv/generic/make-derivation.nix:541:13
       … while evaluating attribute 'DEVENV_DOTFILE' of derivation 'devenv-shell'
       … while evaluating definitions from `/nix/store/0752bxc8by5dkayj70wzsjrnkd8l6a3i-source/src/modules/top-level.nix':
       … while evaluating the option `perSystem.x86_64-linux.devenv.shells.default.devenv.dotfile':
       (stack trace truncated; use '--show-trace' to show the full, detailed trace)
       error: string 'flake.nix
       priv
       mix.exs
       config
       assets
       VERSION
       flake.lock
       README.md
       nix
       AGENTS.md
       lib
       test
       mix.lock
       deps.nix
       /.devenv' doesn't represent an absolute path
Gio

Gio OP

I’m sorry. I wrote a new minimal without devenv.
https://github.com/gytars/elixir_hidraw_error_nix

NobbZ

NobbZ

This is weird.

I can totally reproduce your issue, but I don’t have an explanation nor fix for this behaviour.

I am sorry.

Gio

Gio OP

Thank you.

My guess is, it’s unrelated to deps_nix / nix.


@linux_users
Could someone test the following on their elixir project?

# Add the following to your mix.exs
  defp deps do
    [
      #...
      {:hidraw, "~> 0.2.2"}
      #...
    ]
  end
# Run the following commands
mix deps.get
mix deps.compile

compile will probably fail on all Linux systems, if elixir_make hasn’t been compiled before.


I don’t have enough Elixir knowledge either. The cause could be at one of these three.

  • compiler: mix deps.compile , the order is wrong
  • elixir_make library
  • hidraw library
— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
water
I’m aware of 2 such projects, are there others? git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
itzmidinesh
Hi all, I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
leoschweizer
Hi, we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
csmr
Hi all, I’m new here and would like to hear peoples views on my Elixir/Phoenix based game-engine! :smiley: Mutonex gamedesign was finish...
New
Stef-Verniers
Hello I’ve been coding in Elixir for almost two years now because of my current job where we implemented Elixir in our application. But ...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews