crane.lib.<system> attribute missing in flake outputs for revision
dfd9a8dfd09db9aad544c4d3b6c47b12562544a5` (and latest) in specific Nix environment
#843
-
Describe the bug** The Steps To Reproduce
nix-repl> craneFlake = builtins.getFlake "github:ipetkov/crane/dfd9a8dfd09db9aad544c4d3b6c47b12562544a5"
nix-repl> craneFlake.lib
error: attribute 'lib' missing
at «string»:1:1:
1| craneFlake.lib
| ^
nix-repl> craneFlake.lib.x86_64-linux
error: attribute 'lib' missing
at «string»:1:1:
1| craneFlake.lib.x86_64-linux
| ^ This demonstrates that the flake object for this revision, as fetched and evaluated by Expected behavior Screenshots or Error Logs**
My {
description = "Minimal Flake to demonstrate crane.lib issue";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
crane.url = "github:ipetkov/crane"; # Lock file pins this to dfd9a8d...
};
outputs = { self, nixpkgs, rust-overlay, crane, ... }@inputs:
let
supportedSystems = [ "x86_64-linux" ];
mkSystemOutputs = system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
craneLibForSystem = crane.lib.${system};
craneLib = craneLibForSystem.overrideToolchain rustToolchain;
dummyPackage = craneLib.buildPackage {
pname = "dummy";
version = "0.1.0";
src = craneLib.path ./.;
cargoExtraArgs = "--bin dummy_bin";
};
in {
packages = {
default = dummyPackage;
};
};
perSystemOutputs = nixpkgs.lib.genAttrs supportedSystems mkSystemOutputs;
in {
packages = nixpkgs.lib.mapAttrs (sn: so: so.packages) perSystemOutputs;
};
} (To make the above flake runnable for reproduction, a minimal My {
"nodes": {
"crane": {
"locked": {
"lastModified": 1746291859,
"narHash": "sha256-DdWJLA+D5tcmrRSg5Y7tp/qWaD05ATI4Z7h22gd1h7Q=",
"owner": "ipetkov",
"repo": "crane",
"rev": "dfd9a8dfd09db9aad544c4d3b6c47b12562544a5",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
}
// ... other inputs from my project's flake.lock ...
},
"root": "root",
"version": 7
} Environment
Additional context
Could there be an issue with how this specific revision Thank you for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @evanlhatch thanks for the report and the detailed reproduction! The Take a look at the most recent version of any of the examples to get started. Hope this helps! |
Beta Was this translation helpful? Give feedback.
Hi @evanlhatch thanks for the report and the detailed reproduction!
The
lib
output was deprecated in #617 and subsequently removed in #692, so you'll need to change your configuration to use themkLib
output now. If you don't need to customize thenixpkgs
instantiation you can usecraneLib = inputs.crane.mkLib nixpkgs.legacyPackages.${system};
(or if you do need to customize thenixpkgs
instantiation usecraneLib = inputs.crane.mkLib pkgs;
).Take a look at the most recent version of any of the examples to get started. Hope this helps!