From d4b629cc275769c2553db819643849cda2395a17 Mon Sep 17 00:00:00 2001 From: Stefan Weigl-Bosker Date: Mon, 5 Jan 2026 12:40:09 -0500 Subject: init wip wip, pt2 wip, pt3 --- nix/flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ nix/flake.nix | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 nix/flake.lock create mode 100644 nix/flake.nix (limited to 'nix') diff --git a/nix/flake.lock b/nix/flake.lock new file mode 100644 index 0000000..5fd6f52 --- /dev/null +++ b/nix/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1767379071, + "narHash": "sha256-EgE0pxsrW9jp9YFMkHL9JMXxcqi/OoumPJYwf+Okucw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fb7944c166a3b630f177938e478f0378e64ce108", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nix/flake.nix b/nix/flake.nix new file mode 100644 index 0000000..240619c --- /dev/null +++ b/nix/flake.nix @@ -0,0 +1,60 @@ +{ + 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 + + doxygen + ccache + python3 + + ninja + clang-tools + + z3 + gtest + pkg-config + lit + + buildifier + buildozer + ]; + CC = "ccache clang"; + CXX = "ccache clang++"; + # LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath [ pkgs.libcxx ]; + NIX_HARDENING_ENABLE = ""; + }; + } + ); +} + -- cgit v1.2.3