From 5b1b10eb702021043d38dc160b9183f59a1c2296 Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 6 Sep 2024 23:54:46 +0200 Subject: [PATCH] flake.nix: replace naersk with buildRustPackage --- flake.lock | 22 ---------------------- flake.nix | 26 ++++++++++---------------- 2 files changed, 10 insertions(+), 38 deletions(-) diff --git a/flake.lock b/flake.lock index 06ddaea..93773ba 100644 --- a/flake.lock +++ b/flake.lock @@ -1,26 +1,5 @@ { "nodes": { - "naersk": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1713520724, - "narHash": "sha256-CO8MmVDmqZX2FovL75pu5BvwhW+Vugc7Q6ze7Hj8heI=", - "owner": "nix-community", - "repo": "naersk", - "rev": "c5037590290c6c7dae2e42e7da1e247e54ed2d49", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "master", - "repo": "naersk", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1714656196, @@ -39,7 +18,6 @@ }, "root": { "inputs": { - "naersk": "naersk", "nixpkgs": "nixpkgs", "utils": "utils" } diff --git a/flake.nix b/flake.nix index 5ab4f41..cf997eb 100644 --- a/flake.nix +++ b/flake.nix @@ -2,27 +2,21 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; utils.url = "github:numtide/flake-utils"; - naersk = { - url = "github:nix-community/naersk/master"; - inputs.nixpkgs.follows = "nixpkgs"; - }; }; - outputs = { self, nixpkgs, utils, naersk }: + outputs = { self, nixpkgs, utils }: let inherit (nixpkgs) lib; deadnixLambda = pkgs: - let - naersk-lib = pkgs.callPackage naersk { }; - in - naersk-lib.buildPackage { + pkgs.rustPlatform.buildRustPackage { pname = "deadnix"; - root = ./.; - checkInputs = [ pkgs.rustPackages.clippy ]; + version = self.sourceInfo.lastModifiedDate; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + nativeCheckInputs = [ pkgs.clippy ]; doCheck = true; - cargoTestCommands = x: - x ++ [ - ''cargo clippy --all --all-features --tests -- \ + postCheck = '' + cargo clippy --all --all-features --tests -- \ -D clippy::pedantic \ -D warnings \ -A clippy::module-name-repetitions \ @@ -31,8 +25,8 @@ -A clippy::cast-possible-truncation \ -A clippy::nonminimal_bool \ -A clippy::must-use-candidate \ - -A clippy::missing-panics-doc || true'' - ]; + -A clippy::missing-panics-doc + ''; meta.description = "Scan Nix files for dead code"; }; in