feat: rust template #26
|
@ -35,23 +35,18 @@
|
||||||
overlays = [ (final: prev: { ${packageName} = self.packages.${system}.${packageName}; }) ];
|
overlays = [ (final: prev: { ${packageName} = self.packages.${system}.${packageName}; }) ];
|
||||||
};
|
};
|
||||||
|
|
||||||
fenixPkgsFor = pkgs: fenix.packages.${pkgs.system};
|
fenixPkgs = fenix.packages.${pkgs.system};
|
||||||
fenixChannelFor =
|
fenixChannel = fenixPkgs.toolchainOf {
|
||||||
pkgs:
|
channel = "nightly";
|
||||||
(fenixPkgsFor pkgs).toolchainOf {
|
date =
|
||||||
channel = "nightly";
|
builtins.replaceStrings [ "nightly-" ] [ "" ]
|
||||||
date =
|
(builtins.fromTOML (builtins.readFile ./rust-toolchain.toml)).toolchain.channel;
|
||||||
builtins.replaceStrings [ "nightly-" ] [ "" ]
|
sha256 = "sha256-SzEeSoO54GiBQ2kfANPhWrt0EDRxqEvhIbTt2uJt/TQ=";
|
||||||
(builtins.fromTOML (builtins.readFile ./rust-toolchain.toml)).toolchain.channel;
|
};
|
||||||
sha256 = "sha256-SzEeSoO54GiBQ2kfANPhWrt0EDRxqEvhIbTt2uJt/TQ=";
|
|
||||||
};
|
|
||||||
|
|
||||||
toolchainFor =
|
toolchainFor =
|
||||||
pkgs:
|
pkgs:
|
||||||
let
|
with fenixPkgs;
|
||||||
fenix-pkgs = fenixPkgsFor pkgs;
|
|
||||||
in
|
|
||||||
with fenix-pkgs;
|
|
||||||
combine [
|
combine [
|
||||||
minimal.cargo
|
minimal.cargo
|
||||||
minimal.rustc
|
minimal.rustc
|
||||||
|
@ -86,8 +81,8 @@
|
||||||
inherit
|
inherit
|
||||||
system
|
system
|
||||||
pkgs
|
pkgs
|
||||||
fenixPkgsFor
|
fenixPkgs
|
||||||
fenixChannelFor
|
fenixChannel
|
||||||
toolchainFor
|
toolchainFor
|
||||||
rustPlatformFor
|
rustPlatformFor
|
||||||
crossPackageFor
|
crossPackageFor
|
||||||
|
@ -101,21 +96,18 @@
|
||||||
packages = forSystems (
|
packages = forSystems (
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
fenixChannelFor,
|
fenixChannel,
|
||||||
system,
|
system,
|
||||||
crossPackageFor,
|
crossPackageFor,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
|
||||||
fenix-channel = fenixChannelFor pkgs;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
${packageName} = pkgs.callPackage (./. + "/nix/packages/${packageName}.nix") {
|
${packageName} = pkgs.callPackage (./. + "/nix/packages/${packageName}.nix") {
|
||||||
inherit cargoMeta;
|
inherit cargoMeta;
|
||||||
flake-self = self;
|
flake-self = self;
|
||||||
rustPlatform = pkgs.makeRustPlatform {
|
rustPlatform = pkgs.makeRustPlatform {
|
||||||
cargo = fenix-channel.toolchain;
|
cargo = fenixChannel.toolchain;
|
||||||
rustc = fenix-channel.toolchain;
|
rustc = fenixChannel.toolchain;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
default = self.packages.${system}.${packageName};
|
default = self.packages.${system}.${packageName};
|
||||||
|
@ -128,10 +120,9 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
devShells = forSystems (
|
devShells = forSystems (
|
||||||
{ pkgs, fenixChannelFor, ... }:
|
{ pkgs, fenixChannel, ... }:
|
||||||
let
|
let
|
||||||
fenix-channel = fenixChannelFor pkgs;
|
fenixRustToolchain = fenixChannel.withComponents [
|
||||||
fenixRustToolchain = fenix-channel.withComponents [
|
|
||||||
"cargo"
|
"cargo"
|
||||||
"clippy-preview"
|
"clippy-preview"
|
||||||
"rust-src"
|
"rust-src"
|
||||||
|
|
Loading…
Reference in a new issue