Skip to content

Commit

Permalink
Move some tools to an externally usable overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronmondal committed Dec 14, 2024
1 parent 4896948 commit 4e00120
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 18 deletions.
28 changes: 12 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,10 @@
cargoExtraArgs = "--features enable_tokio_console";
});

publish-ghcr = pkgs.callPackage ./tools/publish-ghcr.nix {};

local-image-test = pkgs.callPackage ./tools/local-image-test.nix {};

nativelink-is-executable-test = pkgs.callPackage ./tools/nativelink-is-executable-test.nix {inherit nativelink;};

generate-toolchains = pkgs.callPackage ./tools/generate-toolchains.nix {};

native-cli = pkgs.callPackage ./native-cli/default.nix {};

build-chromium-tests =
pkgs.writeShellScriptBin
"build-chromium-tests"
Expand Down Expand Up @@ -209,7 +203,8 @@

nativelink-worker-init = pkgs.callPackage ./tools/nativelink-worker-init.nix {inherit buildImage self nativelink-image;};

createWorker = pkgs.callPackage ./tools/create-worker.nix {inherit buildImage self;};
createWorker = pkgs.nativelink-tools.lib.createWorker {inherit self;};

buck2-toolchain = let
buck2-nightly-rust-version = "2024-04-28";
buck2-nightly-rust = pkgs.rust-bin.nightly.${buck2-nightly-rust-version};
Expand Down Expand Up @@ -305,6 +300,7 @@
overlays = [
self.overlays.lre
(import ./tools/nixpkgs-disable-ratehammering-pulumi-tests.nix)
self.overlays.tools
(import rust-overlay)
(import ./tools/rust-overlay-cut-libsecret.nix)
];
Expand All @@ -316,14 +312,12 @@
};
native = {
type = "app";
program = "${native-cli}/bin/native";
program = "${pkgs.nativelink-tools.native-cli}/bin/native";
};
};
packages =
rec {
inherit
local-image-test
native-cli
nativelink
nativelinkCoverageForHost
nativelink-aarch64-linux
Expand All @@ -332,9 +326,10 @@
nativelink-is-executable-test
nativelink-worker-init
nativelink-x86_64-linux
publish-ghcr
;

inherit (pkgs.nativelink-tools) local-image-test publish-ghcr native-cli;

default = nativelink;

nativelink-worker-lre-cc = createWorker pkgs.lre.lre-cc.image;
Expand Down Expand Up @@ -444,13 +439,13 @@
pkgs.playwright-test

# Additional tools from within our development environment.
local-image-test
build-chromium-tests
docs
generate-toolchains
pkgs.lre.lre-cc.lre-cc-configs-gen
pkgs.lre.clang
native-cli
docs
build-chromium-tests
pkgs.lre.lre-cc.lre-cc-configs-gen
pkgs.nativelink-tools.local-image-test
pkgs.nativelink-tools.native-cli
]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.CoreFoundation
Expand Down Expand Up @@ -512,6 +507,7 @@
};
overlays = {
lre = import ./local-remote-execution/overlays/default.nix {inherit nix2container;};
tools = import ./tools/public/default.nix {inherit nix2container;};
};
};
}
4 changes: 2 additions & 2 deletions tools/create-worker.nix → tools/public/create-worker.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
bash,
buildEnv,
buildImage,
nix2container,
coreutils,
gnused,
lib,
Expand Down Expand Up @@ -76,7 +76,7 @@ in
# added and set as entrypoint. This allows arbitrary base images to be
# "enriched" with nativelink to create worker images for cloud deployments.
image:
buildImage {
nix2container.buildImage {
name = "nativelink-worker-${image.imageName}";
fromImage = image;
maxLayers = 20;
Expand Down
14 changes: 14 additions & 0 deletions tools/public/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{nix2container}: final: _prev: {
inherit (nix2container.packages.${final.system}) nix2container;

# Note: Only put tools here that should be usable from external flakes.
nativelink-tools = {
local-image-test = final.callPackage ./local-image-test.nix {};
publish-ghcr = final.callPackage ./publish-ghcr.nix {};
native-cli = final.callPackage ../../native-cli/default.nix {};

lib = {
createWorker = import ./create-worker.nix;
};
};
}
File renamed without changes.
File renamed without changes.

0 comments on commit 4e00120

Please sign in to comment.