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
- Host: GitHub
- URL: https://github.com/srid/monorepo-nix-template
- Owner: srid
- License: mit
- Created: 2022-05-11T19:39:17.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-25T14:48:31.000Z (about 4 years ago)
- Last Synced: 2025-03-18T15:48:40.085Z (over 1 year ago)
- Language: Nix
- Size: 24.4 KB
- Stars: 18
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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