replace naersk with crane, drop nix-filter

This commit is contained in:
müde 2026-08-01 01:27:37 +02:00
commit 33188c98ff
3 changed files with 73 additions and 142 deletions

79
flake.lock generated
View file

@ -1,60 +1,17 @@
{ {
"nodes": { "nodes": {
"fenix": { "crane": {
"inputs": {
"nixpkgs": [
"naersk",
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": { "locked": {
"lastModified": 1752475459, "lastModified": 1785520756,
"narHash": "sha256-z6QEu4ZFuHiqdOPbYss4/Q8B0BFhacR8ts6jO/F/aOU=", "narHash": "sha256-eGUJ3OJ+P4R6x9bN2xx/VTwhrhBt3U0CKtcY/B5xp50=",
"owner": "nix-community", "owner": "ipetkov",
"repo": "fenix", "repo": "crane",
"rev": "bf0d6f70f4c9a9cf8845f992105652173f4b617f", "rev": "fe4c37e1c9e4d5135a89c7f6a734da02e778c34b",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "ipetkov",
"repo": "fenix", "repo": "crane",
"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",
"type": "github" "type": "github"
} }
}, },
@ -76,27 +33,9 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"naersk": "naersk", "crane": "crane",
"nix-filter": "nix-filter",
"nixpkgs": "nixpkgs" "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", "root": "root",

View file

@ -3,19 +3,14 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05"; nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
nix-filter.url = "github:numtide/nix-filter"; crane.url = "github:ipetkov/crane";
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs =
{ {
self, self,
nixpkgs, nixpkgs,
naersk, crane,
nix-filter,
}: }:
let let
lib = nixpkgs.lib; lib = nixpkgs.lib;
@ -40,8 +35,8 @@
{ pkgs, ... }: { pkgs, ... }:
rec { rec {
servicepoint-simulator = import ./servicepoint-simulator.nix { servicepoint-simulator = import ./servicepoint-simulator.nix {
inherit nix-filter pkgs; inherit pkgs;
naersk' = pkgs.callPackage naersk { }; craneLib = crane.mkLib pkgs;
}; };
default = servicepoint-simulator; default = servicepoint-simulator;
} }

View file

@ -1,74 +1,71 @@
{ {
naersk', craneLib,
pkgs, pkgs,
nix-filter,
}: }:
naersk'.buildPackage rec { let
src = nix-filter.lib.filter { commonArgs = {
root = ./.; src = craneLib.cleanCargoSource ./.;
include = [ nativeBuildInputs = with pkgs; [
./Cargo.toml pkg-config
./Cargo.lock makeWrapper
./src
./Web437_IBM_BIOS.woff
./README.md
./LICENSE
]; ];
}; strictDeps = true;
nativeBuildInputs = with pkgs; [ buildInputs =
pkg-config
makeWrapper
];
strictDeps = true;
buildInputs =
with pkgs;
[
xe
xz
roboto
]
++ lib.optionals pkgs.stdenv.isLinux (
with pkgs; with pkgs;
[ [
# gpu xe
libGL xz
vulkan-headers
vulkan-loader
vulkan-tools
vulkan-tools-lunarg
vulkan-extension-layer
vulkan-validation-layers
# keyboard roboto
libxkbcommon
# font loading
fontconfig
freetype
# WINIT_UNIX_BACKEND=wayland
wayland
# WINIT_UNIX_BACKEND=x11
libxcursor
libxrandr
libxi
libx11
libx11.dev
] ]
) ++ lib.optionals pkgs.stdenv.isLinux (
++ lib.optionals pkgs.stdenv.isDarwin ( with pkgs;
with pkgs.darwin.apple_sdk.frameworks; [
[ # gpu
Carbon libGL
QuartzCore vulkan-headers
AppKit vulkan-loader
] vulkan-tools
); vulkan-tools-lunarg
vulkan-extension-layer
vulkan-validation-layers
postInstall = '' # keyboard
wrapProgram $out/bin/servicepoint-simulator \ libxkbcommon
--suffix LD_LIBRARY_PATH : ${pkgs.lib.makeLibraryPath buildInputs}
''; # 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}
'';
}
)