Giter Site home page Giter Site logo

nix-autobahn's Introduction

Under construction

  • still rather primitive, needs more work

Overview

You are running Nix/NixOS and have ever encountered the following problem?

> ./factorio
bash: ./factorio: No such file or directory

Fear not, now there is nix-autobahn which will help you running those binaries:

> nix-autobahn factorio
Pick provider for libX11.so.6: xlibs.libX11.out /lib/libX11.so.6
Pick provider for libXinerama.so.1: xlibs.libXinerama.out /lib/libXinerama.so.1
Pick provider for libpulse-simple.so.0: pulseaudioFull.out /lib/libpulse-simple.so.0

nix-autobahn looks through the output of ldd factorio for missing shared objects (*.so* files). For each missing one nix-index's nix-locate is used to determine provider candidates (read: packages that offer this shared object). If more than one candidate is found a nice™ TUI asks you to pick one. All of the chosen packages are baked into a FHS-compatible Sandbox that can be built through a nix expression inside of a shell script.

All that is left from now is to run it:

> ./run-with-nix
# ...
   0.010 Error SDLWindow.cpp:186: Failed to create an application window. SDL_Error: Failed loading libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
   0.010 Error Util.cpp:83: Failed to create an application window. SDL_Error: Failed loading libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
   1.316 Goodbye

Sadly, that didn't work so well. Fortunately we know why: We need a provider for libGL.so.1. Now we have two options: Either we pass -l libGL.so.1 to nix-autobahn to tell it to find a provider for that given shared object or we just know the missing package is libGL. In the latter case we can pass -p libGL to nix-autobahn to ensure that a provider for libGL ends up in the build expression:

> nix-autobahn factorio -p libGL
Pick provider for libX11.so.6: xlibs.libX11.out /lib/libX11.so.6
Pick provider for libXinerama.so.1: xlibs.libXinerama.out /lib/libXinerama.so.1
Pick provider for libpulse-simple.so.0: pulseaudioFull.out /lib/libpulse-simple.so.0
> ./run-with-nix

And we are good to go!

Usage

USAGE:
    nix-autobahn [OPTIONS] <BINARY>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -l, --additional-libs <libs>...        Additional libraries to search for and propagate
    -p, --additional-pkgs <packages>...    Additional packages to propagate

ARGS:
    <BINARY>    dynamically linked binary to be examined

Dependencies

  • nix-index. Ensure that both nix-index is installed and has a valid index. To rebuild the index simply run nix-index. For further information refer to nix-index's manual: nix-index --help. Rebuilding the index is not frequently needed, in fact we recommend doing so if you ran into problems or changed your channel (e.g. nixos-19.03 -> nixos-19.09).

nix-autobahn's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nix-autobahn's Issues

flake: latest commit fails to build

Thank you for nix-autobahn!

When using this flake with the most recent commit, building it sadly fails:

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/silgjxagpjh73yanyw3hvxkbrc90d39l-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
[naersk] cargo_version (read): 1.56.0
[naersk] cargo_message_format (set): json-diagnostic-rendered-ansi
[naersk] cargo_release: --release
[naersk] cargo_options:
[naersk] cargo_build_options: $cargo_release -j "$NIX_BUILD_CORES" --message-format=$cargo_message_format
[naersk] cargo_test_options: $cargo_release -j "$NIX_BUILD_CORES"
[naersk] RUST_TEST_THREADS: 8
[naersk] cargo_bins_jq_filter: select(.reason == "compiler-artifact" and .executable != null and .profile.test == false)
[naersk] cargo_build_output_json (created): /build/tmp.LKFHBXeUxk
[naersk] crate_sources: /nix/store/7ys74naparchgvjn07micpwa29d3axmh-crates-io
[naersk] RUSTFLAGS:
[naersk] CARGO_BUILD_RUSTFLAGS:
[naersk] CARGO_BUILD_RUSTFLAGS (updated): --remap-path-prefix /nix/store/7ys74naparchgvjn07micpwa29d3axmh-crates-io=/sources
[naersk] pre-installing dep /nix/store/bbx7x3sc0l63yjyj5n1fgahiqg3rvfs5-nix-autobahn-deps-0.1.0
@nix { "action": "setPhase", "phase": "buildPhase" }
building
cargo build $cargo_release -j "$NIX_BUILD_CORES" --message-format=$cargo_message_format
   Compiling nix-autobahn v0.1.0 (/build/source)
error: could not compile `nix-autobahn` due to 7 previous errors
error: cannot find derive macro `Parser` in this scope
  --> src/main.rs:99:10
   |
99 | #[derive(Parser)]
   |          ^^^^^^
   |
note: `Parser` is imported here, but it is only a trait, without a derive macro
  --> src/main.rs:9:5
   |
9  | use clap::Parser;
   |     ^^^^^^^^^^^^


error: cannot find attribute `clap` in this scope
   --> src/main.rs:100:3

Last commit that works here: 62317eb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.