nix build working

This commit is contained in:
Thomas Zahner 2024-12-19 15:29:57 +01:00
parent 3be68e4e18
commit c4d43b0277
2 changed files with 75 additions and 2 deletions

47
default.nix Normal file
View file

@ -0,0 +1,47 @@
{
pkgs,
nixpkgs,
system,
rust-overlay,
rustVersion,
}:
let
rustPkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
common = {
version = "0.17.0";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs =
[ pkgs.openssl ]
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
pkgs.Security
pkgs.SystemConfiguration
];
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
RUST_BACKTRACE = 1;
checkFlags = [
"--skip=src/lib.rs"
"--skip=client::tests"
"--skip=collector::tests::test_url_without_extension_is_html"
];
};
in
{
app = pkgs.rustPlatform.buildRustPackage (
common
// {
pname = "lychee";
}
);
}

View file

@ -1,4 +1,5 @@
{
description = "A flake for building and developing lychee";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
@ -11,8 +12,13 @@
...
}:
let
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
rustVersion = "latest"; # using a specific version: "1.62.0"
in
{
devShells = forAllSystems (system: {
@ -22,7 +28,6 @@
inherit system;
overlays = [ (import rust-overlay) ];
};
rustVersion = "latest"; # using a specific version: "1.62.0"
rust = pkgs.rust-bin.stable.${rustVersion}.default.override {
extensions = [
"rust-src" # for rust-analyzer
@ -39,5 +44,26 @@
];
};
});
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
code = pkgs.callPackage ./. {
inherit
nixpkgs
system
rust-overlay
rustVersion
;
};
in
{
default = pkgs.symlinkJoin {
name = "all";
paths = with code; [ app ];
};
}
);
};
}