treefmt/flake.nix
zimbatm 2b88168c0a
flake: expose the list of supported systems
This is a new convention that lets consumers of the flake control what
systems this flake will be built with.

As a consumer you can pass your own list of systems, by overriding the
inputs. Eg:

```
inputs.systems.url = "path:./flake.systems.nix";
inputs.systems.flake = false;
inputs.treefmt.url = "github:numtide/treefmt";
inputs.treefmt.inputs.follows.systems = "systems";
```

Invented with the help of bb010g in https://github.com/numtide/flake-utils/pull/84

See <https://github.com/nix-systems/nix-systems>
2023-04-09 12:09:16 +02:00

44 lines
1.3 KiB
Nix

{
description = "treefmt";
# To update all inputs:
# $ nix flake update --recreate-lock-file
inputs.systems.url = "github:nix-systems/default";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
inputs.flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
inputs.rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
inputs.mkdocs-numtide.url = "github:numtide/mkdocs-numtide";
inputs.mkdocs-numtide.inputs.nixpkgs.follows = "nixpkgs";
outputs = { self, nixpkgs, flake-parts, mkdocs-numtide, systems, ... }@inputs:
flake-parts.lib.mkFlake { inherit self; } {
systems = import systems;
perSystem = { system, pkgs, ... }:
let
packages = import ./. {
inherit system;
mkdocs-numtide = mkdocs-numtide.packages.${system}.default;
};
in
{
# This contains a mix of packages, modules, ...
legacyPackages = packages;
# Allow `nix run github:numtide/treefmt`.
packages.default = packages.treefmt;
packages.docs = mkdocs-numtide.lib.${system}.mkDocs {
name = "treefmt-docs";
src = ./.;
};
devShells.default = packages.devShell;
};
};
}