summaryrefslogtreecommitdiff
path: root/nix/flake.nix
blob: fa570f303fedc59b4cf4b7c0458f7104bb6bb3bd (plain)
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
60
61
62
{
  description = "pedagogical compiler monorepo (bazel + nix + clang + ccache)";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs =
    {
      self,
      nixpkgs,
      flake-utils,
      ...
    }:
    flake-utils.lib.eachDefaultSystem (
      system:
      let
        # pkgs = import nixpkgs { inherit system; config.replaceStdenv = {pkgs, ...}: pkgs.clangStdenv; };
        pkgs = import nixpkgs { inherit system; };
        # lock = builtins.fromJSON (builtins.readFile ./flake.lock);
        # spec = lock.nodes.nixpkgs.locked;
        # nixpkgs = fetchTarball "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz";
      in
      {
        devShells.default = pkgs.mkShell {
          name = "compiler stuff";
          packages = with pkgs; [
            # clang-tools
            # bazelisk
            bazel_8
            bazel-buildtools
            nix
            git
            gcc
            graphviz

            doxygen
            ccache
            python3

            ninja
            clang-tools
            clang

            z3
            catch2_3
            pkg-config
            lit

            buildifier
            buildozer
          ];
          CC = "ccache clang";
          CXX = "ccache clang++";
          # LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath [ pkgs.libcxx ];
          NIX_HARDENING_ENABLE = "";
        };
      }
    );
}