mirror of
https://github.com/exo-explore/exo.git
synced 2026-01-29 16:22:28 -05:00
Package prettier with Svelte support and add it to treefmt-nix to format the dashboard. This change is brutal, I spent a long time trying to get it nicer but it doesn't seem there's a good way to make this minimal. Sorry for the noise! This will make it easier for new contributors to get the formatting right first time. Also removes the `.prettierrc` because it turns out treefmt-nix was ignoring it. Test plan: - CI
138 lines
3.6 KiB
Nix
138 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;
|
|
package = self'.packages.prettier-svelte;
|
|
includes = [ "*.ts" "*.svelte" ];
|
|
};
|
|
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"
|
|
''}
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
}
|