mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-11-09 20:33:15 -06:00
deprecate other oizys-cli implementations
This commit is contained in:
parent
abc82c31d8
commit
8d77bde437
35 changed files with 1 additions and 1703 deletions
|
@ -54,10 +54,7 @@ in
|
||||||
nixosModules = listToAttrs (findModulesList ../modules);
|
nixosModules = listToAttrs (findModulesList ../modules);
|
||||||
nixosConfigurations = mapAttrs (name: _: mkSystem name) (readDir ../hosts);
|
nixosConfigurations = mapAttrs (name: _: mkSystem name) (readDir ../hosts);
|
||||||
packages = forAllSystems (pkgs: rec {
|
packages = forAllSystems (pkgs: rec {
|
||||||
# oizys-zig = pkgs.callPackage ../pkgs/oizys/oizys-zig { inherit zig2nix; };
|
oizys-go = pkgs.callPackage ../pkgs/oizys {};
|
||||||
# oizys-nim = pkgs.callPackage ../pkgs/oizys/oizys-nim { };
|
|
||||||
# oizys-rs = pkgs.callPackage ../pkgs/oizys/oizys-rs { };
|
|
||||||
oizys-go = pkgs.callPackage ../pkgs/oizys/oizys-go { inherit self; };
|
|
||||||
default = oizys-go;
|
default = oizys-go;
|
||||||
});
|
});
|
||||||
devShells = forAllSystems (pkgs: {
|
devShells = forAllSystems (pkgs: {
|
||||||
|
@ -76,7 +73,5 @@ in
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
|
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
{ buildNimPackage }:
|
|
||||||
buildNimPackage {
|
|
||||||
pname = "oizys";
|
|
||||||
version = "unstable";
|
|
||||||
src = ./.;
|
|
||||||
}
|
|
|
@ -1,197 +0,0 @@
|
||||||
import std/[macros, os, osproc, parseopt, times, strformat, strutils, terminal]
|
|
||||||
from std/nativesockets import getHostname
|
|
||||||
|
|
||||||
let summaryFile = getEnv("GITHUB_STEP_SUMMARY")
|
|
||||||
|
|
||||||
macro doc(procedure: typed): untyped =
|
|
||||||
## extract documenatation comments from procedure
|
|
||||||
procedure.expectKind(nnkSym)
|
|
||||||
if procedure.symKind != nskProc:
|
|
||||||
error("procedure expected", procedure)
|
|
||||||
let
|
|
||||||
impl = procedure.getImpl
|
|
||||||
docs = impl.body.extractDocCommentsAndRunnables
|
|
||||||
var doc: string
|
|
||||||
for element in docs:
|
|
||||||
if element.kind == nnkCommentStmt:
|
|
||||||
doc.addSep("\n", startLen = 1)
|
|
||||||
doc.add($element)
|
|
||||||
result = newLit(doc)
|
|
||||||
|
|
||||||
proc logInfo(args: varargs[string, `$`]) =
|
|
||||||
stdout.styledWriteLine(
|
|
||||||
fgCyan, "oizys", resetStyle, "|",
|
|
||||||
styleDim, "INFO", resetStyle, "| ",
|
|
||||||
args.join("")
|
|
||||||
)
|
|
||||||
|
|
||||||
proc logErr(args: varargs[string, `$`]) =
|
|
||||||
stdout.styledWriteLine(
|
|
||||||
fgCyan, "oizys", resetStyle, "|",
|
|
||||||
fgRed, "ERROR", resetStyle, "| ",
|
|
||||||
args.join("")
|
|
||||||
)
|
|
||||||
|
|
||||||
proc logWarn(args: varargs[string, `$`]) =
|
|
||||||
stdout.styledWriteLine(
|
|
||||||
fgCyan, "oizys", resetStyle, "|",
|
|
||||||
fgYellow, "WARN", resetStyle, "| ",
|
|
||||||
args.join("")
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
OizysContext = object
|
|
||||||
flake, host: string
|
|
||||||
extraArgs: seq[string]
|
|
||||||
cache = "daylin"
|
|
||||||
pinix: bool = true
|
|
||||||
|
|
||||||
proc execQuit(c: OizysContext, args: varargs[string]) =
|
|
||||||
let cmd = (@args & c.extraArgs).join(" ")
|
|
||||||
logInfo "exec: ", cmd
|
|
||||||
quit (execCmd cmd)
|
|
||||||
|
|
||||||
proc newCtx(): OizysContext =
|
|
||||||
result = OizysContext()
|
|
||||||
result.flake = getEnv("FLAKE_PATH", getEnv("HOME") / "oizys")
|
|
||||||
result.host = getHostname()
|
|
||||||
|
|
||||||
proc check(c: OizysContext) =
|
|
||||||
if not dirExists c.flake:
|
|
||||||
logErr c.flake, "does not exist"
|
|
||||||
logErr "please use -f/--flake or $FLAKE_PATH"
|
|
||||||
quit 1
|
|
||||||
logInfo "flake:", c.flake
|
|
||||||
logInfo "host:", c.host
|
|
||||||
|
|
||||||
proc cmd(c: OizysContext): string {.inline.} =
|
|
||||||
let pixExists = findExe("pix") != ""
|
|
||||||
if c.pinix:
|
|
||||||
if pixExists:
|
|
||||||
return "pix"
|
|
||||||
else:
|
|
||||||
logWarn "pinix not found, falling back to nix"
|
|
||||||
return "nix"
|
|
||||||
|
|
||||||
proc systemFlakePath(c: OizysContext): string =
|
|
||||||
c.flake & "#nixosConfigurations." & c.host & ".config.system.build.toplevel"
|
|
||||||
|
|
||||||
proc build(c: OizysContext) =
|
|
||||||
## build nixos
|
|
||||||
execQuit c, c.cmd, "build", c.systemFlakePath
|
|
||||||
|
|
||||||
proc dry(c: OizysContext) =
|
|
||||||
## poor man's nix flake check
|
|
||||||
execQuit c, c.cmd, "build", c.systemFlakePath, "--dry-run"
|
|
||||||
|
|
||||||
proc cache(c: OizysContext) =
|
|
||||||
## build and push to cachix
|
|
||||||
let start = now()
|
|
||||||
let code = execCmd """
|
|
||||||
cachix watch-exec """ & c.cache & """ \
|
|
||||||
-- \
|
|
||||||
nix build """ & c.systemFlakePath & """ \
|
|
||||||
--print-build-logs \
|
|
||||||
--accept-flake-config
|
|
||||||
"""
|
|
||||||
|
|
||||||
let duration = (now() - start)
|
|
||||||
if code != 0:
|
|
||||||
logErr "failed to build configuration for: ", c.host
|
|
||||||
quit code
|
|
||||||
|
|
||||||
if summaryFile != "":
|
|
||||||
writeFile(
|
|
||||||
summaryFile,
|
|
||||||
"Built host: " & c.host & " in " & $duration & " seconds"
|
|
||||||
)
|
|
||||||
logInfo "Built host: " & c.host & " in " & $duration & " seconds"
|
|
||||||
|
|
||||||
|
|
||||||
proc nixosRebuild(c: OizysContext, subcmd: string) =
|
|
||||||
let cmd = if c.pinix: "pixos-rebuild" else: "nixos-rebuild"
|
|
||||||
execQuit c, "sudo", cmd, subcmd, "--flake", c.flake
|
|
||||||
|
|
||||||
proc boot(c: OizysContext) =
|
|
||||||
## nixos rebuild boot
|
|
||||||
nixosRebuild c, "build"
|
|
||||||
|
|
||||||
proc switch(c: OizysContext) =
|
|
||||||
## nixos rebuild switch
|
|
||||||
nixosRebuild c, "switch"
|
|
||||||
|
|
||||||
proc path(c: OizysContext) =
|
|
||||||
## print nix flake output
|
|
||||||
echo c.systemFlakePath
|
|
||||||
|
|
||||||
const usage = fmt"""
|
|
||||||
oizys <cmd> [opts]
|
|
||||||
|
|
||||||
commands:
|
|
||||||
dry {dry.doc}
|
|
||||||
boot {boot.doc}
|
|
||||||
switch {switch.doc}
|
|
||||||
cache {cache.doc}
|
|
||||||
build {build.doc}
|
|
||||||
path {path.doc}
|
|
||||||
|
|
||||||
options:
|
|
||||||
-h|--help show this help
|
|
||||||
--host hostname (current host)
|
|
||||||
-f|--flake path to flake ($FLAKE_PATH or $HOME/oizys)
|
|
||||||
-c|--cache name of cachix binary cache (daylin)
|
|
||||||
--no-pinix don't use pinix
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
proc runCmd(c: OizysContext, cmd: string) =
|
|
||||||
case cmd:
|
|
||||||
of "dry": dry c
|
|
||||||
of "switch": switch c
|
|
||||||
of "boot": boot c
|
|
||||||
of "cache": cache c
|
|
||||||
of "build": build c
|
|
||||||
of "path": path c
|
|
||||||
else:
|
|
||||||
logErr "unknown command: ", cmd
|
|
||||||
echo usage
|
|
||||||
quit 1
|
|
||||||
|
|
||||||
|
|
||||||
proc parseFlag(c: var OizysContext, kind: CmdLineKind, key, val: string) =
|
|
||||||
case key:
|
|
||||||
of "h", "help":
|
|
||||||
echo usage; quit 0
|
|
||||||
of "host":
|
|
||||||
c.host = val
|
|
||||||
of "f", "flake":
|
|
||||||
c.flake = val
|
|
||||||
of "no-pinix":
|
|
||||||
c.pinix = false
|
|
||||||
else:
|
|
||||||
c.extraArgs.add (if kind == cmdLongOption: "--" else: "-") & key
|
|
||||||
c.extraArgs.add val
|
|
||||||
|
|
||||||
when isMainModule:
|
|
||||||
var
|
|
||||||
c = newCtx()
|
|
||||||
subcmd: string
|
|
||||||
var p = initOptParser(
|
|
||||||
longNoVal = @["no-pinix", "help", ""], shortNoVal = {'h'}
|
|
||||||
)
|
|
||||||
for kind, key, val in p.getopt():
|
|
||||||
case kind
|
|
||||||
of cmdArgument:
|
|
||||||
subcmd = key
|
|
||||||
of cmdLongOption, cmdShortOption:
|
|
||||||
if key == "": break
|
|
||||||
parseFlag c, kind, key, val
|
|
||||||
of cmdEnd:
|
|
||||||
discard
|
|
||||||
if subcmd == "":
|
|
||||||
echo "please specify a command"
|
|
||||||
echo usage; quit 1
|
|
||||||
c.extraArgs = p.remainingArgs
|
|
||||||
check c
|
|
||||||
runCmd c, subcmd
|
|
|
@ -1,13 +0,0 @@
|
||||||
# Package
|
|
||||||
|
|
||||||
author = "Daylin Morgan"
|
|
||||||
version = "0.1.0"
|
|
||||||
description = "oizys"
|
|
||||||
license = "MIT"
|
|
||||||
srcDir = "."
|
|
||||||
bin = @["oizys"]
|
|
||||||
|
|
||||||
|
|
||||||
# Dependencies
|
|
||||||
|
|
||||||
requires "nim >= 2.0.0"
|
|
19
pkgs/oizys/oizys-rs/.gitignore
vendored
19
pkgs/oizys/oizys-rs/.gitignore
vendored
|
@ -1,19 +0,0 @@
|
||||||
# Created by https://www.toptal.com/developers/gitignore/api/rust
|
|
||||||
# Edit at https://www.toptal.com/developers/gitignore?templates=rust
|
|
||||||
|
|
||||||
### Rust ###
|
|
||||||
# Generated by Cargo
|
|
||||||
# will have compiled files and executables
|
|
||||||
debug/
|
|
||||||
target/
|
|
||||||
|
|
||||||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
|
||||||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
|
||||||
|
|
||||||
# These are backup files generated by rustfmt
|
|
||||||
**/*.rs.bk
|
|
||||||
|
|
||||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
|
||||||
*.pdb
|
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/rust
|
|
792
pkgs/oizys/oizys-rs/Cargo.lock
generated
792
pkgs/oizys/oizys-rs/Cargo.lock
generated
|
@ -1,792 +0,0 @@
|
||||||
# This file is automatically @generated by Cargo.
|
|
||||||
# It is not intended for manual editing.
|
|
||||||
version = 3
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "android-tzdata"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "android_system_properties"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstream"
|
|
||||||
version = "0.6.14"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
|
|
||||||
dependencies = [
|
|
||||||
"anstyle",
|
|
||||||
"anstyle-parse",
|
|
||||||
"anstyle-query",
|
|
||||||
"anstyle-wincon",
|
|
||||||
"colorchoice",
|
|
||||||
"is_terminal_polyfill",
|
|
||||||
"utf8parse",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle"
|
|
||||||
version = "1.0.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle-parse"
|
|
||||||
version = "0.2.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4"
|
|
||||||
dependencies = [
|
|
||||||
"utf8parse",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle-query"
|
|
||||||
version = "1.0.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5"
|
|
||||||
dependencies = [
|
|
||||||
"windows-sys 0.52.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "anstyle-wincon"
|
|
||||||
version = "3.0.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
|
|
||||||
dependencies = [
|
|
||||||
"anstyle",
|
|
||||||
"windows-sys 0.52.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "autocfg"
|
|
||||||
version = "1.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bitflags"
|
|
||||||
version = "1.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bumpalo"
|
|
||||||
version = "3.16.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cc"
|
|
||||||
version = "1.0.97"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cfg-if"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "chrono"
|
|
||||||
version = "0.4.38"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
|
|
||||||
dependencies = [
|
|
||||||
"android-tzdata",
|
|
||||||
"iana-time-zone",
|
|
||||||
"num-traits",
|
|
||||||
"serde",
|
|
||||||
"windows-targets 0.52.5",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clap"
|
|
||||||
version = "4.5.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0"
|
|
||||||
dependencies = [
|
|
||||||
"clap_builder",
|
|
||||||
"clap_derive",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clap_builder"
|
|
||||||
version = "4.5.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
|
|
||||||
dependencies = [
|
|
||||||
"anstream",
|
|
||||||
"anstyle",
|
|
||||||
"clap_lex",
|
|
||||||
"strsim",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clap_complete"
|
|
||||||
version = "4.5.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dd79504325bf38b10165b02e89b4347300f855f273c4cb30c4a3209e6583275e"
|
|
||||||
dependencies = [
|
|
||||||
"clap",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clap_derive"
|
|
||||||
version = "4.5.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64"
|
|
||||||
dependencies = [
|
|
||||||
"heck",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clap_lex"
|
|
||||||
version = "0.7.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "colorchoice"
|
|
||||||
version = "1.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "colored"
|
|
||||||
version = "2.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8"
|
|
||||||
dependencies = [
|
|
||||||
"lazy_static",
|
|
||||||
"windows-sys 0.48.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-foundation-sys"
|
|
||||||
version = "0.8.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "futures"
|
|
||||||
version = "0.3.30"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0"
|
|
||||||
dependencies = [
|
|
||||||
"futures-channel",
|
|
||||||
"futures-core",
|
|
||||||
"futures-executor",
|
|
||||||
"futures-io",
|
|
||||||
"futures-sink",
|
|
||||||
"futures-task",
|
|
||||||
"futures-util",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "futures-channel"
|
|
||||||
version = "0.3.30"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
|
|
||||||
dependencies = [
|
|
||||||
"futures-core",
|
|
||||||
"futures-sink",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "futures-core"
|
|
||||||
version = "0.3.30"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "futures-executor"
|
|
||||||
version = "0.3.30"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d"
|
|
||||||
dependencies = [
|
|
||||||
"futures-core",
|
|
||||||
"futures-task",
|
|
||||||
"futures-util",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "futures-io"
|
|
||||||
version = "0.3.30"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "futures-macro"
|
|
||||||
version = "0.3.30"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "futures-sink"
|
|
||||||
version = "0.3.30"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "futures-task"
|
|
||||||
version = "0.3.30"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "futures-util"
|
|
||||||
version = "0.3.30"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
|
|
||||||
dependencies = [
|
|
||||||
"futures-channel",
|
|
||||||
"futures-core",
|
|
||||||
"futures-io",
|
|
||||||
"futures-macro",
|
|
||||||
"futures-sink",
|
|
||||||
"futures-task",
|
|
||||||
"memchr",
|
|
||||||
"pin-project-lite",
|
|
||||||
"pin-utils",
|
|
||||||
"slab",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "heck"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "homedir"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "22074da8bba2ef26fc1737ae6c777b5baab5524c2dc403b5c6a76166766ccda5"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"nix",
|
|
||||||
"serde",
|
|
||||||
"widestring",
|
|
||||||
"windows-sys 0.48.0",
|
|
||||||
"wmi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hostname"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f9c7c7c8ac16c798734b8a24560c1362120597c40d5e1459f09498f8f6c8f2ba"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"libc",
|
|
||||||
"windows",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "iana-time-zone"
|
|
||||||
version = "0.1.60"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141"
|
|
||||||
dependencies = [
|
|
||||||
"android_system_properties",
|
|
||||||
"core-foundation-sys",
|
|
||||||
"iana-time-zone-haiku",
|
|
||||||
"js-sys",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"windows-core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "iana-time-zone-haiku"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "is_terminal_polyfill"
|
|
||||||
version = "1.70.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "js-sys"
|
|
||||||
version = "0.3.69"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
|
|
||||||
dependencies = [
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "lazy_static"
|
|
||||||
version = "1.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libc"
|
|
||||||
version = "0.2.154"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "log"
|
|
||||||
version = "0.4.21"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "memchr"
|
|
||||||
version = "2.7.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "memoffset"
|
|
||||||
version = "0.7.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "nix"
|
|
||||||
version = "0.26.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"cfg-if",
|
|
||||||
"libc",
|
|
||||||
"memoffset",
|
|
||||||
"pin-utils",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-traits"
|
|
||||||
version = "0.2.19"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "oizys"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"clap",
|
|
||||||
"clap_complete",
|
|
||||||
"homedir",
|
|
||||||
"hostname",
|
|
||||||
"spinoff",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "once_cell"
|
|
||||||
version = "1.19.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "paste"
|
|
||||||
version = "1.0.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pin-project-lite"
|
|
||||||
version = "0.2.14"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pin-utils"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "proc-macro2"
|
|
||||||
version = "1.0.82"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b"
|
|
||||||
dependencies = [
|
|
||||||
"unicode-ident",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "quote"
|
|
||||||
version = "1.0.36"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde"
|
|
||||||
version = "1.0.201"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c"
|
|
||||||
dependencies = [
|
|
||||||
"serde_derive",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_derive"
|
|
||||||
version = "1.0.201"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "slab"
|
|
||||||
version = "0.4.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "spinoff"
|
|
||||||
version = "0.8.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "20aa2ed67fbb202e7b716ff8bfc6571dd9301617767380197d701c31124e88f6"
|
|
||||||
dependencies = [
|
|
||||||
"colored",
|
|
||||||
"once_cell",
|
|
||||||
"paste",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "strsim"
|
|
||||||
version = "0.11.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "syn"
|
|
||||||
version = "2.0.63"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"unicode-ident",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thiserror"
|
|
||||||
version = "1.0.60"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18"
|
|
||||||
dependencies = [
|
|
||||||
"thiserror-impl",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thiserror-impl"
|
|
||||||
version = "1.0.60"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-ident"
|
|
||||||
version = "1.0.12"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "utf8parse"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen"
|
|
||||||
version = "0.2.92"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"wasm-bindgen-macro",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-backend"
|
|
||||||
version = "0.2.92"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
|
|
||||||
dependencies = [
|
|
||||||
"bumpalo",
|
|
||||||
"log",
|
|
||||||
"once_cell",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
"wasm-bindgen-shared",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-macro"
|
|
||||||
version = "0.2.92"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
|
|
||||||
dependencies = [
|
|
||||||
"quote",
|
|
||||||
"wasm-bindgen-macro-support",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-macro-support"
|
|
||||||
version = "0.2.92"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
"wasm-bindgen-backend",
|
|
||||||
"wasm-bindgen-shared",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-shared"
|
|
||||||
version = "0.2.92"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "widestring"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows"
|
|
||||||
version = "0.52.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
|
|
||||||
dependencies = [
|
|
||||||
"windows-core",
|
|
||||||
"windows-implement",
|
|
||||||
"windows-interface",
|
|
||||||
"windows-targets 0.52.5",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-core"
|
|
||||||
version = "0.52.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
|
|
||||||
dependencies = [
|
|
||||||
"windows-targets 0.52.5",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-implement"
|
|
||||||
version = "0.52.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "12168c33176773b86799be25e2a2ba07c7aab9968b37541f1094dbd7a60c8946"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-interface"
|
|
||||||
version = "0.52.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9d8dc32e0095a7eeccebd0e3f09e9509365ecb3fc6ac4d6f5f14a3f6392942d1"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-sys"
|
|
||||||
version = "0.48.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
|
||||||
dependencies = [
|
|
||||||
"windows-targets 0.48.5",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-sys"
|
|
||||||
version = "0.52.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
|
||||||
dependencies = [
|
|
||||||
"windows-targets 0.52.5",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-targets"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
|
||||||
dependencies = [
|
|
||||||
"windows_aarch64_gnullvm 0.48.5",
|
|
||||||
"windows_aarch64_msvc 0.48.5",
|
|
||||||
"windows_i686_gnu 0.48.5",
|
|
||||||
"windows_i686_msvc 0.48.5",
|
|
||||||
"windows_x86_64_gnu 0.48.5",
|
|
||||||
"windows_x86_64_gnullvm 0.48.5",
|
|
||||||
"windows_x86_64_msvc 0.48.5",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-targets"
|
|
||||||
version = "0.52.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
|
|
||||||
dependencies = [
|
|
||||||
"windows_aarch64_gnullvm 0.52.5",
|
|
||||||
"windows_aarch64_msvc 0.52.5",
|
|
||||||
"windows_i686_gnu 0.52.5",
|
|
||||||
"windows_i686_gnullvm",
|
|
||||||
"windows_i686_msvc 0.52.5",
|
|
||||||
"windows_x86_64_gnu 0.52.5",
|
|
||||||
"windows_x86_64_gnullvm 0.52.5",
|
|
||||||
"windows_x86_64_msvc 0.52.5",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_aarch64_gnullvm"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_aarch64_gnullvm"
|
|
||||||
version = "0.52.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_aarch64_msvc"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_aarch64_msvc"
|
|
||||||
version = "0.52.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_i686_gnu"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_i686_gnu"
|
|
||||||
version = "0.52.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_i686_gnullvm"
|
|
||||||
version = "0.52.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_i686_msvc"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_i686_msvc"
|
|
||||||
version = "0.52.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_x86_64_gnu"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_x86_64_gnu"
|
|
||||||
version = "0.52.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_x86_64_gnullvm"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_x86_64_gnullvm"
|
|
||||||
version = "0.52.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_x86_64_msvc"
|
|
||||||
version = "0.48.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows_x86_64_msvc"
|
|
||||||
version = "0.52.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wmi"
|
|
||||||
version = "0.13.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fc2f0a4062ca522aad4705a2948fd4061b3857537990202a8ddd5af21607f79a"
|
|
||||||
dependencies = [
|
|
||||||
"chrono",
|
|
||||||
"futures",
|
|
||||||
"log",
|
|
||||||
"serde",
|
|
||||||
"thiserror",
|
|
||||||
"windows",
|
|
||||||
]
|
|
|
@ -1,13 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "oizys"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
clap = { version = "4.5.4", features = ["derive"] }
|
|
||||||
clap_complete = "4.5.1"
|
|
||||||
homedir = "0.2.1"
|
|
||||||
hostname = "0.4.0"
|
|
||||||
spinoff = "0.8.0"
|
|
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
installShellFiles,
|
|
||||||
rustPlatform,
|
|
||||||
nix-output-monitor,
|
|
||||||
}:
|
|
||||||
rustPlatform.buildRustPackage {
|
|
||||||
pname = "oizys";
|
|
||||||
version = "unstable";
|
|
||||||
src = ./.;
|
|
||||||
cargoLock = {
|
|
||||||
lockFile = ./Cargo.lock;
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs = [ installShellFiles ];
|
|
||||||
buildInputs = [ nix-output-monitor ];
|
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
installShellCompletion --cmd oizys \
|
|
||||||
--zsh <($out/bin/oizys --completions zsh)
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,228 +0,0 @@
|
||||||
use clap::{CommandFactory, Parser, Subcommand};
|
|
||||||
use clap_complete::{generate, Generator, Shell};
|
|
||||||
use spinoff::{spinners, Color, Spinner};
|
|
||||||
use std::{env, io, path::PathBuf, process::Command};
|
|
||||||
|
|
||||||
#[derive(Parser)]
|
|
||||||
#[command(version, about, long_about = None)]
|
|
||||||
struct Cli {
|
|
||||||
/// increase verbosity
|
|
||||||
#[arg(short, long,global=true, action = clap::ArgAction::Count)]
|
|
||||||
verbose: u8,
|
|
||||||
|
|
||||||
/// path to flake ($OIZYS_DIR or $HOME/oizys)
|
|
||||||
#[arg(short, long, global = true)]
|
|
||||||
flake: Option<PathBuf>,
|
|
||||||
|
|
||||||
/// host name (current host)
|
|
||||||
#[arg(long, global = true)]
|
|
||||||
host: Option<String>,
|
|
||||||
|
|
||||||
/// generate shell completion
|
|
||||||
#[arg(long, value_enum, hide = true)]
|
|
||||||
completions: Option<Shell>,
|
|
||||||
|
|
||||||
#[command(subcommand)]
|
|
||||||
command: Option<Commands>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Subcommand)]
|
|
||||||
enum Commands {
|
|
||||||
/// poor man's nix flake check
|
|
||||||
Dry {},
|
|
||||||
|
|
||||||
/// nixos rebuild boot
|
|
||||||
Boot {},
|
|
||||||
|
|
||||||
/// nixos rebuild switch
|
|
||||||
Switch {},
|
|
||||||
|
|
||||||
/// build and push to cachix
|
|
||||||
Cache {
|
|
||||||
/// name of cachix binary cache
|
|
||||||
#[arg(short, long, default_value = "daylin")]
|
|
||||||
name: String,
|
|
||||||
},
|
|
||||||
|
|
||||||
///build nixos (w/ nix build)
|
|
||||||
Build {},
|
|
||||||
|
|
||||||
/// print nix flake output
|
|
||||||
Output {},
|
|
||||||
}
|
|
||||||
|
|
||||||
fn print_completions<G: Generator>(gen: G, cmd: &mut clap::Command) {
|
|
||||||
generate(gen, cmd, cmd.get_name().to_string(), &mut io::stdout());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
struct Oizys {
|
|
||||||
host: String,
|
|
||||||
flake: PathBuf,
|
|
||||||
verbose: u8,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn trim_hashes(buf: &str, trim_drv: bool) -> Vec<String> {
|
|
||||||
buf.lines()
|
|
||||||
.skip(1)
|
|
||||||
.map(|line| {
|
|
||||||
line.split_once('-')
|
|
||||||
.map(|x| {
|
|
||||||
format!(" {}", {
|
|
||||||
if trim_drv {
|
|
||||||
x.1.replace(".drv", "")
|
|
||||||
} else {
|
|
||||||
x.1.to_string()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.expect("failed to trim derivation")
|
|
||||||
})
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Oizys {
|
|
||||||
fn from(cli: &Cli) -> Oizys {
|
|
||||||
let host = cli
|
|
||||||
.host
|
|
||||||
.clone()
|
|
||||||
.unwrap_or(hostname::get().unwrap().to_string_lossy().to_string());
|
|
||||||
let flake = cli.flake.clone().unwrap_or(env::var("OIZYS_DIR").map_or(
|
|
||||||
homedir::get_my_home().unwrap().unwrap().join("oizys"),
|
|
||||||
PathBuf::from,
|
|
||||||
));
|
|
||||||
|
|
||||||
Oizys {
|
|
||||||
host,
|
|
||||||
flake,
|
|
||||||
verbose: cli.verbose,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn output(self: &Oizys) -> String {
|
|
||||||
format!(
|
|
||||||
"{}#nixosConfigurations.{}.config.system.build.toplevel",
|
|
||||||
self.flake.to_string_lossy(),
|
|
||||||
self.host
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn show_cmd(self: &Oizys, cmd: &Command) {
|
|
||||||
println!("executing: {}", format!("{:?}", cmd).replace('"', ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse_dry_output(self: &Oizys, output: &str) {
|
|
||||||
let parts: Vec<&str> = output.split("\nthese").collect();
|
|
||||||
// TODO: handle more cases of output
|
|
||||||
// currently fails if nothing to fetch
|
|
||||||
if parts.len() != 3 {
|
|
||||||
eprintln!("couldn't parse dry output into three parts");
|
|
||||||
eprintln!("{}", output);
|
|
||||||
std::process::exit(1);
|
|
||||||
}
|
|
||||||
let to_build: Vec<String> = trim_hashes(parts[1], true);
|
|
||||||
let to_fetch: Vec<String> = trim_hashes(parts[2], false);
|
|
||||||
if self.verbose > 0 {
|
|
||||||
println!("TO BUILD: {}\n{}\n", to_build.len(), to_build.join("\n"));
|
|
||||||
println!("TO FETCH: {}\n{}\n", to_fetch.len(), to_fetch.join("\n"));
|
|
||||||
} else {
|
|
||||||
println!("To build: {}", to_build.len());
|
|
||||||
println!("To fetch: {}", to_fetch.len());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn dry(self: &Oizys) {
|
|
||||||
let flake_output = self.output();
|
|
||||||
let mut cmd = Command::new("nix");
|
|
||||||
cmd.args(["build", &flake_output.as_str(), "--dry-run"]);
|
|
||||||
if self.verbose >= 2 {
|
|
||||||
self.show_cmd(&cmd)
|
|
||||||
}
|
|
||||||
let mut spinner = Spinner::new(spinners::Arc, "evaluating...", Color::Cyan);
|
|
||||||
let output = String::from_utf8(cmd.output().expect("failed to run nix build").stderr)
|
|
||||||
.expect("faild to parse nix build --dry-run output");
|
|
||||||
spinner.stop_with_message("evaluating finished");
|
|
||||||
|
|
||||||
if output.contains("derivations will be built") {
|
|
||||||
self.parse_dry_output(&output);
|
|
||||||
} else {
|
|
||||||
println!("{} up to date", self.host)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn build(self: &Oizys) {
|
|
||||||
let flake_output = self.output();
|
|
||||||
let mut cmd = Command::new("nix");
|
|
||||||
cmd.args(["build", &flake_output.as_str()]);
|
|
||||||
if self.verbose >= 2 {
|
|
||||||
self.show_cmd(&cmd);
|
|
||||||
}
|
|
||||||
cmd.status().expect("failed to run nix build");
|
|
||||||
}
|
|
||||||
|
|
||||||
fn nixos_rebuild(self: &Oizys, subcommand: &str) {
|
|
||||||
let flake_output = format!("{}#{}", self.flake.to_string_lossy(), self.host);
|
|
||||||
let mut cmd = Command::new("sudo");
|
|
||||||
cmd.args(["nixos-rebuild", subcommand, "--flake", &flake_output]);
|
|
||||||
if self.verbose >= 2 {
|
|
||||||
self.show_cmd(&cmd);
|
|
||||||
}
|
|
||||||
cmd.status()
|
|
||||||
.unwrap_or_else(|_| panic!("failed to run nixos-rebuild {subcommand}"));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cache(self: &Oizys, name: &String) {
|
|
||||||
let flake_output = self.output();
|
|
||||||
let mut cmd = Command::new("cachix");
|
|
||||||
cmd.args([
|
|
||||||
"watch-exec",
|
|
||||||
&name,
|
|
||||||
"--",
|
|
||||||
"nix",
|
|
||||||
"build",
|
|
||||||
&flake_output,
|
|
||||||
"--print-build-logs",
|
|
||||||
"--accept-flake-config",
|
|
||||||
]);
|
|
||||||
if self.verbose >= 2 {
|
|
||||||
self.show_cmd(&cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd.status()
|
|
||||||
.unwrap_or_else(|_| panic!("failed to run cachix watch-exec"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let cli = Cli::parse();
|
|
||||||
let oizys = Oizys::from(&cli);
|
|
||||||
|
|
||||||
if let Some(completions) = cli.completions {
|
|
||||||
let mut cmd = Cli::command();
|
|
||||||
eprintln!("Generating completion for {completions:?}");
|
|
||||||
print_completions(completions, &mut cmd);
|
|
||||||
std::process::exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if oizys.verbose > 2 {
|
|
||||||
println!("-vv is max verbosity")
|
|
||||||
}
|
|
||||||
if oizys.verbose >= 1 {
|
|
||||||
println!("{:?}", oizys)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(command) = &cli.command {
|
|
||||||
match command {
|
|
||||||
Commands::Dry {} => oizys.dry(),
|
|
||||||
Commands::Build {} => oizys.build(),
|
|
||||||
Commands::Output {} => println!("{}", oizys.output()),
|
|
||||||
Commands::Boot {} => oizys.nixos_rebuild("boot"),
|
|
||||||
Commands::Switch {} => oizys.nixos_rebuild("switch"),
|
|
||||||
Commands::Cache { name } => oizys.cache(name),
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
eprintln!("No subcommand provided..");
|
|
||||||
let mut cmd = Cli::command();
|
|
||||||
cmd.print_help().unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
13
pkgs/oizys/oizys-zig/.gitignore
vendored
13
pkgs/oizys/oizys-zig/.gitignore
vendored
|
@ -1,13 +0,0 @@
|
||||||
# Created by https://www.toptal.com/developers/gitignore/api/zig
|
|
||||||
# Edit at https://www.toptal.com/developers/gitignore?templates=zig
|
|
||||||
|
|
||||||
### zig ###
|
|
||||||
# Zig programming language
|
|
||||||
|
|
||||||
zig-cache/
|
|
||||||
zig-out/
|
|
||||||
build/
|
|
||||||
build-*/
|
|
||||||
docgen_tmp/
|
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/zig
|
|
|
@ -1,37 +0,0 @@
|
||||||
const std = @import("std");
|
|
||||||
|
|
||||||
pub fn build(b: *std.Build) void {
|
|
||||||
// b.release_mode = .safe;
|
|
||||||
const target = b.standardTargetOptions(.{});
|
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
|
||||||
|
|
||||||
const exe = b.addExecutable(.{
|
|
||||||
.name = "oizys",
|
|
||||||
.root_source_file = .{ .path = "src/main.zig" },
|
|
||||||
.target = target,
|
|
||||||
.optimize = optimize,
|
|
||||||
});
|
|
||||||
exe.root_module.addImport("yazap", b.dependency("yazap", .{}).module("yazap"));
|
|
||||||
exe.root_module.addImport("donuts", b.dependency("donuts", .{}).module("donuts"));
|
|
||||||
b.installArtifact(exe);
|
|
||||||
|
|
||||||
const run_cmd = b.addRunArtifact(exe);
|
|
||||||
run_cmd.step.dependOn(b.getInstallStep());
|
|
||||||
if (b.args) |args| {
|
|
||||||
run_cmd.addArgs(args);
|
|
||||||
}
|
|
||||||
const run_step = b.step("run", "Run the app");
|
|
||||||
run_step.dependOn(&run_cmd.step);
|
|
||||||
|
|
||||||
// I haven't written any...
|
|
||||||
// const exe_unit_tests = b.addTest(.{
|
|
||||||
// .root_source_file = .{ .path = "src/main.zig" },
|
|
||||||
// .target = target,
|
|
||||||
// .optimize = optimize,
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
|
|
||||||
// const test_step = b.step("test", "Run unit tests");
|
|
||||||
// test_step.dependOn(&run_exe_unit_tests.step);
|
|
||||||
//
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
.{
|
|
||||||
.name = "oizys-zig",
|
|
||||||
.version = "0.0.0",
|
|
||||||
.dependencies = .{
|
|
||||||
.yazap = .{
|
|
||||||
.url = "git+https://github.com/prajwalch/yazap.git#341750ff62e3102da4a7f8233920aebace1fc337",
|
|
||||||
.hash = "1220fa71798c994044a987cbde6e73af76bfc402117a61971ccf48f4af4b7154e8d3",
|
|
||||||
},
|
|
||||||
.donuts = .{
|
|
||||||
.url = "git+https://github.com/daylinmorgan/donuts.git#b454b9c1fa3084e6d1431f399d133afe31d4235a",
|
|
||||||
.hash = "1220b6bf5f90c96bd9ac86d989aa1afd605522463afa7f8f372cdf24fac65a5eed99",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
.paths = .{""},
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"1220fa71798c994044a987cbde6e73af76bfc402117a61971ccf48f4af4b7154e8d3": {
|
|
||||||
"name": "yazap",
|
|
||||||
"url": "git+https://github.com/prajwalch/yazap.git#341750ff62e3102da4a7f8233920aebace1fc337",
|
|
||||||
"hash": "sha256-nNhFpay+xk0Ix3GAT1fZ2q/bD9AAx7Xkl4X7QxlzK0M="
|
|
||||||
},
|
|
||||||
"1220b6bf5f90c96bd9ac86d989aa1afd605522463afa7f8f372cdf24fac65a5eed99": {
|
|
||||||
"name": "donuts",
|
|
||||||
"url": "git+https://github.com/daylinmorgan/donuts.git#b454b9c1fa3084e6d1431f399d133afe31d4235a",
|
|
||||||
"hash": "sha256-q3FcUMdhpiyoqlwj5FbIVdUszeAoYzVFzGTgfWzm/pU="
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
zig2nix,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
(zig2nix.outputs.zig-env.${pkgs.system} {
|
|
||||||
zig = zig2nix.outputs.packages.${pkgs.system}.zig.master.bin;
|
|
||||||
}).package
|
|
||||||
{
|
|
||||||
name = "oizys";
|
|
||||||
src = lib.cleanSource ./.;
|
|
||||||
}
|
|
|
@ -1,74 +0,0 @@
|
||||||
const Cli = @This();
|
|
||||||
const std = @import("std");
|
|
||||||
const yazap = @import("yazap");
|
|
||||||
const App = yazap.App;
|
|
||||||
const Arg = yazap.Arg;
|
|
||||||
const Allocator = std.mem.Allocator;
|
|
||||||
|
|
||||||
allocator: Allocator,
|
|
||||||
app: App,
|
|
||||||
matches: *const yazap.ArgMatches = undefined,
|
|
||||||
forward: ?[][]const u8 = null,
|
|
||||||
process_args: ?[]const [:0]u8 = null,
|
|
||||||
|
|
||||||
pub fn init(allocator: Allocator) !Cli {
|
|
||||||
var app = App.init(allocator, "oizys", "nix begat oizys");
|
|
||||||
|
|
||||||
const oizys = app.rootCommand();
|
|
||||||
var cmd_dry = app.createCommand("dry", "poor man's nix flake check");
|
|
||||||
var cmd_build = app.createCommand("build", "build nixos (w/nix build)");
|
|
||||||
var cmd_cache = app.createCommand("cache", "build and push to cachix");
|
|
||||||
var cmd_output = app.createCommand("output", "show system flake output path");
|
|
||||||
var cmd_boot = app.createCommand("boot", "nixos rebuild boot");
|
|
||||||
var cmd_switch = app.createCommand("switch", "nixos rebuild switch");
|
|
||||||
|
|
||||||
try cmd_cache.addArg(Arg.singleValueOption("name", 'n', "name of cachix cache"));
|
|
||||||
inline for (.{
|
|
||||||
&cmd_dry,
|
|
||||||
&cmd_build,
|
|
||||||
&cmd_cache,
|
|
||||||
&cmd_output,
|
|
||||||
&cmd_switch,
|
|
||||||
&cmd_boot,
|
|
||||||
}) |subcmd| {
|
|
||||||
try subcmd.addArg(Arg.positional("forward", null, null));
|
|
||||||
try subcmd.addArg(Arg.singleValueOption("flake", 'f', "path to flake"));
|
|
||||||
try subcmd.addArg(Arg.singleValueOption("host", null, "hostname (default: current host)"));
|
|
||||||
try oizys.addSubcommand(subcmd.*);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Cli{
|
|
||||||
.allocator = allocator,
|
|
||||||
.app = app,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_forward_args(self: *Cli, args: []const [:0]u8) !usize {
|
|
||||||
var forward = std.ArrayList([]const u8).init(self.allocator);
|
|
||||||
|
|
||||||
const delim_idx: usize = delim_lookup: for (args, 0..) |arg, i| {
|
|
||||||
if (std.mem.eql(u8, "--", arg)) break :delim_lookup i;
|
|
||||||
} else args.len;
|
|
||||||
|
|
||||||
if (args.len > delim_idx)
|
|
||||||
for (args[delim_idx + 1 ..]) |fwd|
|
|
||||||
try forward.append(fwd);
|
|
||||||
|
|
||||||
self.forward = try forward.toOwnedSlice();
|
|
||||||
return delim_idx;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn parse(self: *Cli) !void {
|
|
||||||
self.process_args = try std.process.argsAlloc(self.allocator);
|
|
||||||
const delim_idx = try self.get_forward_args(self.process_args.?);
|
|
||||||
self.matches = try self.app.parseFrom(self.process_args.?[1..delim_idx]);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn deinit(self: *Cli) void {
|
|
||||||
std.process.argsFree(self.allocator, self.process_args.?);
|
|
||||||
if (self.forward) |fwd| {
|
|
||||||
for (fwd) |arg| self.allocator.free(arg);
|
|
||||||
self.allocator.free(fwd);
|
|
||||||
}
|
|
||||||
self.app.deinit();
|
|
||||||
}
|
|
|
@ -1,217 +0,0 @@
|
||||||
const Oizys = @This();
|
|
||||||
const std = @import("std");
|
|
||||||
const ArgMatches = @import("yazap").ArgMatches;
|
|
||||||
const Allocator = std.mem.Allocator;
|
|
||||||
const Donuts = @import("donuts").Donuts;
|
|
||||||
|
|
||||||
allocator: Allocator,
|
|
||||||
flake: []const u8,
|
|
||||||
host: []const u8,
|
|
||||||
cache_name: []const u8,
|
|
||||||
output: []const u8,
|
|
||||||
cmd: OizysCmd,
|
|
||||||
debug: bool = false,
|
|
||||||
forward: ?[][]const u8,
|
|
||||||
|
|
||||||
pub const OizysCmd = enum {
|
|
||||||
dry,
|
|
||||||
@"switch",
|
|
||||||
boot,
|
|
||||||
cache,
|
|
||||||
output,
|
|
||||||
build,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn init(allocator: std.mem.Allocator, matches: *const ArgMatches, forward: ?[][]const u8) !Oizys {
|
|
||||||
const cmd = matches.subcommand.?.name;
|
|
||||||
const flags = matches.subcommandMatches(cmd).?;
|
|
||||||
var oizys = Oizys{
|
|
||||||
.allocator = allocator,
|
|
||||||
.host = undefined,
|
|
||||||
.flake = undefined,
|
|
||||||
.output = undefined,
|
|
||||||
.cmd = std.meta.stringToEnum(OizysCmd, cmd).?,
|
|
||||||
.cache_name = flags.getSingleValue("cache") orelse "daylin",
|
|
||||||
.forward = forward,
|
|
||||||
};
|
|
||||||
if (flags.getSingleValue("host")) |host| {
|
|
||||||
oizys.host = try allocator.dupe(u8, host);
|
|
||||||
} else {
|
|
||||||
oizys.host = try Oizys.getDefaultHostName(allocator);
|
|
||||||
}
|
|
||||||
if (flags.getSingleValue("flake")) |flake| {
|
|
||||||
oizys.flake = try allocator.dupe(u8, flake);
|
|
||||||
} else {
|
|
||||||
oizys.flake = try Oizys.getDefaultFlake(allocator);
|
|
||||||
}
|
|
||||||
|
|
||||||
oizys.output = try std.fmt.allocPrint(
|
|
||||||
allocator,
|
|
||||||
"{s}#nixosConfigurations.{s}.config.system.build.toplevel",
|
|
||||||
.{ oizys.flake, oizys.host },
|
|
||||||
);
|
|
||||||
|
|
||||||
return oizys;
|
|
||||||
// return Oizys{
|
|
||||||
// .allocator = allocator,
|
|
||||||
// .host = host,
|
|
||||||
// .flake = flake,
|
|
||||||
// .output = try std.fmt.allocPrint(
|
|
||||||
// allocator,
|
|
||||||
// "{s}#nixosConfigurations.{s}.config.system.build.toplevel",
|
|
||||||
// .{ flake, host },
|
|
||||||
// ),
|
|
||||||
// .cmd = std.meta.stringToEnum(OizysCmd, cmd).?,
|
|
||||||
// .cache_name = flags.getSingleValue("cache") orelse "daylin",
|
|
||||||
// .forward = forward,
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn deinit(self: *Oizys) void {
|
|
||||||
self.allocator.free(self.flake);
|
|
||||||
self.allocator.free(self.output);
|
|
||||||
self.allocator.free(self.host);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn getDefaultHostName(allocator: Allocator) ![]const u8 {
|
|
||||||
var name_buffer: [std.posix.HOST_NAME_MAX]u8 = undefined;
|
|
||||||
const hostname = try std.posix.gethostname(&name_buffer);
|
|
||||||
return std.fmt.allocPrint(allocator, "{s}", .{hostname});
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn getDefaultFlake(allocator: Allocator) ![]const u8 {
|
|
||||||
return std.process.getEnvVarOwned(allocator, "OIZYS_DIR") catch {
|
|
||||||
const homedir = try std.process.getEnvVarOwned(allocator, "HOME");
|
|
||||||
defer allocator.free(homedir);
|
|
||||||
return try std.fmt.allocPrint(allocator, "{s}/oizys", .{homedir});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn getOutputPath(self: *Oizys) ![]const u8 {
|
|
||||||
return std.fmt.allocPrint(
|
|
||||||
self.allocator,
|
|
||||||
"{s}#nixosConfigurations.{s}.config.system.build.toplevel",
|
|
||||||
.{ self.flake, self.host },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub const NixCmd = enum { Nix, NixosRebuild };
|
|
||||||
|
|
||||||
pub fn runNixCmd(self: *Oizys, cmd: NixCmd, argv: []const []const u8) !void {
|
|
||||||
var args = std.ArrayList([]const u8).init(self.allocator);
|
|
||||||
defer args.deinit();
|
|
||||||
|
|
||||||
switch (cmd) {
|
|
||||||
NixCmd.Nix => try args.append("nix"),
|
|
||||||
NixCmd.NixosRebuild => try args.appendSlice(&.{ "sudo", "nixos-rebuild" }),
|
|
||||||
}
|
|
||||||
try args.appendSlice(argv);
|
|
||||||
if (self.forward) |fwd| try args.appendSlice(fwd);
|
|
||||||
var p = std.ChildProcess.init(args.items, self.allocator);
|
|
||||||
_ = try p.spawnAndWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn cache(self: *Oizys) !void {
|
|
||||||
var p = std.ChildProcess.init(
|
|
||||||
&.{
|
|
||||||
"cachix",
|
|
||||||
"watch-exec",
|
|
||||||
self.cache_name,
|
|
||||||
"--verbose",
|
|
||||||
"--",
|
|
||||||
"nix",
|
|
||||||
"build",
|
|
||||||
self.output,
|
|
||||||
"--print-build-logs",
|
|
||||||
"--accept-flake-config",
|
|
||||||
},
|
|
||||||
self.allocator,
|
|
||||||
);
|
|
||||||
_ = try p.spawnAndWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
const DryResult = struct {
|
|
||||||
allocator: Allocator,
|
|
||||||
fetch: [][]const u8,
|
|
||||||
build: [][]const u8,
|
|
||||||
|
|
||||||
pub fn parse(allocator: Allocator, output: []const u8) !DryResult {
|
|
||||||
var it = std.mem.splitSequence(u8, output, ":\n");
|
|
||||||
_ = it.next();
|
|
||||||
var fetch = std.ArrayList([]const u8).init(allocator);
|
|
||||||
var build = std.ArrayList([]const u8).init(allocator);
|
|
||||||
|
|
||||||
if (it.next()) |x| {
|
|
||||||
try parseLines(x, &fetch);
|
|
||||||
} else {
|
|
||||||
return error.DryParseError;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (it.next()) |x| {
|
|
||||||
try parseLines(x, &build);
|
|
||||||
} else {
|
|
||||||
return error.DryParseError;
|
|
||||||
}
|
|
||||||
|
|
||||||
return .{
|
|
||||||
.allocator = allocator,
|
|
||||||
.fetch = try fetch.toOwnedSlice(),
|
|
||||||
.build = try build.toOwnedSlice(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn deinit(self: *DryResult) void {
|
|
||||||
self.allocator.free(self.fetch);
|
|
||||||
self.allocator.free(self.build);
|
|
||||||
// for (self.fetch) |item| {
|
|
||||||
// self.allocator.free(item);
|
|
||||||
// }
|
|
||||||
// for (self.build) |item| {
|
|
||||||
// self.allocator.free(item);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
fn parseLines(buffer: []const u8, list: *std.ArrayList([]const u8)) !void {
|
|
||||||
var lines = std.mem.splitSequence(u8, buffer, "\n");
|
|
||||||
while (lines.next()) |line| {
|
|
||||||
try list.append(line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn dry(self: *Oizys) !void {
|
|
||||||
var sp = Donuts(std.io.getStdOut()).init(
|
|
||||||
"evaluating...",
|
|
||||||
.{ .style = .dots },
|
|
||||||
.{},
|
|
||||||
);
|
|
||||||
try sp.start();
|
|
||||||
const cmd_output = try std.ChildProcess.run(.{
|
|
||||||
.allocator = self.allocator,
|
|
||||||
.argv = &.{ "nix", "build", self.output, "--dry-run" },
|
|
||||||
});
|
|
||||||
try sp.stop(.{ .message = "done." });
|
|
||||||
defer self.allocator.free(cmd_output.stdout);
|
|
||||||
defer self.allocator.free(cmd_output.stderr);
|
|
||||||
var result = try DryResult.parse(self.allocator, cmd_output.stderr);
|
|
||||||
defer result.deinit();
|
|
||||||
|
|
||||||
std.debug.print(
|
|
||||||
"to fetch: {d}\nto build: {d}\n",
|
|
||||||
.{ result.fetch.len, result.build.len },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn run(self: *Oizys) !void {
|
|
||||||
switch (self.cmd) {
|
|
||||||
.@"switch" => try self.runNixCmd(.NixosRebuild, &.{ "switch", "--flake", self.flake }),
|
|
||||||
|
|
||||||
.boot => try self.runNixCmd(.NixosRebuild, &.{ "boot", "--flake", self.flake }),
|
|
||||||
.dry => try self.dry(),
|
|
||||||
.build => try self.runNixCmd(.Nix, &.{ "build", self.output }),
|
|
||||||
.output => {
|
|
||||||
const stdout = std.io.getStdOut().writer();
|
|
||||||
try stdout.print("{s}\n", .{self.output});
|
|
||||||
},
|
|
||||||
.cache => try self.cache(),
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
const std = @import("std");
|
|
||||||
const Oizys = @import("Oizys.zig");
|
|
||||||
const Cli = @import("Cli.zig");
|
|
||||||
|
|
||||||
pub fn main() !void {
|
|
||||||
// memory management isn't hard :P
|
|
||||||
// var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
|
||||||
// defer arena.deinit();
|
|
||||||
// const allocator = arena.allocator();
|
|
||||||
//
|
|
||||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
|
||||||
const allocator = gpa.allocator();
|
|
||||||
defer _ = gpa.deinit();
|
|
||||||
|
|
||||||
var cli = try Cli.init(allocator);
|
|
||||||
try cli.parse();
|
|
||||||
defer cli.deinit();
|
|
||||||
|
|
||||||
if (!cli.matches.containsArgs()) {
|
|
||||||
try cli.app.displayHelp();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var oizys = try Oizys.init(allocator, cli.matches, cli.forward);
|
|
||||||
defer oizys.deinit();
|
|
||||||
try oizys.run();
|
|
||||||
}
|
|
Loading…
Reference in a new issue