feat(flake): migrate to crane

This commit is contained in:
2026-05-09 14:09:25 -04:00
parent e902db8b2c
commit ee653392e3
3 changed files with 65 additions and 44 deletions
+5 -9
View File
@@ -1,19 +1,15 @@
{
lib,
craneLib,
pkgs,
rust,
self,
}:
pkgs.rustPlatform.buildRustPackage {
craneLib.buildPackage {
pname = "errornowatcher";
version = self.shortRev or self.dirtyShortRev;
version = "0.2.0";
cargoLock.lockFile = ./Cargo.lock;
src = lib.cleanSource ./.;
src = craneLib.cleanCargoSource ./.;
nativeBuildInputs = with pkgs; [
rust
clang
mold
pkg-config
];
Generated
+49 -15
View File
@@ -1,5 +1,41 @@
{
"nodes": {
"crane": {
"locked": {
"lastModified": 1778106249,
"narHash": "sha256-cM/AuKy5tMhwOOQIbha8ZRRMHVfNf7cv2aljIw+qoCg=",
"owner": "ipetkov",
"repo": "crane",
"rev": "6d015ea29630b7ad2402841386da2cb617a470a7",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1778314245,
"narHash": "sha256-a8p3JMunVzj0o86V9CNTyEFw7z4105QWl+bEz6Du8Jw=",
"owner": "nix-community",
"repo": "fenix",
"rev": "f54d645218048a7abe226983a922cdaca63cd845",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
@@ -51,28 +87,26 @@
},
"root": {
"inputs": {
"crane": "crane",
"fenix": "fenix",
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
"nixpkgs": "nixpkgs"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1778296574,
"narHash": "sha256-DVmg1JCjG0VJTa+FF6tH6tkQChaxzK1EzPL98RiRWU0=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "1d634a90dffb59ec9ba52652de311b15528c1595",
"lastModified": 1778246258,
"narHash": "sha256-RUZuOfzouSaK/VjcOCU/P5Nb3EhpM8qGnIcHWIIo4Sw=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "73ca1d4ef136e2367627d698f00db94882b49440",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
}
+11 -20
View File
@@ -1,21 +1,22 @@
{
inputs = {
crane.url = "github:ipetkov/crane";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
crane,
fenix,
flake-parts,
nixpkgs,
rust-overlay,
self,
...
}@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
@@ -32,19 +33,9 @@
...
}:
let
rust = pkgs.rust-bin.nightly.latest.default.override {
extensions = [
"rust-src"
"rust-analyzer-preview"
];
};
craneLib = (crane.mkLib pkgs).overrideToolchain fenix.packages.${system}.complete.toolchain;
in
{
_module.args.pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
};
devShells.default = pkgs.mkShell {
name = "errornowatcher";
@@ -58,7 +49,7 @@
packages = rec {
default = errornowatcher;
errornowatcher = pkgs.callPackage ./. { inherit rust self; };
errornowatcher = pkgs.callPackage ./. { inherit craneLib; };
};
};
};