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

View file

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

View file

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

View file

@ -37,11 +37,11 @@
trusted-users = ["@wheel"]; trusted-users = ["@wheel"];
accept-flake-config = true; accept-flake-config = true;
# substituters = [ substituters = [
# "https://daylin.cachix.org" "https://daylin.cachix.org"
# ]; ];
# trusted-public-keys = [ trusted-public-keys = [
# "daylin.cachix.org-1:fLdSnbhKjtOVea6H9KqXeir+PyhO+sDSPhEW66ClE/k=" "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 from std/nativesockets import getHostname
let summaryFile = getEnv("GITHUB_STEP_SUMMARY") let summaryFile = getEnv("GITHUB_STEP_SUMMARY")
proc info(args: varargs[string, `$`]) = proc info(args: varargs[string, `$`]) =
stdout.styledWriteLine( stdout.styledWriteLine(
fgCyan, "oizys", resetStyle, "|", fgCyan, "oizys", resetStyle, "|",
@ -17,18 +18,15 @@ proc error(args: varargs[string, `$`]) =
args.join("") args.join("")
) )
proc execQuit(cmd: string) =
quit (execCmd cmd)
type type
OizysContext = object OizysContext = object
flake, host: string flake, host: string
extraArgs: seq[string]
cache = "daylin" cache = "daylin"
pinix: bool = true 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 = proc newCtx(): OizysContext =
result = OizysContext() result = OizysContext()
result.flake = getEnv("FLAKE_PATH", getEnv("HOME") / "oizys") result.flake = getEnv("FLAKE_PATH", getEnv("HOME") / "oizys")
@ -50,11 +48,11 @@ proc systemFlakePath(c: OizysContext): string =
proc build(c: OizysContext) = proc build(c: OizysContext) =
## build nixos ## build nixos
execQuit c, c.cmd, "build", c.systemFlakePath execQuit c.cmd & " build " & c.systemFlakePath
proc dry(c: OizysContext) = proc dry(c: OizysContext) =
## poor man's nix flake check ## 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) = proc cache(c: OizysContext) =
let start = now() let start = now()
@ -79,7 +77,7 @@ proc cache(c: OizysContext) =
proc nixosRebuild(c: OizysContext, subcmd: string) = proc nixosRebuild(c: OizysContext, subcmd: string) =
let cmd = if c.pinix: "pixos-rebuild" else: "nixos-rebuild" 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) = proc boot(c: OizysContext) =
## nixos rebuild boot ## nixos rebuild boot
@ -121,7 +119,7 @@ proc runCmd(c: OizysContext, cmd: string) =
quit 1 quit 1
proc parseFlag(c: var OizysContext, kind: CmdLineKind, key, val: string) = proc parseFlag(c: var OizysContext, key, val: string) =
case key: case key:
of "h", "help": of "h", "help":
echo usage; quit 0 echo usage; quit 0
@ -131,31 +129,23 @@ proc parseFlag(c: var OizysContext, kind: CmdLineKind, key, val: string) =
c.flake = val c.flake = val
of "no-pinix": of "no-pinix":
c.pinix = false c.pinix = false
else:
c.extraArgs.add (if kind == cmdLongOption: "--" else: "-") & key
c.extraArgs.add val
when isMainModule: when isMainModule:
import std/parseopt
var var
c = newCtx() c = newCtx()
subcmd: string subcmd: string
var p = initOptParser( for kind, key, val in getopt(longNoVal = @["no-nom"]):
longNoVal = @["no-pinix", "help", ""], shortNoVal = {'h'}
)
for kind, key, val in p.getopt():
case kind case kind
of cmdArgument: of cmdArgument:
echo key
subcmd = key subcmd = key
of cmdLongOption, cmdShortOption: of cmdLongOption, cmdShortOption:
if key == "": parseFlag c, key, val
break
parseFlag c, kind, key, val
of cmdEnd: of cmdEnd:
discard discard
if subcmd == "": if subcmd == "":
echo "please specify a command" echo "please specify a command"
echo usage; quit 1 echo usage; quit 1
c.extraArgs = p.remainingArgs
check c check c
runCmd c, subcmd runCmd c, subcmd