-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into fix/nixpkgs_http_ar…
…chive
- Loading branch information
Showing
7 changed files
with
109 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM ubuntu:23.04 | ||
|
||
RUN apt-get update -qq && \ | ||
apt-get install openssh-server curl xz-utils sudo locales ca-certificates -y && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN mkdir -m 0755 /nix && \ | ||
groupadd -r nixbld && \ | ||
chown root /nix && \ | ||
for n in $(seq 1 10); do useradd -c "Nix build user $n" -d /var/empty -g nixbld -G nixbld -M -N -r -s "$(command -v nologin)" "nixbld$n"; done | ||
|
||
RUN curl -L https://nixos.org/nix/install | bash | ||
|
||
COPY .github/nix-server/keys . | ||
|
||
RUN cat ci.pub > $HOME/.ssh/authorized_keys | ||
|
||
RUN echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config && \ | ||
echo ". /root/.nix-profile/etc/profile.d/nix.sh" >> $HOME/.bashrc && \ | ||
ln -sf /root/.nix-profile/bin/nix-store /usr/bin/ && \ | ||
ln -sf /root/.nix-profile/bin/nix-daemon /usr/bin/ | ||
|
||
CMD ["/usr/sbin/sshd", "-D"] |
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,9 @@ | ||
Host nix-server | ||
Hostname localhost | ||
Port 2222 | ||
User root | ||
IdentityFile /home/runner/.ssh/ci | ||
|
||
Host * | ||
StrictHostKeyChecking no | ||
UserKnownHostsFile=/dev/null |
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ jobs: | |
with: | ||
access_token: ${{ github.token }} | ||
test-nixpkgs: | ||
name: Build & Test - Nixpkgs - ${{ matrix.bzlmodEnabled && 'bzlmod' || 'workspace' }} - ${{ matrix.os }} | ||
name: Build & Test - Nixpkgs - ${{ matrix.bzlmodEnabled && 'bzlmod' || 'workspace' }} ${{ matrix.withNixRemote && '- NixRemote ' || '' }}- ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
@@ -27,6 +27,9 @@ jobs: | |
bzlmodEnabled: | ||
- true | ||
- false | ||
withNixRemote: | ||
- true | ||
- false | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/[email protected] | ||
|
@@ -49,13 +52,34 @@ jobs: | |
# no-op flag to avoid "ERROR: Config value 'ci' is not defined in any .rc file" | ||
common:ci --announce_rc=false | ||
EOF | ||
- name: Start remote Nix server | ||
if: matrix.withNixRemote && matrix.os == 'ubuntu-latest' | ||
run: | | ||
# Generate temporary SSH keys. | ||
mkdir -p $HOME/.ssh | ||
mkdir -p .github/nix-server/keys | ||
ssh-keygen -t ed25519 -f .github/nix-server/keys/ci -C ci-nix-server -q -N "" | ||
docker build -t nix-server -f .github/nix-server/Dockerfile . | ||
docker run -d -p 2222:22 nix-server | ||
cp .github/nix-server/keys/* $HOME/.ssh/ | ||
sudo cp .github/nix-server/config /etc/ssh/ssh_config | ||
- name: Build & test | ||
env: | ||
BZLMOD_ENABLED: ${{ matrix.bzlmodEnabled }} | ||
NIX_REMOTE_ENABLED: matrix.withNixRemote && matrix.os == 'ubuntu-latest' | ||
run: | | ||
if [ "$NIX_REMOTE_ENABLED" = "true" ]; then | ||
echo "Setting BAZEL_NIX_REMOTE env variable" | ||
export BAZEL_NIX_REMOTE=nix-server | ||
fi | ||
nix-shell --pure \ | ||
--keep GITHUB_REPOSITORY \ | ||
--keep BZLMOD_ENABLED \ | ||
--keep BAZEL_NIX_REMOTE \ | ||
--run 'bash .github/build-and-test' | ||
test-examples: | ||
name: Build & Test - Examples | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/**/bazel-* | ||
|
||
/**/node_modules | ||
|
||
.github/nix-server/keys |
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
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