I never really have a reason to package software, as I’m not a developer of any sort, but I did find this application that I’d like to try using that needs a package. It’s a pretty simple imgui C app, but I can’t seem to get it to build. Here’s the GitHub repo for the application:
Again, I don’t know a lot about this stuff, so I’m probably doing something wrong! Getting the following error upon build:
this derivation will be built:
/nix/store/nw6gis4irldsqcyi1agphpnyrks1kl77-mixid-0.1.6.drv
building '/nix/store/nw6gis4irldsqcyi1agphpnyrks1kl77-mixid-0.1.6.drv'...
Running phase: unpackPhase
unpacking source archive /nix/store/qi3yj6gl50f62myc9718m0mx46ckvmss-source
source root is source
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/kllgpjfpzhdd5lybk9p4pqmf413iks8q-mixid-0.1.6/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/kllgpjfpzhdd5lybk9p4pqmf413iks8q-mixid-0.1.6/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/kllgpjfpzhdd5lybk9p4pqmf413iks8q-mixid-0.1.6/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/kllgpjfpzhdd5lybk9p4pqmf413iks8q-mixid-0.1.6/share/doc/mixid -DCMAKE_INSTALL_INFODIR=/nix/store/kllgpjfpzhdd5lybk9p4pqmf413iks8q-mixid-0.1.6/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/kllgpjfpzhdd5lybk9p4pqmf413iks8q-mixid-0.1.6/share/man -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/kllgpjfpzhdd5lybk9p4pqmf413iks8q-mixid-0.1.6/include -DCMAKE_INSTALL_SBINDIR=/nix/store/kllgpjfpzhdd5lybk9p4pqmf413iks8q-mixid-0.1.6/sbin -DCMAKE_INSTALL_BINDIR=/nix/store/kllgpjfpzhdd5lybk9p4pqmf413iks8q-mixid-0.1.6/bin -DCMAKE_INSTALL_NAME_DIR=/nix/store/kllgpjfpzhdd5lybk9p4pqmf413iks8q-mixid-0.1.6/lib -DCMAKE_STRIP=/nix/store/kbw2j1vag664b3sj3rjwz9v53cqx87sb-gcc-wrapper-15.2.0/bin/strip -DCMAKE_RANLIB=/nix/store/kbw2j1vag664b3sj3rjwz9v53cqx87sb-gcc-wrapper-15.2.0/bin/ranlib -DCMAKE_AR=/nix/store/kbw2j1vag664b3sj3rjwz9v53cqx87sb-gcc-wrapper-15.2.0/bin/ar -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/nix/store/kllgpjfpzhdd5lybk9p4pqmf413iks8q-mixid-0.1.6
-- The CXX compiler identification is GNU 15.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /nix/store/kbw2j1vag664b3sj3rjwz9v53cqx87sb-gcc-wrapper-15.2.0/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /nix/store/1nv3i8mpypy3d516f4pd95m0w72r73jy-pkg-config-wrapper-0.29.2/bin/pkg-config (found version "0.29.2")
CMake Error at build/CMakeFiles/fc-stamp/imgui_external/download-imgui_external.cmake:163 (message):
Each download failed!
error: downloading 'https://github.com/ocornut/imgui/archive/refs/tags/v1.92.4.tar.gz' failed
status_code: 6
status_string: "Could not resolve hostname"
log:
--- LOG BEGIN ---
Could not resolve host: github.com
Store negative name resolve for github.com:443
shutting down connection #0
--- LOG END ---
error: downloading 'https://github.com/ocornut/imgui/archive/refs/tags/v1.92.4.tar.gz' failed
status_code: 6
status_string: "Could not resolve hostname"
log:
--- LOG BEGIN ---
Could not resolve host: github.com
Store negative name resolve for github.com:443
shutting down connection #0
--- LOG END ---
error: downloading 'https://github.com/ocornut/imgui/archive/refs/tags/v1.92.4.tar.gz' failed
status_code: 6
status_string: "Could not resolve hostname"
log:
--- LOG BEGIN ---
Could not resolve host: github.com
Store negative name resolve for github.com:443
shutting down connection #0
--- LOG END ---
error: downloading 'https://github.com/ocornut/imgui/archive/refs/tags/v1.92.4.tar.gz' failed
status_code: 6
status_string: "Could not resolve hostname"
log:
--- LOG BEGIN ---
Could not resolve host: github.com
Store negative name resolve for github.com:443
shutting down connection #0
--- LOG END ---
error: downloading 'https://github.com/ocornut/imgui/archive/refs/tags/v1.92.4.tar.gz' failed
status_code: 6
status_string: "Could not resolve hostname"
log:
--- LOG BEGIN ---
Could not resolve host: github.com
Store negative name resolve for github.com:443
shutting down connection #0
--- LOG END ---
error: downloading 'https://github.com/ocornut/imgui/archive/refs/tags/v1.92.4.tar.gz' failed
status_code: 6
status_string: "Could not resolve hostname"
log:
--- LOG BEGIN ---
Could not resolve host: github.com
Store negative name resolve for github.com:443
shutting down connection #0
--- LOG END ---
Call Stack (most recent call first):
build/CMakeFiles/fc-tmp/imgui_external/download.cmake:7 (include)
/nix/store/1m0z4ixir10fg7ba7g131js04bxgv265-cmake-4.1.2/share/cmake-4.1/Modules/FetchContent.cmake:1753 (include)
/nix/store/1m0z4ixir10fg7ba7g131js04bxgv265-cmake-4.1.2/share/cmake-4.1/Modules/FetchContent.cmake:1706 (__FetchContent_doStepDirect)
/nix/store/1m0z4ixir10fg7ba7g131js04bxgv265-cmake-4.1.2/share/cmake-4.1/Modules/FetchContent.cmake:1607 (__FetchContent_populateDirect)
/nix/store/1m0z4ixir10fg7ba7g131js04bxgv265-cmake-4.1.2/share/cmake-4.1/Modules/FetchContent.cmake:2145:EVAL:2 (__FetchContent_doPopulation)
/nix/store/1m0z4ixir10fg7ba7g131js04bxgv265-cmake-4.1.2/share/cmake-4.1/Modules/FetchContent.cmake:2145 (cmake_language)
/nix/store/1m0z4ixir10fg7ba7g131js04bxgv265-cmake-4.1.2/share/cmake-4.1/Modules/FetchContent.cmake:2384 (__FetchContent_Populate)
CMakeLists.txt:15 (FetchContent_MakeAvailable)
-- Configuring incomplete, errors occurred!
error: Cannot build '/nix/store/nw6gis4irldsqcyi1agphpnyrks1kl77-mixid-0.1.6.drv'.
Reason: builder failed with exit code 1.
Output paths:
/nix/store/kllgpjfpzhdd5lybk9p4pqmf413iks8q-mixid-0.1.6
Last 25 log lines:
> log:
> --- LOG BEGIN ---
> Could not resolve host: github.com
>
> Store negative name resolve for github.com:443
>
> shutting down connection #0
>
>
>
> --- LOG END ---
>
>
> Call Stack (most recent call first):
> build/CMakeFiles/fc-tmp/imgui_external/download.cmake:7 (include)
> /nix/store/1m0z4ixir10fg7ba7g131js04bxgv265-cmake-4.1.2/share/cmake-4.1/Modules/FetchContent.cmake:1753 (include)
> /nix/store/1m0z4ixir10fg7ba7g131js04bxgv265-cmake-4.1.2/share/cmake-4.1/Modules/FetchContent.cmake:1706 (__FetchContent_doStepDirect)
> /nix/store/1m0z4ixir10fg7ba7g131js04bxgv265-cmake-4.1.2/share/cmake-4.1/Modules/FetchContent.cmake:1607 (__FetchContent_populateDirect)
> /nix/store/1m0z4ixir10fg7ba7g131js04bxgv265-cmake-4.1.2/share/cmake-4.1/Modules/FetchContent.cmake:2145:EVAL:2 (__FetchContent_doPopulation)
> /nix/store/1m0z4ixir10fg7ba7g131js04bxgv265-cmake-4.1.2/share/cmake-4.1/Modules/FetchContent.cmake:2145 (cmake_language)
> /nix/store/1m0z4ixir10fg7ba7g131js04bxgv265-cmake-4.1.2/share/cmake-4.1/Modules/FetchContent.cmake:2384 (__FetchContent_Populate)
> CMakeLists.txt:15 (FetchContent_MakeAvailable)
>
>
> -- Configuring incomplete, errors occurred!
For full logs, run:
nix log /nix/store/nw6gis4irldsqcyi1agphpnyrks1kl77-mixid-0.1.6.drv
Any help would be greatly appreciated! As best I can tell, it looks like it’s getting hung up trying to download the imgui tarball specified in the source, but I can’t really tell why. My browser downloads it just fine when I paste the exact URL.
The part of the upstream repository that this happens in is here.
Nixpkgs includes its own copy of imgui, so the build should[1] be configured to use it instead of fetching it as part of the make process.
An exception to using nixpkgs version is if the upstream uses a different version and the project being packaged is not compatible with the nixpkgs version. ↩︎
Excellent! Thank you so much for your help, this gives me a great direction to go in.
Seems like since it’s just imgui and a relatively recent version at that, I’m going to investigate patching the CMake list file such that I can provide the dependency in my derivation. Polygon’s work with Nix-Buildproxy is very impressive, but hopefully I won’t need that!
Usually I’m a teach-you-to-fish sort of person, but this was right in the sweet spot of ‘small enough to do while I wait for other things to compile’ but ‘fiddly enough that giving tips for all the little things to tweak would take considerably longer’, so here you go.
Well I’m not really sure how to begin to thank you because I feel like you’ve just simultaneously saved me like a week of fumbling my way through this but also taught me a lot at the same time. Thanks so much!
I hate to be the guy to come back with more basic questions after all the help I’ve received here, but does anyone have any pointers or best practices on actually getting this thing into my NixOS config? I don’t think it makes a whole lot of sense to do a PR on nixpkgs for it, but I’m struggling with some errors when I try to install from my local repo. I’ve tried several ways of doing this, and this seems to be the closest I’ve gotten (this is a NixOS module I made using my standard module template, I have roles.desktop.addons.audient turned on in my host config file):
{
config,
pkgs,
inputs,
lib,
...
}:
with lib;
let
cfg = config.roles.desktop.addons.audient;
in {
options.roles.desktop.addons.audient = {
enable = mkEnableOption "Enable control app for Audient iD audio interfaces";
};
config = mkIf cfg.enable {
environment.systemPackages = [ import ./mixid/result/bin/MixiD ];
};
}
When I try to rebuild my system using either nh or nixos-rebuild, I get this error:
Building NixOS configuration
error:
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:37:12:
36|
37| strict = derivationStrict drvAttrs;
| ^
38|
… while evaluating derivation 'nixos-system-ghost-26.05.20260208.d6c7193'
whose name attribute is located at /nix/store/gnf2ayqhb31qvgh1s9mg3aqaj9378cg7-source/pkgs/stdenv/generic/make-derivation.nix:536:13
… while evaluating attribute 'buildCommand' of derivation 'nixos-system-ghost-26.05.20260208.d6c7193'
at /nix/store/gnf2ayqhb31qvgh1s9mg3aqaj9378cg7-source/nixos/modules/system/activation/top-level.nix:64:7:
63| passAsFile = [ "extraDependencies" ];
64| buildCommand = systemBuilder;
| ^
65|
… while evaluating the option `environment.etc.dbus-1.source':
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: A definition for option `environment.systemPackages."[definition 4-entry 1]"' is not of type `package'. Definition values:
- In `/nix/store/k86smd6f5lg2y6ljl5pg56dz56kbhbwk-source/modules/core/desktop/addons/audient.nix': <function>
┏━ 1 Errors:
┃ error:
┃ … while calling the 'derivationStrict' builtin
┃ at <nix/derivation-internal.nix>:37:12:
┃ 36|
┃ 37| strict = derivationStrict drvAttrs;
┃ | ^
┃ 38|
┃
┃ … while evaluating derivation 'nixos-system-ghost-26.05.20260208.d6c7193'
┃ whose name attribute is located at /nix/store/gnf2ayqhb31qvgh1s9mg3aqaj9378cg7-source/pkgs/stdenv/generic/make-derivation.nix:536:13
┃
┃ … while evaluating attribute 'buildCommand' of derivation 'nixos-system-ghost-26.05.20260208.d6c7193'
┃ at /nix/store/gnf2ayqhb31qvgh1s9mg3aqaj9378cg7-source/nixos/modules/system/activation/top-level.nix:64:7:
┃ 63| passAsFile = [ "extraDependencies" ];
┃ 64| buildCommand = systemBuilder;
┃ | ^
┃ 65|
┃
┃ … while evaluating the option `environment.etc.dbus-1.source':
┃
┃ (stack trace truncated; use '--show-trace' to show the full, detailed trace)
┃
┃ error: A definition for option `environment.systemPackages."[definition 4-entry 1]"' is not of type `package'. Definition values:
┃ - In `/nix/store/k86smd6f5lg2y6ljl5pg56dz56kbhbwk-source/modules/core/desktop/addons/audient.nix': <function>
┣━━━
┗━ ∑ ⚠ Exited with 1 errors reported by nix at 14:36:19 after 7s
Error:
0: Failed to build configuration
1: Command exited with status Exited(1)
And again, I can easily get the app to run with ./result/bin/MixiD, so I guess I could just stick it somewhere and do a hyprland keybind for that? Seems less than ideal, though.
The easiest, simplest and most straight-forward way to solve this is simply call the package instead of just importing. That is:
environment.systemPackages = [ (pkgs.callPackage ./mixid.nix {}) ];
# The parenthesis are syntatically important here, don’t forget them.
with ./mixid.nix being the file with contents shared by @rhendric and saved in the same dir as your configuration.nix (if using flake and git, remember to git add it).
This way you don’t have to deal with all the overlays headache.
Well it was a bit of an undertaking to get it sorted out, but now I have an overlay and a custom package installed on my machine. Thanks for your help!
Now my last question: does anyone know why rofi doesn’t seem to recognize MixiD as an application? I can run it just fine from a console command or from rofi as a command, but it doesn’t return anything when I try to search for it as an application.
Is this something in my derivation that I need to add, or would this more likely be something in my rofi config?
This probably because rofi searches for desktop entry files and can’t find one for MixID. This is part of the XDG spec and is stored in $XDG_CONFIG_HOME/applications/<program>.desktop or part of a derivation in $out/share/applications/<program>.desktop. The file for vim, for example, would be something like this:
It contains stuff such as what to execute, metadata, how to execute, the icon used in launchers, etc.
I’m not entirelly sure if just placing the desktop file in the derivation is enough for nixos but you can verify it’s there by looking at a result of nix build nixpkgs#vim. You can test it creating on your XDG_CONFIG_HOMEas I mentioned before.
I think you’re correct, but I’m still having trouble figuring out where to put this file. I don’t seem to have a ~/.config/applications directory at all, which is kind of weird. In any case, I’ve edited the installPhase of my derivation such that it includes the .desktop file, but I’m pretty sure I have the syntax wrong?
When I go to rebuild, it stops at the installPhase (obviously) and throws an error. Probably using the wrong function for where to put this thing, maybe the wrong phase entirely?
You could manually create the ~/.config/applications/ directory and the desktop file manually, if there isn’t one it just means that the desktop files from the other applications are being set up elsewhere (such as the /nix/store).
If you wan’t to make the desktop part of the derivation, the makeDesktopItemwould be the recommended way, as said by @magicquark. In you case, you are using install incorrectly with no source file and a string in the next line, one way to solve it would be:
Notice that we don’t have an icon for MixiD (there isn’t one in the repo) so we can’t configure one in the desktop file. Because of that, Rofi won’t show one for it, though it will show a name. You may try to use a generic one and it will have to be part of the derivation directory and be properly referenced or use fetchUrl for remote content (see here).