From fef1cda009e1f9567982ddae62d48bba77a821c4 Mon Sep 17 00:00:00 2001 From: thesimplekid Date: Wed, 23 Jul 2025 22:16:42 +0100 Subject: [PATCH] refactor(flake): remove crane build system and simplify flake dependencies Remove crane and fenix dependencies along with their associated build infrastructure. This simplifies the flake to focus on development environments while removing package builds and applications. --- flake.lock | 24 +++++++------- flake.nix | 95 +++--------------------------------------------------- 2 files changed, 16 insertions(+), 103 deletions(-) diff --git a/flake.lock b/flake.lock index 6de88337..8589eaed 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "crane": { "locked": { - "lastModified": 1750266157, - "narHash": "sha256-tL42YoNg9y30u7zAqtoGDNdTyXTi8EALDeCB13FtbQA=", + "lastModified": 1753316655, + "narHash": "sha256-tzWa2kmTEN69OEMhxFy+J2oWSvZP5QhEgXp3TROOzl0=", "owner": "ipetkov", "repo": "crane", - "rev": "e37c943371b73ed87faf33f7583860f81f1d5a48", + "rev": "f35a3372d070c9e9ccb63ba7ce347f0634ddf3d2", "type": "github" }, "original": { @@ -23,11 +23,11 @@ "rust-analyzer-src": [] }, "locked": { - "lastModified": 1750833544, - "narHash": "sha256-e5W27mfPGiM35qr0DjTUzLHP4ET2MbvRc4HJHScw/ko=", + "lastModified": 1753511988, + "narHash": "sha256-wC9PR+rPjmcpnPdOIDwyNwQiRhNsuDs3oZY3t42f4uA=", "owner": "nix-community", "repo": "fenix", - "rev": "c3940d9ff4d37e965e5841149367234c2aad1ab6", + "rev": "25db7a6f4de7dea678620785e03fbc4560c00672", "type": "github" }, "original": { @@ -93,11 +93,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1750622754, - "narHash": "sha256-kMhs+YzV4vPGfuTpD3mwzibWUE6jotw5Al2wczI0Pv8=", + "lastModified": 1753345091, + "narHash": "sha256-CdX2Rtvp5I8HGu9swBmYuq+ILwRxpXdJwlpg8jvN4tU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c7ab75210cb8cb16ddd8f290755d9558edde7ee1", + "rev": "3ff0e34b1383648053bba8ed03f201d3466f90c9", "type": "github" }, "original": { @@ -160,11 +160,11 @@ ] }, "locked": { - "lastModified": 1750819193, - "narHash": "sha256-XvkupGPZqD54HuKhN/2WhbKjAHeTl1UEnWspzUzRFfA=", + "lastModified": 1753497720, + "narHash": "sha256-yzZkDMVfPpNyTciQOfriWpRXrgGNT/cvrFAEQZ//SZs=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "1ba3b9c59b68a4b00156827ad46393127b51b808", + "rev": "c8b8b812010515b7d9bd7e538f06a9f4edb373ff", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 20def631..5790c106 100644 --- a/flake.nix +++ b/flake.nix @@ -27,7 +27,7 @@ pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; }; - outputs = { self, nixpkgs, rust-overlay, flake-utils, pre-commit-hooks, crane, fenix, ... }: + outputs = { self, nixpkgs, rust-overlay, flake-utils, pre-commit-hooks, ... }: flake-utils.lib.eachDefaultSystem (system: let overlays = [ (import rust-overlay) ]; @@ -87,80 +87,9 @@ libz ] ++ libsDarwin; - # WASM deps - WASMInputs = with pkgs; [ - ]; - - - - craneLib = crane.mkLib pkgs; - src = craneLib.cleanCargoSource ./.; # Common arguments can be set here to avoid repeating them later - commonArgs = { - inherit src; - strictDeps = true; - - buildInputs = [ - # Add additional build inputs here - pkgs.protobuf - pkgs.pkg-config - ] ++ lib.optionals pkgs.stdenv.isDarwin [ - # Additional darwin specific inputs can be set here - pkgs.libiconv - ]; - - # Additional environment variables can be set directly - # MY_CUSTOM_VAR = "some value"; - PROTOC = "${pkgs.protobuf}/bin/protoc"; - PROTOC_INCLUDE = "${pkgs.protobuf}/include"; - }; - - - craneLibLLvmTools = craneLib.overrideToolchain - (fenix.packages.${system}.complete.withComponents [ - "cargo" - "llvm-tools" - "rustc" - ]); - - cargoArtifacts = craneLib.buildDepsOnly commonArgs; - - individualCrateArgs = commonArgs // { - inherit cargoArtifacts; - inherit (craneLib.crateNameFromCargoToml { inherit src; }) version; - # NB: we disable tests since we'll run them all via cargo-nextest - doCheck = false; - }; - - fileSetForCrate = crate: lib.fileset.toSource { - root = ./.; - fileset = lib.fileset.unions [ - ./Cargo.toml - ./Cargo.lock - (craneLib.fileset.commonCargoSources ./crates/cdk) - (craneLib.fileset.commonCargoSources ./crates/cdk-axum) - (craneLib.fileset.commonCargoSources ./crates/cdk-cln) - (craneLib.fileset.commonCargoSources ./crates/cdk-lnd) - (craneLib.fileset.commonCargoSources ./crates/cdk-fake-wallet) - (craneLib.fileset.commonCargoSources ./crates/cdk-lnbits) - (craneLib.fileset.commonCargoSources ./crates/cdk-redb) - (craneLib.fileset.commonCargoSources ./crates/cdk-sqlite) - ./crates/cdk-sqlite/src/mint/migrations - ./crates/cdk-sqlite/src/wallet/migrations - (craneLib.fileset.commonCargoSources crate) - ]; - }; - - cdk-mintd = craneLib.buildPackage (individualCrateArgs // { - pname = "cdk-mintd"; - name = "cdk-mintd-${individualCrateArgs.version}"; - cargoExtraArgs = "-p cdk-mintd"; - src = fileSetForCrate ./crates/cdk-mintd; - }); - - - nativeBuildInputs = with pkgs; [ + nativeBuildInputs = [ #Add additional build inputs here ] ++ lib.optionals isDarwin [ # Additional darwin specific native inputs can be set here @@ -201,22 +130,6 @@ }; }; - - packages = { - inherit cdk-mintd; - default = cdk-mintd; - } // lib.optionalAttrs (!pkgs.stdenv.isDarwin) { - my-workspace-llvm-coverage = craneLibLLvmTools.cargoLlvmCov (commonArgs // { - inherit cargoArtifacts; - }); - }; - - apps = { - cdk-mintd = flake-utils.lib.mkApp { - drv = cdk-mintd; - }; - }; - devShells = let # pre-commit-checks @@ -238,13 +151,13 @@ cargo update -p pest_meta --precise 2.8.0 cargo update -p pest --precise 2.8.0 "; - buildInputs = buildInputs ++ WASMInputs ++ [ msrv_toolchain ]; + buildInputs = buildInputs ++ [ msrv_toolchain ]; inherit nativeBuildInputs; } // envVars); stable = pkgs.mkShell ({ shellHook = ''${_shellHook}''; - buildInputs = buildInputs ++ WASMInputs ++ [ stable_toolchain ]; + buildInputs = buildInputs ++ [ stable_toolchain ]; inherit nativeBuildInputs; } // envVars);