aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/x509-info/flake.lock84
-rw-r--r--src/x509-info/flake.nix60
2 files changed, 114 insertions, 30 deletions
diff --git a/src/x509-info/flake.lock b/src/x509-info/flake.lock
index c3ece1f..67d9a74 100644
--- a/src/x509-info/flake.lock
+++ b/src/x509-info/flake.lock
@@ -1,7 +1,61 @@
{
"nodes": {
+ "crane": {
+ "inputs": {
+ "flake-compat": "flake-compat",
+ "flake-utils": "flake-utils",
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "rust-overlay": "rust-overlay"
+ },
+ "locked": {
+ "lastModified": 1667522439,
+ "narHash": "sha256-1tDYoumL5337T4BkC87iRXbAfeyeeOXa5WAbeP/ENqQ=",
+ "owner": "ipetkov",
+ "repo": "crane",
+ "rev": "b70e77d2e2d480a3a0bce3ecd2d981679588b23f",
+ "type": "github"
+ },
+ "original": {
+ "owner": "ipetkov",
+ "repo": "crane",
+ "type": "github"
+ }
+ },
+ "flake-compat": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1650374568,
+ "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "rev": "b4a34015c698c7793d592d66adbab377907a2be8",
+ "type": "github"
+ },
+ "original": {
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "type": "github"
+ }
+ },
"flake-utils": {
"locked": {
+ "lastModified": 1667395993,
+ "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "flake-utils_2": {
+ "locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
@@ -55,15 +109,41 @@
},
"root": {
"inputs": {
- "flake-utils": "flake-utils",
+ "crane": "crane",
+ "flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks",
- "rust-overlay": "rust-overlay"
+ "rust-overlay": "rust-overlay_2"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": [
+ "crane",
+ "flake-utils"
+ ],
+ "nixpkgs": [
+ "crane",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1667487142,
+ "narHash": "sha256-bVuzLs1ZVggJAbJmEDVO9G6p8BH3HRaolK70KXvnWnU=",
+ "owner": "oxalica",
+ "repo": "rust-overlay",
+ "rev": "cf668f737ac986c0a89e83b6b2e3c5ddbd8cf33b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "oxalica",
+ "repo": "rust-overlay",
+ "type": "github"
+ }
+ },
+ "rust-overlay_2": {
+ "inputs": {
+ "flake-utils": [
"flake-utils"
],
"nixpkgs": [
diff --git a/src/x509-info/flake.nix b/src/x509-info/flake.nix
index 6061f08..c0e0eeb 100644
--- a/src/x509-info/flake.nix
+++ b/src/x509-info/flake.nix
@@ -11,6 +11,10 @@
nixpkgs.follows = "nixpkgs";
};
};
+ crane = {
+ url = "github:ipetkov/crane";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs = {
@@ -25,43 +29,45 @@
, flake-utils
, nixpkgs
, rust-overlay
+ , crane
, pre-commit-hooks
}:
- let
- # Borrow project metadata from the Rust config
- meta = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package;
- inherit (meta) name version;
- overlays = [
- # Rust helpers
- (import rust-overlay)
- # Build Rust toolchain using helpers from rust-overlay
- (self: super: {
- # This supplies cargo, rustc, rustfmt, etc.
- rustToolchain = super.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
- })
- ];
- in
flake-utils.lib.eachDefaultSystem
(system:
let
- pkgs = import nixpkgs { inherit overlays system; };
+ pkgs = import nixpkgs {
+ inherit system;
+ overlays = [ (import rust-overlay) ];
+ };
+ rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
+
+ craneLib = (crane.mkLib pkgs).overrideScope' (_: _: {
+ cargo = rust-toolchain;
+ clippy = rust-toolchain;
+ rustc = rust-toolchain;
+ rustfmt = rust-toolchain;
+ });
+
+ src = ./.;
+
+ cargoArtifacts = craneLib.buildDepsOnly {
+ inherit src;
+ };
+
+ x509-info = craneLib.buildPackage {
+ inherit cargoArtifacts src;
+ };
in
{
- packages = rec {
- default = x509-info;
- x509-info = pkgs.rustPlatform.buildRustPackage {
- pname = name;
- inherit version;
- src = ./.;
- release = true;
- cargoLock.lockFile = ./Cargo.lock;
- };
+ packages.default = x509-info;
+ apps.default = flake-utils.lib.mkApp {
+ drv = x509-info;
};
checks = {
pre-commit = pre-commit-hooks.lib.${system}.run {
- src = ./.;
+ inherit src;
hooks = {
clippy = {
enable = true;
@@ -80,10 +86,8 @@
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
- rustToolchain
- cargo-audit
+ rust-toolchain
cargo-deny
- rust-analyzer
];
inherit (self.checks.${system}.pre-commit) shellHook;