diff --git a/.bazelrc b/.bazelrc index dd63abf1..d6fd108c 100644 --- a/.bazelrc +++ b/.bazelrc @@ -44,7 +44,7 @@ build --noexperimental_profile_include_primary_output build --remote_instance_name=main # Nix-generated action env for rules_ll. -try-import %workspace%/.bazelrc.ll +try-import %workspace%/ll.bazelrc # Nix-generated flags for LRE. try-import %workspace%/lre.bazelrc diff --git a/.gitignore b/.gitignore index 778c7227..60a486a6 100644 --- a/.gitignore +++ b/.gitignore @@ -26,10 +26,10 @@ MODULE.bazel.lock examples/MODULE.bazel.lock # Generated by the rules_ll bazelrc hook. -.bazelrc.ll +ll.bazelrc # Generated by the LRE bazelrc hook. -.bazelrc.lre +lre.bazelrc # Ignore NativeLink's local Pulumi stack. Pulumi.dev.yaml diff --git a/examples/.bazelrc b/examples/.bazelrc index 7ba64670..e22e8797 100644 --- a/examples/.bazelrc +++ b/examples/.bazelrc @@ -44,9 +44,9 @@ build --noexperimental_profile_include_primary_output build --remote_instance_name=main # Nix-generated action env for rules_ll. Usually this would be -# `%workspace%/.bazelrc.ll`, but since this example flake is in the rules_ll +# `%workspace%/ll.bazelrc`, but since this example flake is in the rules_ll # repository we need to reference the file from the parent directory. -try-import %workspace%/../.bazelrc.ll +try-import %workspace%/../ll.bazelrc # Nix-generated flags for LRE. try-import %workspace%/../lre.bazelrc diff --git a/examples/flake.nix b/examples/flake.nix index 06a26120..9fdeeaff 100644 --- a/examples/flake.nix +++ b/examples/flake.nix @@ -92,10 +92,12 @@ local-remote-execution.settings = { inherit (pkgs.lre.lre-cc.meta) Env; }; - rules_ll.settings.llEnv = rules_ll.lib.defaultLlEnv { - inherit pkgs; - LL_CFLAGS = "-I${openssl.dev}/include"; - LL_LDFLAGS = "-L${openssl.out}/lib"; + rules_ll.settings = { + Env = rules_ll.lib.defaultLlEnv { + inherit pkgs; + LL_CFLAGS = "-I${openssl.dev}/include"; + LL_LDFLAGS = "-L${openssl.out}/lib"; + }; }; devShells.default = pkgs.mkShell { nativeBuildInputs = diff --git a/flake-module.nix b/flake-module.nix index b149f2ea..1adceac9 100644 --- a/flake-module.nix +++ b/flake-module.nix @@ -33,7 +33,7 @@ in }; installationScript = mkOption { type = types.str; - description = lib.mdDoc "A .bazelrc.ll generator for rules_ll."; + description = lib.mdDoc "A ll.bazelrc generator for rules_ll."; default = cfg.settings.installationScript; defaultText = lib.literalMD "bazelrc contents"; readOnly = true; diff --git a/flake.nix b/flake.nix index cf38cf56..089134f7 100644 --- a/flake.nix +++ b/flake.nix @@ -93,15 +93,17 @@ pre-commit.settings = { hooks = import ./pre-commit-hooks.nix { inherit pkgs; }; }; - rules_ll.settings.llEnv = - let - openssl = (pkgs.openssl.override { static = true; }); - in - self.lib.defaultLlEnv { - inherit pkgs; - LL_CFLAGS = "-I${openssl.dev}/include"; - LL_LDFLAGS = "-L${openssl.out}/lib"; - }; + rules_ll.settings = { + Env = + let + openssl = (pkgs.openssl.override { static = true; }); + in + self.lib.defaultLlEnv { + inherit pkgs; + LL_CFLAGS = "-I${openssl.dev}/include"; + LL_LDFLAGS = "-L${openssl.out}/lib"; + }; + }; packages = { ll = import ./devtools/ll.nix { inherit pkgs; @@ -145,11 +147,11 @@ # development shell. ${config.pre-commit.installationScript} - # Generate .bazelrc.ll which contains Bazel configuration + # Generate ll.bazelrc which contains Bazel configuration # when rules_ll is run from a nix environment. ${config.rules_ll.installationScript} - # Generate .bazelrc.lre which configures the LRE toolchains. + # Generate lre.bazelrc which configures the LRE toolchains. ${config.local-remote-execution.installationScript} # Ensure that the ll command points to our ll binary. diff --git a/modules/rules_ll.nix b/modules/rules_ll.nix index c2bab93d..fa592f34 100644 --- a/modules/rules_ll.nix +++ b/modules/rules_ll.nix @@ -4,12 +4,12 @@ let inherit (pkgs) runCommand writeText git; - processedActionEnvs = map (x: "build --@rules_ll//ll:" + x) config.llEnv; + processedActionEnvs = map (x: "build --@rules_ll//ll:" + x) config.Env; - configFile = runCommand ".bazelrc.ll" { } '' + configFile = runCommand "ll.bazelrc" { } '' printf '# These flags are dynamically generated by rules_ll. # - # Add try-import %%workspace%%/.bazelrc.ll to your .bazelrc to + # Add try-import %%workspace%%/ll.bazelrc to your .bazelrc to # include these flags when running Bazel in a nix environment. ${lib.concatLines processedActionEnvs}' >$out @@ -20,10 +20,10 @@ in installationScript = mkOption { type = types.str; description = lib.mkDoc '' - A bash snippet which creates a .bazelrc.ll file in the repository. + A bash snippet which creates an ll.bazelrc file in the repository. ''; }; - llEnv = mkOption { + Env = mkOption { type = types.listOf types.str; description = lib.mdDoc '' Environment variables for `--@rules_ll//ll:*` settings. @@ -31,12 +31,12 @@ in For instance: ```nix - llEnv = [ + Env = [ "LL_CFLAGS=-I''${openssl.dev}/include" ] ``` - results in the following line in `.bazelrc.ll`: + results in the following line in `ll.bazelrc`: ```bash build --@rules_ll//ll:LL_CFLAGS=-I''${openssl.dev}/include @@ -72,16 +72,16 @@ in # filesystem churn. This improves performance with watch tools like # lorri and prevents installation loops by lorri. - if ! readlink "''${GIT_WC}/.bazelrc.ll" >/dev/null \ - || [[ $(readlink "''${GIT_WC}/.bazelrc.ll") != ${configFile} ]]; then + if ! readlink "''${GIT_WC}/ll.bazelrc" >/dev/null \ + || [[ $(readlink "''${GIT_WC}/ll.bazelrc") != ${configFile} ]]; then echo 1>&2 "rules_ll: updating $PWD repository" - [ -L .bazelrc.ll ] && unlink .bazelrc.ll + [ -L ll.bazelrc ] && unlink ll.bazelrc - if [ -e "''${GIT_WC}/.bazelrc.ll" ]; then - echo 1>&2 "rules_ll: WARNING: Refusing to install because of pre-existing .bazelrc.ll" - echo 1>&2 " Remove the .bazelrc.ll file and add .bazelrc.ll to .gitignore." + if [ -e "''${GIT_WC}/ll.bazelrc" ]; then + echo 1>&2 "rules_ll: WARNING: Refusing to install because of pre-existing ll.bazelrc" + echo 1>&2 " Remove the ll.bazelrc file and add ll.bazelrc to .gitignore." else - ln -fs ${configFile} "''${GIT_WC}/.bazelrc.ll" + ln -fs ${configFile} "''${GIT_WC}/ll.bazelrc" fi fi fi