Giter VIP home page Giter VIP logo

bazel-nix-flakes's Introduction

Fully hermetic bazel build with nix, without /nix/store Test status

An experiment in fully hermetic, but also self-installing nix based hermetic bazel build.

The build rules at https://github.com/tweag/rules_nixpkgs allow bazel to bring in dependencies from nixpkgs. But, it requires having a /nix/store on your machine, which in turn means you need to have a pre-existing system-wide nix installation.

This repository goes one step further: bazel will instantiate a bazel-specific nix store and pull in the appropriate dependencies from nixpkgs. This means that you will not need to install nix in order to use the packages from nixpkgs.

This example repo adds the dir //tools to an existing rules_nixpkgs example, which makes a stand-alone and ephemeral nix installation in your bazel cache, and prepares all dependencies for compilation. It then builds a hello world app.

  1. install bazelisk, name it bazel
  2. try: bazel run :hello

The actual reusable set of bazel local nix rules is at: https://github.com/filmil/bazel_local_nix.


Original README.md below. From https://github.com/tweag/rules_nixpkgs/tree/master/examples/flakes


bazel-nix-flakes-example

The example is generating a local nixpkgs repository using the flakes.lock file already present on flakes projects.

Requirements

The nix package manager should be installed with flakes support enabled.

Running the example

The local nixpkgs repository can be used by explicitly specifying the generated toolchain.

``bash nix-shell --run "bazel run --crosstool_top=@nixpkgs_config_cc//:toolchain :hello"

bazel-nix-flakes's People

Contributors

filmil avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

bazel-nix-flakes's Issues

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.