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, pkgs,
rust,
self,
}: }:
pkgs.rustPlatform.buildRustPackage { craneLib.buildPackage {
pname = "errornowatcher"; pname = "errornowatcher";
version = self.shortRev or self.dirtyShortRev; version = "0.2.0";
cargoLock.lockFile = ./Cargo.lock; src = craneLib.cleanCargoSource ./.;
src = lib.cleanSource ./.;
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
rust clang
mold mold
pkg-config pkg-config
]; ];
Generated
+49 -15
View File
@@ -1,5 +1,41 @@
{ {
"nodes": { "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": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
@@ -51,28 +87,26 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"crane": "crane",
"fenix": "fenix",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs"
"rust-overlay": "rust-overlay"
} }
}, },
"rust-overlay": { "rust-analyzer-src": {
"inputs": { "flake": false,
"nixpkgs": [
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1778296574, "lastModified": 1778246258,
"narHash": "sha256-DVmg1JCjG0VJTa+FF6tH6tkQChaxzK1EzPL98RiRWU0=", "narHash": "sha256-RUZuOfzouSaK/VjcOCU/P5Nb3EhpM8qGnIcHWIIo4Sw=",
"owner": "oxalica", "owner": "rust-lang",
"repo": "rust-overlay", "repo": "rust-analyzer",
"rev": "1d634a90dffb59ec9ba52652de311b15528c1595", "rev": "73ca1d4ef136e2367627d698f00db94882b49440",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "oxalica", "owner": "rust-lang",
"repo": "rust-overlay", "ref": "nightly",
"repo": "rust-analyzer",
"type": "github" "type": "github"
} }
} }
+11 -20
View File
@@ -1,21 +1,22 @@
{ {
inputs = { inputs = {
crane.url = "github:ipetkov/crane";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs =
{ {
crane,
fenix,
flake-parts, flake-parts,
nixpkgs,
rust-overlay,
self,
... ...
}@inputs: }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
@@ -32,19 +33,9 @@
... ...
}: }:
let let
rust = pkgs.rust-bin.nightly.latest.default.override { craneLib = (crane.mkLib pkgs).overrideToolchain fenix.packages.${system}.complete.toolchain;
extensions = [
"rust-src"
"rust-analyzer-preview"
];
};
in in
{ {
_module.args.pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
};
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
name = "errornowatcher"; name = "errornowatcher";
@@ -58,7 +49,7 @@
packages = rec { packages = rec {
default = errornowatcher; default = errornowatcher;
errornowatcher = pkgs.callPackage ./. { inherit rust self; }; errornowatcher = pkgs.callPackage ./. { inherit craneLib; };
}; };
}; };
}; };