Getting Things

Flake-parts offers a couple of ways to access the same thing. This gives you freedom to pick the most convenient syntax for a use case.

This page is like a cheat sheet, for you to get a feel for what's what.

Get a locally defined package

Getting the locally defined hello package on/for an x86_64-linux host:

On the command line

nix build .#hello

In perSystem


The self' parameter is derived from the flake self, which may benefit from evaluation caching in the future.

The config parameter is conceptually simpler and lets you access all options inside perSystem, including unexposed ones if you're into defining such options.

In the top level


Anything you can do at the top level, you can do in perSystem as well, although you may have to @ match those module arguments.

For example, add change the top level function header to e.g. toplevel@{ config, ... }: /*...*/ so you can access toplevel.config despite plain config being shadowed by perSystem = { config, ... }: /*...*/.


(getSystem "x86_64-linux").packages.hello
withSystem "x86_64-linux" ({ config, ... }:

allSystems may not be future proof if Nix starts to allow building for all systems. An opened up system is incompatible with enumerated systems as required by an attribute set.