Skip to content

Commit

Permalink
refactor(nixery): Adapt Nix build instructions for readTree
Browse files Browse the repository at this point in the history
This does not fully change the build structure of Nixery to be
depot-compatible yet, but should allow most targets to be built in
depot CI.

This contains some hacks to work around surface incompatibilities
which we'll clear away later.

Change-Id: I84e7734334abbe299983956f528c0897f49fa8c2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5485
Tested-by: BuildkiteCI
Reviewed-by: tazjin <[email protected]>
  • Loading branch information
tazjin committed Apr 20, 2022
1 parent f84e452 commit 322589f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 11 additions & 3 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

{ pkgs ? import ./nixpkgs-pin.nix
# This function header aims to provide compatibility between builds of
# Nixery taking place inside/outside of the TVL depot.
#
# In the future, Nixery will transition to using //nix/buildGo for its
# build system and this will need some major adaptations to support
# that.
{ depot ? { nix.readTree.drvTargets = x: x; }
, pkgs ? import <nixpkgs> {}
, preLaunch ? ""
, extraPackages ? []
, maxLayers ? 20
Expand All @@ -27,7 +34,8 @@ let
# Current Nixery commit - this is used as the Nixery version in
# builds to distinguish errors between deployed versions, see
# server/logs.go for details.
nixery-commit-hash = args.commitHash or pkgs.lib.commitIdFromGitRepo ./.git;
gitDir = if builtins.pathExists ./.git then ./.git else ../../.git;
nixery-commit-hash = args.commitHash or pkgs.lib.commitIdFromGitRepo gitDir;

# Go implementation of the Nixery server which implements the
# container registry interface.
Expand All @@ -46,7 +54,7 @@ let
"-ldflags=-s -w -X main.version=${nixery-commit-hash}"
];
};
in rec {
in depot.nix.readTree.drvTargets rec {
# Implementation of the Nix image building logic
nixery-prepare-image = import ./prepare-image { inherit pkgs; };

Expand Down
4 changes: 0 additions & 4 deletions nixpkgs-pin.nix

This file was deleted.

0 comments on commit 322589f

Please sign in to comment.