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 314 additions and 150 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) 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,algiz' default: 'othalan'
# default: ',othalan,algiz'
type: string type: string
lockFile: lockFile:
description: 'flake.lock file' description: 'flake.lock file'
@ -16,7 +18,8 @@ on:
inputs: inputs:
hosts: hosts:
description: 'list of hosts to build' description: 'list of hosts to build'
default: ',othalan,algiz' default: 'othalan'
# default: ',othalan,algiz'
type: string type: string
# concurrency: # concurrency:
@ -37,28 +40,11 @@ jobs:
host: github.com host: github.com
private-key: ${{ secrets.SSH_PRIVATE_KEY }} private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: ./.github/actions/clean-disk - uses: ./.github/actions/nix
with: with:
purge-packages: 'true' attic_token: ${{ secrets.ATTIC_TOKEN }}
clean: true
- uses: DeterminateSystems/nix-installer-action@v15 btrfs: true
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 != '' }}"
@ -70,13 +56,12 @@ jobs:
run: nix build . --print-build-logs run: nix build . --print-build-logs
- name: Build - name: Build
run: | run: >
nix run . \ nix run .
-- \ --
build --minimal \ cache
--host,="${{ inputs.hosts }}" \ --host "${{ inputs.hosts }}"
--flake . \ --flake .
--debug \ --debug
-- \ --
--keep-going \ --keep-going
--print-build-logs

View file

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

View file

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

View file

@ -4,7 +4,7 @@
outputs = inputs: (import ./lib inputs).oizysFlake; outputs = inputs: (import ./lib inputs).oizysFlake;
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-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";

View file

@ -2,10 +2,19 @@
(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;
};
}) })
] ]

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 jsony, hwylterm, hwylterm/logging, zippy/ziparchives
import ./[exec, context] 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".}
@ -12,6 +13,33 @@ template withTmpDir(body: untyped): untyped =
body body
removeDir tmpDir 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" var ghToken = getEnv "GITHUB_TOKEN"
proc checkToken() {.inline.} = proc checkToken() {.inline.} =
@ -52,47 +80,39 @@ proc postGhApi(url: string, body: JsonNode) =
except: except:
errorQuit "failed to get response code" 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) = proc createDispatch*(workflowFileName: string, `ref`: string) =
## https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event ## 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 if workflowFileName.endsWith(".yml") or workflowFileName.endsWith(".yaml"): workflowFileName
else: workflowFileName & ".yml" else: workflowFileName & ".yml"
let body = %*{"ref": `ref`}
info fmt"creating dispatch event for {workflow}" info fmt"creating dispatch event for {workflow}"
postGhApi( postGhApi(
fmt"https://api.github.com/repos/daylinmorgan/oizys/actions/workflows/{workflow}/dispatches", fmt"https://api.github.com/repos/daylinmorgan/oizys/actions/workflows/{workflow}/dispatches",
%*{ body
"ref": `ref`,
}
) )
let (run, ok) = getInProgressRun(workflow)
type if ok: info "view workflow run at: " & run.html_url
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]
proc listUpdateRuns(): seq[GhWorkflowRun] = proc listUpdateRuns(): seq[GhWorkflowRun] =
## get update.yml runs ## get update.yml runs