Compare commits

...

11 commits

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

• Updated input 'ghostty':
    'git+ssh://git@github.com/ghostty-org/ghostty?ref=refs/heads/main&rev=e54ae31d1cf1816f5b9fb7e1fb77d6537dabace6' (2024-11-18)
  → 'git+ssh://git@github.com/ghostty-org/ghostty?ref=refs/heads/main&rev=14f603e691e13cb14855a4af8e9760a578f7aefd' (2024-11-19)
• Updated input 'hyprland':
    'git+https://github.com/hyprwm/Hyprland/?ref=refs/heads/main&rev=df9ff4489973afa9e29bb94ac47c946db745b460' (2024-11-18)
  → 'git+https://github.com/hyprwm/Hyprland/?ref=refs/heads/main&rev=67cee430061626ccd73dc6d30eed9db289053608' (2024-11-19)
• Updated input 'lix':
    'c859d03013.tar.gz?narHash=sha256-bq21I1EjXJa/s5Rra9J9ot2NkPCnI0F5uNPurwYLdpE%3D&rev=c859d03013712b349d82ee6223948d6d03e63a8d' (2024-11-15)
  → 'f116608a20.tar.gz?narHash=sha256-OjrXEVD8LtZB5X7LtPCdNx4n5iZOQ2nJmpDlM/foEkI%3D&rev=f116608a20430b8484814300cdf22eebeb75a59f' (2024-11-19)
• Updated input 'lix-module':
    '691193879d.tar.gz?narHash=sha256-RNaIu43b9PoXEhW4OqXUNZKY/jezQyCYWwdv1M0VjsA%3D&rev=691193879d96bdfd1e6ab5ebcca2fadc7604cf34' (2024-11-09)
  → 'aa2846680f.tar.gz?narHash=sha256-n6dPGRlMGdL8X5gviA6ZuRfUdbdD5KiNN/BpABA5YT0%3D&rev=aa2846680fa9a2032939d720487942567fd9eb63' (2024-11-18)
• Updated input 'lix-module/flake-utils':
    'github:numtide/flake-utils/c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a' (2024-09-17)
  → 'github:numtide/flake-utils/11707dc2f618dd54ca8739b309ec4fc024de578b' (2024-11-13)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/8cfa4547f95836136691e10493f18155694f198a' (2024-11-18)
  → 'github:nix-community/nixpkgs-wayland/1e388cad31a52c4dc25613484b3591298b105935' (2024-11-19)
2024-11-19 20:18:43 +00:00
d2b28de009
stop building llm+rofi 2024-11-19 14:15:30 -06:00
cf9855ddeb
build for all hosts 2024-11-19 14:08:24 -06:00
35deff0e0d
finish gha update/ci update refactor 2024-11-19 14:07:28 -06:00
7baf2fc303
abstractions 2024-11-19 13:56:00 -06:00
8114ac1b3b
keep console logger handy to update 2024-11-19 13:55:42 -06:00
a8ce1b651e
change update 2024-11-19 13:30:45 -06:00
1bb8da0bf1
add new ci command 2024-11-19 13:17:25 -06:00
42e7de22b1
add todo 2024-11-19 12:25:45 -06:00
a86f4e9698
link the results 2024-11-19 12:11:00 -06:00
4c8fccd973
ssssh 2024-11-19 10:16:51 -06:00
10 changed files with 159 additions and 151 deletions

View file

@ -51,9 +51,11 @@ jobs:
nix run .
--
cache
--host,=",othalan,algiz"
--host,=",othalan,algiz,mannaz,naudiz"
--flake .
--debug
--
--quiet
- name: Commit Updates
uses: daylin-bot/actions/commit-and-push@main
@ -61,85 +63,9 @@ jobs:
push-args: --set-upstream --force origin flake-lock
build-full-at-once:
needs: build-minimal
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# needed to access ghostty repo for now
- name: Setup SSH
uses: MrSquaare/ssh-setup-action@v3
with:
host: github.com
private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: daylin-bot/actions/setup@main
- uses: ./.github/actions/nix
with:
attic_token: ${{ secrets.ATTIC_TOKEN }}
clean: true
btrfs: true
- name: Pre-build oizys
run: nix build .
- name: Build
run: >
nix run .
--
build
"$(nix run . -- output --host,=othalan,algiz,mannaz,naudiz --flake .)"
--flake .
--debug
--
--keep-going
--out-link current
- run: git checkout flake-lock
- name: Pre-build oizys
run: nix build .
- name: Build Updated
run: >
nix run .
--
build
"$(nix run . -- output --host,=othalan,algiz,mannaz,naudiz --flake .)"
--flake .
--debug
--
--keep-going
--out-link updated
- run: ls
# - run: |
# echo "# System Diff" >> $GITHUB_STEP_SUMMARY
# nix run "nixpkgs#nvd" -- --color always diff ./current ./updated >> summary.md
# printf '```\n%s\n```\n' "$(nix run "nixpkgs#nvd" -- diff ./current ./updated)" >> $GITHUB_STEP_SUMMARY
#
- run: df -h
# - uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.host }}-summary
# path: summary.md
#
build-full:
needs: build-minimal
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
host:
- othalan
- algiz
- mannaz
- naudiz
steps:
- name: Checkout
uses: actions/checkout@v4
@ -157,49 +83,34 @@ jobs:
- uses: ./.github/actions/nix
with:
attic_token: ${{ secrets.ATTIC_TOKEN }}
clean: true
# clean: true
btrfs: true
- name: Pre-build oizys
run: nix build .
- name: Build
- name: Build Current and Updated Systems
run: >
nix run .
--
build
"$(nix run . -- output --host "${{ matrix.host }}" --flake .)"
ci update
--host,=othalan,algiz,mannaz,naudiz
--flake .
--debug
--
--keep-going
--out-link current
- run: git checkout flake-lock
- name: Pre-build oizys
run: nix build .
- name: Build Updated
run: >
nix run .
--
build
"$(nix run . -- output --host "${{ matrix.host }}" --flake .)"
--flake .
--debug
--
--keep-going
--out-link updated
--quiet
- run: |
echo "# System Diff" >> $GITHUB_STEP_SUMMARY
nix run "nixpkgs#nvd" -- --color always diff ./current ./updated >> summary.md
printf '```\n%s\n```\n' "$(nix run "nixpkgs#nvd" -- diff ./current ./updated)" >> $GITHUB_STEP_SUMMARY
echo "# system diffs" >> $GITHUB_STEP_SUMMARY
for host in othalan algiz mannaz naudiz; do
echo "## $host" >> $GITHUB_STEP_SUMMARY
nix run "nixpkgs#nvd" -- --color always diff ./$host-current ./$host-updated >> $host-summary.md
printf '```\n%s\n```\n' "$(nix run "nixpkgs#nvd" -- diff ./$host-current ./$host-updated)" >> $GITHUB_STEP_SUMMARY
done
- run: df -h
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.host }}-summary
path: summary.md
name: summary
path: '*-summary.md'

View file

@ -165,11 +165,11 @@
"systems": "systems_3"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
@ -240,11 +240,11 @@
"zig": "zig"
},
"locked": {
"lastModified": 1731947012,
"narHash": "sha256-OL7pQ/dMLC1Ek+rkXHEXpvx+UBO1Pbo1kTVe2kmcYsY=",
"lastModified": 1732039947,
"narHash": "sha256-LgLGpeyimlCyHWzsQZ5xL0GJv+14zTVsAPTOuwL/qkA=",
"ref": "refs/heads/main",
"rev": "e54ae31d1cf1816f5b9fb7e1fb77d6537dabace6",
"revCount": 8018,
"rev": "14f603e691e13cb14855a4af8e9760a578f7aefd",
"revCount": 8023,
"type": "git",
"url": "ssh://git@github.com/ghostty-org/ghostty"
},
@ -318,11 +318,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1731945258,
"narHash": "sha256-N7uJSSMqHzwH4uahb+Uw3sADVp3XdLfqkP2T144gnFk=",
"lastModified": 1731978971,
"narHash": "sha256-P9DXCxDvjFt4aMc2x67hvSpNvSqX18X840w6cEVZXoo=",
"ref": "refs/heads/main",
"rev": "df9ff4489973afa9e29bb94ac47c946db745b460",
"revCount": 5475,
"rev": "67cee430061626ccd73dc6d30eed9db289053608",
"revCount": 5480,
"submodules": true,
"type": "git",
"url": "https://github.com/hyprwm/Hyprland/"
@ -498,11 +498,11 @@
"lix": {
"flake": false,
"locked": {
"lastModified": 1731683711,
"narHash": "sha256-bq21I1EjXJa/s5Rra9J9ot2NkPCnI0F5uNPurwYLdpE=",
"rev": "c859d03013712b349d82ee6223948d6d03e63a8d",
"lastModified": 1731992627,
"narHash": "sha256-OjrXEVD8LtZB5X7LtPCdNx4n5iZOQ2nJmpDlM/foEkI=",
"rev": "f116608a20430b8484814300cdf22eebeb75a59f",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/c859d03013712b349d82ee6223948d6d03e63a8d.tar.gz?rev=c859d03013712b349d82ee6223948d6d03e63a8d"
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/f116608a20430b8484814300cdf22eebeb75a59f.tar.gz?rev=f116608a20430b8484814300cdf22eebeb75a59f"
},
"original": {
"type": "tarball",
@ -521,11 +521,11 @@
]
},
"locked": {
"lastModified": 1731185731,
"narHash": "sha256-RNaIu43b9PoXEhW4OqXUNZKY/jezQyCYWwdv1M0VjsA=",
"rev": "691193879d96bdfd1e6ab5ebcca2fadc7604cf34",
"lastModified": 1731967274,
"narHash": "sha256-n6dPGRlMGdL8X5gviA6ZuRfUdbdD5KiNN/BpABA5YT0=",
"rev": "aa2846680fa9a2032939d720487942567fd9eb63",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/691193879d96bdfd1e6ab5ebcca2fadc7604cf34.tar.gz?rev=691193879d96bdfd1e6ab5ebcca2fadc7604cf34"
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/aa2846680fa9a2032939d720487942567fd9eb63.tar.gz?rev=aa2846680fa9a2032939d720487942567fd9eb63"
},
"original": {
"type": "tarball",
@ -745,11 +745,11 @@
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1731954473,
"narHash": "sha256-iNzMvn3P/3tinhRpYQVSVukrFP22qqlQ59a9kKYN7LU=",
"lastModified": 1732040857,
"narHash": "sha256-nwbtI77CGa6AclGOmNXKLZFboxeAJWqX0IVgT2Ezo1Y=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "8cfa4547f95836136691e10493f18155694f198a",
"rev": "1e388cad31a52c4dc25613484b3591298b105935",
"type": "github"
},
"original": {

View file

@ -33,11 +33,10 @@ hwylCli:
? "set minimal"
- m
preSub:
setupLoggers(debug)
setupLoggers()
updateContext(host, flake, debug, resetCache)
subcommands:
[build]
... "nix build"
flags:
@ -65,8 +64,23 @@ hwylCli:
nixBuildWithCache(name, args, service, jobs)
[ci]
... "builtin ci"
# current behavior adds this block twice...
# when really I want it to only happen in the lowest "subcommand"
# needs to be fixed in hwylterm
preSub:
updateContext(host, flake, debug, resetCache)
subcommands:
[update]
... "build current and updated hosts"
run:
ciUpdate(args)
[gha]
... "trigger GHA"
flags:
# make a key/value input that is passed to workflows and encoded in json
# i.e. --input:ref:main
`ref`:
T string
? "git ref/branch/tag to trigger workflow on"

View file

@ -1,6 +1,7 @@
import std/[logging, os, strformat, strutils]
from std/nativesockets import getHostname
import hwylterm, hwylterm/logging
import ./logging
type
OizysContext* = object
@ -36,6 +37,8 @@ proc updateContext*(
) =
if host.len > 0: oc.hosts = host
oc.debug = debug
if debug:
consoleLogger.levelThreshold = lvlAll
oc.resetCache = resetCache
if flake != "":
oc.flake =
@ -49,5 +52,3 @@ proc getFlake*(): string = return oc.flake
proc isDebug*(): bool = return oc.debug
proc isResetCache*(): bool = return oc.resetCache
proc isCi*(): bool = return oc.ci

View file

@ -47,7 +47,10 @@ proc runCmdCapt*(
if errstrm.readLine(line):
result.stderr.add line & '\n'
result.exitCode = peekExitCode(p)
if result.exitCode != -1: break
if result.exitCode != -1:
result.stdout.add outstrm.readAll()
result.stderr.add errstrm.readAll()
break
close p

View file

@ -137,17 +137,17 @@ proc getArtifacts(runId: int): seq[GhArtifact] =
let response = getGhApi(fmt"https://api.github.com/repos/daylinmorgan/oizys/actions/runs/{runId}/artifacts")
fromJson(response.body, ListGhArtifactResponse).artifacts
proc getUpdateSummaryArtifact(runId: int, host: string): GhArtifact =
let name = fmt"{host}-summary"
proc getUpdateSummaryArtifact(runId: int): GhArtifact =
let name = "summary"
let artifacts = getArtifacts(runId)
for artifact in artifacts:
if artifact.name == name:
return artifact
fatalQuit fmt"failed to find summary for run id: {runID}"
proc getUpdateSummaryUrl(runID: int, host: string): string =
proc getUpdateSummaryUrl(runID: int): string =
## https://api.github.com/repos/OWNER/REPO/actions/artifacts/ARTIFACT_ID/ARCHIVE_FORMAT
let artifact = getUpdateSummaryArtifact(runID, host)
let artifact = getUpdateSummaryArtifact(runID)
# httpclient was forwarding the Authorization headers,
# which confused Azure where the archive lives...
var response: Response
@ -164,20 +164,20 @@ proc getUpdateSummaryUrl(runID: int, host: string): string =
if location.len == 0: errorQuit fmt("location header missing url?")
return location[0]
proc fetchUpdateSummaryFromUrl(url: string): string =
proc fetchUpdateSummaryFromUrl(url: string, host: string): string =
withTmpDir:
let client = newHttpClient()
client.downloadFile(url, tmpDir / "summary.zip")
let reader = openZipArchive(tmpDir / "summary.zip")
try:
result = reader.extractFile("summary.md")
result = reader.extractFile(host & "-summary.md")
finally:
reader.close()
proc getUpdateSummary*(runId: int, host: string): string =
withSpinner("fetching update summary"):
let url = getUpdateSummaryUrl(runId, host)
result = fetchUpdateSummaryFromUrl(url)
let url = getUpdateSummaryUrl(runId)
result = fetchUpdateSummaryFromUrl(url, host)
type
GitRepo = object

View file

@ -24,3 +24,5 @@ comma-with-db
nix-index-with-db
python
net.conf
llm
rofi

View file

@ -23,19 +23,18 @@ proc getOizysLogPath(): string =
createDir(dataDir / "oizys")
result = dataDir / "oizys" / "oizys.log"
setLogFilter(lvlAll)
proc setupLoggers*(debug: bool) =
let logLevel =
if not debug: lvlInfo
else: lvlAll
addHandler(
newHwylConsoleLogger(
var consoleLogger* =
newHwylConsoleLogger(
fmtPrefix = $bb"[b magenta]oizys",
fmtSuffix = " ",
levelThreshold = logLevel
)
levelThreshold = lvlInfo
)
proc setupLoggers*() =
addHandler(
consoleLogger
)
addHandler(
newRollingFileLogger(

View file

@ -14,9 +14,12 @@ proc nixCommand(cmd: string): string =
result.addArg "--log-format multiline"
result.addArg cmd
proc nixosConfigAttr(host: string): string =
getFlake() & "#nixosConfigurations." & host & ".config.system.build.toplevel"
proc nixosConfigAttrs*(): seq[string] =
for host in getHosts():
result.add getFlake() & "#nixosConfigurations." & host & ".config.system.build.toplevel"
result.add nixosConfigAttr(host)
const nixosSubcmds* =
"""switch boot test build dry-build dry-activate edit
@ -348,3 +351,78 @@ proc nixBuildWithCache*(name: string, rest:seq[string], service: string, jobs: i
if pushErr != 0:
errorQuit "failed to push build to cache"
#[
- name: Build
run: >
nix run .
--
build
"$(nix run . -- output --host,=othalan,algiz,mannaz,naudiz --flake .)"
--flake .
--debug
--
--keep-going
--no-link
- run: git show origin/flake-lock:flake.lock > updated.lock
- name: Pre-build oizys
run: nix build . --reference-lock-file updated.lock
- name: Build Updated
run: >
nix run .
--
build
"$(nix run . -- output --host,=othalan,algiz,mannaz,naudiz --flake .)"
--flake .
--debug
--
--keep-going
--no-link
--reference-lock-file updated.lock
- run: |
for host in othalan algiz mannaz naudiz; do
for rev in current updated; do
args="\"$(nix run . -- output --host $host)\" --out-link \"${host}-${rev}\""
[[ "$rev" == "updated" ]] && args="$args --reference-lock-file updated.lock"
nix build $args
done
done
]#
proc getUpdatedLockFile() =
info "getting updated flake.lock as updated.lock"
let res = runCmdCapt("git --no-pager show origin/flake-lock:flake.lock")
if res.exitCode != 0:
fatalQuit "failed to fetch updated lock file using git"
writeFile("updated.lock", res.stdout)
# probably duplicating logic above ¯\_(ツ)_/¯
proc buildSystem(host: string, rest: seq[string]) =
var cmd = nixCommand("build")
cmd.addArg nixosConfigAttr(host)
cmd.addArgs rest
let code = runCmd cmd
if code != 0:
fatalQuit "build failed"
proc ciUpdate*(rest: seq[string]) =
for host in getHosts():
info "building " & host.bb("bold")
buildSystem(
host,
@["--out-link", host & "-current", "--quiet"] & rest
)
getUpdatedLockFile()
for host in getHosts():
info "building updated " & host.bb("bold")
buildSystem(
host,
@["--out-link", host & "-updated", "--quiet", "--reference-lock-file", "updated.lock"] & rest
)

View file

@ -3,10 +3,10 @@
## oizys
- [ ] write a flake template that includes the systems boilerplate
- [ ] get the running action url after `oizys ci {workflow}.yml`
## software
- [ ] why is my update ci always building llm and rofi?
- [ ] include langservers for enabled languages?
<!--[tracking issue](https://github.com/wez/wezterm/issues/5990)-->
- [ ] ~wezterm is broken...something to do with fonts?~ using ghostty