diff options
author | Thomas Mühlbacher <tmuehlbacher@posteo.net> | 2024-05-22 21:08:09 +0200 |
---|---|---|
committer | Thomas Mühlbacher <tmuehlbacher@posteo.net> | 2024-05-22 22:35:05 +0200 |
commit | cc16402e4f31a63ab415043da06f0445fe55765c (patch) | |
tree | 078600146ccf3987fbae3e4c2d18fbc498148eb1 /flake.nix | |
parent | 0fcdd67bf0fcd38a61a2eda647b9b7342b558ff2 (diff) |
build(nix): replace flake-utils with flake-parts
it also provides a way for abstracting `system` and provides optional
modules, like treefmt-nix.
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 57 |
1 files changed, 37 insertions, 20 deletions
@@ -4,7 +4,7 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - utils.url = "github:numtide/flake-utils"; + flake-parts.url = "github:hercules-ci/flake-parts"; flake-compat = { url = "github:edolstra/flake-compat"; @@ -13,24 +13,41 @@ }; outputs = - { nixpkgs, utils, ... }: - utils.lib.eachDefaultSystem ( - system: - let - pkgs = import nixpkgs { inherit system; }; - in - rec { - packages.default = packages.bcachefs-tools; - packages.bcachefs-tools = pkgs.callPackage ./build.nix { }; - packages.bcachefs-tools-fuse = packages.bcachefs-tools.override { fuseSupport = true; }; - - formatter = pkgs.nixfmt-rfc-style; - - devShells.default = pkgs.mkShell { - inputsFrom = [ packages.default ]; - - LIBCLANG_PATH = "${pkgs.clang.cc.lib}/lib"; + inputs@{ + self, + nixpkgs, + flake-parts, + flake-compat, + ... + }: + flake-parts.lib.mkFlake { inherit inputs; } { + # can be extended, but these have proper binary cache support in nixpkgs + # as of writing. + systems = [ + "aarch64-linux" + "x86_64-linux" + ]; + + perSystem = + { + self', + config, + pkgs, + ... + }: + { + packages.default = config.packages.bcachefs-tools; + packages.bcachefs-tools = pkgs.callPackage ./build.nix { }; + + packages.bcachefs-tools-fuse = config.packages.bcachefs-tools.override { fuseSupport = true; }; + + formatter = pkgs.nixfmt-rfc-style; + + devShells.default = pkgs.mkShell { + inputsFrom = [ config.packages.default ]; + + LIBCLANG_PATH = "${pkgs.clang.cc.lib}/lib"; + }; }; - } - ); + }; } |