Skip to content

Commit

Permalink
actions: add aarch64-linux remote builder
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Sep 20, 2023
1 parent f935b09 commit e37091a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 5 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build-and-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,23 @@ jobs:
root-reserve-mb: 512
swap-size-mb: 1024
- uses: actions/checkout@v4
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
- name: Setup SSH for Nix's remote builders
run: |
cat > /root/.ssh/config <<- EOF
Host *
StrictHostKeyChecking accept-new
EOF
- uses: cachix/install-nix-action@v22
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
builders = ssh://zatsune-nixos-uk aarch64-linux
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
Expand All @@ -35,6 +48,8 @@ jobs:
nix build --print-build-logs '.#nixosConfigurations.miku-nixos.config.system.build.toplevel'
nix build --print-build-logs '.#nixosConfigurations.mirai-vps.config.system.build.toplevel'
nix build --print-build-logs '.#nixosConfigurations.sankyuu-nixos.config.system.build.toplevel'
- name: 'Build NixOS configs for: zatsune-nixos'
run: nix build --print-build-logs '.#nixosConfigurations.zatsune-nixos.config.system.build.toplevel'
build-macos:
runs-on: macos-13
steps:
Expand Down
9 changes: 8 additions & 1 deletion actions/build-and-cache.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ with constants;
steps = with steps; [
maximimizeBuildSpaceStep
checkoutStep
(installNixActionStep { })
setupTailscale
setupSshForRemoteBuilder
(installNixActionStep {
extraNixConfig = ''
builders = ssh://zatsune-nixos-uk aarch64-linux
'';
})
cachixActionStep
setDefaultGitBranchStep
(buildHomeManagerConfigurations { })
(buildNixOSConfigurations { })
(buildNixOSConfigurations { hostnames = [ "zatsune-nixos" ]; })
];
};
build-macos = {
Expand Down
1 change: 1 addition & 0 deletions actions/constants.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
maximize-build-space = "easimon/maximize-build-space@v7";
create-pull-request = "peter-evans/create-pull-request@v5";
command-output = "mathiasvr/[email protected]";
tailscale = "tailscale/github-action@v2";
};
ubuntu.runs-on = "ubuntu-latest";
macos.runs-on = "macos-13";
Expand Down
18 changes: 18 additions & 0 deletions actions/steps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,22 @@ with constants;
sudo apt-get install -q -y qemu-system-aarch64 qemu-efi binfmt-support qemu-user-static
'';
};
setupSshForRemoteBuilder = {
name = "Setup SSH for Nix's remote builders";
run = ''
cat > /root/.ssh/config <<- EOF
Host *
StrictHostKeyChecking accept-new
EOF
'';
};
setupTailscale = {
name = "Tailscale";
uses = actions.tailscale;
"with" = {
oauth-client-id = "\${{ secrets.TS_OAUTH_CLIENT_ID }}";
oauth-secret = "\${{ secrets.TS_OAUTH_SECRET }}";
tags = "tag:ci";
};
};
}
4 changes: 0 additions & 4 deletions actions/update-flakes.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
let
steps = import ./steps.nix;
constants = import ./constants.nix;
first = list: builtins.elemAt list 0;
in
with constants;
{
Expand All @@ -19,12 +18,9 @@ with constants;
(installNixActionStep { })
setDefaultGitBranchStep
cachixActionStep
# (buildNixOSConfigurations { hostnames = [ (first nixos.hostnames) ]; extraNixFlags = [ "-o /tmp/nixos_old" ]; })
updateFlakeLockStep
(buildHomeManagerConfigurations { })
(buildNixOSConfigurations { })
# (buildNixOSConfigurations { hostnames = [ (first nixos.hostnames) ]; extraNixFlags = [ "-o /tmp/nixos_new" ]; })
# (diffNixOutputs "NixOS" "/tmp/nixos_old" "/tmp/nixos_new")
(createPullRequestStep [ ])
];
};
Expand Down

0 comments on commit e37091a

Please sign in to comment.