diff --git a/flake.lock b/flake.lock index 104072b..aa00ac1 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1724479785, @@ -16,8 +34,21 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1733096140, + "narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" + } + }, "root": { "inputs": { + "flake-parts": "flake-parts", "nixpkgs": "nixpkgs", "rust-overlay": "rust-overlay" } diff --git a/flake.nix b/flake.nix index b58f7a2..a29cebe 100644 --- a/flake.nix +++ b/flake.nix @@ -3,37 +3,36 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + flake-parts = { + url = "github:hercules-ci/flake-parts"; + inputs.nixpkgs.follows = "nixpkgs"; + }; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { nixpkgs, rust-overlay, ... }: - let - # System types to support. - supportedSystems = [ + outputs = inputs@{ nixpkgs, rust-overlay, flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" "aarch64-darwin" ]; - forAllSystems = function: nixpkgs.lib.genAttrs supportedSystems - (system: function (import nixpkgs { + perSystem = { system, pkgs, ... }: { + _module.args.pkgs = (import nixpkgs { inherit system; overlays = [ rust-overlay.overlays.default ]; - })); - in - { - devShells = forAllSystems - (pkgs: { - default = import ./shell.nix { - inherit pkgs; - additionalBuildInputs = [ - (pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override { - extensions = [ "rust-src" "rust-analyzer" ]; - })) - ]; - }; }); + devShells.default = import ./shell.nix { + inherit pkgs; + additionalBuildInputs = [ + (pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override { + extensions = [ "rust-src" "rust-analyzer" ]; + })) + ]; + }; + }; }; }