-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ config, pkgs, lib, inputs, modulesPath, ... }: { | ||
imports = | ||
[ | ||
../incus/configuration.nix | ||
]; | ||
|
||
environment.systemPackages = with pkgs; [ | ||
git | ||
bazelisk-env | ||
]; | ||
|
||
networking.hostName = "bazelisk"; | ||
|
||
users.users.test = { | ||
isNormalUser = true; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
|
||
if [ ! -e /tmp/mgit ]; then | ||
git clone git@ci.mgit.at:mgit/mgit /tmp/mgit | ||
fi | ||
incus exec bazelisk -- rm -rf /home/test/mgit | ||
incus exec bazelisk -- rm -rf /home/test/.cache | ||
incus file push /tmp/mgit bazelisk/home/test -r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
cd "$(dirname "$(readlink -f "$0")")" | ||
BASE=$(git rev-parse --show-toplevel) | ||
|
||
incus launch images:nixos/unstable bazelisk -c security.nesting=true | ||
incus config device add bazelisk nixos-common disk "source=$BASE" "path=/etc/nixos" | ||
sleep 10s # allow it some time to boot | ||
incus exec bazelisk -- nix shell --extra-experimental-features "nix-command flakes" nixpkgs#git --command git config --global --add safe.directory /etc/nixos || true | ||
incus exec bazelisk -- nix shell --extra-experimental-features "nix-command flakes" nixpkgs#git --command nixos-rebuild switch --flake /etc/nixos#bazelisk || true | ||
bash reset.sh | ||
incus restart bazelisk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
cd "$(dirname "$(readlink -f "$0")")" | ||
BASE=$(git rev-parse --show-toplevel) | ||
|
||
incus exec bazelisk -- su test -l -c "USE_SHELL=1 bazelisk-env" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
cd "$(dirname "$(readlink -f "$0")")" | ||
BASE=$(git rev-parse --show-toplevel) | ||
|
||
incus exec bazelisk -- nixos-rebuild switch | ||
incus restart bazelisk # kill old bazel processes | ||
sleep 5s # allow it some time to boot | ||
incus exec bazelisk -- sh -c "cd /home/test/mgit && su test -c 'bazelisk-env build //... --sandbox_debug --verbose_failures --keep_going'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
buildFHSUserEnv, | ||
}: | ||
|
||
buildFHSUserEnv { | ||
name = "bazelisk-env"; | ||
extraOutputsToInstall = ["include" "dev"]; # TODO: make it saner? | ||
|
||
# this is necesarry to make sure we don't inherit things from nixos that we don't want to inherit | ||
# like non-FHS bash interactive from /run/current-system/sw/bin | ||
extraBwrapArgs = [ | ||
# for debugging | ||
"--ro-bind" "/run" "/.host-run" | ||
|
||
"--tmpfs" "/run" | ||
# dns | ||
"--ro-bind" "/run/systemd" "/run/systemd" | ||
# several things, including dns | ||
"--ro-bind" "/run/nscd" "/run/nscd" | ||
]; | ||
|
||
# for go build | ||
multiArch = true; | ||
|
||
# NOTE: since /run/current-system is inaccessible | ||
# EVERY required tool must be specified here | ||
targetPkgs = pkgs: with pkgs; [ | ||
# include no more than this | ||
# crt1.o is already taken care of by buildFHSEnv.nix | ||
gcc_multi.out | ||
binutils | ||
pkg-config | ||
python3 | ||
coreutils-full # is not multi since takes forever to build and no cache available | ||
bazelisk | ||
git | ||
which | ||
python3 | ||
patch | ||
iputils | ||
host | ||
]; | ||
|
||
# everything that we need both 64bit and 32bit versions of | ||
multiPkgs = pkgs: with pkgs; [ | ||
zlib | ||
]; | ||
|
||
profile = '' | ||
export BAZELISK_ENV=1 | ||
export CC=$(which gcc) | ||
CMD=bazelisk | ||
if [ -v USE_SHELL ]; then | ||
CMD="/usr/bin/bash" | ||
fi | ||
''; | ||
|
||
runScript = "$CMD"; # $@ will already be appended by nix | ||
} |