Improve Nix package and shell (#21075)
With an addition of useFetchCargoVendor, crane becomes less necessary for our use. This reuses the package from nixpkgs as well as creating a better devshell that both work on macOS. I use Xcode's SDKROOT and DEVELOPER_DIR to point the swift in the livekit client crate to a correct sdk when using a devshell. Devshell should work without that once apple releases sources for the 15.1 SDK but for now this is an easy fix This also replaces fenix with rust-overlay because of issues with the out-of-sandbox access I've noticed fenix installed toolchains have Release Notes: - N/A
This commit is contained in:
parent
c021ee60d6
commit
4564da2875
5 changed files with 326 additions and 238 deletions
81
flake.nix
81
flake.nix
|
@ -3,60 +3,61 @@
|
|||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
||||
fenix = {
|
||||
url = "github:nix-community/fenix";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
crane.url = "github:ipetkov/crane";
|
||||
flake-compat.url = "github:edolstra/flake-compat";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
crane,
|
||||
fenix,
|
||||
...
|
||||
}: let
|
||||
systems = ["x86_64-linux" "aarch64-linux"];
|
||||
outputs =
|
||||
{ nixpkgs, rust-overlay, ... }:
|
||||
let
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-linux"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
|
||||
overlays = {
|
||||
fenix = fenix.overlays.default;
|
||||
rust-toolchain = final: prev: {
|
||||
rustToolchain = final.fenix.stable.toolchain;
|
||||
};
|
||||
zed-editor = final: prev: {
|
||||
zed-editor = final.callPackage ./nix/build.nix {
|
||||
craneLib = (crane.mkLib final).overrideToolchain final.rustToolchain;
|
||||
rustPlatform = final.makeRustPlatform {
|
||||
inherit (final.rustToolchain) cargo rustc;
|
||||
overlays = {
|
||||
rust-overlay = rust-overlay.overlays.default;
|
||||
rust-toolchain = final: prev: {
|
||||
rustToolchain = final.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
};
|
||||
zed-editor = final: prev: {
|
||||
zed-editor = final.callPackage ./nix/build.nix {
|
||||
rustPlatform = final.makeRustPlatform {
|
||||
cargo = final.rustToolchain;
|
||||
rustc = final.rustToolchain;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mkPkgs = system:
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
overlays = builtins.attrValues overlays;
|
||||
};
|
||||
mkPkgs =
|
||||
system:
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
overlays = builtins.attrValues overlays;
|
||||
};
|
||||
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f (mkPkgs system));
|
||||
in {
|
||||
packages = forAllSystems (pkgs: {
|
||||
zed-editor = pkgs.zed-editor;
|
||||
default = pkgs.zed-editor;
|
||||
});
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f (mkPkgs system));
|
||||
in
|
||||
{
|
||||
packages = forAllSystems (pkgs: {
|
||||
zed-editor = pkgs.zed-editor;
|
||||
default = pkgs.zed-editor;
|
||||
});
|
||||
|
||||
devShells = forAllSystems (pkgs: {
|
||||
default = import ./nix/shell.nix {inherit pkgs;};
|
||||
});
|
||||
devShells = forAllSystems (pkgs: {
|
||||
default = import ./nix/shell.nix { inherit pkgs; };
|
||||
});
|
||||
|
||||
formatter = forAllSystems (pkgs: pkgs.alejandra);
|
||||
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
|
||||
|
||||
overlays =
|
||||
overlays
|
||||
// {
|
||||
overlays = overlays // {
|
||||
default = nixpkgs.lib.composeManyExtensions (builtins.attrValues overlays);
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue