From 33188c98ff039af4d27621e3d1bcbe909a99338b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Sat, 1 Aug 2026 01:27:37 +0200 Subject: [PATCH] replace naersk with crane, drop nix-filter --- flake.lock | 79 +++-------------------- flake.nix | 13 ++-- servicepoint-simulator.nix | 127 ++++++++++++++++++------------------- 3 files changed, 75 insertions(+), 144 deletions(-) diff --git a/flake.lock b/flake.lock index e7a7233..d54fc28 100644 --- a/flake.lock +++ b/flake.lock @@ -1,60 +1,17 @@ { "nodes": { - "fenix": { - "inputs": { - "nixpkgs": [ - "naersk", - "nixpkgs" - ], - "rust-analyzer-src": "rust-analyzer-src" - }, + "crane": { "locked": { - "lastModified": 1752475459, - "narHash": "sha256-z6QEu4ZFuHiqdOPbYss4/Q8B0BFhacR8ts6jO/F/aOU=", - "owner": "nix-community", - "repo": "fenix", - "rev": "bf0d6f70f4c9a9cf8845f992105652173f4b617f", + "lastModified": 1785520756, + "narHash": "sha256-eGUJ3OJ+P4R6x9bN2xx/VTwhrhBt3U0CKtcY/B5xp50=", + "owner": "ipetkov", + "repo": "crane", + "rev": "fe4c37e1c9e4d5135a89c7f6a734da02e778c34b", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "fenix", - "type": "github" - } - }, - "naersk": { - "inputs": { - "fenix": "fenix", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1752689277, - "narHash": "sha256-uldUBFkZe/E7qbvxa3mH1ItrWZyT6w1dBKJQF/3ZSsc=", - "owner": "nix-community", - "repo": "naersk", - "rev": "0e72363d0938b0208d6c646d10649164c43f4d64", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "naersk", - "type": "github" - } - }, - "nix-filter": { - "locked": { - "lastModified": 1731533336, - "narHash": "sha256-oRam5PS1vcrr5UPgALW0eo1m/5/pls27Z/pabHNy2Ms=", - "owner": "numtide", - "repo": "nix-filter", - "rev": "f7653272fd234696ae94229839a99b73c9ab7de0", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "nix-filter", + "owner": "ipetkov", + "repo": "crane", "type": "github" } }, @@ -76,27 +33,9 @@ }, "root": { "inputs": { - "naersk": "naersk", - "nix-filter": "nix-filter", + "crane": "crane", "nixpkgs": "nixpkgs" } - }, - "rust-analyzer-src": { - "flake": false, - "locked": { - "lastModified": 1752428706, - "narHash": "sha256-EJcdxw3aXfP8Ex1Nm3s0awyH9egQvB2Gu+QEnJn2Sfg=", - "owner": "rust-lang", - "repo": "rust-analyzer", - "rev": "591e3b7624be97e4443ea7b5542c191311aa141d", - "type": "github" - }, - "original": { - "owner": "rust-lang", - "ref": "nightly", - "repo": "rust-analyzer", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 29ab8e6..6b1a3fe 100644 --- a/flake.nix +++ b/flake.nix @@ -3,19 +3,14 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05"; - nix-filter.url = "github:numtide/nix-filter"; - naersk = { - url = "github:nix-community/naersk"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + crane.url = "github:ipetkov/crane"; }; outputs = { self, nixpkgs, - naersk, - nix-filter, + crane, }: let lib = nixpkgs.lib; @@ -40,8 +35,8 @@ { pkgs, ... }: rec { servicepoint-simulator = import ./servicepoint-simulator.nix { - inherit nix-filter pkgs; - naersk' = pkgs.callPackage naersk { }; + inherit pkgs; + craneLib = crane.mkLib pkgs; }; default = servicepoint-simulator; } diff --git a/servicepoint-simulator.nix b/servicepoint-simulator.nix index b54043e..00c0021 100644 --- a/servicepoint-simulator.nix +++ b/servicepoint-simulator.nix @@ -1,74 +1,71 @@ { - naersk', + craneLib, pkgs, - nix-filter, }: -naersk'.buildPackage rec { - src = nix-filter.lib.filter { - root = ./.; - include = [ - ./Cargo.toml - ./Cargo.lock - ./src - ./Web437_IBM_BIOS.woff - ./README.md - ./LICENSE +let + commonArgs = { + src = craneLib.cleanCargoSource ./.; + nativeBuildInputs = with pkgs; [ + pkg-config + makeWrapper ]; - }; - nativeBuildInputs = with pkgs; [ - pkg-config - makeWrapper - ]; - strictDeps = true; - buildInputs = - with pkgs; - [ - xe - xz - - roboto - ] - ++ lib.optionals pkgs.stdenv.isLinux ( + strictDeps = true; + buildInputs = with pkgs; [ - # gpu - libGL - vulkan-headers - vulkan-loader - vulkan-tools - vulkan-tools-lunarg - vulkan-extension-layer - vulkan-validation-layers + xe + xz - # keyboard - libxkbcommon - - # font loading - fontconfig - freetype - - # WINIT_UNIX_BACKEND=wayland - wayland - - # WINIT_UNIX_BACKEND=x11 - libxcursor - libxrandr - libxi - libx11 - libx11.dev + roboto ] - ) - ++ lib.optionals pkgs.stdenv.isDarwin ( - with pkgs.darwin.apple_sdk.frameworks; - [ - Carbon - QuartzCore - AppKit - ] - ); + ++ lib.optionals pkgs.stdenv.isLinux ( + with pkgs; + [ + # gpu + libGL + vulkan-headers + vulkan-loader + vulkan-tools + vulkan-tools-lunarg + vulkan-extension-layer + vulkan-validation-layers - postInstall = '' - wrapProgram $out/bin/servicepoint-simulator \ - --suffix LD_LIBRARY_PATH : ${pkgs.lib.makeLibraryPath buildInputs} - ''; -} + # keyboard + libxkbcommon + + # font loading + fontconfig + freetype + + # WINIT_UNIX_BACKEND=wayland + wayland + + # WINIT_UNIX_BACKEND=x11 + libxcursor + libxrandr + libxi + libx11 + libx11.dev + ] + ) + ++ lib.optionals pkgs.stdenv.isDarwin ( + with pkgs.darwin.apple_sdk.frameworks; + [ + Carbon + QuartzCore + AppKit + ] + ); + }; +in +craneLib.buildPackage ( + commonArgs + // { + cargoArtifacts = craneLib.buildDepsOnly commonArgs; + + postInstall = '' + wrapProgram $out/bin/servicepoint-simulator \ + --suffix LD_LIBRARY_PATH : ${pkgs.lib.makeLibraryPath commonArgs.buildInputs} + ''; + } +)