Skip to content

Commit

Permalink
Move most devbox packages to "latest" (gravitational#30295)
Browse files Browse the repository at this point in the history
* Fix init_hook for Fish users

* Move development tools to "latest"

* Use Buf and OpenSSL formulas

* Use rust and yarn formulas

* Bump Go version

* Update lock files
  • Loading branch information
codingllama authored Aug 10, 2023
1 parent a88ceed commit 55eb8bd
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 192 deletions.
88 changes: 1 addition & 87 deletions build.assets/flake/flake.lock

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

55 changes: 12 additions & 43 deletions build.assets/flake/flake.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright 2023 Gravitational, Inc.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -23,27 +23,20 @@
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/8ad5e8132c5dcf977e308e7bf5517cc6cc0bf7d8"; # general packages
rust-overlay.url = "github:oxalica/rust-overlay";


# Linting dependencies
helmPkgs.url = "github:nixos/nixpkgs/8ad5e8132c5dcf977e308e7bf5517cc6cc0bf7d8"; # helm 3.11.1

# libbpf dependencies.
libbpfPkgs.url = "github:nixos/nixpkgs/79b3d4bcae8c7007c9fd51c279a8a67acfa73a2a"; # libbpf 1.0.1

# bats dependencies.
batsPkgs.url = "github:nixos/nixpkgs/5c1ffb7a9fc96f2d64ed3523c2bdd379bdb7b471"; # bats 1.2.1
};

outputs = { self,
flake-utils,
nixpkgs,
rust-overlay,

helmPkgs,
libbpfPkgs,
batsPkgs,
}:
flake-utils.lib.eachDefaultSystem
(system:
Expand All @@ -54,16 +47,13 @@
nodeProtocTsVersion = "v5.0.1";
grpcToolsVersion = "1.12.4";
libpcscliteVersion = "1.9.9-teleport";
rustVersion = "1.68.0";
yarnVersion = "1.22.19";

overlays = [ (import rust-overlay) ];
overlays = [];

# Package aliases to make reusing these packages easier.
# The individual package names here have been determined by using
# https://lazamar.co.uk/nix-versions/
libbpf = libbpfPkgs.legacyPackages.${system}.libbpf;
bats = batsPkgs.legacyPackages.${system}.bats;

# pkgs is an alias for the nixpkgs at the system level. This will be used
# for general utilities.
Expand All @@ -74,7 +64,7 @@
# The helm unittest plugin.
helm-unittest = pkgs.buildGoModule rec {
name = "helm-unittest";

src = pkgs.fetchFromGitHub {
owner = "vbehar";
repo = "helm3-unittest";
Expand All @@ -83,13 +73,13 @@
};

vendorSha256 = null;

postInstall = ''
install -Dm644 plugin.yaml $out/helm-unittest/plugin.yaml
mkdir "$out/helm-unittest/bin"
mv $out/bin/helm3-unittest $out/helm-unittest/bin/unittest
'';

doCheck = false;
};

Expand Down Expand Up @@ -167,49 +157,30 @@
grpc-tools = pkgs.stdenv.mkDerivation rec {
pname = "grpc-tools";
version = grpcToolsVersion;

src = pkgs.fetchFromGitHub {
owner = "grpc";
repo = "grpc-node";
rev = "grpc-tools@${grpcToolsVersion}";
fetchSubmodules = true;
sha256 = "sha256-708lBIGW5+vvSTrZHl/kc+ck7JKNXElrghIGDrMSyx8=";
};

sourceRoot = "source/packages/grpc-tools";

nativeBuildInputs = [ pkgs.cmake ];

installPhase = ''
install -Dm755 -t $out/bin grpc_node_plugin
cp grpc_node_plugin grpc_tools_node_protoc_plugin
install -Dm755 -t $out/bin grpc_tools_node_protoc_plugin
install -Dm755 -t $out/bin deps/protobuf/protoc
'';
};

rust = pkgs.rust-bin.stable.${rustVersion}.default;
# Yarn binary.
yarn = pkgs.stdenv.mkDerivation {
name = "yarn";
src = fetchTarball {
url = "https://yarnpkg.com/downloads/${yarnVersion}/yarn-v${yarnVersion}.tar.gz";
sha256 = "sha256:0jl77rl2sidsj3ym637w7g35wnv190l96n050aqlm4pyc6wi8v6p";
};
buildInputs = [
pkgs.nodejs-16_x
];
buildPhase = ''
mkdir "$out"
cp -R * "$out"
install -Dm755 -t $out/bin deps/protobuf/protoc
'';
};

conditionalBuildInputs = if pkgs.stdenv.isLinux then [
bats
libbpf
] else if pkgs.stdenv.isDarwin then [
pkgs.darwin.IOKit
Expand All @@ -232,8 +203,6 @@
helm = helm;
libpcsclite = libpcsclite;
protoc-gen-gogo = protoc-gen-gogo;
rust = rust;
yarn = yarn;
};
});
}
44 changes: 23 additions & 21 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
{
"packages": [
"[email protected]",
"[email protected]",
"github:nixos/nixpkgs/2920b6fc16a9ed5d51429e94238b28306ceda79e#buf",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"addlicense@latest",
"bash@latest",
"bats@latest",
"buf@latest",
"gci@latest",
"git@latest",
"golangci-lint@latest",
"gotestsum@latest",
"libiconvReal@latest",
"openssl@latest",
"patchelf@latest",
"python@latest",
"shellcheck@latest",
"yamllint@latest",
"zlib@latest",

"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"github:nixos/nixpkgs/b39bfdc033e1d79f2b58e1630530e5d54b19e698#openssl",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",

"path:build.assets/flake#conditional",
"path:build.assets/flake#grpc-tools",
"path:build.assets/flake#helm",
"path:build.assets/flake#libpcsclite",
"path:build.assets/flake#node-protoc-ts",
"path:build.assets/flake#protoc-gen-gogo",
"path:build.assets/flake#rust",
"path:build.assets/flake#yarn",
"bash@latest",
"git@latest"
"path:build.assets/flake#protoc-gen-gogo"
],
"shell": {
"init_hook": [
"export TELEPORT_DEVBOX=1",
"export PATH=\"$HOME/.cargo/bin:$PATH\"",
"unset GOROOT"
"type unset 2>/dev/null && unset GOROOT"
]
},
"nixpkgs": {
Expand Down
Loading

0 comments on commit 55eb8bd

Please sign in to comment.