mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-22 01:50:44 -06:00
Compare commits
13 commits
60721af15a
...
76961c1ee8
Author | SHA1 | Date | |
---|---|---|---|
|
76961c1ee8 | ||
fd02d7a3e3 | |||
774f35bfec | |||
734c5b0f8f | |||
ec0c58792d | |||
daeb99d4e9 | |||
6a76620437 | |||
95123022bb | |||
4e30ceffb9 | |||
afa347e80e | |||
e49988ab35 | |||
9352e82219 | |||
b851d4ae01 |
8 changed files with 214 additions and 45 deletions
88
.github/actions/nix/action.yml
vendored
Normal file
88
.github/actions/nix/action.yml
vendored
Normal file
|
@ -0,0 +1,88 @@
|
|||
# adapted from https://github.com/azuwis/actions/tree/7236424fa0fdc8d82df7cd4bff831a9d2338ce9e/nix
|
||||
name: Install Nix and setup cache
|
||||
inputs:
|
||||
nix_conf:
|
||||
description: Extra nix.conf config
|
||||
default: |
|
||||
accept-flake-config = true
|
||||
build-dir = /nix/var
|
||||
experimental-features = pipe-operator
|
||||
keep-derivations = true
|
||||
keep-outputs = true
|
||||
# key:
|
||||
# description: Key to actions/cache
|
||||
# default: nix
|
||||
# install_action:
|
||||
# description: Set `nixbuild` to use nixbuild/nix-quick-install-action, otherwide use cachix/install-nix-action
|
||||
# default: nixbuild
|
||||
# use_nixpkgs_in_flake:
|
||||
# description: Use nixpkgs defined in flake.nix
|
||||
# default: true
|
||||
# nixpkgs_url:
|
||||
# description: Nixpkgs URL
|
||||
# default: https://nixos.org/channels/nixos-24.05
|
||||
clean:
|
||||
description: Clean up disk space
|
||||
default: false
|
||||
btrfs:
|
||||
description: Use BTRFS to setup RAID0
|
||||
default: false
|
||||
attic_token:
|
||||
description: token to access attic cache
|
||||
# debug:
|
||||
# description: Enable debug
|
||||
# default: false
|
||||
# debug_token:
|
||||
# default: ${{ github.token }}
|
||||
# description: Set github token for gh cli
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- shell: bash
|
||||
env:
|
||||
CLEAN: ${{ inputs.clean }}
|
||||
BTRFS: ${{ inputs.btrfs }}
|
||||
run: exec ${{ github.action_path }}/prepare.sh
|
||||
|
||||
- uses: DeterminateSystems/nix-installer-action@v15
|
||||
with:
|
||||
source-url: https://install.lix.systems/lix/lix-installer-x86_64-linux
|
||||
extra-conf: ${{ inputs.nix_conf }}
|
||||
|
||||
- name: Install and login to attic cache
|
||||
shell: bash
|
||||
run: |
|
||||
nix profile install "nixpkgs#attic-client"
|
||||
attic login oizys https://attic.dayl.in "${{ inputs.attic_token}}"
|
||||
|
||||
# - name: Nix restore pre
|
||||
# shell: bash
|
||||
# env:
|
||||
# CACHE_KEY: ${{ inputs.key }}
|
||||
# run: exec ${{ github.action_path }}/restore.sh pre
|
||||
# - uses: actions/cache/restore@v4
|
||||
# with:
|
||||
# key: ${{ env.CACHE_KEY }}-${{ runner.os }}-${{ runner.arch }}-${{ env.CACHE_TIMESTAMP }}
|
||||
# restore-keys: |
|
||||
# ${{ env.CACHE_KEY }}-${{ runner.os }}-${{ runner.arch }}
|
||||
# path: |
|
||||
# /nix/store
|
||||
# /nix/var/nix/db
|
||||
# /nix/var/nix/gcroots
|
||||
# /nix/var/nix/profiles
|
||||
# ~/.cache/nix
|
||||
# ~/.local/state/nix
|
||||
# ~/.nix-channels
|
||||
# ~/.nix-defexpr
|
||||
# - name: Nix restore post
|
||||
# shell: bash
|
||||
# env:
|
||||
# USE_NIXPKGS_IN_FLAKE: ${{ inputs.use_nixpkgs_in_flake }}
|
||||
# NIXPKGS_URL: ${{ inputs.nixpkgs_url }}
|
||||
# run: exec ${{ github.action_path }}/restore.sh post
|
||||
# - name: Debug
|
||||
# if: ${{ inputs.debug == true || inputs.debug == 'true' || inputs.debug == 'nopause' }}
|
||||
# shell: bash
|
||||
# env:
|
||||
# GH_TOKEN: ${{ inputs.debug_token }}
|
||||
# run: exec ${{ github.action_path }}/debug.sh "${{ inputs.debug }}"
|
83
.github/actions/nix/prepare.sh
vendored
Executable file
83
.github/actions/nix/prepare.sh
vendored
Executable file
|
@ -0,0 +1,83 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
case "$RUNNER_OS" in
|
||||
Linux)
|
||||
if [ "$CLEAN" = true ]; then
|
||||
echo "Disk clean, before:"
|
||||
df -h -x tmpfs
|
||||
sudo rm -rf \
|
||||
/etc/skel/.cargo \
|
||||
/etc/skel/.dotnet \
|
||||
/etc/skel/.rustup \
|
||||
/home/runner/.cargo \
|
||||
/home/runner/.dotnet \
|
||||
/home/runner/.rustup \
|
||||
/home/runneradmin/.cargo \
|
||||
/home/runneradmin/.dotnet \
|
||||
/home/runneradmin/.rustup \
|
||||
/opt/az \
|
||||
/opt/google \
|
||||
/opt/hostedtoolcache \
|
||||
/opt/microsoft \
|
||||
/opt/pipx \
|
||||
/root/.sbt \
|
||||
/usr/lib/google-cloud-sdk \
|
||||
/usr/lib/jvm \
|
||||
/usr/local \
|
||||
/usr/share/az_* \
|
||||
/usr/share/dotnet \
|
||||
/usr/share/miniconda \
|
||||
/usr/share/swift
|
||||
docker image prune --all --force >/dev/null
|
||||
echo
|
||||
echo "After:"
|
||||
df -h -x tmpfs
|
||||
echo
|
||||
fi
|
||||
if [ "$BTRFS" = true ]; then
|
||||
echo "Make /nix BTRFS RAID0 from /btrfs and /mnt/btrfs"
|
||||
sudo touch /btrfs /mnt/btrfs
|
||||
sudo chmod 600 /btrfs /mnt/btrfs
|
||||
sudo fallocate --zero-range --length "$(($(df --block-size=1 --output=avail / | sed -n 2p) - 2147483648))" /btrfs
|
||||
sudo fallocate --zero-range --length "$(df --block-size=1 --output=avail /mnt | sed -n 2p)" /mnt/btrfs
|
||||
sudo losetup /dev/loop6 /btrfs
|
||||
sudo losetup /dev/loop7 /mnt/btrfs
|
||||
sudo mkfs.btrfs --data raid0 /dev/loop6 /dev/loop7
|
||||
sudo mkdir /nix
|
||||
sudo mount -t btrfs -o compress=zstd /dev/loop6 /nix
|
||||
sudo chown "${RUNNER_USER}:" /nix
|
||||
elif [ "$(findmnt -bno size /mnt)" -gt 20000000000 ]; then
|
||||
df -h -x tmpfs
|
||||
echo "/mnt is large, bind mount /mnt/nix"
|
||||
# sudo install -d -o "$RUNNER_USER" /mnt/nix /nix
|
||||
# issue with determinate installer?
|
||||
sudo install -d /mnt/nix /nix
|
||||
sudo mount --bind /mnt/nix /nix
|
||||
fi
|
||||
;;
|
||||
macOS)
|
||||
if [ "$CLEAN" = true ]; then
|
||||
echo "Disk clean, before:"
|
||||
df -h /
|
||||
sudo rm -rf \
|
||||
/Applications/Xcode_* \
|
||||
/Library/Developer/CoreSimulator \
|
||||
/Library/Frameworks \
|
||||
/Users/runner/.dotnet \
|
||||
/Users/runner/.rustup \
|
||||
/Users/runner/Library/Android \
|
||||
/Users/runner/Library/Caches \
|
||||
/Users/runner/Library/Developer/CoreSimulator \
|
||||
/Users/runner/hostedtoolcache
|
||||
echo
|
||||
echo "After:"
|
||||
df -h /
|
||||
fi
|
||||
# This save about 110G disk space, and take about 0.6s
|
||||
sudo rm -rf \
|
||||
/Library/Developer/CoreSimulator \
|
||||
/Users/runner/Library/Developer/CoreSimulator
|
||||
# Disable MDS service on macOS
|
||||
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist || true
|
||||
;;
|
||||
esac
|
51
.github/workflows/build.yml
vendored
51
.github/workflows/build.yml
vendored
|
@ -1,12 +1,14 @@
|
|||
name: Build NixOS (on demand)
|
||||
|
||||
# TODO: accept , style sep in hwylcli
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
hosts:
|
||||
description: 'list of hosts to build'
|
||||
required: true
|
||||
default: ',othalan,algiz'
|
||||
default: 'othalan'
|
||||
# default: ',othalan,algiz'
|
||||
type: string
|
||||
lockFile:
|
||||
description: 'flake.lock file'
|
||||
|
@ -16,7 +18,8 @@ on:
|
|||
inputs:
|
||||
hosts:
|
||||
description: 'list of hosts to build'
|
||||
default: ',othalan,algiz'
|
||||
default: 'othalan'
|
||||
# default: ',othalan,algiz'
|
||||
type: string
|
||||
|
||||
# concurrency:
|
||||
|
@ -37,28 +40,11 @@ jobs:
|
|||
host: github.com
|
||||
private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
|
||||
- uses: ./.github/actions/clean-disk
|
||||
- uses: ./.github/actions/nix
|
||||
with:
|
||||
purge-packages: 'true'
|
||||
|
||||
- uses: DeterminateSystems/nix-installer-action@v16
|
||||
with:
|
||||
source-url: https://install.lix.systems/lix/lix-installer-x86_64-linux
|
||||
extra-conf: |
|
||||
experimental-features = pipe-operator
|
||||
accept-flake-config = true
|
||||
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@v8
|
||||
|
||||
# - name: Install and login to attic cache
|
||||
# run: |
|
||||
# nix profile install "nixpkgs#attic-client"
|
||||
# attic login oizys https://attic.dayl.in "${{ secrets.ATTIC_TOKEN }}"
|
||||
|
||||
# - uses: cachix/cachix-action@v15
|
||||
# with:
|
||||
# name: daylin
|
||||
# authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||
attic_token: ${{ secrets.ATTIC_TOKEN }}
|
||||
clean: true
|
||||
btrfs: true
|
||||
|
||||
- name: write lock file
|
||||
if: "${{ inputs.lockFile != '' }}"
|
||||
|
@ -70,13 +56,12 @@ jobs:
|
|||
run: nix build . --print-build-logs
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
nix run . \
|
||||
-- \
|
||||
build --minimal \
|
||||
--host,="${{ inputs.hosts }}" \
|
||||
--flake . \
|
||||
--debug \
|
||||
-- \
|
||||
--keep-going \
|
||||
--print-build-logs
|
||||
run: >
|
||||
nix run .
|
||||
--
|
||||
cache
|
||||
--host "${{ inputs.hosts }}"
|
||||
--flake .
|
||||
--debug
|
||||
--
|
||||
--keep-going
|
||||
|
|
9
.github/workflows/update.yml
vendored
9
.github/workflows/update.yml
vendored
|
@ -69,8 +69,8 @@ jobs:
|
|||
--host "othalan"
|
||||
--flake .
|
||||
--debug
|
||||
--
|
||||
--print-build-logs
|
||||
# --
|
||||
# --print-build-logs
|
||||
|
||||
- name: Commit Updates
|
||||
uses: daylin-bot/actions/commit-and-push@main
|
||||
|
@ -126,10 +126,9 @@ jobs:
|
|||
--debug
|
||||
--
|
||||
--keep-going
|
||||
--print-build-logs
|
||||
# --print-build-logs
|
||||
--out-link current
|
||||
|
||||
|
||||
- run: git checkout flake-lock
|
||||
|
||||
- name: Pre-build oizys
|
||||
|
@ -145,7 +144,7 @@ jobs:
|
|||
--debug
|
||||
--
|
||||
--keep-going
|
||||
--print-build-logs
|
||||
# --print-build-logs
|
||||
--out-link updated
|
||||
|
||||
- run: |
|
||||
|
|
|
@ -792,16 +792,16 @@
|
|||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1731319897,
|
||||
"narHash": "sha256-PbABj4tnbWFMfBp6OcUK5iGy1QY+/Z96ZcLpooIbuEI=",
|
||||
"lastModified": 1731890469,
|
||||
"narHash": "sha256-D1FNZ70NmQEwNxpSSdTXCSklBH1z2isPR84J6DQrJGs=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "dc460ec76cbff0e66e269457d7b728432263166c",
|
||||
"rev": "5083ec887760adfe12af64830a66807423a859a7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
outputs = inputs: (import ./lib inputs).oizysFlake;
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
stable.url = "github:nixos/nixpkgs/nixos-24.05";
|
||||
my-nixpkgs.url = "github:daylinmorgan/nixpkgs/nixos-unstable";
|
||||
|
||||
|
|
|
@ -2,10 +2,19 @@
|
|||
(loadOverlays inputs ./.)
|
||||
++ [
|
||||
inputs.nim2nix.overlays.default # adds buildNimPackage
|
||||
(final: _prev: {
|
||||
(final: prev: {
|
||||
stable = import inputs.stable {
|
||||
system = final.system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
# nixd + lix = problem, or am I just pulling in nix2.24 now?
|
||||
nixt = prev.nixt.override {
|
||||
nix = final.nixVersions.nix_2_24;
|
||||
};
|
||||
|
||||
nixd = prev.nixd.override {
|
||||
nix = final.nixVersions.nix_2_24;
|
||||
};
|
||||
})
|
||||
]
|
||||
|
|
|
@ -4,6 +4,7 @@ import ./[exec, context]
|
|||
|
||||
# localPassC is used by zippy but the additional
|
||||
# module mangling on nixos somehow breaks localPassC
|
||||
# https://github.com/NixOS/nixpkgs/issues/356524
|
||||
when defined(amd64) and (defined(gcc) or defined(clang)):
|
||||
{.passC: "-msse4.1 -mpclmul".}
|
||||
|
||||
|
@ -79,7 +80,11 @@ proc postGhApi(url: string, body: JsonNode) =
|
|||
except:
|
||||
errorQuit "failed to get response code"
|
||||
|
||||
proc getInProgressRun(workflow: string, timeout: int = 5000): (GhWorkflowRun, bool) =
|
||||
proc getInProgressRun(
|
||||
workflow: string,
|
||||
timeout: int = 10000
|
||||
): (GhWorkflowRun, bool) =
|
||||
## wait up to 10 seconds to try to fetch ongoing run url
|
||||
let
|
||||
start = now()
|
||||
timeoutDuration = initDuration(milliseconds = timeout)
|
||||
|
|
Loading…
Reference in a new issue