mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-11-09 20:33:15 -06:00
Compare commits
3 commits
6d2146a4f3
...
16ff586de4
Author | SHA1 | Date | |
---|---|---|---|
16ff586de4 | |||
09c2d08540 | |||
e1799718b9 |
6 changed files with 64 additions and 68 deletions
64
flake.lock
64
flake.lock
|
@ -20,11 +20,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725199881,
|
"lastModified": 1725753098,
|
||||||
"narHash": "sha256-jsmipf/u1GFZE5tBUkr56CHMN6VpUWCAjfLIhvQijU0=",
|
"narHash": "sha256-/NO/h/qD/eJXAQr/fHA4mdDgYsNT9thHQ+oT6KPi2ac=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "aquamarine",
|
"repo": "aquamarine",
|
||||||
"rev": "f8a687dd29ff019657498f1bd14da2fbbf0e604b",
|
"rev": "e4a13203112a036fc7f437d391c7810f3dd5ab52",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -323,11 +323,11 @@
|
||||||
"xdph": "xdph"
|
"xdph": "xdph"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725976150,
|
"lastModified": 1726071051,
|
||||||
"narHash": "sha256-Dv4XEWRcVFZhBDbj11/zuuXyf7TGHFVU1IGH9W/yPX8=",
|
"narHash": "sha256-eZPhLQ8DM8AsP+zM1KmUzxWQaiTpOUbFS1xeOyjgwvg=",
|
||||||
"ref": "refs/heads/main",
|
"ref": "refs/heads/main",
|
||||||
"rev": "155d44016d0cb11332c454db73d59030cdbd7b13",
|
"rev": "8b9e385943d1a9fd0f8c6070fa1eae507ae26145",
|
||||||
"revCount": 5209,
|
"revCount": 5213,
|
||||||
"submodules": true,
|
"submodules": true,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/hyprwm/Hyprland/"
|
"url": "https://github.com/hyprwm/Hyprland/"
|
||||||
|
@ -399,11 +399,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725188252,
|
"lastModified": 1725997860,
|
||||||
"narHash": "sha256-yBH8c4GDaEAtBrh+BqIlrx5vp6gG/Gu8fQQK63KAQgs=",
|
"narHash": "sha256-d/rZ/fHR5l1n7PeyLw0StWMNLXVU9c4HFyfskw568so=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "hyprlang",
|
"repo": "hyprlang",
|
||||||
"rev": "c12ab785ce1982f82594aff03b3104c598186ddd",
|
"rev": "dfeb5811dd6485490cce18d6cc1e38a055eea876",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -504,11 +504,11 @@
|
||||||
"lix": {
|
"lix": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725927421,
|
"lastModified": 1726016547,
|
||||||
"narHash": "sha256-tiQ9OxiuTb/02xEU2ceo9MIxWBS5Rm/IAhv6QshH8K0=",
|
"narHash": "sha256-tB4Y3Rrv67ZdEo3HJzxYL5XX9wqtvWwIX1z8k399W0s=",
|
||||||
"rev": "cc183fdbc14ce105a5661d646983f791978b9d5c",
|
"rev": "24db81eaf28259ab8f8334ccd6368673a26ed422",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/cc183fdbc14ce105a5661d646983f791978b9d5c.tar.gz?rev=cc183fdbc14ce105a5661d646983f791978b9d5c"
|
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/24db81eaf28259ab8f8334ccd6368673a26ed422.tar.gz?rev=24db81eaf28259ab8f8334ccd6368673a26ed422"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
|
@ -707,11 +707,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725103162,
|
"lastModified": 1725983898,
|
||||||
"narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=",
|
"narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b",
|
"rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -744,11 +744,11 @@
|
||||||
"nixpkgs": "nixpkgs_6"
|
"nixpkgs": "nixpkgs_6"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725981791,
|
"lastModified": 1726058240,
|
||||||
"narHash": "sha256-+4dwaoIrnubM29MK8BW4S2mdKwdlCF1svtO0hQ443X0=",
|
"narHash": "sha256-p74soeV48Sry7+wOxDJ8Gqx3JT26lH9AY4+slpJemyw=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs-wayland",
|
"repo": "nixpkgs-wayland",
|
||||||
"rev": "90046312d6c074e7b941b7ea9c4e54f4d416e5da",
|
"rev": "5d6271a06b79364aa838cdc68c5852d383b17236",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -791,11 +791,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_4": {
|
"nixpkgs_4": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725634671,
|
"lastModified": 1725983898,
|
||||||
"narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=",
|
"narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c",
|
"rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -823,11 +823,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_6": {
|
"nixpkgs_6": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725634671,
|
"lastModified": 1725983898,
|
||||||
"narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=",
|
"narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c",
|
"rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -900,11 +900,11 @@
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725957803,
|
"lastModified": 1726002278,
|
||||||
"narHash": "sha256-qBG8DEmc9aOLr/WBtsuOB5QKEDxK2bDy4dq3X686xdo=",
|
"narHash": "sha256-INEUQt5tQkmQtHv+//9+FGFOet2IEJPg/31y8qtsCqs=",
|
||||||
"owner": "roc-lang",
|
"owner": "roc-lang",
|
||||||
"repo": "roc",
|
"repo": "roc",
|
||||||
"rev": "2936a37a1c54cb4cb10003c3b7e43a4772bbccf9",
|
"rev": "3d9c4673af25349be43e0e8e703a0f4b36176577",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1162,11 +1162,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725228143,
|
"lastModified": 1726046979,
|
||||||
"narHash": "sha256-kbSiPA5oXiz1+1eVoRslMi5wylHD6SDT8dS9eZAxXAM=",
|
"narHash": "sha256-6SEsjurq9cdTkITA6d49ncAJe4O/8CgRG5/F//s6Xh8=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "xdg-desktop-portal-hyprland",
|
"repo": "xdg-desktop-portal-hyprland",
|
||||||
"rev": "11e15b437e7efc39e452f36e15a183225d6bfa39",
|
"rev": "e695669fd8e1d1be9eaae40f35e00f8bd8b64c18",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -23,11 +23,13 @@ mkOizysModule config "chrome" {
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
(chromium.override {
|
# (chromium.override {
|
||||||
commandLineArgs = [ "--force-dark-mode" ];
|
# commandLineArgs = [ "--force-dark-mode" ];
|
||||||
enableWideVine = true;
|
# enableWideVine = true;
|
||||||
})
|
# })
|
||||||
|
|
||||||
(google-chrome.override { commandLineArgs = [ "--force-dark-mode" ]; })
|
(google-chrome.override {
|
||||||
|
commandLineArgs = [ "--force-dark-mode" ];
|
||||||
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,22 +23,19 @@ proc initContext*(): OizysContext =
|
||||||
result.ci = getEnv("GITHUB_STEP_SUMMARY") != ""
|
result.ci = getEnv("GITHUB_STEP_SUMMARY") != ""
|
||||||
|
|
||||||
var oc = initContext()
|
var oc = initContext()
|
||||||
|
|
||||||
proc checkPath(s: string): string =
|
proc checkPath(s: string): string =
|
||||||
## fail if path doesn't exist
|
## fail if path doesn't exist
|
||||||
if not s.dirExists:
|
if not s.dirExists: fatalQuit fmt"flake path: {s} does not exist"
|
||||||
errorQuit fmt"flake path: {s} does not exist"
|
|
||||||
s
|
s
|
||||||
|
|
||||||
# public api -------------------------------------
|
|
||||||
|
|
||||||
proc updateContext*(
|
proc updateContext*(
|
||||||
host: seq[string],
|
host: seq[string],
|
||||||
flake: string,
|
flake: string,
|
||||||
debug: bool,
|
debug: bool,
|
||||||
resetCache: bool
|
resetCache: bool
|
||||||
) =
|
) =
|
||||||
if host.len > 0:
|
if host.len > 0: oc.hosts = host
|
||||||
oc.hosts = host
|
|
||||||
oc.debug = debug
|
oc.debug = debug
|
||||||
oc.resetCache = resetCache
|
oc.resetCache = resetCache
|
||||||
if flake != "":
|
if flake != "":
|
||||||
|
@ -49,9 +46,9 @@ proc updateContext*(
|
||||||
debug bb(fmt"""[b]flake[/]: {oc.flake}, [b]hosts[/]: {oc.hosts.join(" ")}""")
|
debug bb(fmt"""[b]flake[/]: {oc.flake}, [b]hosts[/]: {oc.hosts.join(" ")}""")
|
||||||
|
|
||||||
proc getHosts*(): seq[string] = return oc.hosts
|
proc getHosts*(): seq[string] = return oc.hosts
|
||||||
proc getFlake*(): string = return oc.flake
|
proc getFlake*(): string = return oc.flake
|
||||||
proc isDebug*(): bool = return oc.debug
|
proc isDebug*(): bool = return oc.debug
|
||||||
proc isResetCache*(): bool = return oc.resetCache
|
proc isResetCache*(): bool = return oc.resetCache
|
||||||
proc isCi*(): bool = return oc.ci
|
proc isCi*(): bool = return oc.ci
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,12 +32,12 @@ proc runCmdCapt*(
|
||||||
args = args[1..^1],
|
args = args[1..^1],
|
||||||
options = {poUsePath}
|
options = {poUsePath}
|
||||||
)
|
)
|
||||||
|
# NOTE: if I didn't use streams could I just read from the file handle instead?
|
||||||
let
|
let
|
||||||
outstrm = peekableOutputStream p
|
outstrm = peekableOutputStream p
|
||||||
errstrm = peekableErrorStream p
|
errstrm = peekableErrorStream p
|
||||||
result.exitCode = -1
|
result.exitCode = -1
|
||||||
var line: string
|
var line: string
|
||||||
# var cnt: int
|
|
||||||
while true:
|
while true:
|
||||||
if CaptStdout in capture:
|
if CaptStdout in capture:
|
||||||
if outstrm.readLine(line):
|
if outstrm.readLine(line):
|
||||||
|
@ -48,9 +48,6 @@ proc runCmdCapt*(
|
||||||
result.exitCode = peekExitCode(p)
|
result.exitCode = peekExitCode(p)
|
||||||
if result.exitCode != -1: break
|
if result.exitCode != -1: break
|
||||||
|
|
||||||
# result.exitCode = waitForExit p
|
|
||||||
# result.exitCode = waitForExit p
|
|
||||||
# close p
|
|
||||||
close p
|
close p
|
||||||
|
|
||||||
proc runCmdCaptWithSpinner*(
|
proc runCmdCaptWithSpinner*(
|
||||||
|
|
|
@ -10,9 +10,9 @@ when defined(amd64) and (defined(gcc) or defined(clang)):
|
||||||
template withTmpDir(body: untyped): untyped =
|
template withTmpDir(body: untyped): untyped =
|
||||||
let tmpDir {.inject.} = createTempDir("oizys","")
|
let tmpDir {.inject.} = createTempDir("oizys","")
|
||||||
body
|
body
|
||||||
removeDir(tmpDir)
|
removeDir tmpDir
|
||||||
|
|
||||||
var ghToken = getEnv("GITHUB_TOKEN")
|
var ghToken = getEnv "GITHUB_TOKEN"
|
||||||
|
|
||||||
proc checkToken() {.inline.} =
|
proc checkToken() {.inline.} =
|
||||||
if ghToken == "": fatalQuit "GITHUB_TOKEN not set"
|
if ghToken == "": fatalQuit "GITHUB_TOKEN not set"
|
||||||
|
@ -50,7 +50,8 @@ proc postGhApi(url: string, body: JsonNode) =
|
||||||
let response = client.post(url, body = $body)
|
let response = client.post(url, body = $body)
|
||||||
info fmt"Status: {response.code}"
|
info fmt"Status: {response.code}"
|
||||||
except:
|
except:
|
||||||
error "failed to get response code"
|
errorQuit "failed to get response code"
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
|
@ -174,7 +175,7 @@ proc fetch(r: GitRepo) =
|
||||||
checkGit code
|
checkGit code
|
||||||
|
|
||||||
proc status(r: GitRepo) =
|
proc status(r: GitRepo) =
|
||||||
let (output, _, code) = runCmdCapt(r.git("status", "--porcelain"))
|
let (output, _, code) = runCmdCapt r.git("status", "--porcelain")
|
||||||
checkGit code
|
checkGit code
|
||||||
if output.len > 0:
|
if output.len > 0:
|
||||||
info "unstaged commits, cowardly exiting..."
|
info "unstaged commits, cowardly exiting..."
|
||||||
|
@ -188,6 +189,4 @@ proc rebase(r: GitRepo, `ref`: string) =
|
||||||
proc updateRepo*() =
|
proc updateRepo*() =
|
||||||
let repo = GitRepo(path: getFlake())
|
let repo = GitRepo(path: getFlake())
|
||||||
fetch repo
|
fetch repo
|
||||||
rebase repo, "origin/flake-lock"
|
rebase(repo, "origin/flake-lock")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,7 @@ import std/macros
|
||||||
|
|
||||||
type
|
type
|
||||||
OverlayKind = enum
|
OverlayKind = enum
|
||||||
oPre
|
oPre, oPost
|
||||||
oPost
|
|
||||||
OverlayProc = object
|
OverlayProc = object
|
||||||
node: NimNode
|
node: NimNode
|
||||||
kind: OverlayKind
|
kind: OverlayKind
|
||||||
|
@ -27,6 +26,7 @@ proc applyOverlay(child: NimNode, overlayProc: OverlayProc) =
|
||||||
macro overlay*(x: untyped): untyped =
|
macro overlay*(x: untyped): untyped =
|
||||||
##[
|
##[
|
||||||
apply pre and post operations to procs:
|
apply pre and post operations to procs:
|
||||||
|
|
||||||
```nim
|
```nim
|
||||||
overlay:
|
overlay:
|
||||||
proc pre(a: bool) =
|
proc pre(a: bool) =
|
||||||
|
@ -43,7 +43,8 @@ macro overlay*(x: untyped): untyped =
|
||||||
echo "inside mine"
|
echo "inside mine"
|
||||||
echo "after"
|
echo "after"
|
||||||
```
|
```
|
||||||
]##
|
]##
|
||||||
|
|
||||||
result = newStmtList()
|
result = newStmtList()
|
||||||
var overlays: seq[OverlayProc]
|
var overlays: seq[OverlayProc]
|
||||||
for child in x.children():
|
for child in x.children():
|
||||||
|
|
Loading…
Reference in a new issue