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": {
"flake-parts": {
"flake-utils": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
"systems": "systems"
},
"locked": {
"lastModified": 1749398372,
"narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
@@ -34,21 +34,6 @@
"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": {
"locked": {
"lastModified": 1744536153,
@@ -67,7 +52,7 @@
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
@@ -89,6 +74,21 @@
"repo": "rust-overlay",
"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",

View File

@@ -4,48 +4,40 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
inputs@{
flake-parts,
{
self,
nixpkgs,
rust-overlay,
...
flake-utils,
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
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;
};
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
};
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,
packageToml,
rust-bin,
@@ -12,7 +12,7 @@ let
rust:
mkShell {
inputsFrom = [
(self'.packages.default.override {
(defaultPackage.override {
rust = rust.override {
extensions = [
"rust-src"