simplify flake

This commit is contained in:
Vinzenz Schroeter 2025-02-15 09:29:29 +01:00
parent e6a7a8e163
commit 073d982d57

View file

@ -23,28 +23,21 @@
"aarch64-darwin" "aarch64-darwin"
"x86_64-darwin" "x86_64-darwin"
]; ];
forAllSystems = lib.genAttrs supported-systems; forAllSystems =
make-rust-toolchain-core = f:
pkgs: lib.genAttrs supported-systems (
pkgs.symlinkJoin { system:
name = "rust-toolchain-core"; f rec {
paths = with pkgs; [ pkgs = nixpkgs.legacyPackages.${system};
rustc inherit system;
cargo }
rustPlatform.rustcSrc );
];
};
in in
rec { rec {
packages = forAllSystems ( packages = forAllSystems (
system: { pkgs, ... }:
let let
pkgs = nixpkgs.legacyPackages."${system}"; naersk' = pkgs.callPackage naersk { };
rust-toolchain-core = make-rust-toolchain-core pkgs;
naersk' = pkgs.callPackage naersk {
cargo = rust-toolchain-core;
rustc = rust-toolchain-core;
};
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
pkg-config pkg-config
makeWrapper makeWrapper
@ -69,9 +62,8 @@
package package
]; ];
src = ./.; src = ./.;
nativeBuildInputs = nativeBuildInputs; inherit nativeBuildInputs buildInputs;
strictDeps = true; strictDeps = true;
buildInputs = buildInputs;
gitSubmodules = true; gitSubmodules = true;
overrideMain = old: { overrideMain = old: {
preConfigure = '' preConfigure = ''
@ -95,9 +87,8 @@
cargoTestOptions = x: x ++ package-param; cargoTestOptions = x: x ++ package-param;
src = ./.; src = ./.;
doCheck = true; doCheck = true;
nativeBuildInputs = nativeBuildInputs;
strictDeps = true; strictDeps = true;
buildInputs = buildInputs; inherit nativeBuildInputs buildInputs;
}; };
in in
rec { rec {
@ -130,25 +121,24 @@
legacyPackages = packages; legacyPackages = packages;
devShells = forAllSystems ( devShells = forAllSystems (
system: { pkgs, system }:
let
pkgs = nixpkgs.legacyPackages."${system}";
rust-toolchain = pkgs.symlinkJoin {
name = "rust-toolchain";
paths = with pkgs; [
(make-rust-toolchain-core pkgs)
rustfmt
clippy
cargo-expand
cargo-tarpaulin
];
};
in
{ {
default = pkgs.mkShell rec { default = pkgs.mkShell rec {
inputsFrom = [ self.packages.${system}.servicepoint ]; inputsFrom = [ self.packages.${system}.servicepoint ];
packages = with pkgs; [ packages = with pkgs; [
rust-toolchain (pkgs.symlinkJoin
{
name = "rust-toolchain";
paths = with pkgs; [
rustc
cargo
rustPlatform.rustcSrc
rustfmt
clippy
cargo-expand
cargo-tarpaulin
];
})
ruby ruby
dotnet-sdk_8 dotnet-sdk_8
gcc gcc
@ -160,6 +150,6 @@
} }
); );
formatter = forAllSystems (system: nixpkgs.legacyPackages."${system}".nixfmt-rfc-style); formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-rfc-style);
}; };
} }