From 309ac175c32d38c4be7fe581efc20f24280d25ec Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Sat, 26 Aug 2023 17:44:04 -0400 Subject: [PATCH] Switch to using crane --- flake.lock | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++--- flake.nix | 17 ++++++++++--- 2 files changed, 84 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index 60bed44..858eedf 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,46 @@ { "nodes": { + "crane": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ], + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1692750383, + "narHash": "sha256-n5P5HOXuu23UB1h9PuayldnRRVQuXJLpoO+xqtMO3ws=", + "owner": "ipetkov", + "repo": "crane", + "rev": "ef5d11e3c2e5b3924eb0309dba2e1fea2d9062ae", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "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" @@ -20,25 +61,52 @@ }, "nixpkgs": { "locked": { - "lastModified": 1693029596, - "narHash": "sha256-jFSmUmXjxBMNYAC+oC3ZfgeNveGd0cjPdu6SXvzSexE=", + "lastModified": 1693028636, + "narHash": "sha256-WOG42JO/yyvgYK3jQktDEy2qtZI7R+s3Lo4Y9gBr6XM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "203f0a1f3a41e67f2161aa50acff2a76f32a3f91", + "rev": "e61ea96d43505ba0d2c066134eb9d67cadfddce7", "type": "github" }, "original": { "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { + "crane": "crane", "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "crane", + "flake-utils" + ], + "nixpkgs": [ + "crane", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1691374719, + "narHash": "sha256-HCodqnx1Mi2vN4f3hjRPc7+lSQy18vRn8xWW68GeQOg=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "b520a3889b24aaf909e287d19d406862ced9ffc9", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, diff --git a/flake.nix b/flake.nix index 0377c65..dc6cf7b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,25 +1,34 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; + + crane.url = "github:ipetkov/crane"; + crane.inputs = { + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + }; }; - outputs = inputs@{ self, nixpkgs, flake-utils, ... }: + outputs = { self, nixpkgs, crane, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; + craneLib = crane.lib.${system}; in { - packages.ggelo = pkgs.rustPlatform.buildRustPackage { + packages.ggelo = craneLib.buildPackage { pname = "ggelo"; version = "0.1.0"; src = ./.; cargoBuildFlags = "-p cli"; - cargoLock.lockFile = ./Cargo.lock; nativeBuildInputs = [ pkgs.pkg-config ]; PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; + + doCheck = true; }; packages.default = self.packages.${system}.ggelo; + checks.default = self.packages.${system}.ggelo; devShells.default = pkgs.mkShell { inputsFrom = [ self.packages.${system}.ggelo ];