Switch flake to flake-utils

This commit is contained in:
Marcin Kulik
2025-10-13 15:08:03 +02:00
parent 16b96c09a9
commit c11dc3916d
3 changed files with 57 additions and 65 deletions

50
flake.lock generated
View File

@@ -1,20 +1,20 @@
{ {
"nodes": { "nodes": {
"flake-parts": { "flake-utils": {
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1749398372, "lastModified": 1731533236,
"narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=", "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "hercules-ci", "owner": "numtide",
"repo": "flake-parts", "repo": "flake-utils",
"rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569", "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "hercules-ci", "owner": "numtide",
"repo": "flake-parts", "repo": "flake-utils",
"type": "github" "type": "github"
} }
}, },
@@ -34,21 +34,6 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-lib": {
"locked": {
"lastModified": 1748740939,
"narHash": "sha256-rQaysilft1aVMwF14xIdGS3sj1yHlI6oKQNBRTF40cc=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "656a64127e9d791a334452c6b6606d17539476e2",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1744536153, "lastModified": 1744536153,
@@ -67,7 +52,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
} }
@@ -89,6 +74,21 @@
"repo": "rust-overlay", "repo": "rust-overlay",
"type": "github" "type": "github"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View File

@@ -4,48 +4,40 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay"; rust-overlay.url = "github:oxalica/rust-overlay";
flake-parts.url = "github:hercules-ci/flake-parts"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = outputs =
inputs@{ {
flake-parts, self,
nixpkgs,
rust-overlay, rust-overlay,
... flake-utils,
}: }:
flake-parts.lib.mkFlake { inherit inputs; } { flake-utils.lib.eachDefaultSystem (
systems = [ system:
"x86_64-linux" let
"aarch64-linux" pkgs = import nixpkgs {
"aarch64-darwin" inherit system;
"x86_64-darwin" overlays = [ (import rust-overlay) ];
];
perSystem =
{
self',
pkgs,
system,
...
}:
let
packageToml = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package;
in
{
formatter = pkgs.nixfmt-tree;
_module.args = {
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
};
devShells = pkgs.callPackages ./shell.nix { inherit pkgs packageToml self'; };
packages.default = pkgs.callPackage ./default.nix {
inherit packageToml;
rust = pkgs.rust-bin.stable.latest.minimal;
};
}; };
};
packageToml = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package;
defaultPackage = pkgs.callPackage ./default.nix {
inherit packageToml;
rust = pkgs.rust-bin.stable.latest.minimal;
};
in
{
formatter = pkgs.nixfmt-tree;
packages.default = defaultPackage;
devShells = pkgs.callPackages ./shell.nix {
inherit pkgs packageToml;
defaultPackage = defaultPackage;
};
}
);
} }

View File

@@ -1,5 +1,5 @@
{ {
self', defaultPackage,
pkgs, pkgs,
packageToml, packageToml,
rust-bin, rust-bin,
@@ -12,7 +12,7 @@ let
rust: rust:
mkShell { mkShell {
inputsFrom = [ inputsFrom = [
(self'.packages.default.override { (defaultPackage.override {
rust = rust.override { rust = rust.override {
extensions = [ extensions = [
"rust-src" "rust-src"