Switch crane input to FlakeHub

This commit is contained in:
Luc Perkins 2025-03-24 20:25:46 -03:00
parent 7ed9fc9cbb
commit a774f04dfb
No known key found for this signature in database
GPG key ID: C86EE5D85EE4DDA5
3 changed files with 16 additions and 23 deletions

View file

@ -18,6 +18,3 @@ jobs:
pr-labels: | pr-labels: |
dependencies dependencies
automated automated
inputs: |
nixpkgs
nix

View file

@ -2,17 +2,16 @@
"nodes": { "nodes": {
"crane": { "crane": {
"locked": { "locked": {
"lastModified": 1742394900, "lastModified": 1741479724,
"narHash": "sha256-vVOAp9ahvnU+fQoKd4SEXB2JG2wbENkpqcwlkIXgUC0=", "narHash": "sha256-fnyETBKSVRa5abjOiRG/IAzKZq5yX8U6oRrHstPl4VM=",
"owner": "ipetkov", "rev": "60202a2e3597a3d91f5e791aab03f45470a738b5",
"repo": "crane", "revCount": 709,
"rev": "70947c1908108c0c551ddfd73d4f750ff2ea67cd", "type": "tarball",
"type": "github" "url": "https://api.flakehub.com/f/pinned/ipetkov/crane/0.20.2/0195784b-915b-7d2d-915d-ab02d1112ef9/source.tar.gz"
}, },
"original": { "original": {
"owner": "ipetkov", "type": "tarball",
"repo": "crane", "url": "https://flakehub.com/f/ipetkov/crane/%2A"
"type": "github"
} }
}, },
"flake-compat": { "flake-compat": {

View file

@ -4,14 +4,12 @@
inputs = { inputs = {
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
# Pinned to `master` until a release containing crane.url = "https://flakehub.com/f/ipetkov/crane/*";
# <https://github.com/ipetkov/crane/pull/792> is cut.
crane.url = "github:ipetkov/crane";
nix.url = "https://flakehub.com/f/NixOS/nix/2"; nix.url = "https://flakehub.com/f/NixOS/nix/2";
}; };
outputs = { self, nixpkgs, crane, ... }@inputs: outputs = inputs:
let let
supportedSystems = [ supportedSystems = [
"aarch64-linux" "aarch64-linux"
@ -20,14 +18,13 @@
"x86_64-darwin" "x86_64-darwin"
]; ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f rec { forEachSupportedSystem = f: inputs.nixpkgs.lib.genAttrs supportedSystems (system: f rec {
pkgs = import nixpkgs { pkgs = import inputs.nixpkgs {
inherit system; inherit system;
overlays = [ overlays = [
self.overlays.default inputs.self.overlays.default
]; ];
}; };
inherit (pkgs) lib;
inherit system; inherit system;
}); });
in in
@ -35,14 +32,14 @@
overlays.default = final: prev: overlays.default = final: prev:
let let
craneLib = crane.mkLib final; craneLib = inputs.crane.mkLib final;
crateName = craneLib.crateNameFromCargoToml { crateName = craneLib.crateNameFromCargoToml {
cargoToml = ./magic-nix-cache/Cargo.toml; cargoToml = ./magic-nix-cache/Cargo.toml;
}; };
commonArgs = { commonArgs = {
inherit (crateName) pname version; inherit (crateName) pname version;
src = self; src = inputs.self;
nativeBuildInputs = with final; [ nativeBuildInputs = with final; [
pkg-config pkg-config
@ -97,7 +94,7 @@
createChain 200 startFile; createChain 200 startFile;
}); });
devShells = forEachSupportedSystem ({ system, pkgs, lib }: { devShells = forEachSupportedSystem ({ system, pkgs }: {
default = pkgs.mkShell { default = pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [
rustc rustc