Compare commits

..

18 commits

Author SHA1 Message Date
ec91979acb flake.lock: Update
Flake lock file updates:

• Updated input 'ghostty':
    'git+ssh://git@github.com/ghostty-org/ghostty?ref=refs/heads/main&rev=4853597cd9829e622be2c3628dc748407c27c423' (2024-11-14)
  → 'git+ssh://git@github.com/ghostty-org/ghostty?ref=refs/heads/main&rev=e54ae31d1cf1816f5b9fb7e1fb77d6537dabace6' (2024-11-18)
• Updated input 'hyprland':
    'git+https://github.com/hyprwm/Hyprland/?ref=refs/heads/main&rev=098e491a43e8b26f4382b48651a4131464bf6a2f' (2024-11-15)
  → 'git+https://github.com/hyprwm/Hyprland/?ref=refs/heads/main&rev=df9ff4489973afa9e29bb94ac47c946db745b460' (2024-11-18)
• Updated input 'hyprland/aquamarine':
    'github:hyprwm/aquamarine/3b00e96f90cb0040de6d88ad99bf5f4d443f0c59' (2024-11-13)
  → 'github:hyprwm/aquamarine/b31a6a4da8199ae3489057db7d36069a70749a56' (2024-11-16)
• Updated input 'hyprland/hyprutils':
    'github:hyprwm/hyprutils/315fba5d21d87ddb756d4bebdb49f99d86b0ffe8' (2024-11-13)
  → 'github:hyprwm/hyprutils/e911361a687753bbbdfe3b6a9eab755ecaf1d9e1' (2024-11-15)
• Updated input 'hyprland/nixpkgs':
    'github:NixOS/nixpkgs/76612b17c0ce71689921ca12d9ffdc9c23ce40b2' (2024-11-09)
  → 'github:NixOS/nixpkgs/5e4fbfb6b3de1aa2872b76d49fafc942626e2add' (2024-11-15)
• Updated input 'hyprland/xdph':
    'github:hyprwm/xdg-desktop-portal-hyprland/09b23cef06fe248e61cec8862c04b9bcb62f4b6d' (2024-11-04)
  → 'github:hyprwm/xdg-desktop-portal-hyprland/8070f36deec723de71e7557441acb17e478204d3' (2024-11-15)
• Updated input 'lix':
    '43777939eb.tar.gz?narHash=sha256-1LGkwq9g/BfM0JuZmWPYwBX5RiqIpW/BxXcsLwkVcGg%3D&rev=43777939eb2253596ff822771929a8820916fb29' (2024-11-12)
  → 'c859d03013.tar.gz?narHash=sha256-bq21I1EjXJa/s5Rra9J9ot2NkPCnI0F5uNPurwYLdpE%3D&rev=c859d03013712b349d82ee6223948d6d03e63a8d' (2024-11-15)
• Updated input 'nix-index-database':
    'github:nix-community/nix-index-database/40d882b55e89add1ded379cc99edaab24983d6d9' (2024-11-14)
  → 'github:nix-community/nix-index-database/bdba246946fb079b87b4cada4df9b1cdf1c06132' (2024-11-17)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/3a7690c5fe0ecfceeddbf09f8642dca424d29793' (2024-11-15)
  → 'github:nix-community/nixpkgs-wayland/8cfa4547f95836136691e10493f18155694f198a' (2024-11-18)
• Updated input 'nixpkgs-wayland/lib-aggregate':
    'github:nix-community/lib-aggregate/902e1bb3c2ae0f051ff98e4e3eac247f7e6ca392' (2024-11-14)
  → 'github:nix-community/lib-aggregate/7a1d37b2b16f32536628df9cea6a2003d79a49f9' (2024-11-17)
• Updated input 'nixpkgs-wayland/lib-aggregate/nixpkgs-lib':
    'github:nix-community/nixpkgs.lib/e04234d263750db01c78a412690363dc2226e68a' (2024-11-10)
  → 'github:nix-community/nixpkgs.lib/b9f04e3cf71c23bea21d2768051e6b3068d44734' (2024-11-17)
• Updated input 'nixpkgs-wayland/nix-eval-jobs':
    'github:nix-community/nix-eval-jobs/f2ccb7e2d80601fb43807c36f14703f2342420f3' (2024-11-14)
  → 'github:nix-community/nix-eval-jobs/d926bcd5206c0b7afe47bed92557c8cd5e882b36' (2024-11-15)
• Updated input 'nixpkgs-wayland/nixpkgs':
    'github:nixos/nixpkgs/dc460ec76cbff0e66e269457d7b728432263166c' (2024-11-11)
  → 'github:nixos/nixpkgs/5e4fbfb6b3de1aa2872b76d49fafc942626e2add' (2024-11-15)
• Updated input 'stable':
    'github:nixos/nixpkgs/689fed12a013f56d4c4d3f612489634267d86529' (2024-11-12)
  → 'github:nixos/nixpkgs/e8c38b73aeb218e27163376a2d617e61a2ad9b59' (2024-11-16)
2024-11-18 19:30:07 +00:00
38875c732e
remove comment 2024-11-18 13:27:39 -06:00
72a6de5f9f
use nix action on update 2024-11-18 13:06:08 -06:00
f16208b69e
final print 2024-11-18 12:54:30 -06:00
10ec087e7b
determinate permissions issue again 2024-11-18 12:49:37 -06:00
fd02d7a3e3
try cleaning 2024-11-18 12:47:10 -06:00
774f35bfec
workaround determinate installer 2024-11-18 12:20:29 -06:00
734c5b0f8f
+x 2024-11-18 12:15:33 -06:00
ec0c58792d
add bash 2024-11-18 12:14:43 -06:00
daeb99d4e9
add token to action 2024-11-18 12:11:04 -06:00
6a76620437
generalized nix ci action 2024-11-18 12:07:29 -06:00
95123022bb
fix overlay 2024-11-18 11:50:38 -06:00
4e30ceffb9
increase ci timeout 2024-11-18 11:39:58 -06:00
afa347e80e
fix build 2024-11-18 11:39:52 -06:00
e49988ab35
overlay style fix 2024-11-18 11:34:27 -06:00
9352e82219
modernize build ci 2024-11-18 11:34:15 -06:00
b851d4ae01
get crazy and use nixpkgs 2024-11-18 11:14:23 -06:00
dd5ee96b87
add message with workflow url 2024-11-15 15:37:55 -06:00
8 changed files with 311 additions and 147 deletions

88
.github/actions/nix/action.yml vendored Normal file
View 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 }}"

87
.github/actions/nix/prepare.sh vendored Executable file
View file

@ -0,0 +1,87 @@
#!/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
# issue with determinate installer?
# 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
echo "Final:"
df -h -x tmpfs
echo
;;
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

View file

@ -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@v15
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

View file

@ -28,27 +28,12 @@ jobs:
private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: daylin-bot/actions/setup@main
- uses: ./.github/actions/clean-disk
- uses: ./.github/actions/nix
with:
attic_token: ${{ secrets.ATTIC_TOKEN }}
- run: git checkout -B flake-lock
- uses: DeterminateSystems/nix-installer-action@v15
with:
source-url: https://install.lix.systems/lix/lix-installer-x86_64-linux
extra-conf: |
experimental-features = pipe-operator
accept-flake-config = true
- 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: Update nix flake
run: |
nix flake update --commit-lock-file
@ -69,8 +54,6 @@ jobs:
--host "othalan"
--flake .
--debug
--
--print-build-logs
- name: Commit Updates
uses: daylin-bot/actions/commit-and-push@main
@ -101,21 +84,16 @@ jobs:
host: github.com
private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: DeterminateSystems/nix-installer-action@v15
- uses: daylin-bot/actions/setup@main
- uses: ./.github/actions/nix
with:
source-url: https://install.lix.systems/lix/lix-installer-x86_64-linux
extra-conf: |
experimental-features = pipe-operator
accept-flake-config = true
- uses: ./.github/actions/clean-disk
with:
purge-packages: 'true'
attic_token: ${{ secrets.ATTIC_TOKEN }}
clean: true
btrfs: true
- name: Pre-build oizys
run: nix build .
- name: Build
run: >
nix run .
@ -126,10 +104,8 @@ jobs:
--debug
--
--keep-going
--print-build-logs
--out-link current
- run: git checkout flake-lock
- name: Pre-build oizys
@ -145,7 +121,6 @@ jobs:
--debug
--
--keep-going
--print-build-logs
--out-link updated
- run: |

View file

@ -20,11 +20,11 @@
]
},
"locked": {
"lastModified": 1731496216,
"narHash": "sha256-nlQrNN+tmJ+iP6Ck/czwZI0Hxz3oNvUyGkVruxJwgwA=",
"lastModified": 1731774881,
"narHash": "sha256-1Dxryiw8u2ejntxrrv3sMtIE8WHKxmlN4KeH+uMGbmc=",
"owner": "hyprwm",
"repo": "aquamarine",
"rev": "3b00e96f90cb0040de6d88ad99bf5f4d443f0c59",
"rev": "b31a6a4da8199ae3489057db7d36069a70749a56",
"type": "github"
},
"original": {
@ -240,11 +240,11 @@
"zig": "zig"
},
"locked": {
"lastModified": 1731706414,
"narHash": "sha256-9Er1h1w6lXg6hQJnfLVacs6e+naamMyRPKijdBt8gFA=",
"lastModified": 1731947012,
"narHash": "sha256-OL7pQ/dMLC1Ek+rkXHEXpvx+UBO1Pbo1kTVe2kmcYsY=",
"ref": "refs/heads/main",
"rev": "7dbcde72863a09405bf456fcfc41f878330a64f9",
"revCount": 7987,
"rev": "e54ae31d1cf1816f5b9fb7e1fb77d6537dabace6",
"revCount": 8018,
"type": "git",
"url": "ssh://git@github.com/ghostty-org/ghostty"
},
@ -318,11 +318,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1731631654,
"narHash": "sha256-a6gy39yki4mX/Oj83aG08nNntXxXhM1wjksNXGZ8x5c=",
"lastModified": 1731945258,
"narHash": "sha256-N7uJSSMqHzwH4uahb+Uw3sADVp3XdLfqkP2T144gnFk=",
"ref": "refs/heads/main",
"rev": "098e491a43e8b26f4382b48651a4131464bf6a2f",
"revCount": 5456,
"rev": "df9ff4489973afa9e29bb94ac47c946db745b460",
"revCount": 5475,
"submodules": true,
"type": "git",
"url": "https://github.com/hyprwm/Hyprland/"
@ -438,11 +438,11 @@
]
},
"locked": {
"lastModified": 1731518387,
"narHash": "sha256-aZZw1ZvTMLkcA6udlvkA3hrCkuipoWLy8s/JNnIclxY=",
"lastModified": 1731702627,
"narHash": "sha256-+JeO9gevnXannQxMfR5xzZtF4sYmSlWkX/BPmPx0mWk=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "315fba5d21d87ddb756d4bebdb49f99d86b0ffe8",
"rev": "e911361a687753bbbdfe3b6a9eab755ecaf1d9e1",
"type": "github"
},
"original": {
@ -482,11 +482,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1731586450,
"narHash": "sha256-upNRIVk5PmBPJ307djkiowhHOx8Dqwb5bpM4XNJH4Ek=",
"lastModified": 1731845570,
"narHash": "sha256-5reOtlm18XLnh3ezruPOg2wQO+MB7ztsFaIzSUAzeh8=",
"owner": "nix-community",
"repo": "lib-aggregate",
"rev": "902e1bb3c2ae0f051ff98e4e3eac247f7e6ca392",
"rev": "7a1d37b2b16f32536628df9cea6a2003d79a49f9",
"type": "github"
},
"original": {
@ -498,11 +498,11 @@
"lix": {
"flake": false,
"locked": {
"lastModified": 1731416517,
"narHash": "sha256-1LGkwq9g/BfM0JuZmWPYwBX5RiqIpW/BxXcsLwkVcGg=",
"rev": "43777939eb2253596ff822771929a8820916fb29",
"lastModified": 1731683711,
"narHash": "sha256-bq21I1EjXJa/s5Rra9J9ot2NkPCnI0F5uNPurwYLdpE=",
"rev": "c859d03013712b349d82ee6223948d6d03e63a8d",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/43777939eb2253596ff822771929a8820916fb29.tar.gz?rev=43777939eb2253596ff822771929a8820916fb29"
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/c859d03013712b349d82ee6223948d6d03e63a8d.tar.gz?rev=c859d03013712b349d82ee6223948d6d03e63a8d"
},
"original": {
"type": "tarball",
@ -657,11 +657,11 @@
]
},
"locked": {
"lastModified": 1731593150,
"narHash": "sha256-FvksinoI2Y6kuwH+cKBu1oDA8uPGfoRqgtQV6O8GDc4=",
"lastModified": 1731814505,
"narHash": "sha256-l9ryrx1Twh08a+gxrMGM9O/aZKEimZfa6sZVyPCImgI=",
"owner": "nix-community",
"repo": "nix-index-database",
"rev": "40d882b55e89add1ded379cc99edaab24983d6d9",
"rev": "bdba246946fb079b87b4cada4df9b1cdf1c06132",
"type": "github"
},
"original": {
@ -692,11 +692,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1731139594,
"narHash": "sha256-IigrKK3vYRpUu+HEjPL/phrfh7Ox881er1UEsZvw9Q4=",
"lastModified": 1731676054,
"narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "76612b17c0ce71689921ca12d9ffdc9c23ce40b2",
"rev": "5e4fbfb6b3de1aa2872b76d49fafc942626e2add",
"type": "github"
},
"original": {
@ -708,11 +708,11 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1731200463,
"narHash": "sha256-qDaAweJjdFbVExqs8aG27urUgcgKufkIngHW3Rzustg=",
"lastModified": 1731805462,
"narHash": "sha256-yhEMW4MBi+IAyEJyiKbnFvY1uARyMKJpLUhkczI49wk=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "e04234d263750db01c78a412690363dc2226e68a",
"rev": "b9f04e3cf71c23bea21d2768051e6b3068d44734",
"type": "github"
},
"original": {
@ -745,11 +745,11 @@
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1731684610,
"narHash": "sha256-rfb93JFID/fYO7h0Yhsot6TjbUgtEJMl6Qk212cVdOY=",
"lastModified": 1731954473,
"narHash": "sha256-iNzMvn3P/3tinhRpYQVSVukrFP22qqlQ59a9kKYN7LU=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "a3fc86160dba0a9160716cf6f1d4ff4da7a53085",
"rev": "8cfa4547f95836136691e10493f18155694f198a",
"type": "github"
},
"original": {
@ -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"
}
@ -824,11 +824,11 @@
},
"nixpkgs_6": {
"locked": {
"lastModified": 1731319897,
"narHash": "sha256-PbABj4tnbWFMfBp6OcUK5iGy1QY+/Z96ZcLpooIbuEI=",
"lastModified": 1731676054,
"narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "dc460ec76cbff0e66e269457d7b728432263166c",
"rev": "5e4fbfb6b3de1aa2872b76d49fafc942626e2add",
"type": "github"
},
"original": {
@ -938,11 +938,11 @@
},
"stable": {
"locked": {
"lastModified": 1731386116,
"narHash": "sha256-lKA770aUmjPHdTaJWnP3yQ9OI1TigenUqVC3wweqZuI=",
"lastModified": 1731797254,
"narHash": "sha256-df3dJApLPhd11AlueuoN0Q4fHo/hagP75LlM5K1sz9g=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "689fed12a013f56d4c4d3f612489634267d86529",
"rev": "e8c38b73aeb218e27163376a2d617e61a2ad9b59",
"type": "github"
},
"original": {
@ -1121,11 +1121,11 @@
]
},
"locked": {
"lastModified": 1730743262,
"narHash": "sha256-iTLqj3lU8kFehPm5tXpctzkD274t/k1nwSSq3qCWXeg=",
"lastModified": 1731703417,
"narHash": "sha256-rheDc/7C+yI+QspYr9J2z9kQ5P9F4ATapI7qyFAe1XA=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "09b23cef06fe248e61cec8862c04b9bcb62f4b6d",
"rev": "8070f36deec723de71e7557441acb17e478204d3",
"type": "github"
},
"original": {

View file

@ -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";

View file

@ -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;
};
})
]

View file

@ -1,9 +1,10 @@
import std/[httpclient,logging, os, strformat, strutils, json, tables, tempfiles]
import std/[httpclient,logging, os, strformat, strutils, json, tables, tempfiles, times]
import jsony, hwylterm, hwylterm/logging, zippy/ziparchives
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".}
@ -12,6 +13,33 @@ template withTmpDir(body: untyped): untyped =
body
removeDir tmpDir
type
GhArtifact = object
id: int
name: string
url: string
archive_download_url*: string
GhWorkflowRun = object
id*: int
node_id: string
run_number: int
event: string
status: string
conclusion: string
html_url: string
workflow_id: int
created_at*: string # use datetime?
updated_at: string # use datetime?
ListGhArtifactResponse = object
total_count: int
artifacts: seq[GhArtifact]
ListGhWorkflowResponse = object
total_count: int
workflow_runs: seq[GhWorkflowRun]
var ghToken = getEnv "GITHUB_TOKEN"
proc checkToken() {.inline.} =
@ -52,47 +80,39 @@ proc postGhApi(url: string, body: JsonNode) =
except:
errorQuit "failed to get response code"
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)
withSpinner fmt"waiting for {workflow} workflow to start":
while (now() - start) < timeoutDuration:
let response = getGhApi(fmt"https://api.github.com/repos/daylinmorgan/oizys/actions/workflows/{workflow}/runs")
let runs = fromJson(response.body, ListGhWorkflowResponse).workflow_runs
if runs[0].status == "in_progress":
spinner.stop() # cleanup
return (runs[0], true)
sleep 500
warn "timeout reached waiting for workflow to start"
proc createDispatch*(workflowFileName: string, `ref`: string) =
## https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event
var workflow =
let workflow =
if workflowFileName.endsWith(".yml") or workflowFileName.endsWith(".yaml"): workflowFileName
else: workflowFileName & ".yml"
let body = %*{"ref": `ref`}
info fmt"creating dispatch event for {workflow}"
postGhApi(
fmt"https://api.github.com/repos/daylinmorgan/oizys/actions/workflows/{workflow}/dispatches",
%*{
"ref": `ref`,
}
body
)
type
GhArtifact = object
id: int
name: string
url: string
archive_download_url*: string
GhWorkflowRun = object
id*: int
node_id: string
run_number: int
event: string
status: string
conclusion: string
html_url: string
workflow_id: int
created_at*: string # use datetime?
updated_at: string # use datetime?
ListGhArtifactResponse = object
total_count: int
artifacts: seq[GhArtifact]
ListGhWorkflowResponse = object
total_count: int
workflow_runs: seq[GhWorkflowRun]
let (run, ok) = getInProgressRun(workflow)
if ok: info "view workflow run at: " & run.html_url
proc listUpdateRuns(): seq[GhWorkflowRun] =
## get update.yml runs