Skip to content

Commit

Permalink
Samsung/WSL2
Browse files Browse the repository at this point in the history
  • Loading branch information
573 committed Jul 24, 2023
1 parent 8278a92 commit c1d0db6
Show file tree
Hide file tree
Showing 205 changed files with 6,098 additions and 8,476 deletions.
60 changes: 0 additions & 60 deletions .agenix.toml

This file was deleted.

14 changes: 0 additions & 14 deletions .editorconfig

This file was deleted.

3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
*.age binary diff=age
# Convert to LF line endings on checkout.
*.sh text eol=lf
*.nix text eol=lf
102 changes: 15 additions & 87 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,76 +22,22 @@ jobs:
matrix:
system:
- aarch64
- x86_64
nix-command:
- fmt -- --check
- eval .#apps.$_system.nixos-shell.program
- eval .#apps.$_system.setup.program

include:
- nix-command: develop .#jdk8 --profile profile
system: x86_64
- nix-command: develop .#jdk11 --profile profile
system: x86_64
- nix-command: develop .#jdk17 --profile profile
system: x86_64
- nix-command: develop .#php74 --profile profile
system: x86_64
- nix-command: develop .#php80 --profile profile
system: x86_64
- nix-command: develop .#php81 --profile profile
system: x86_64

- nix-command: build .#homeConfigurations."tobias@gamer".activationPackage
system: x86_64
- nix-command: build .#homeConfigurations."tobhap@M386".activationPackage
system: x86_64
deploy-agent: M386
deploy-args: --async

- nix-command: build .#nixOnDroidConfigurations.oneplus5.activationPackage --impure
- nix-command: build .#nixOnDroidConfigurations.sams9.activationPackage --impure --print-build-logs --log-lines 9999 --accept-flake-config
system: aarch64

- nix-command: build .#nixosConfigurations.argon.config.system.build.toplevel
system: aarch64
deploy-agent: argon
- nix-command: build .#nixosConfigurations.krypton.config.system.build.toplevel
system: x86_64
deploy-agent: krypton
- nix-command: build .#nixosConfigurations.neon.config.system.build.toplevel
system: x86_64
deploy-agent: neon
deploy-agent: sams9
deploy-args: --async
- nix-command: build .#nixosConfigurations.xenon.config.system.build.toplevel
system: aarch64
deploy-agent: xenon

- nix-command: build .#packages.$_system.rpi-firmware
system: aarch64
- nix-command: build .#packages.$_system.rpi-image
system: aarch64
- nix-command: build .#packages.$_system.installer-image
system: x86_64

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}

- name: Install nix
uses: cachix/install-nix-action@v20
with:
extra_nix_config: |
keep-going = true
show-trace = true
- name: Setup cachix
uses: cachix/cachix-action@v12
with:
name: gerschtli
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Build command (aarch64)
if: matrix.system == 'aarch64'
# FIXME: use upstream once --tty is removed
Expand All @@ -100,7 +46,6 @@ jobs:
with:
arch: aarch64
distro: alpine_latest
githubToken: ${{ github.token }}
dockerRunArgs: --volume /nix:/nix
install: |
apk --no-cache add curl git xz
Expand All @@ -109,17 +54,17 @@ jobs:
_system: ${{ matrix.system }}-linux
CACHIX_ACTIVATE_TOKEN: ${{ secrets.CACHIX_ACTIVATE_TOKEN || 'no-value' }}
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
mkdir -p /home/ci/.config/nix
cat <<EOF > /home/ci/.config/nix/nix.conf
experimental-features = nix-command flakes
extra-experimental-features = flakes
accept-flake-config = true
keep-going = true
show-trace = true
access-tokens = github.com=$GITHUB_TOKEN
EOF
chown --recursive ci:ci /nix /home/ci
Expand All @@ -137,6 +82,7 @@ jobs:
--fail \
--location \
"https://nixos.org/nix/install"
# "https://releases.nixos.org/nix/nix-2.14.1/install"
su ci -c "sh /tmp/install --no-channel-add --no-daemon"
rm /tmp/install
Expand All @@ -145,7 +91,7 @@ jobs:
su ci -c ". /home/ci/.nix-profile/etc/profile.d/nix.sh; $*"
}
# FIXME: setting build-hook is needed because default hook `nix __build-remote` is not available
# FIXME: setting build-hook is needed because default hook `nix __build-remote` is not available - NixOS/nix#7217
function build_hook() {
local nix_path="$(run which nix)"
echo "${nix_path/bin\/nix/libexec/nix/build-remote}"
Expand All @@ -158,50 +104,32 @@ jobs:
run cachix --version
run cachix use gerschtli
run cachix use nix-on-droid
run cachix use 573-bc
run cachix use nix-community
run cachix use tweag-jupyter
run cachix use coq
run cachix use nixpkgs-ruby
echo "::group::Build command"
run git config --global --add safe.directory "$(pwd)"
run nix ${{ matrix.nix-command }}
${{ github.ref == 'refs/heads/master' && inputs.branch == '' && matrix.deploy-agent &&
# FIXME I left the inputs.branch == '' clause off on purpose to test what's its' semantics
${{ github.ref == 'refs/heads/wsl2' && matrix.deploy-agent &&
format(
'
echo "::group::Build spec"
spec="$(run nix build --print-out-paths ".#cachix-deploy-spec-{0}")"
spec="$(run nix build --print-out-paths ".#cachix-deploy-spec-{0}" --impure)"
echo "::group::Upload spec"
run cachix push gerschtli "$spec"
echo "::group::Activate deployment"
run cachix deploy activate --agent "{0}" {1} "$spec"
run cachix push 573-bc "$spec"
',
matrix.deploy-agent,
matrix.deploy-args
)
|| 'echo "::group::Skip spec deploy"'
}}
- name: Build command (x86_64)
if: matrix.system == 'x86_64'
env:
_system: ${{ matrix.system }}-linux
run: nix ${{ matrix.nix-command }}

- name: Deploy cachix-agent spec (x86_64)
if: matrix.system == 'x86_64' && github.ref == 'refs/heads/master' && inputs.branch == '' && matrix.deploy-agent
env:
CACHIX_ACTIVATE_TOKEN: ${{ secrets.CACHIX_ACTIVATE_TOKEN }}
run: |
echo "::group::Build spec"
spec="$(nix build --print-out-paths ".#cachix-deploy-spec-${{ matrix.deploy-agent }}")"
echo "::group::Upload spec"
cachix push gerschtli "$spec"
echo "::group::Activate deployment"
cachix deploy activate --agent "${{ matrix.deploy-agent }}" ${{ matrix.deploy-args }} "$spec"
# vim: set sw=2:
108 changes: 22 additions & 86 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -1,95 +1,31 @@
name: Update inputs
name: update-flake-lock
on:
workflow_dispatch:
workflow_dispatch: # allows manual triggering
pull_request: # triggers on every Pull Request
schedule:
- cron: 0 0 * * 1
- cron: '0 0 * * 1'

jobs:
update:
lockfile:
runs-on: ubuntu-latest

outputs:
branch: ${{ steps.branch.outputs.branch }}
update_available: ${{ steps.changes.outputs.update_available }}

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

uses: actions/checkout@v2
- name: Install nix
uses: cachix/install-nix-action@v20

- name: Set branch name output
id: branch
run: echo "branch=ci/automatic-update-$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT

- name: Create branch locally
run: git switch -c ${{ steps.branch.outputs.branch }}

- name: Setup git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Tobias Happ"
- name: Update inputs
run: |
nix \
--option commit-lockfile-summary 'flake.inputs: automatic update' \
flake update \
--commit-lock-file
- name: Check for changes
id: changes
run: |
if git diff --exit-code origin/master...; then
echo "update_available=false" >> $GITHUB_OUTPUT
else
echo "update_available=true" >> $GITHUB_OUTPUT
fi
- name: Push changes
if: steps.changes.outputs.update_available == 'true'
run: git push --force origin ${{ steps.branch.outputs.branch }}

build:
uses: ./.github/workflows/ci.yml
needs: update
if: needs.update.outputs.update_available == 'true'
with:
branch: ${{ needs.update.outputs.branch }}
secrets:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}

merge:
runs-on: ubuntu-latest
needs:
- update
- build

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: cachix/install-nix-action@v22
with:
fetch-depth: 0

- name: Check if update branch is behind master
run: git diff origin/${{ needs.update.outputs.branch }}...origin/master --exit-code

- name: Merge update into master
run: git merge origin/${{ needs.update.outputs.branch }}

- name: Push master
run: git push origin master

- name: Delete update branch
run: git push --delete origin ${{ needs.update.outputs.branch }}

# needed for cachix agent deployments
final-build:
uses: ./.github/workflows/ci.yml
needs: merge
secrets:
CACHIX_ACTIVATE_TOKEN: ${{ secrets.CACHIX_ACTIVATE_TOKEN }}
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
extra_nix_config: |
show-trace = true
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Update flake.lock
id: update
if: ${{ github.event_name != 'pull_request' }}
uses: DeterminateSystems/update-flake-lock@v19
with:
pr-title: "Update flake.lock" # Title of PR to be created
pr-labels: | # Labels to be set on the PR
dependencies
automated
- name: Print PR number
run: echo Pull request number is ${{ steps.update.outputs.pull-request-number }}.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.*/
nixos.qcow2
result
result-*
Loading

0 comments on commit c1d0db6

Please sign in to comment.