about summary refs log tree commit diff
path: root/flake.nix
blob: 86ebe6de89cd4cc2856362eb172e8527d5f23b61 (plain) (blame)
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
{
  description = "Interpreter flake";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    zig.url    = "github:mitchellh/zig-overlay";
    zls = {
      url = "github:zigtools/zls";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, zig, zls }: let
    systems = ["x86_64-darwin" "aarch64-darwin" "x86_64-linux"];

    createDevShell = system: let
      pkgs = import nixpkgs {
        inherit system;
        config.allowUnfree = true;
      };
      isDarwin = pkgs.stdenv.isDarwin;
    in pkgs.mkShell {
      buildInputs = with pkgs; [
        zig.packages."${system}".master
        zls.packages."${system}".default
      ]
      ++ pkgs.lib.optional isDarwin llvmPackages_19.libllvm
      ++ pkgs.lib.optionals (!isDarwin) ([
        llvmPackages_20.libllvm
        gdb
        gf
        valgrind
      ]);
    };
  in {
    devShell = nixpkgs.lib.genAttrs systems createDevShell;
  };
}