diff options
| author | Stefan Kreutz <mail@skreutz.com> | 2025-12-07 15:24:00 +0100 |
|---|---|---|
| committer | Stefan Kreutz <mail@skreutz.com> | 2025-12-07 15:24:00 +0100 |
| commit | e6c10729f834974be26f5a7ac0991d2f33c792c4 (patch) | |
| tree | 13dc28af61666785ae8e9dea99f9b37dc414e369 /flake.nix | |
| parent | 341ef2e7fac4ae33c046e82832a34b8e4aa98c48 (diff) | |
| download | brck-e6c10729f834974be26f5a7ac0991d2f33c792c4.tar | |
See also <https://ayats.org/blog/no-flake-utils>.
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 80 |
1 files changed, 53 insertions, 27 deletions
@@ -3,39 +3,65 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - flake-utils.url = "github:numtide/flake-utils"; + flake-parts.url = "github:hercules-ci/flake-parts"; naersk = { url = "github:nix-community/naersk"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, nixpkgs, flake-utils, naersk, ... }@inputs: - flake-utils.lib.eachDefaultSystem (system: - let - pkgs = import nixpkgs { - inherit system; - config = { }; - overlays = [ ]; - }; - naersk' = pkgs.callPackage naersk { }; - in rec { - # nix build - # nix run . -- --help - packages.default = packages.brck; + outputs = + inputs@{ + self, + nixpkgs, + flake-parts, + naersk, + ... + }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; - # nix build .#brck - # nix run .#brck -- --help - packages.brck = naersk'.buildPackage { - name = "brck"; - src = builtins.path { path = ./.; name = "brck"; }; - meta.mainProgram = "brck"; - }; + perSystem = + { pkgs, system, ... }: + let + naersk' = pkgs.callPackage naersk { }; + in + rec { + # nix build + # nix run . -- --help + packages.default = packages.brck; - # nix develop - devShells.default = pkgs.mkShell { - nativeBuildInputs = with pkgs; [ rustc cargo rustfmt clippy cargo-audit cargo-edit rust-analyzer ]; - }; - } - ); + # nix build .#brck + # nix run .#brck -- --help + packages.brck = naersk'.buildPackage { + name = "brck"; + src = builtins.path { + path = ./.; + name = "brck"; + }; + meta.mainProgram = "brck"; + }; + + # nix develop + devShells.default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + rustc + cargo + rustfmt + clippy + cargo-audit + cargo-edit + rust-analyzer + ]; + }; + + # nix fmt + formatter = pkgs.nixfmt-tree; + }; + }; } |