An open API service indexing awesome lists of open source software.

https://github.com/srid/monorepo-nix-template

Make monorepos with Nix flakes
https://github.com/srid/monorepo-nix-template

Last synced: about 1 year ago
JSON representation

Make monorepos with Nix flakes

Awesome Lists containing this project

README

          

# monorepo-nix-template

A simple demonstration of writing a top-level `flake.nix` that delegates to the inner `default.nix` (flake alike) of a sub-project. This pattern is useful in monorepos with many sub-projects written in different programming languages.

Files of interest:

- `flake.nix` -- top-level flake
- `haskell/project.nix` -- haskell flake-alike
- `rust/project.nix` -- rust flake-alike

Features

- Haskell app statically links to Rust library
- Works on Linux and macOS (M1)
- IDE experience works for both languages through HLS.
- Autoformat by treefmt

## Haskell

The Haskell programs links with the Rust library.

```
nix develop -c sh -c "cd ./haskell && cabal run"
```

## Rust

```
nix develop -c sh -c "cd ./rusty && cargo build"
```

## Nix

Run the full program,

```
nix run
```

Just build it,

```
nix build
```

## Alternative approaches

- https://github.com/hercules-ci/flake-parts