mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-22 10:10:45 -06:00
Compare commits
1 commit
76961c1ee8
...
60721af15a
Author | SHA1 | Date | |
---|---|---|---|
|
60721af15a |
8 changed files with 45 additions and 214 deletions
88
.github/actions/nix/action.yml
vendored
88
.github/actions/nix/action.yml
vendored
|
@ -1,88 +0,0 @@
|
||||||
# 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
83
.github/actions/nix/prepare.sh
vendored
|
@ -1,83 +0,0 @@
|
||||||
#!/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,14 +1,12 @@
|
||||||
name: Build NixOS (on demand)
|
name: Build NixOS (on demand)
|
||||||
|
|
||||||
# TODO: accept , style sep in hwylcli
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
hosts:
|
hosts:
|
||||||
description: 'list of hosts to build'
|
description: 'list of hosts to build'
|
||||||
required: true
|
required: true
|
||||||
default: 'othalan'
|
default: ',othalan,algiz'
|
||||||
# default: ',othalan,algiz'
|
|
||||||
type: string
|
type: string
|
||||||
lockFile:
|
lockFile:
|
||||||
description: 'flake.lock file'
|
description: 'flake.lock file'
|
||||||
|
@ -18,8 +16,7 @@ on:
|
||||||
inputs:
|
inputs:
|
||||||
hosts:
|
hosts:
|
||||||
description: 'list of hosts to build'
|
description: 'list of hosts to build'
|
||||||
default: 'othalan'
|
default: ',othalan,algiz'
|
||||||
# default: ',othalan,algiz'
|
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
# concurrency:
|
# concurrency:
|
||||||
|
@ -40,12 +37,29 @@ jobs:
|
||||||
host: github.com
|
host: github.com
|
||||||
private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
|
||||||
- uses: ./.github/actions/nix
|
- uses: ./.github/actions/clean-disk
|
||||||
with:
|
with:
|
||||||
attic_token: ${{ secrets.ATTIC_TOKEN }}
|
purge-packages: 'true'
|
||||||
clean: true
|
|
||||||
btrfs: 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 }}"
|
||||||
|
|
||||||
- name: write lock file
|
- name: write lock file
|
||||||
if: "${{ inputs.lockFile != '' }}"
|
if: "${{ inputs.lockFile != '' }}"
|
||||||
run: |
|
run: |
|
||||||
|
@ -56,12 +70,13 @@ jobs:
|
||||||
run: nix build . --print-build-logs
|
run: nix build . --print-build-logs
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: >
|
run: |
|
||||||
nix run .
|
nix run . \
|
||||||
--
|
-- \
|
||||||
cache
|
build --minimal \
|
||||||
--host "${{ inputs.hosts }}"
|
--host,="${{ inputs.hosts }}" \
|
||||||
--flake .
|
--flake . \
|
||||||
--debug
|
--debug \
|
||||||
--
|
-- \
|
||||||
--keep-going
|
--keep-going \
|
||||||
|
--print-build-logs
|
||||||
|
|
9
.github/workflows/update.yml
vendored
9
.github/workflows/update.yml
vendored
|
@ -69,8 +69,8 @@ jobs:
|
||||||
--host "othalan"
|
--host "othalan"
|
||||||
--flake .
|
--flake .
|
||||||
--debug
|
--debug
|
||||||
# --
|
--
|
||||||
# --print-build-logs
|
--print-build-logs
|
||||||
|
|
||||||
- name: Commit Updates
|
- name: Commit Updates
|
||||||
uses: daylin-bot/actions/commit-and-push@main
|
uses: daylin-bot/actions/commit-and-push@main
|
||||||
|
@ -126,9 +126,10 @@ jobs:
|
||||||
--debug
|
--debug
|
||||||
--
|
--
|
||||||
--keep-going
|
--keep-going
|
||||||
# --print-build-logs
|
--print-build-logs
|
||||||
--out-link current
|
--out-link current
|
||||||
|
|
||||||
|
|
||||||
- run: git checkout flake-lock
|
- run: git checkout flake-lock
|
||||||
|
|
||||||
- name: Pre-build oizys
|
- name: Pre-build oizys
|
||||||
|
@ -144,7 +145,7 @@ jobs:
|
||||||
--debug
|
--debug
|
||||||
--
|
--
|
||||||
--keep-going
|
--keep-going
|
||||||
# --print-build-logs
|
--print-build-logs
|
||||||
--out-link updated
|
--out-link updated
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
|
|
|
@ -792,16 +792,16 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_4": {
|
"nixpkgs_4": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731890469,
|
"lastModified": 1731319897,
|
||||||
"narHash": "sha256-D1FNZ70NmQEwNxpSSdTXCSklBH1z2isPR84J6DQrJGs=",
|
"narHash": "sha256-PbABj4tnbWFMfBp6OcUK5iGy1QY+/Z96ZcLpooIbuEI=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5083ec887760adfe12af64830a66807423a859a7",
|
"rev": "dc460ec76cbff0e66e269457d7b728432263166c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"ref": "nixpkgs-unstable",
|
"ref": "nixos-unstable",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
outputs = inputs: (import ./lib inputs).oizysFlake;
|
outputs = inputs: (import ./lib inputs).oizysFlake;
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
stable.url = "github:nixos/nixpkgs/nixos-24.05";
|
stable.url = "github:nixos/nixpkgs/nixos-24.05";
|
||||||
my-nixpkgs.url = "github:daylinmorgan/nixpkgs/nixos-unstable";
|
my-nixpkgs.url = "github:daylinmorgan/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
|
|
|
@ -2,19 +2,10 @@
|
||||||
(loadOverlays inputs ./.)
|
(loadOverlays inputs ./.)
|
||||||
++ [
|
++ [
|
||||||
inputs.nim2nix.overlays.default # adds buildNimPackage
|
inputs.nim2nix.overlays.default # adds buildNimPackage
|
||||||
(final: prev: {
|
(final: _prev: {
|
||||||
stable = import inputs.stable {
|
stable = import inputs.stable {
|
||||||
system = final.system;
|
system = final.system;
|
||||||
config.allowUnfree = true;
|
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,7 +4,6 @@ import ./[exec, context]
|
||||||
|
|
||||||
# localPassC is used by zippy but the additional
|
# localPassC is used by zippy but the additional
|
||||||
# module mangling on nixos somehow breaks localPassC
|
# module mangling on nixos somehow breaks localPassC
|
||||||
# https://github.com/NixOS/nixpkgs/issues/356524
|
|
||||||
when defined(amd64) and (defined(gcc) or defined(clang)):
|
when defined(amd64) and (defined(gcc) or defined(clang)):
|
||||||
{.passC: "-msse4.1 -mpclmul".}
|
{.passC: "-msse4.1 -mpclmul".}
|
||||||
|
|
||||||
|
@ -80,11 +79,7 @@ proc postGhApi(url: string, body: JsonNode) =
|
||||||
except:
|
except:
|
||||||
errorQuit "failed to get response code"
|
errorQuit "failed to get response code"
|
||||||
|
|
||||||
proc getInProgressRun(
|
proc getInProgressRun(workflow: string, timeout: int = 5000): (GhWorkflowRun, bool) =
|
||||||
workflow: string,
|
|
||||||
timeout: int = 10000
|
|
||||||
): (GhWorkflowRun, bool) =
|
|
||||||
## wait up to 10 seconds to try to fetch ongoing run url
|
|
||||||
let
|
let
|
||||||
start = now()
|
start = now()
|
||||||
timeoutDuration = initDuration(milliseconds = timeout)
|
timeoutDuration = initDuration(milliseconds = timeout)
|
||||||
|
|
Loading…
Reference in a new issue