Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use_flake() {
watch_file flake.nix
watch_file flake.lock
watch_file ghc.bzl
eval "$(nix print-dev-env --profile "$(direnv_layout_dir)/flake-profile")"
}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 2
fetch-depth: 42
persist-credentials: false
- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ repeat.cabal
/bazel-*
/.pre-commit-config.yaml
/.direnv/
/result
20 changes: 6 additions & 14 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ GHC_OPTS = [
"-XOverloadedStrings",
]

GHC_VERSION = "9.4.8"
GHC_VERSION = "9.8.4"

nix_repo = use_extension("@rules_nixpkgs_core//extensions:repository.bzl", "nix_repo")
nix_repo.file(
Expand Down Expand Up @@ -109,25 +109,17 @@ register_toolchains("@nixpkgs_python_toolchain//:toolchain")

register_toolchains("@rules_haskell_python_local//:toolchain")

go_sdk = use_extension("//go:extensions.bzl", "go_sdk")

gazelle_haskell = use_extension(":init_gazelle_haskell.bzl", "gazelle_haskell")
gazelle_haskell.init(json = "//:json_pkg")
use_repo(gazelle_haskell, "io_tweag_gazelle_haskell_modules_deps")

go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "@io_bazel_rules_go//:go.mod")
go_deps.from_file(go_mod = "//gazelle:go.mod")
use_repo(
go_deps,
"com_github_bazelbuild_buildtools",
"com_github_gogo_protobuf",
"com_github_golang_mock",
"com_github_golang_protobuf",
"com_github_pmezard_go_difflib",
"org_golang_google_genproto",
"org_golang_google_grpc",
"org_golang_google_grpc_cmd_protoc_gen_go_grpc",
"org_golang_google_protobuf",
"org_golang_x_net",
"org_golang_x_tools",
)

empty_repo = use_repo_rule("//:utils.bzl", "empty_repo")

empty_repo(name = "nixpkgs_python3_toolchain")
1,725 changes: 1,725 additions & 0 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

63 changes: 0 additions & 63 deletions WORKSPACE.bazel

This file was deleted.

3 changes: 2 additions & 1 deletion app/Version.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

module Version (version) where

import Data.Maybe (fromMaybe, listToMaybe)
import Language.Haskell.TH (runIO)
import qualified Language.Haskell.TH.Syntax as TH (lift)

version :: String
version =
$( let firstLine = head . lines
$( let firstLine = fromMaybe "unknown" . listToMaybe . lines
in runIO (firstLine <$> readFile "VERSION") >>= TH.lift
)
12 changes: 12 additions & 0 deletions bazel_xcode_local.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/tools/osx/xcode_configure.bzl b/tools/osx/xcode_configure.bzl
index 0461ad88b2..201332b229 100644
--- a/tools/osx/xcode_configure.bzl
+++ b/tools/osx/xcode_configure.bzl
@@ -301,6 +301,7 @@ xcode_autoconf = repository_rule(
],
implementation = _impl,
configure = True,
+ local = True,
attrs = {
"xcode_locator": attr.string(),
"remote_xcode": attr.string(),
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 48 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "replay";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
nix-filter.url = "github:numtide/nix-filter";
flake-compat = {
url = "github:edolstra/flake-compat";
Expand All @@ -21,6 +21,7 @@
flake-utils.lib.eachSystem [ aarch64-darwin aarch64-linux x86_64-darwin x86_64-linux ]
(system:
let
inherit (nixpkgs) lib;
pkgs = import nixpkgs { inherit system; };
filter = nix-filter.lib;
bazel = pkgs.bazel_7;
Expand Down Expand Up @@ -51,6 +52,41 @@
'';
devTools = let inherit (pkgs) bazel-watcher buildifier haskell-language-server lib ormolu; in
[ bazel-wrapper buildifier ghcWithHoogle haskell-language-server ormolu ] ++ lib.optional (!bazel-watcher.meta.broken) bazel-watcher;

nixpkgs_python3_toolchain = pkgs.stdenvNoCC.mkDerivation {
name = "python3-toolchain";
dontUnpack = true;
dontPatch = true;
installPhase = ''
mkdir -p $out/{runtime,toolchains}
touch $out/WORKSPACE.bazel $out/BUILD.bazel
cat >$out/toolchains/BUILD.bazel <<'EOF'
load("@platforms//host:constraints.bzl", "HOST_CONSTRAINTS")
toolchain(
name = "runtime_toolchain",
toolchain = "//runtime:py_runtime_pair",
toolchain_type = "@rules_python//python:toolchain_type",
target_compatible_with = HOST_CONSTRAINTS,
)
EOF

cat >$out/runtime/BUILD.bazel <<'EOF'
load("@rules_python//python:py_runtime.bzl", "py_runtime")
load("@rules_python//python:py_runtime_pair.bzl", "py_runtime_pair")

py_runtime(
name = "runtime",
interpreter_path = "${lib.getExe pkgs.python3}",
stub_shebang = "#!/${lib.getExe pkgs.python3}",
)

py_runtime_pair(
name = "py_runtime_pair",
py3_runtime = ":runtime",
)
EOF
'';
};
in
rec {
packages.replay = pkgs.buildBazelPackage {
Expand All @@ -75,6 +111,8 @@
removeRulesCC = false;

bazelFlags = [
"--override_repository=_main~_repo_rules~nixpkgs_python3_toolchain=${nixpkgs_python3_toolchain}"
"--extra_toolchains=@nixpkgs_python3_toolchain//toolchains:all"
"--extra_toolchains=@rules_haskell_nix_ghc_in_nix_toolchain//:toolchain"
"--registry"
"file://${bazel-central-registry}"
Expand All @@ -89,7 +127,13 @@
exePath = "/bin/replay";
};

inherit bazel;
bazel =
if pkgs.stdenv.isDarwin then
bazel.overrideAttrs
(final: prev: {
patches = prev.patches ++ [ ./bazel_xcode_local.diff ];
}) else
bazel;

bazelTargets = [ "//:replay" ];

Expand All @@ -100,7 +144,7 @@
# make all directories writable
find $bazelOut/external/ -type d -exec chmod --changes +w '{}' ';'
'';
sha256 = "sha256-0VhBRjITTqzGOR0jlkqpp5zzsVElDN0kdynZ2+XYmZ8=";
sha256 = "sha256-zt1VWlMmtY1vlpArWwFI5+jj/qPjKQdDeIApGCdGP94=";
};

buildAttrs = {
Expand All @@ -110,6 +154,7 @@
rm -rf "$bazelOut/external/"*[~+]{local_config_cc_toolchains,local_config_cc_toolchains.marker}
rm -rf "$bazelOut/external/"*[~+]{local_config_sh,local_config_sh.marker}
rm -rf "$bazelOut/external/"*[~+]{local_jdk,local_jdk.marker}
rm -rf "$bazelOut/external/"*[~+]{local_config_xcode,local_config_xcode.marker}
'';
installPhase = ''
install -D -t $out/bin bazel-bin/replay
Expand Down
28 changes: 28 additions & 0 deletions gazelle/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module github.com/tweag/gazelle_haskell_modules

go 1.22.9

toolchain go1.24.6

require (
github.com/bazelbuild/bazel-gazelle v0.45.0
github.com/bazelbuild/buildtools v0.0.0-20240918101019-be1c24cc9a44
github.com/bazelbuild/rules_go v0.55.1
)

require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/mock v1.7.0-rc.1 // indirect
github.com/golang/protobuf v1.5.4 // indirect
golang.org/x/mod v0.23.0 // indirect
golang.org/x/net v0.35.0 // indirect
golang.org/x/sync v0.11.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/text v0.22.0 // indirect
golang.org/x/tools v0.30.0 // indirect
google.golang.org/genproto v0.0.0-20250115164207-1a7da9e5054f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250106144421-5f5ef82da422 // indirect
google.golang.org/grpc v1.67.3 // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect
google.golang.org/protobuf v1.36.3 // indirect
)
Loading