Compare commits

..

No commits in common. "8766668a1c2a01a68982ee2e25f696662a679fdf" and "d20a3371740c4da4794e1dc85f096b4e20833fe9" have entirely different histories.

5 changed files with 31 additions and 42 deletions

View file

@ -169,11 +169,11 @@
},
"locked": {
"dir": "inputs",
"lastModified": 1709059876,
"narHash": "sha256-zc4rfNB4EkFmU67E8J7zpe2pqFD1ONXQgBw2ptow5jY=",
"lastModified": 1709052087,
"narHash": "sha256-iVkXKOCGoMAlvPrZQau4hEBFK3lWRmvrPfs25parGW4=",
"owner": "daylinmorgan",
"repo": "oizys",
"rev": "60a1c20747ef729ba07e8bbc18fa8caebdd85010",
"rev": "c0b2603a31b07e939c5663cfd1b1effa47da5d69",
"type": "github"
},
"original": {
@ -271,11 +271,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1709038661,
"narHash": "sha256-Ys611iT6pChGv954aa4f8oKoDKJG3IXjJjPhnj6uaLY=",
"lastModified": 1708976803,
"narHash": "sha256-yvRygcySjjSvj5JTaCdo7lPqJ/2mBV2XQ94Oaq/14qw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "8520c158aee718c6e87b56881105fc4223c3c723",
"rev": "548a86b335d7ecd8b57ec617781f5e652ab0c38e",
"type": "github"
},
"original": {
@ -314,11 +314,11 @@
]
},
"locked": {
"lastModified": 1709054151,
"narHash": "sha256-XRF+8hpY5+g5jxld8EMERVtIfJM6WMdVKW5Mnm912xo=",
"lastModified": 1709050816,
"narHash": "sha256-8pFTejdM2+L0XMp2/sKtXxx6S7348oLDW10uGrmYvds=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "c4fff942ce8dc430bb33f983dab44d308c2966a9",
"rev": "022be38bbf1d4be94cff0d382108bece8ad0d2ad",
"type": "github"
},
"original": {

View file

@ -30,14 +30,12 @@
extra-substituters = [
"https://hyprland.cachix.org"
"https://nixpkgs-wayland.cachix.org"
# "https://daylin.cachix.org"
"https://cache.garnix.io"
"https://daylin.cachix.org"
];
extra-trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
# "daylin.cachix.org-1:fLdSnbhKjtOVea6H9KqXeir+PyhO+sDSPhEW66ClE/k="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
"daylin.cachix.org-1:fLdSnbhKjtOVea6H9KqXeir+PyhO+sDSPhEW66ClE/k="
];
};
outputs = _: {};

View file

@ -4,6 +4,7 @@
pkgs,
...
}: let
inherit (lib) mkIfIn;
cfg = config.oizys.languages;
in {

View file

@ -37,11 +37,11 @@
trusted-users = ["@wheel"];
accept-flake-config = true;
# substituters = [
# "https://daylin.cachix.org"
# ];
# trusted-public-keys = [
# "daylin.cachix.org-1:fLdSnbhKjtOVea6H9KqXeir+PyhO+sDSPhEW66ClE/k="
# ];
substituters = [
"https://daylin.cachix.org"
];
trusted-public-keys = [
"daylin.cachix.org-1:fLdSnbhKjtOVea6H9KqXeir+PyhO+sDSPhEW66ClE/k="
];
};
}

View file

@ -1,8 +1,9 @@
import std/[os, osproc, parseopt, times, strutils, terminal]
import std/[os, osproc, tables, times, strutils, terminal]
from std/nativesockets import getHostname
let summaryFile = getEnv("GITHUB_STEP_SUMMARY")
proc info(args: varargs[string, `$`]) =
stdout.styledWriteLine(
fgCyan, "oizys", resetStyle, "|",
@ -17,18 +18,15 @@ proc error(args: varargs[string, `$`]) =
args.join("")
)
proc execQuit(cmd: string) =
quit (execCmd cmd)
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(" ")
info "exec: ", cmd
quit (execCmd cmd)
proc newCtx(): OizysContext =
result = OizysContext()
result.flake = getEnv("FLAKE_PATH", getEnv("HOME") / "oizys")
@ -50,11 +48,11 @@ proc systemFlakePath(c: OizysContext): string =
proc build(c: OizysContext) =
## build nixos
execQuit c, c.cmd, "build", c.systemFlakePath
execQuit c.cmd & " build " & c.systemFlakePath
proc dry(c: OizysContext) =
## poor man's nix flake check
execQuit c, c.cmd, "build", c.systemFlakePath, "--dry-run"
execQuit c.cmd & " build " & c.systemFlakePath & " --dry-run"
proc cache(c: OizysContext) =
let start = now()
@ -79,7 +77,7 @@ proc cache(c: OizysContext) =
proc nixosRebuild(c: OizysContext, subcmd: string) =
let cmd = if c.pinix: "pixos-rebuild" else: "nixos-rebuild"
execQuit c, "sudo", cmd, subcmd, "--flake", c.flake
execQuit "sudo " & cmd & " " & subcmd & " " & " --flake " & c.flake
proc boot(c: OizysContext) =
## nixos rebuild boot
@ -121,7 +119,7 @@ proc runCmd(c: OizysContext, cmd: string) =
quit 1
proc parseFlag(c: var OizysContext, kind: CmdLineKind, key, val: string) =
proc parseFlag(c: var OizysContext, key, val: string) =
case key:
of "h", "help":
echo usage; quit 0
@ -131,31 +129,23 @@ proc parseFlag(c: var OizysContext, kind: CmdLineKind, key, val: string) =
c.flake = val
of "no-pinix":
c.pinix = false
else:
c.extraArgs.add (if kind == cmdLongOption: "--" else: "-") & key
c.extraArgs.add val
when isMainModule:
import std/parseopt
var
c = newCtx()
subcmd: string
var p = initOptParser(
longNoVal = @["no-pinix", "help", ""], shortNoVal = {'h'}
)
for kind, key, val in p.getopt():
for kind, key, val in getopt(longNoVal = @["no-nom"]):
case kind
of cmdArgument:
echo key
subcmd = key
of cmdLongOption, cmdShortOption:
if key == "":
break
parseFlag c, kind, key, val
parseFlag c, 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