From a1857d0221a9039aa2c039f6d7a769bb0769f1b2 Mon Sep 17 00:00:00 2001 From: Thomas Himmelstoss <9889638+tfkhim@users.noreply.github.com> Date: Sun, 29 Oct 2023 14:34:20 +0100 Subject: [PATCH] ci: use the development shell from crane A recent crane update [1] added a wrapper for pkgs.mkShell. Another pull request [2] also automatically adds rustfmt and clippy to the dev shell. This commit uses the new crane development shell to simplify the setup. Links: [1] https://github.com/ipetkov/crane/pull/378 [2] https://github.com/ipetkov/crane/pull/432 --- flake.lock | 85 +++--------------------------------------------------- flake.nix | 10 ++----- 2 files changed, 7 insertions(+), 88 deletions(-) diff --git a/flake.lock b/flake.lock index c73ae20..57eda94 100644 --- a/flake.lock +++ b/flake.lock @@ -2,19 +2,16 @@ "nodes": { "crane": { "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils", "nixpkgs": [ "nixpkgs" - ], - "rust-overlay": "rust-overlay" + ] }, "locked": { - "lastModified": 1693787605, - "narHash": "sha256-rwq5U8dy+a9JFny/73L0SJu1GfWwATMPMTp7D+mjHy8=", + "lastModified": 1698166613, + "narHash": "sha256-y4rdN4flxRiROqNi1waMYIZj/Fs7L2OrszFk/1ry9vU=", "owner": "ipetkov", "repo": "crane", - "rev": "8b4f7a4dab2120cf41e7957a28a853f45016bd9d", + "rev": "b7db46f0f1751f7b1d1911f6be7daf568ad5bc65", "type": "github" }, "original": { @@ -23,40 +20,6 @@ "type": "github" } }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1692799911, - "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1693844670, @@ -78,46 +41,6 @@ "crane": "crane", "nixpkgs": "nixpkgs" } - }, - "rust-overlay": { - "inputs": { - "flake-utils": [ - "crane", - "flake-utils" - ], - "nixpkgs": [ - "crane", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1693707092, - "narHash": "sha256-HR1EnynBSPqbt+04/yxxqsG1E3n6uXrOl7SPco/UnYo=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "98ccb73e6eefc481da6039ee57ad8818d1ca8d56", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index b0dae43..b7467bb 100644 --- a/flake.nix +++ b/flake.nix @@ -56,7 +56,7 @@ sway-workspace-extras = self.packages.${prev.system}.default; }; - devShells = forSupportedSystems ({ system, pkgs, ... }: + devShells = forSupportedSystems ({ system, pkgs, craneLib, ... }: let fix = pkgs.writeShellScriptBin "fix" '' cargo fmt @@ -72,14 +72,10 @@ ''; in { - default = pkgs.mkShell { + default = craneLib.devShell { inputsFrom = [ self.packages.${system}.package ]; - nativeBuildInputs = with pkgs; [ - cargo - rustc - clippy - rustfmt + packages = [ fix checkFmt lint