mirror of
https://github.com/daylinmorgan/oizys.git
synced 2025-02-22 15:15:50 -06:00
add --system to oizys output
This commit is contained in:
parent
cbe0f41e6c
commit
244992f35b
2 changed files with 15 additions and 4 deletions
|
@ -138,12 +138,17 @@ hwylCli:
|
|||
... "nixos config attr"
|
||||
flags:
|
||||
^minimal
|
||||
system:
|
||||
? "show system path"
|
||||
run:
|
||||
if not minimal:
|
||||
echo nixosConfigAttrs().join(" ")
|
||||
else:
|
||||
if minimal and system:
|
||||
echo "--minimal and --system are mutually exclusive"
|
||||
elif minimal:
|
||||
showOizysDerivations()
|
||||
|
||||
elif system:
|
||||
echo getSystemPaths().mapIt(it & "^*").join(" ")
|
||||
else:
|
||||
echo nixosConfigAttrs().join(" ")
|
||||
[update]
|
||||
... "update and run nixos-rebuild"
|
||||
flags:
|
||||
|
|
|
@ -198,6 +198,7 @@ proc nixDerivationShow*(drvs: openArray[string]): Table[string, NixDerivation] =
|
|||
runCmdCaptWithSpinner(cmd, "evaluating " & drvs.join(" "))
|
||||
fromJson(output, Table[string, NixDerivation])
|
||||
|
||||
|
||||
# TODO: replace asserts in this proc, would be easier with results type
|
||||
proc findSystemPaths(drvs: Table[string, NixDerivation]): seq[string] =
|
||||
let hosts = getHosts()
|
||||
|
@ -214,6 +215,10 @@ proc findSystemPaths(drvs: Table[string, NixDerivation]): seq[string] =
|
|||
|
||||
assert len(hosts) == len(result)
|
||||
|
||||
# NOTE: is find system paths always called after a nixDerivationShow?
|
||||
proc getSystemPaths*(): seq[string] =
|
||||
let systemDrvs = nixDerivationShow(nixosConfigAttrs())
|
||||
result = findSystemPaths(systemDrvs)
|
||||
|
||||
proc filterSeq(
|
||||
drvs: seq[string],
|
||||
|
@ -240,6 +245,7 @@ func isIgnored(drv: string): bool =
|
|||
proc getSystemPathDrvs*(): seq[string] =
|
||||
let systemDrvs = nixDerivationShow(nixosConfigAttrs())
|
||||
let systemPathDrvs = findSystemPaths(systemDrvs)
|
||||
|
||||
result =
|
||||
collect:
|
||||
for k, drv in nixDerivationShow(systemPathDrvs):
|
||||
|
|
Loading…
Add table
Reference in a new issue