mirror of
https://github.com/exo-explore/exo.git
synced 2026-01-19 03:22:01 -05:00
Continue working towards a fully Nix based build by building the dashboard with Nix. Continuing the theme of using the existing lock files, use dream2nix to parse the lock file and build the tree of dependency derivations. dream2nix doesn't like the bundleDependencies, so we apply a small patch to the lock file that drops all dependencies that are bundled. This should ideally be contributed upstream but that can be done later. Use this new dashboard build in the build-app CI workflow, meaning future macOS apps will include this reproducible dashboard. Test plan: - Built a DMG, shipped to a cluster, loaded in a browser with no cache and the dashboard looks good. - Directory layout is as expected: ``` $ nix build .#dashboard $ find result/ ... result/_app/immutable/entry result/_app/immutable/entry/app.CTPAnMjf.js result/_app/immutable/entry/start.fUSEa-2O.js result/_app/immutable/nodes result/_app/immutable/nodes/3.DqQr1Obm.js result/_app/immutable/nodes/0.DgEY44RO.js result/_app/immutable/nodes/2.BjZg_lJh.js result/_app/immutable/nodes/1.D6vGUYYT.js result/_app/env.js result/_app/version.json result/exo-logo.png result/favicon.ico result/index.html ```
137 lines
3.6 KiB
Nix
137 lines
3.6 KiB
Nix
{
|
|
description = "The development environment for Exo";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
flake-parts = {
|
|
url = "github:hercules-ci/flake-parts";
|
|
inputs.nixpkgs-lib.follows = "nixpkgs";
|
|
};
|
|
|
|
crane.url = "github:ipetkov/crane";
|
|
|
|
fenix = {
|
|
url = "github:nix-community/fenix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
treefmt-nix = {
|
|
url = "github:numtide/treefmt-nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
dream2nix = {
|
|
url = "github:nix-community/dream2nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# Pinned nixpkgs for swift-format (swift is broken on x86_64-linux in newer nixpkgs)
|
|
nixpkgs-swift.url = "github:NixOS/nixpkgs/08dacfca559e1d7da38f3cf05f1f45ee9bfd213c";
|
|
};
|
|
|
|
nixConfig = {
|
|
extra-trusted-public-keys = "exo.cachix.org-1:okq7hl624TBeAR3kV+g39dUFSiaZgLRkLsFBCuJ2NZI=";
|
|
extra-substituters = "https://exo.cachix.org";
|
|
};
|
|
|
|
outputs =
|
|
inputs:
|
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
|
systems = [
|
|
"x86_64-linux"
|
|
"aarch64-darwin"
|
|
"aarch64-linux"
|
|
];
|
|
|
|
imports = [
|
|
inputs.treefmt-nix.flakeModule
|
|
./dashboard/parts.nix
|
|
./rust/parts.nix
|
|
];
|
|
|
|
perSystem =
|
|
{ config, self', inputs', pkgs, lib, system, ... }:
|
|
let
|
|
fenixToolchain = inputs'.fenix.packages.complete;
|
|
# Use pinned nixpkgs for swift-format (swift is broken on x86_64-linux in newer nixpkgs)
|
|
pkgsSwift = import inputs.nixpkgs-swift { inherit system; };
|
|
in
|
|
{
|
|
treefmt = {
|
|
projectRootFile = "flake.nix";
|
|
programs = {
|
|
nixpkgs-fmt.enable = true;
|
|
ruff-format = {
|
|
enable = true;
|
|
excludes = [ "rust/exo_pyo3_bindings/exo_pyo3_bindings.pyi" ];
|
|
};
|
|
rustfmt = {
|
|
enable = true;
|
|
package = config.rust.toolchain;
|
|
};
|
|
prettier = {
|
|
enable = true;
|
|
includes = [ "*.ts" ];
|
|
};
|
|
swift-format = {
|
|
enable = true;
|
|
package = pkgsSwift.swiftPackages.swift-format;
|
|
};
|
|
};
|
|
};
|
|
|
|
checks.lint = pkgs.runCommand "lint-check" { } ''
|
|
export RUFF_CACHE_DIR="$TMPDIR/ruff-cache"
|
|
${pkgs.ruff}/bin/ruff check ${inputs.self}/
|
|
touch $out
|
|
'';
|
|
|
|
devShells.default = with pkgs; pkgs.mkShell {
|
|
inputsFrom = [ self'.checks.cargo-build ];
|
|
|
|
packages =
|
|
[
|
|
# FORMATTING
|
|
config.treefmt.build.wrapper
|
|
|
|
# PYTHON
|
|
python313
|
|
uv
|
|
ruff
|
|
basedpyright
|
|
|
|
# RUST
|
|
config.rust.toolchain
|
|
maturin
|
|
|
|
# NIX
|
|
nixpkgs-fmt
|
|
|
|
# SVELTE
|
|
nodejs
|
|
|
|
# MISC
|
|
just
|
|
jq
|
|
]
|
|
++ lib.optionals stdenv.isLinux [
|
|
unixtools.ifconfig
|
|
]
|
|
++ lib.optionals stdenv.isDarwin [
|
|
macmon
|
|
];
|
|
|
|
OPENSSL_NO_VENDOR = "1";
|
|
|
|
shellHook = ''
|
|
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${python313}/lib"
|
|
${lib.optionalString stdenv.isLinux ''
|
|
export LD_LIBRARY_PATH="${openssl.out}/lib:$LD_LIBRARY_PATH"
|
|
''}
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
}
|