Compare commits

..

No commits in common. "09aa87e51f47ff01b1ced9be6500f1eabc0ee0f3" and "e1799718b91b5cf3b43bc7ce80d8a1d617b01f18" have entirely different histories.

6 changed files with 41 additions and 37 deletions

View file

@ -504,11 +504,11 @@
"lix": {
"flake": false,
"locked": {
"lastModified": 1726072500,
"narHash": "sha256-VfnBb2oNwLsnKbeaGyhLx2aHU+3AS3tzMpW9VdZGzgo=",
"rev": "df0137226d7db4bfac455076be9f37dae6f01ffe",
"lastModified": 1726016547,
"narHash": "sha256-tB4Y3Rrv67ZdEo3HJzxYL5XX9wqtvWwIX1z8k399W0s=",
"rev": "24db81eaf28259ab8f8334ccd6368673a26ed422",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/df0137226d7db4bfac455076be9f37dae6f01ffe.tar.gz?rev=df0137226d7db4bfac455076be9f37dae6f01ffe"
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/24db81eaf28259ab8f8334ccd6368673a26ed422.tar.gz?rev=24db81eaf28259ab8f8334ccd6368673a26ed422"
},
"original": {
"type": "tarball",
@ -744,11 +744,11 @@
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1726089853,
"narHash": "sha256-cpP8CDvELczaYLY0RIfYu0vLC8kU/PgM46AZRDAQEe8=",
"lastModified": 1726058240,
"narHash": "sha256-p74soeV48Sry7+wOxDJ8Gqx3JT26lH9AY4+slpJemyw=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "ace4183b2665fa1b7acf1ce74a83519bbf828a58",
"rev": "5d6271a06b79364aa838cdc68c5852d383b17236",
"type": "github"
},
"original": {

View file

@ -23,13 +23,11 @@ mkOizysModule config "chrome" {
};
environment.systemPackages = with pkgs; [
# (chromium.override {
# commandLineArgs = [ "--force-dark-mode" ];
# enableWideVine = true;
# })
(google-chrome.override {
(chromium.override {
commandLineArgs = [ "--force-dark-mode" ];
enableWideVine = true;
})
(google-chrome.override { commandLineArgs = [ "--force-dark-mode" ]; })
];
}

View file

@ -23,19 +23,22 @@ proc initContext*(): OizysContext =
result.ci = getEnv("GITHUB_STEP_SUMMARY") != ""
var oc = initContext()
proc checkPath(s: string): string =
proc checkPath(s: string): string =
## fail if path doesn't exist
if not s.dirExists: fatalQuit fmt"flake path: {s} does not exist"
if not s.dirExists:
errorQuit fmt"flake path: {s} does not exist"
s
# public api -------------------------------------
proc updateContext*(
host: seq[string],
flake: string,
debug: bool,
resetCache: bool
) =
if host.len > 0: oc.hosts = host
if host.len > 0:
oc.hosts = host
oc.debug = debug
oc.resetCache = resetCache
if flake != "":
@ -46,9 +49,9 @@ proc updateContext*(
debug bb(fmt"""[b]flake[/]: {oc.flake}, [b]hosts[/]: {oc.hosts.join(" ")}""")
proc getHosts*(): seq[string] = return oc.hosts
proc getFlake*(): string = return oc.flake
proc isDebug*(): bool = return oc.debug
proc isResetCache*(): bool = return oc.resetCache
proc isCi*(): bool = return oc.ci
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

@ -32,22 +32,25 @@ proc runCmdCapt*(
args = args[1..^1],
options = {poUsePath}
)
# NOTE: if I didn't use streams could I just read from the file handle instead?
let
let
outstrm = peekableOutputStream p
errstrm = peekableErrorStream p
result.exitCode = -1
var line: string
# var cnt: int
while true:
if CaptStdout in capture:
if outstrm.readLine(line):
if outstrm.readLine(line):
result.stdout.add line & '\n'
if CaptStderr in capture:
if errstrm.readLine(line):
result.stderr.add line & '\n'
result.exitCode = peekExitCode(p)
if result.exitCode != -1: break
# result.exitCode = waitForExit p
# result.exitCode = waitForExit p
# close p
close p
proc runCmdCaptWithSpinner*(

View file

@ -7,19 +7,19 @@ import ./[logging, exec, context]
when defined(amd64) and (defined(gcc) or defined(clang)):
{.passC: "-msse4.1 -mpclmul".}
template withTmpDir(body: untyped): untyped =
template withTmpDir(body: untyped): untyped =
let tmpDir {.inject.} = createTempDir("oizys","")
body
removeDir tmpDir
removeDir(tmpDir)
var ghToken = getEnv "GITHUB_TOKEN"
var ghToken = getEnv("GITHUB_TOKEN")
proc checkToken() {.inline.} =
if ghToken == "": fatalQuit "GITHUB_TOKEN not set"
proc ghClient(
maxRedirects = 5
): HttpClient =
): HttpClient =
checkToken()
result = newHttpClient(maxRedirects = maxRedirects)
result.headers = newHttpHeaders({
@ -50,8 +50,7 @@ proc postGhApi(url: string, body: JsonNode) =
let response = client.post(url, body = $body)
info fmt"Status: {response.code}"
except:
errorQuit "failed to get response code"
error "failed to get response code"
proc createDispatch*(workflowFileName: string, `ref`: string) =
## https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event
@ -175,7 +174,7 @@ proc fetch(r: GitRepo) =
checkGit code
proc status(r: GitRepo) =
let (output, _, code) = runCmdCapt r.git("status", "--porcelain")
let (output, _, code) = runCmdCapt(r.git("status", "--porcelain"))
checkGit code
if output.len > 0:
info "unstaged commits, cowardly exiting..."
@ -189,4 +188,6 @@ proc rebase(r: GitRepo, `ref`: string) =
proc updateRepo*() =
let repo = GitRepo(path: getFlake())
fetch repo
rebase(repo, "origin/flake-lock")
rebase repo, "origin/flake-lock"

View file

@ -2,7 +2,8 @@ import std/macros
type
OverlayKind = enum
oPre, oPost
oPre
oPost
OverlayProc = object
node: NimNode
kind: OverlayKind
@ -26,7 +27,6 @@ proc applyOverlay(child: NimNode, overlayProc: OverlayProc) =
macro overlay*(x: untyped): untyped =
##[
apply pre and post operations to procs:
```nim
overlay:
proc pre(a: bool) =
@ -43,8 +43,7 @@ macro overlay*(x: untyped): untyped =
echo "inside mine"
echo "after"
```
]##
]##
result = newStmtList()
var overlays: seq[OverlayProc]
for child in x.children():