Compare commits

...

3 commits

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

• Updated input 'hyprland':
    'git+https://github.com/hyprwm/Hyprland/?ref=refs/heads/main&rev=5c6c300abfea2539ffad9bcbf857325eec5ab765' (2024-09-30)
  → 'git+https://github.com/hyprwm/Hyprland/?ref=refs/heads/main&rev=de68e065fe861d7ca01eca267df4c305bc6e73c2' (2024-10-02)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/06cf0e1da4208d3766d898b7fdab6513366d45b9' (2024-09-29)
  → 'github:nixos/nixpkgs/27e30d177e57d912d614c88c622dcfdb2e6e6515' (2024-10-01)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/50e4446e6dce9e1e52455f5b87bb91e83a538468' (2024-09-30)
  → 'github:nix-community/nixpkgs-wayland/a40e6b047b6166aed5fab801e99a8d6b980d4680' (2024-10-01)
• Updated input 'pixi':
    'github:daylinmorgan/pixi-flake/935278026a29a12589bb594533905d329bd16a9d' (2024-09-26)
  → 'github:daylinmorgan/pixi-flake/d4ea6b52b804cd20d4b661b568389e35e372e2f5' (2024-10-03)
• Updated input 'roc':
    'github:roc-lang/roc/aaeefc09b60313a28597372d3fdec041c1b96a22' (2024-10-01)
  → 'github:roc-lang/roc/2c62f773efaa08302dd8e765f4dba91a0cdbde8d' (2024-10-02)
2024-10-03 10:37:41 -05:00
f6e25397d4
remove comments 2024-10-03 10:04:45 -05:00
e134e37d5d
abstract logger 2024-10-02 17:23:07 -05:00
5 changed files with 72 additions and 44 deletions

View file

@ -357,11 +357,11 @@
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
"lastModified": 1727714556, "lastModified": 1727900725,
"narHash": "sha256-l4cPDA3xGtGdQmdSCAO2VyWg9xwW6//KwDYefdWtovQ=", "narHash": "sha256-yS4oC5G/FKrsrRjk03cGzTEXHAwfjP7azFHoKvlFfD8=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "5c6c300abfea2539ffad9bcbf857325eec5ab765", "rev": "de68e065fe861d7ca01eca267df4c305bc6e73c2",
"revCount": 5285, "revCount": 5287,
"submodules": true, "submodules": true,
"type": "git", "type": "git",
"url": "https://github.com/hyprwm/Hyprland/" "url": "https://github.com/hyprwm/Hyprland/"
@ -845,11 +845,11 @@
"nixpkgs": "nixpkgs_6" "nixpkgs": "nixpkgs_6"
}, },
"locked": { "locked": {
"lastModified": 1727710797, "lastModified": 1727812556,
"narHash": "sha256-2Xr8tAZoLrMkvD0Sil6053x2Lbsy8cvmlk8sApSWdD0=", "narHash": "sha256-U9cEs2W0eLvIS0kEMBGP8eZMdrpoHqynByth/mu2Nvc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixpkgs-wayland", "repo": "nixpkgs-wayland",
"rev": "50e4446e6dce9e1e52455f5b87bb91e83a538468", "rev": "a40e6b047b6166aed5fab801e99a8d6b980d4680",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -892,11 +892,11 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1727634051, "lastModified": 1727802920,
"narHash": "sha256-S5kVU7U82LfpEukbn/ihcyNt2+EvG7Z5unsKW9H/yFA=", "narHash": "sha256-HP89HZOT0ReIbI7IJZJQoJgxvB2Tn28V6XS3MNKnfLs=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "06cf0e1da4208d3766d898b7fdab6513366d45b9", "rev": "27e30d177e57d912d614c88c622dcfdb2e6e6515",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -977,11 +977,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1727382008, "lastModified": 1727969805,
"narHash": "sha256-t9SNSBXzECHI5KdWbJXsN2ATpXqq7JBGag/1BgY3yfE=", "narHash": "sha256-eotOuafJ+KcfEYuZVYYTdcj0ST3RG+GOEsomkOQqYp0=",
"owner": "daylinmorgan", "owner": "daylinmorgan",
"repo": "pixi-flake", "repo": "pixi-flake",
"rev": "935278026a29a12589bb594533905d329bd16a9d", "rev": "d4ea6b52b804cd20d4b661b568389e35e372e2f5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1001,11 +1001,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1727785014, "lastModified": 1727866937,
"narHash": "sha256-u9R0Atlcy1Y+r63zk66rjOwMij30ZLwoo6l1k7+OI08=", "narHash": "sha256-kGYrBpSQ4zdPrV10gVemCKk3zKBW6XeC5wROcped8Ms=",
"owner": "roc-lang", "owner": "roc-lang",
"repo": "roc", "repo": "roc",
"rev": "aaeefc09b60313a28597372d3fdec041c1b96a22", "rev": "2c62f773efaa08302dd8e765f4dba91a0cdbde8d",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -8,5 +8,5 @@ buildNimblePackage {
verions = "unstable"; verions = "unstable";
src = lib.cleanSource ./.; src = lib.cleanSource ./.;
nativeBuildInputs = [ openssl ]; nativeBuildInputs = [ openssl ];
nimbleDepsHash = "sha256-3p+PdGkQmKwz5tzJwX0aun3kSOLw/lwzqRkR9+6ECQE="; nimbleDepsHash = "sha256-RceRnhEkei3RfSCTOJsIiw4GSCyhOZhKoEVHNSw/KvA=";
} }

View file

@ -13,12 +13,12 @@
}, },
"hwylterm": { "hwylterm": {
"version": "0.1.0", "version": "0.1.0",
"vcsRevision": "d852761831bd748db24b42f15bc8e2d286232295", "vcsRevision": "7e82f7ba5a24d816a79b3a5ea49f32b4c7a5ef7e",
"url": "https://github.com/daylinmorgan/hwylterm", "url": "https://github.com/daylinmorgan/hwylterm",
"downloadMethod": "git", "downloadMethod": "git",
"dependencies": [], "dependencies": [],
"checksums": { "checksums": {
"sha1": "7de2a93a03bd0659d8d70cc7c08315e0a7f15439" "sha1": "d6d97bdff3fcdfcf4b39b144fa5f27a6b9f9494d"
} }
}, },
"jsony": { "jsony": {

View file

@ -1,13 +1,8 @@
## nix begat oizys ## nix begat oizys
import std/[os, tables, sequtils, strformat, strutils] import std/[os, tables, sequtils, strformat, strutils]
import hwylterm, hwylterm/[cligen, logging] import hwylterm, hwylterm/[cligen, logging]
import oizys/[context, github, nix, overlay]# 3, logging import oizys/[context, github, nix, overlay, logging]
addHandler(
newFancyConsoleLogger(
fmtPrefix = $bb"[b magenta]oizys"
)
)
proc confirm(q: string): bool = proc confirm(q: string): bool =
stderr.write $(q & bb"[yellow] (Y/n) ") stderr.write $(q & bb"[yellow] (Y/n) ")
@ -28,7 +23,7 @@ overlay:
resetCache: bool = false, resetCache: bool = false,
rest: seq[string], rest: seq[string],
) = ) =
if not debug: setLogFilter(lvlInfo) setupLoggers(debug)
updateContext(host, flake, debug, resetCache) updateContext(host, flake, debug, resetCache)
proc dry(minimal: bool = false) = proc dry(minimal: bool = false) =
@ -82,16 +77,6 @@ proc checkExes() =
if findExe("nix") == "": if findExe("nix") == "":
fatalQuit "oizys requires nix" fatalQuit "oizys requires nix"
func `//`[A, B](pairs: openArray[(A, B)]): Table[A, B] =
pairs.toTable()
func `//`[A, B](t1: var Table[A,B], t2: Table[A,B]) =
for k, v in t2.pairs(): t1[k] = v
func `//`[A, B](t1: Table[A, B], t2: Table[A, B]): Table[A, B] =
result // t1; result // t2
func `//`[A, B](pairs: openArray[(A,B)], t2: Table[A,B]): Table[A,B] =
// pairs // t2
when isMainModule: when isMainModule:
import cligen import cligen
@ -115,17 +100,15 @@ when isMainModule:
"name" : "name of cachix binary cache" "name" : "name of cachix binary cache"
} // sharedHelp } // sharedHelp
let let
# clUse must be set here using clCfg doesn't seem to work with dispatchMutli ...
clUse* = $bb("$command $args\n${doc}[bold]Options[/]:\n$options")
osUsage = $bb("$command [[subcmd] $args\n$doc[bold]Options[/]:\n$options") osUsage = $bb("$command [[subcmd] $args\n$doc[bold]Options[/]:\n$options")
dispatchMulti( dispatchMulti(
[build, help = sharedHelp, usage = clUse ], [build, help = sharedHelp, usage = clCfg.use ],
[cache, help = cacheHelp , usage = clUse ], [cache, help = cacheHelp , usage = clCfg.use ],
[ci, help = ciHelp , usage = clUse ], [ci, help = ciHelp , usage = clCfg.use ],
[dry, help = sharedHelp, usage = clUse ], [dry, help = sharedHelp, usage = clCfg.use ],
[osCmd, help = sharedHelp, usage = osUsage, cmdName = "os"], [osCmd, help = sharedHelp, usage = osUsage, cmdName = "os"],
[output, help = sharedHelp, usage = clUse], [output, help = sharedHelp, usage = clCfg.use],
[update, help = updateHelp, usage = clUse], [update, help = updateHelp, usage = clCfg.use],
) )

View file

@ -0,0 +1,45 @@
## nix begat oizys
import std/[logging, os]
import hwylterm, hwylterm/logging
export logging
proc getDataDir(): string =
## Returns the data directory of the current user for applications.
# follows std/os.getCacheDir
# which in turn follows https://crates.io/crates/platform-dirs
result =
when defined(windows):
getEnv("LOCALAPPDATA")
elif defined(osx):
getEnv("XDG_DATA_HOME", getEnv("HOME") / "Library/Application Support")
else:
getEnv("XDG_DATA_HOME", getEnv("HOME") / ".local/share")
result.normalizePathEnd(false)
proc getOizysLogPath(): string =
let dataDir = getDataDir()
createDir(dataDir / "oizys")
result = dataDir / "oizys" / "oizys.log"
setLogFilter(lvlAll)
proc setupLoggers*(debug: bool) =
let logLevel =
if not debug: lvlInfo
else: lvlAll
addHandler(
newFancyConsoleLogger(
fmtPrefix = $bb"[b magenta]oizys",
levelThreshold = logLevel
)
)
addHandler(
newRollingFileLogger(
getOizysLogPath(),
mode = fmAppend,
fmtStr = "$datetime | $levelid:"
)
)