iced-template: replace crane

This commit is contained in:
electria 2026-08-03 12:18:59 -07:00
commit 0095d05e80
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs
2 changed files with 12 additions and 40 deletions

16
flake.lock generated
View file

@ -1,20 +1,5 @@
{ {
"nodes": { "nodes": {
"crane": {
"locked": {
"lastModified": 1785782307,
"narHash": "sha256-MPaRdVkf6zZP5fCPxYCi8Dr4pZzgmXzg8T9nVEbp3Mw=",
"owner": "ipetkov",
"repo": "crane",
"rev": "2c71e194474d13de031d729b729c968ddbe3507f",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@ -51,7 +36,6 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"crane": "crane",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }

View file

@ -2,8 +2,6 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
@ -14,7 +12,6 @@
let let
pkgs = import inputs.nixpkgs { inherit system; }; pkgs = import inputs.nixpkgs { inherit system; };
lib = pkgs.lib; lib = pkgs.lib;
craneLib = inputs.crane.mkLib pkgs;
cargoToml = fromTOML (builtins.readFile ./Cargo.toml); cargoToml = fromTOML (builtins.readFile ./Cargo.toml);
name = cargoToml.package.name; name = cargoToml.package.name;
@ -47,12 +44,6 @@
src = ./.; src = ./.;
}; };
# Build *just* the cargo dependencies,
# to reuse them for build and test derivations.
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
# Build the actual crate itself,
# reusing the dependency artifacts from above.
crate = crate =
let let
desktopItem = pkgs.makeDesktopItem { desktopItem = pkgs.makeDesktopItem {
@ -62,10 +53,11 @@
exec = name; exec = name;
}; };
in in
craneLib.buildPackage ( pkgs.rustPlatform.buildRustPackage (
commonArgs commonArgs
// { // {
inherit cargoArtifacts; inherit name;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = commonArgs.nativeBuildInputs ++ [ nativeBuildInputs = commonArgs.nativeBuildInputs ++ [
pkgs.autoPatchelfHook pkgs.autoPatchelfHook
@ -89,22 +81,18 @@
{ {
packages.default = crate; packages.default = crate;
checks = { devShells.default = pkgs.mkShell {
crate-clippy = craneLib.cargoClippy (
commonArgs
// {
inherit cargoArtifacts;
cargoClippyExtraArgs = "-- --deny warnings";
}
);
};
devShells.default = craneLib.devShell {
LD_LIBRARY_PATH = lib.makeLibraryPath dlDeps; LD_LIBRARY_PATH = lib.makeLibraryPath dlDeps;
inputsFrom = [ crate ]; inputsFrom = [ crate ];
packages = [ pkgs.rust-analyzer ];
packages = with pkgs; [
rustc
cargo
clippy
rustfmt
rust-analyzer
];
}; };
} }
); );