dream2nix
Simplified nix packaging for various programming language ecosystems [maintainer=@DavHau]
Top Related Projects
Nix Packages collection & NixOS
Pure Nix flake utility functions [maintainer=@zimbatm]
Quick Overview
Dream2nix is an automated Nix flake generation framework. It aims to simplify the process of packaging software for Nix by automatically generating Nix expressions from various project types and build systems. Dream2nix supports multiple programming languages and package managers, making it easier to integrate diverse projects into the Nix ecosystem.
Pros
- Automates the creation of Nix flakes for various project types
- Supports multiple programming languages and package managers
- Reduces the complexity of packaging software for Nix
- Improves reproducibility and consistency in Nix packaging
Cons
- May not handle all edge cases or complex project structures perfectly
- Requires some understanding of Nix concepts for optimal use
- Generated flakes might need manual tweaking for certain projects
- Documentation could be more comprehensive for newcomers
Getting Started
To use dream2nix, follow these steps:
- Ensure you have Nix installed with flakes enabled.
- Add dream2nix to your
flake.nix
:
{
inputs.dream2nix.url = "github:nix-community/dream2nix";
outputs = { self, nixpkgs, dream2nix }:
dream2nix.lib.makeFlakeOutputs {
systems = ["x86_64-linux" "aarch64-darwin"];
config.projectRoot = ./.;
source = ./.;
};
}
- Run
nix flake update
to fetch dream2nix. - Use
nix build
ornix develop
to build or enter a development shell for your project.
For more detailed instructions and configuration options, refer to the dream2nix documentation on GitHub.
Competitor Comparisons
Nix Packages collection & NixOS
Pros of nixpkgs
- Extensive package collection with a vast ecosystem
- Well-established and mature project with a large community
- Comprehensive documentation and extensive examples
Cons of nixpkgs
- Steep learning curve for newcomers
- Can be challenging to package certain types of projects
- Occasional inconsistencies in package definitions
Code Comparison
nixpkgs:
{ lib, stdenv, fetchFromGitHub }:
stdenv.mkDerivation rec {
pname = "example";
version = "1.0.0";
src = fetchFromGitHub { ... };
}
dream2nix:
{ dream2nix, ... }:
dream2nix.makeFlakeOutputs {
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = ./.;
}
Key Differences
- dream2nix aims to simplify the packaging process, especially for projects with complex dependencies
- nixpkgs provides a more traditional approach to packaging, requiring manual definition of dependencies and build steps
- dream2nix leverages existing package managers' metadata, while nixpkgs often requires manual specification of package information
Use Cases
- nixpkgs: Ideal for system-wide package management and creating reproducible environments
- dream2nix: Well-suited for quickly packaging projects with complex dependency structures, particularly useful for developers working on diverse codebases
Pure Nix flake utility functions [maintainer=@zimbatm]
Pros of flake-utils
- Lightweight and focused on providing utility functions for Nix flakes
- Simple to use and integrate into existing flake-based projects
- Offers a set of commonly used functions to reduce boilerplate code
Cons of flake-utils
- Limited in scope compared to dream2nix's broader package management capabilities
- Doesn't provide advanced features for converting various project types to Nix
Code Comparison
flake-utils:
{
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system: {
# System-specific outputs
});
}
dream2nix:
{
inputs.dream2nix.url = "github:nix-community/dream2nix";
outputs = { self, nixpkgs, dream2nix }:
dream2nix.lib.makeFlakeOutputs {
systems = ["x86_64-linux"];
config.projectRoot = ./.;
source = ./.;
};
}
Summary
flake-utils is a lightweight tool focused on simplifying common flake operations, while dream2nix offers a more comprehensive solution for converting various project types to Nix. flake-utils is easier to integrate into existing projects, but dream2nix provides more advanced features for package management and conversion.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Automate reproducible packaging for various language ecosystems
Documentation |
Example Repo |
Example Repo Flake |
Example Packages
!!! warning
dream2nix is unstable software. While simple UX is one of our main focus points, the APIs are still under development. Do expect changes that will break your setup.
legacy dream2nix
Dream2nix is currently in the process of being refactored to make use of drv-parts. Not all features and subsystems are migrated yet. If you prefer continue using the makeFlakeOutputs
interface, please refer to the legacy branch of dream2nix.
Funding
This project was funded through the NGI Assure Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 957073. Applications are still open, you can apply today.
If your organization wants to support the project with extra funding in order to add support for more languages or new features, please contact one of the maintainers.
Documentation
Presentations
- ð 2023: dream2nix based on drv-parts
- ð 2021: Original dream2nix presentation (Examples are outdated)
Get in touch
Contribute
Goals
dream2nix focuses on the following aspects:
- Modularity
- Customizability
- Maintainability
- Code de-duplication across 2nix solutions
- Common UI across 2nix solutions
- Reduce effort to develop new 2nix solutions
- Exploration and adoption of new nix features
- Simplified updating of packages
The goal of this project is to create a standardized, generic, modular framework for automated packaging solutions, aiming for better flexibility, maintainability and usability.
The intention is to integrate many existing 2nix converters into this framework, thereby improving many of the previously named aspects and providing a unified UX for all 2nix solutions.
Top Related Projects
Nix Packages collection & NixOS
Pure Nix flake utility functions [maintainer=@zimbatm]
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot