Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
59 lines (54 loc) · 1.76 KB
/
Copy pathflake.nix
File metadata and controls
59 lines (54 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
description = "Lython: an LLVM/MLIR 23 based Python compiler toolchain";
# nixpkgs' own llvmPackages_23, which Hydra builds and cache.nixos.org
# serves: no LLVM is built here and no other binary cache is needed.
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs =
{ self, nixpkgs }:
let
# ⛔ No x86_64-darwin: nixpkgs no longer builds it, so its LLVM 23
# would be a source build on every user's machine.
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-linux"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
in
{
packages = forAllSystems (pkgs: rec {
lython = pkgs.callPackage ./nix/package.nix { };
default = lython;
});
# `nix flake check` builds with the ctest suite and runs it, bench
# tests aside.
checks = forAllSystems (pkgs: {
lython = pkgs.callPackage ./nix/package.nix { withTests = true; };
});
devShells = forAllSystems (
pkgs:
let
llvm = pkgs.llvmPackages_23;
in
{
# `cmake -B build -S .` as in the README; llvm-config on PATH is how
# CMakeLists.txt finds LLVM, and MLIR_DIR names the other store path.
default = pkgs.mkShell.override { stdenv = llvm.stdenv; } {
packages = [
llvm.llvm.dev
llvm.mlir.dev
llvm.tblgen
llvm.clang
llvm.lld
pkgs.cmake
pkgs.ninja
pkgs.python3
pkgs.uv
];
MLIR_DIR = "${llvm.mlir.dev}/lib/cmake/mlir";
};
}
);
formatter = forAllSystems (pkgs: pkgs.nixfmt);
};
}