Skip to content

Er1ckR1ck0/app2nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

app2nix

app2nix demo

Rust Nix

app2nix is a smart CLI tool that automates the packaging of Debian (.deb) applications for Nix/NixOS.

Unlike simple converters that only read the control file, app2nix unpacks the package, scans binaries for ELF dependencies (using patchelf), and maps required shared libraries (.so) to their Nixpkgs counterparts.

🚀 Features

  • 🕵️ Binary Analysis: Unpacks the .deb and scans executables to find actual runtime dependencies (e.g., libdrm.so.2, libgbm.so.1), preventing "library not found" errors.
  • 🪄 Auto-Escalation: Automatically checks for required tools (patchelf, nix-locate). If missing, it uses Nix to provide them—no manual setup required!
  • 🧠 Smart Resolution: Uses a hybrid approach:
    • Internal Map: Instantly identifies common libraries (GTK, X11, GLib, Alsa) for speed.
    • Nix-Index: Queries the Nix file database for obscure or version-specific libraries.
  • ⚡ Ready-to-Use Output: Generates a default.nix that uses autoPatchelfHook and makeWrapper for immediate usage without writing boilerplate.

📦 Usage (Flakes)

You don't need to clone the repository or compile anything manually. You can run app2nix directly using Nix Flakes.

Run directly (Recommended)

Pass the URL or local path to your .deb file after the -- separator:

nix run github:Er1ckR1ck0/app2nix -- https://example.com/software.deb

Install to profile

If you plan to use it frequently, add it to your profile:

nix profile install github:Er1ckR1ck0/app2nix

Build the Result

Once app2nix generates the default.nix file in your current directory:

# Build and install into user environment
nix-env -if default.nix

# Or just build the derivation
nix-build default.nix

⚠️ Known Limitations

80/20 Rule: This tool aims to automate 80-90% of the work. Complex applications (especially Electron or Qt apps with hardcoded paths) might still require manual tweaking of the generated default.nix.

🗺️ Roadmap

  • Flake Support: Simplify usage with nix run.
  • Optimize default.nix template: Ensure output uses modern hooks like autoPatchelfHook.
  • Automate PR creation: Add support for creating Pull Requests to nixpkgs automatically.
  • Advanced Heuristics: Improve detection for "dirty" packages (Electron, Qt, proprietary blobs).
  • RPM Support: Add support for .rpm packages.

About

app2nix simplifies running and building .deb application on NixOS. Autobuild .deb to default.nix config for running on your system

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors