diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47c29f10..21b65a6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python 3.9 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.9 - name: Install mypy diff --git a/WORKSPACE b/WORKSPACE index f556ae07..68ed8605 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,6 +1,7 @@ workspace(name = "toktok") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("//third_party:nixpkgs.bzl", "GCC_LIB", "GHC_VERSION", "LD_LINUX", "NIXOS_SHA256", "NIXOS_VERSION", "PATCHELF") load("//tools/workspace:github.bzl", "github_archive", "new_github_archive") # https://github.com/bazelbuild/bazel-skylib @@ -196,8 +197,8 @@ load( nixpkgs_git_repository( name = "nixpkgs", - revision = "23.11", - sha256 = "bc9a0a74e8d7fb0e11434dd3abaa0cb0572ccd3a65b5a192eea41832b286e8a0", + revision = NIXOS_VERSION, + sha256 = NIXOS_SHA256, ) nixpkgs_cc_configure( @@ -267,7 +268,7 @@ nixpkgs_package( # ========================================================= nixpkgs_java_configure( - attribute_path = "jdk11.home", + attribute_path = "jdk11_headless.home", repository = "@nixpkgs", toolchain = True, toolchain_name = "nixpkgs_java", @@ -295,16 +296,16 @@ http_archive( patch_cmds = [ "chmod 755 java_tools/ijar/ijar", "{patchelf} --set-interpreter {ld_linux} --add-rpath {gcc_lib} java_tools/ijar/ijar".format( - gcc_lib = "/nix/store/myw67gkgayf3s2mniij7zwd79lxy8v0k-gcc-12.3.0-lib/lib", - ld_linux = "/nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib64/ld-linux-x86-64.so.2", - patchelf = "/nix/store/85jldj870vzcl72yz03labc93bwvqayx-patchelf-0.15.0/bin/patchelf", + gcc_lib = GCC_LIB, + ld_linux = LD_LINUX, + patchelf = PATCHELF, ), "chmod 555 java_tools/ijar/ijar", "chmod 755 java_tools/src/tools/singlejar/singlejar_local", "{patchelf} --set-interpreter {ld_linux} --add-rpath {gcc_lib} java_tools/src/tools/singlejar/singlejar_local".format( - gcc_lib = "/nix/store/myw67gkgayf3s2mniij7zwd79lxy8v0k-gcc-12.3.0-lib/lib", - ld_linux = "/nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib64/ld-linux-x86-64.so.2", - patchelf = "/nix/store/85jldj870vzcl72yz03labc93bwvqayx-patchelf-0.15.0/bin/patchelf", + gcc_lib = GCC_LIB, + ld_linux = LD_LINUX, + patchelf = PATCHELF, ), "chmod 555 java_tools/src/tools/singlejar/singlejar_local", ], @@ -380,13 +381,15 @@ haskell_register_ghc_nixpkgs( "-fdiagnostics-color=always", # TODO(iphydf): Move to hs-cimple. "-Wno-redundant-constraints", + # TODO(iphydf): Move to hs-schema. + "-Wno-unused-imports", "-optc=-Wno-unused-command-line-argument", "-optl=-Wl,--no-fatal-warnings", ], nix_file = "//:ghc.nix", repositories = {"nixpkgs": "@nixpkgs"}, #static_runtime = True, - version = "9.4.8", + version = GHC_VERSION, ) [nixpkgs_package( diff --git a/ci-tools b/ci-tools index 13e0dc52..0ee64c18 160000 --- a/ci-tools +++ b/ci-tools @@ -1 +1 @@ -Subproject commit 13e0dc52a8ff464afa6941b3226374f882ddaefa +Subproject commit 0ee64c18e0b9b2b63f47de633903f331f5a5022a diff --git a/dockerfiles b/dockerfiles index 20574a64..95fcb16e 160000 --- a/dockerfiles +++ b/dockerfiles @@ -1 +1 @@ -Subproject commit 20574a64b89308a106b2afa18f7d3528ade45d42 +Subproject commit 95fcb16e4dca100a6e7d1951772cdef8e09ddbf2 diff --git a/ghc.nix b/ghc.nix index 1c264ef5..129583da 100644 --- a/ghc.nix +++ b/ghc.nix @@ -2,94 +2,96 @@ with (import { }); { - ghc = haskellPackages.ghcWithPackages (p: with p; [ - aeson - aeson-pretty - ansi-wl-pprint - array - async - base - base16-bytestring - binary - binary-conduit - brick - bytestring - case-insensitive - casing - clock - conduit - conduit-extra - containers - cryptohash - data-binary-ieee754 - data-default-class - data-fix - deepseq - Diff - directory - edit-distance - entropy - exceptions - expiring-cache-map - extra - file-embed - filepath - generic-arbitrary - github - groom - hashable - hspec - html - http-client - http-client-tls - http-media - http-types - integer-gmp - iproute - insert-ordered-containers - language-c - lens-family - microlens - microlens-mtl - microlens-th - monad-control - monad-parallel - MonadRandom - monad-validate - mtl - network - parallel - pretty - process - QuickCheck - quickcheck-instances - quickcheck-text - random - recursion-schemes - saltine - scientific - servant - servant-server - split - suspend - tabular - text - text-zipper - time - timers - transformers - transformers-compat - unix - unliftio-core - unordered-containers - uuid - vector - vty - wai - wai-cors - wai-extra - warp - word-wrap - yaml - ]); + ghc = haskellPackages.ghcWithPackages.override { installDocumentation = false; } ( + p: with p; [ + aeson + aeson-pretty + ansi-wl-pprint + array + async + base + base16-bytestring + binary + binary-conduit + brick + bytestring + case-insensitive + casing + clock + conduit + conduit-extra + containers + cryptohash + data-binary-ieee754 + data-default-class + data-fix + deepseq + Diff + directory + edit-distance + entropy + exceptions + expiring-cache-map + extra + file-embed + filepath + generic-arbitrary + github + groom + hashable + hspec + html + http-client + http-client-tls + http-media + http-types + integer-gmp + iproute + insert-ordered-containers + language-c + lens-family + microlens + microlens-mtl + microlens-th + monad-control + monad-parallel + MonadRandom + monad-validate + mtl + network + parallel + pretty + process + QuickCheck + quickcheck-instances + quickcheck-text + random + recursion-schemes + saltine + scientific + servant + servant-server + split + suspend + tabular + text + text-zipper + time + timers + transformers + transformers-compat + unix + unliftio-core + unordered-containers + uuid + vector + vty + wai + wai-cors + wai-extra + warp + word-wrap + yaml + ] + ); } diff --git a/heroku.yml b/heroku.yml deleted file mode 100644 index c3c472a2..00000000 --- a/heroku.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -build: - docker: - web: tools/kythe/csrch/Dockerfile diff --git a/hs-github-tools b/hs-github-tools index 5a47c2c6..37ac9fe9 160000 --- a/hs-github-tools +++ b/hs-github-tools @@ -1 +1 @@ -Subproject commit 5a47c2c61e4cacac3e9d6ac48c4d9036c0f61517 +Subproject commit 37ac9fe919ea33f85421378c3904e1bdf3b8722a diff --git a/pyrightconfig.json b/pyrightconfig.json new file mode 100644 index 00000000..a4cc3220 --- /dev/null +++ b/pyrightconfig.json @@ -0,0 +1,4 @@ +{ + "include": ["/src/workspace"], + "exclude": ["bazel-*"] +} diff --git a/third_party/nixpkgs.bzl b/third_party/nixpkgs.bzl new file mode 100644 index 00000000..30c529ff --- /dev/null +++ b/third_party/nixpkgs.bzl @@ -0,0 +1,35 @@ +""" +Hard-coded paths to Nixpkgs binaries. +""" + +# 23.11 + +NIXOS_VERSION = "23.11" +NIXOS_SHA256 = "bc9a0a74e8d7fb0e11434dd3abaa0cb0572ccd3a65b5a192eea41832b286e8a0" + +GHC_VERSION = "9.4.8" + +# Need to add this to rpath. +GCC_LIB = "/nix/store/myw67gkgayf3s2mniij7zwd79lxy8v0k-gcc-12.3.0-lib/lib" + +# Need to change the interpreter to the one from glibc. +LD_LINUX = "/nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib64/ld-linux-x86-64.so.2" + +# Tool to patch the binary with the above two changes. +PATCHELF = "/nix/store/85jldj870vzcl72yz03labc93bwvqayx-patchelf-0.15.0/bin/patchelf" + +# # 24.05 + +# NIXOS_VERSION = "24.05" +# NIXOS_SHA256 = "911314b81780f26fdaf87e17174210bdbd40c86bac1795212f257cdc236a1e78" + +# GHC_VERSION = "9.6.5" + +# # Need to add this to rpath. +# GCC_LIB = "/nix/store/d4dzkmwkyrkc1l8z9x7vcdj193fx4g45-gcc-12.3.0-lib/lib" + +# # Need to change the interpreter to the one from glibc. +# LD_LINUX = "/nix/store/k7zgvzp2r31zkg9xqgjim7mbknryv6bs-glibc-2.39-52/lib64/ld-linux-x86-64.so.2" + +# # Tool to patch the binary with the above two changes. +# PATCHELF = "/nix/store/nbad47q0m0m9c5xid7zh05hiknwircbp-patchelf-0.15.0/bin/patchelf" diff --git a/third_party/zig/toolchains.bzl b/third_party/zig/toolchains.bzl index 16a81794..82b87396 100644 --- a/third_party/zig/toolchains.bzl +++ b/third_party/zig/toolchains.bzl @@ -1,4 +1,9 @@ +""" +Toolchain definitions for Zig. +""" + load("@rules_zig//zig:toolchain.bzl", "zig_target_toolchain") +load("//third_party:nixpkgs.bzl", "LD_LINUX") CPUS = { "aarch64": { @@ -7,11 +12,17 @@ CPUS = { }, "x86_64": { "cpu": "x86_64", - "dynamic_linker": "/nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/ld-linux-x86-64.so.2", + "dynamic_linker": LD_LINUX, }, } -def zig_nix_toolchains(): +def zig_nix_toolchains(name = "zig_nix_toolchains"): + """ + Define toolchains for each supported CPU. + + Args: + name: The name of the rule (unused). + """ for arch in CPUS: native.platform( name = arch + "-linux-gnu", diff --git a/tools/built/src/Dockerfile.dev b/tools/built/src/Dockerfile.dev index fd875f72..67fa9e7f 100644 --- a/tools/built/src/Dockerfile.dev +++ b/tools/built/src/Dockerfile.dev @@ -13,8 +13,8 @@ FROM toxchat/toktok-stack:latest-fastbuild ENV USER=builder RUN sudo nix-daemon --daemon & sleep 1 \ - && nix-channel --add https://github.com/NixOS/nixpkgs/archive/refs/tags/23.11.tar.gz nixpkgs \ - && nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager \ + && nix-channel --add "https://github.com/NixOS/nixpkgs/archive/refs/tags/$NIXOS_VERSION.tar.gz" nixpkgs \ + && nix-channel --add "https://github.com/nix-community/home-manager/archive/release-$NIXOS_VERSION.tar.gz" home-manager \ && nix-channel --update \ && nix-shell '' -A install diff --git a/tools/built/src/Dockerfile.third_party b/tools/built/src/Dockerfile.third_party index 83325732..e8c2a50a 100644 --- a/tools/built/src/Dockerfile.third_party +++ b/tools/built/src/Dockerfile.third_party @@ -16,6 +16,6 @@ WORKDIR /src/workspace RUN sudo nix-daemon --daemon & bazel aquery --output=proto --show_timestamps //... > /dev/null # TODO(https://github.com/tweag/rules_nixpkgs/issues/439): Remove. -RUN sudo sed -Eie "s!\b(mktemp|rm)\b!$(echo -n /nix/store/*-coreutils-9.3/bin/)\1!" /nix/store/*-clang-wrapper-*/bin/cc +RUN sudo sed -Eie 's!\b(mktemp |rm )!'"$(echo -n /nix/store/*-coreutils-*/bin/)"'\1!' /nix/store/*-clang-wrapper-*/bin/cc # vim:ft=dockerfile