Feature Request: Nix
Opened this issue · 1 comments
florerl commented
Look into adding Nix, [https://nixos.org/nix/], as a package source.
gui-dos commented
I tried to get the metadata of the available packages by using the following code (you can copy&paste it in a playground):
import Foundation
@discardableResult
func shell(_ cmd: String) -> String {
let task = Process()
task.launchPath = "/bin/bash"
task.arguments = ["-l", "-c", cmd]
let pipe = Pipe()
task.standardOutput = pipe
task.launch()
task.waitUntilExit()
let data = pipe.fileHandleForReading.readDataToEndOfFile()
let output: String = String(data: data, encoding: .utf8) ?? ""
return output
}
print(shell("/nix/var/nix/profiles/default/bin/nix-env --json -qa python"))
Unfortunately, it doesn't work if you omit the final arg to get the descriptions of all the packages with:
print(shell("/nix/var/nix/profiles/default/bin/nix-env --json -qa")) // freeze :(
I will investigate further.