• Stars
    star
    703
  • Rank 64,412 (Top 2 %)
  • Language
    Nix
  • License
    MIT License
  • Created about 3 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

❄️ Simplify Nix Flakes with the module system

Flake Parts

Core of a distributed framework for writing Nix Flakes.

flake-parts provides the options that represent standard flake attributes and establishes a way of working with system. Opinionated features are provided by an ecosystem of modules that you can import.

flake-parts itself has the goal to be a minimal mirror of the Nix flake schema. Used by itself, it is very lightweight.


Documentation: flake.parts


Why Modules?

Flakes are configuration. The module system lets you refactor configuration into modules that can be shared.

It reduces the proliferation of custom Nix glue code, similar to what the module system has done for NixOS configurations.

Unlike NixOS, but following Flakes' spirit, flake-parts is not a monorepo with the implied goal of absorbing all of open source, but rather a single module that other repositories can build upon, while ensuring a baseline level of compatibility: the core attributes that constitute a flake.

Features

  • Split your flake.nix into focused units, each in their own file.

  • Take care of system.

  • Allow users of your library flake to easily integrate your generated flake outputs into their flake.

  • Reuse project logic written by others

Getting Started

If your project does not have a flake yet:

nix flake init -t github:hercules-ci/flake-parts

Migrate

Otherwise, add the input,

    flake-parts.url = "github:hercules-ci/flake-parts";

then slide mkFlake between your outputs function head and body,

  outputs = inputs@{ flake-parts, ... }:
    flake-parts.lib.mkFlake { inherit inputs; } {
      flake = {
        # Put your original flake attributes here.
      };
      systems = [
        # systems for which you want to build the `perSystem` attributes
        "x86_64-linux"
        # ...
      ];
    };

Now you can add the remaining module attributes like in the the template.

Templates

See the template.

Examples

See the examples/ directory.

Projects using flake-parts

Options Reference

See flake.parts options

More Repositories

1

arion

Run docker-compose with help from Nix/NixOS
Nix
613
star
2

gitignore.nix

Nix functions for filtering local git sources
Nix
243
star
3

legacy-old-hercules

Abandoned
Haskell
168
star
4

hercules-ci-agent

https://hercules-ci.com build and deployment agent
Haskell
97
star
5

canonix

Experiment in Nix formatting
Nix
21
star
6

warp-systemd

Socket activation and other systemd integration for the Warp web server (WAI)
Haskell
20
star
7

hercules-ci-effects

Expressions to change the world (just a tiny bit)
Nix
16
star
8

project.nix

A configuration manager for your projects
Nix
13
star
9

flake.parts-website

Deployment of the https://flake.parts website
Nix
9
star
10

hage

A simple, modern and secure file encryption tool, format, and library, based on https://github.com/FiloSottile/age
Haskell
7
star
11

flake-compat-ci

Stop-gap for traversing flakes with nix-build and Hercules CI
Nix
5
star
12

support

User feedback, questions and our public roadmap. [email protected]
5
star
13

nixops2-flake

Example continuous deployment with NixOps 2 and a Nix Flake
Nix
3
star
14

nixops-example

Nix
3
star
15

gh-pages-example

An example of deploying to GitHub pages with hercules-ci-effects
Nix
3
star
16

nixops-hercules-ci

Use Hercules CI as a NixOps backend
Python
2
star
17

docs.hercules-ci.com

https://docs.hercules-ci.com
Handlebars
2
star
18

haskell-language-server.nix

Nix wrapper providing builds of https://github.com/haskell/ide
Nix
2
star
19

haskell-releaser

Automation of Haskell package release process.
Haskell
2
star
20

terraform-hercules-ci

Terraform modules for Hercules CI
Nix
1
star
21

agent-in-arion

Experimental module to run hercules-ci-agent in podman via arion
Nix
1
star
22

hercules-ci-enterprise

Binaries for Hercules CI Enterprise
Nix
1
star
23

devshell-example

Nix
1
star
24

elm-hercules-extras

Convenience functions not found in core elm packages
Elm
1
star
25

miniherc

A GitHub Action that runs Hercules CI jobs. Good enough for some use cases.
1
star
26

nix-ci-minimal-repo

Nix
1
star