mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-26 21:50:44 -06:00
Compare commits
3 commits
fa200bb369
...
0df4c078d7
Author | SHA1 | Date | |
---|---|---|---|
0df4c078d7 | |||
93cd78cf85 | |||
e6e09537b5 |
3 changed files with 87 additions and 78 deletions
94
flake.lock
94
flake.lock
|
@ -210,11 +210,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1713612213,
|
"lastModified": 1715791817,
|
||||||
"narHash": "sha256-zJboXgWNpNhKyNF8H/3UYzWkx7w00TOCGKi3cwi+tsw=",
|
"narHash": "sha256-J069Uhv/gCMFLX1dSh2f+9ZTM09r1Nv3oUfocCnWKow=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "hyprcursor",
|
"repo": "hyprcursor",
|
||||||
"rev": "cab4746180f210a3c1dd3d53e45c510e309e90e1",
|
"rev": "7c3aa03dffb53921e583ade3d4ae3f487e390e7e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -233,11 +233,11 @@
|
||||||
"xdph": "xdph"
|
"xdph": "xdph"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1715798022,
|
"lastModified": 1716063601,
|
||||||
"narHash": "sha256-ofQ2ZlKBgy0otWRN08kbRjObk2Nkz/f+nRjGww/5zMs=",
|
"narHash": "sha256-gAuCKupztnqai1tZ6TyCFCRbeFzbggL0Oe0vl0/cwK8=",
|
||||||
"ref": "refs/heads/main",
|
"ref": "refs/heads/main",
|
||||||
"rev": "b9c58b6e75f7d0141d8ba88fb3f6f022fed0877a",
|
"rev": "f8857e6072bd85b95393499688872aaf7f088b5b",
|
||||||
"revCount": 4698,
|
"revCount": 4719,
|
||||||
"submodules": true,
|
"submodules": true,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/hyprwm/Hyprland"
|
"url": "https://github.com/hyprwm/Hyprland"
|
||||||
|
@ -305,11 +305,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1713121246,
|
"lastModified": 1715791527,
|
||||||
"narHash": "sha256-502X0Q0fhN6tJK7iEUA8CghONKSatW/Mqj4Wappd++0=",
|
"narHash": "sha256-HhQ4zvGHrRjR63ltySSeg+x+0jb0lepiutWdnFhLRoo=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "hyprlang",
|
"repo": "hyprlang",
|
||||||
"rev": "78fcaa27ae9e1d782faa3ff06c8ea55ddce63706",
|
"rev": "969cb076e5b76f2e823aeca1937a3e1f159812ee",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -330,11 +330,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1715608589,
|
"lastModified": 1715879663,
|
||||||
"narHash": "sha256-vimNaLjLcoNIvBhF37GaB6PRYEvKMamY3UnDE9M5MW8=",
|
"narHash": "sha256-/DwglRvj4XF4ECdNtrCIbthleszAZBwOiXG5A6r0K/c=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "hyprwayland-scanner",
|
"repo": "hyprwayland-scanner",
|
||||||
"rev": "65c2636484e5cb00583b8a7446c3fb657f568883",
|
"rev": "f5181a068c1b06f2db51f6222e50a0c665a2b0c3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -361,11 +361,11 @@
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1715515815,
|
"lastModified": 1716120557,
|
||||||
"narHash": "sha256-yaLScMHNFCH6SbB0HSA/8DWDgK0PyOhCXoFTdHlWkhk=",
|
"narHash": "sha256-rvNq9YolMY1DRMgwdAti8qwNDjkhTsotSWa15/Ch7+A=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "lib-aggregate",
|
"repo": "lib-aggregate",
|
||||||
"rev": "09883ca828e8cfaacdb09e29190a7b84ad1d9925",
|
"rev": "5fa64b174daa22fe0d20ebbcc0ec2c7905b503f1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -401,11 +401,11 @@
|
||||||
"nixpkgs": "nixpkgs_4"
|
"nixpkgs": "nixpkgs_4"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1715442723,
|
"lastModified": 1715885250,
|
||||||
"narHash": "sha256-pXMH7lqr5bT2FjH/3tEdTT/+1+hKx+15WkcGKycWWSM=",
|
"narHash": "sha256-IUFYAl3158Ig5vySnRBHoPReb2/S97bjodCo6FhzJv4=",
|
||||||
"ref": "refs/heads/main",
|
"ref": "refs/heads/main",
|
||||||
"rev": "87b7b7e4bd936301b139e472589d1966b136f45f",
|
"rev": "53d713eb486f21d653af3ef3528e9a19ecfc45e5",
|
||||||
"revCount": 76,
|
"revCount": 81,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.lix.systems/lix-project/nixos-module"
|
"url": "https://git.lix.systems/lix-project/nixos-module"
|
||||||
},
|
},
|
||||||
|
@ -422,11 +422,11 @@
|
||||||
"treefmt-nix": "treefmt-nix"
|
"treefmt-nix": "treefmt-nix"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1715765180,
|
"lastModified": 1715804156,
|
||||||
"narHash": "sha256-RJASAKCIdYO5ZaEU/ctDRlPg74yZJTPb7lkRXeiezAw=",
|
"narHash": "sha256-GtIHP86Cz1kD9xZO/cKbNQACHKdoT9WFbLJAq6W2EDY=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nix-eval-jobs",
|
"repo": "nix-eval-jobs",
|
||||||
"rev": "aa477075a0c47503bb2c193802a40a83e3b2d6ab",
|
"rev": "bb95091f6c6f38f6cfc215a1797a2dd466312c8b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -464,11 +464,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1715483403,
|
"lastModified": 1716088072,
|
||||||
"narHash": "sha256-WMDuQj7J5jbpXI/X/E6FZRKgBFGcaSTvYyVxPnKE6KU=",
|
"narHash": "sha256-ZXzV39r4ShjS6lvhOX+oN0Vazg5A/zibJDzE2r1jlRM=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nix-index-database",
|
"repo": "nix-index-database",
|
||||||
"rev": "f9027322f48b427da23746aa359a6510dfcd0228",
|
"rev": "6b94c48c3bb22d5181333c3fb71beff44116e251",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -495,11 +495,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1715474941,
|
"lastModified": 1716079763,
|
||||||
"narHash": "sha256-CNCqCGOHdxuiVnVkhTpp2WcqSSmSfeQjubhDOcgwGjU=",
|
"narHash": "sha256-DGRfb7fO7c3XDS3twmuaV5NAGPPdU3W7Q35fjIZc8iY=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs.lib",
|
"repo": "nixpkgs.lib",
|
||||||
"rev": "58e03b95f65dfdca21979a081aa62db0eed6b1d8",
|
"rev": "0df131b5ee4d928a4b664b6d0cd99cf134d6ab6b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -516,11 +516,11 @@
|
||||||
"nixpkgs": "nixpkgs_7"
|
"nixpkgs": "nixpkgs_7"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1715797345,
|
"lastModified": 1716128119,
|
||||||
"narHash": "sha256-q2Np+IhOVIHnUhiqgGlsuhIUtRPbd90Odx25ZmxvfHE=",
|
"narHash": "sha256-APMa1xFnUIaYfZUaG8PyrHVlLP9ckm7S80k2TUnWjXg=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs-wayland",
|
"repo": "nixpkgs-wayland",
|
||||||
"rev": "1750d067a124f636acb7f3f9f758c3b00430e6f9",
|
"rev": "6c12f5c0f7dc6d94c332233dbaf67ce1165eadcb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -531,11 +531,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1715534503,
|
"lastModified": 1715787315,
|
||||||
"narHash": "sha256-5ZSVkFadZbFP1THataCaSf0JH2cAH3S29hU9rrxTEqk=",
|
"narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "2057814051972fa1453ddfb0d98badbea9b83c06",
|
"rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -579,11 +579,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_5": {
|
"nixpkgs_5": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1715653339,
|
"lastModified": 1716097317,
|
||||||
"narHash": "sha256-7lR9tpVXviSccl07GXI0+ve/natd24HAkuy1sQp0OlI=",
|
"narHash": "sha256-1UMrLtgzielG/Sop6gl6oTSM4pDt7rF9j9VuxhDWDlY=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "abd6d48f8c77bea7dc51beb2adfa6ed3950d2585",
|
"rev": "8535fb92661f37ff9f0da3007fbc942f7d134b41",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -611,11 +611,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_7": {
|
"nixpkgs_7": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1715534503,
|
"lastModified": 1715961556,
|
||||||
"narHash": "sha256-5ZSVkFadZbFP1THataCaSf0JH2cAH3S29hU9rrxTEqk=",
|
"narHash": "sha256-+NpbZRCRisUHKQJZF3CT+xn14ZZQO+KjxIIanH3Pvn4=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "2057814051972fa1453ddfb0d98badbea9b83c06",
|
"rev": "4a6b83b05df1a8bd7d99095ec4b4d271f2956b64",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -643,11 +643,11 @@
|
||||||
},
|
},
|
||||||
"stable": {
|
"stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1715668745,
|
"lastModified": 1716061101,
|
||||||
"narHash": "sha256-xp62OkRkbUDNUc6VSqH02jB0FbOS+MsfMb7wL1RJOfA=",
|
"narHash": "sha256-H0eCta7ahEgloGIwE/ihkyGstOGu+kQwAiHvwVoXaA0=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "9ddcaffecdf098822d944d4147dd8da30b4e6843",
|
"rev": "e7cc61784ddf51c81487637b3031a6dd2d6673a2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -793,11 +793,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1714662532,
|
"lastModified": 1715788457,
|
||||||
"narHash": "sha256-Pj2xGSYhapYbXL7sk7TTlOtCZcTfPQoL3fPbZeg7L4Y=",
|
"narHash": "sha256-32HOkjSIyANphV0p5gIwP4ONU/CcinhwOyVFB+tL/d0=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "xdg-desktop-portal-hyprland",
|
"repo": "xdg-desktop-portal-hyprland",
|
||||||
"rev": "1f228ba2f1f254195c0b571302b37482861abee3",
|
"rev": "af7c87a32f5d67eb2ada908a6a700f4e74831943",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
|
|
||||||
var buildCmd = &cobra.Command{
|
var buildCmd = &cobra.Command{
|
||||||
Use: "build",
|
Use: "build",
|
||||||
Short: "A brief description of your command",
|
Short: "nix build",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
oizys.NixBuild(args...)
|
oizys.NixBuild(args...)
|
||||||
},
|
},
|
||||||
|
|
|
@ -51,7 +51,10 @@ func (o *Oizys) Output() string {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *Oizys) Update(flake string, host string, cache string, verbose bool) {
|
func (o *Oizys) Update(
|
||||||
|
flake, host, cache string,
|
||||||
|
verbose bool,
|
||||||
|
) {
|
||||||
if host != "" {
|
if host != "" {
|
||||||
o.host = host
|
o.host = host
|
||||||
}
|
}
|
||||||
|
@ -82,11 +85,10 @@ type packages struct {
|
||||||
desc string
|
desc string
|
||||||
}
|
}
|
||||||
|
|
||||||
func parsePackages(buf string, desc string) *packages {
|
func parsePackages(lines []string, desc string) *packages {
|
||||||
w, _ := terminalSize()
|
w, _ := terminalSize()
|
||||||
maxAcceptable := (w / 4) - 1
|
maxAcceptable := (w / 4) - 1
|
||||||
maxLen := 0
|
maxLen := 0
|
||||||
lines := strings.Split(strings.TrimSpace(buf), "\n")[1:]
|
|
||||||
names := make([]string, len(lines))
|
names := make([]string, len(lines))
|
||||||
for i, pkg := range lines {
|
for i, pkg := range lines {
|
||||||
s := strings.SplitN(pkg, "-", 2)
|
s := strings.SplitN(pkg, "-", 2)
|
||||||
|
@ -174,34 +176,32 @@ func (o *Oizys) GitPull() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseDryRunOutput(nixOutput string, verbose bool) {
|
func parseDryRun(buf string) (*packages, *packages) {
|
||||||
parts := strings.Split("\n"+nixOutput, "\nthese")
|
lines := strings.Split(strings.TrimSpace(buf), "\n")
|
||||||
|
var parts [2][]string
|
||||||
|
i := 0
|
||||||
|
for _, line := range lines {
|
||||||
|
if strings.Contains(line, "fetch") {
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(line, " ") {
|
||||||
|
parts[i] = append(parts[i], line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(parts) != 3 {
|
if len(parts[0]) + len(parts[1]) == 0 {
|
||||||
log.Println("no changes...")
|
log.Println("no changes...")
|
||||||
log.Println("or I failed to parse it into the expected number of parts")
|
log.Println("or I failed to parse it into the expected number of parts")
|
||||||
fmt.Println(parts)
|
log.Fatalln("failed to parse nix build --dry-run output")
|
||||||
return
|
|
||||||
}
|
}
|
||||||
toBuild := parsePackages(parts[1], "packages to build")
|
|
||||||
toFetch := parsePackages(parts[2], "packages to fetch")
|
|
||||||
|
|
||||||
toBuild.show(verbose)
|
return parsePackages(parts[0], "packages to build"), parsePackages(parts[1], "packages to fetch")
|
||||||
toFetch.show(verbose)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func nixSpinner(host string) *spinner.Spinner {
|
func showDryRunResult(nixOutput string, verbose bool) {
|
||||||
msg := fmt.Sprintf("%s %s", " evaluating derivation for:",
|
toBuild, toFetch := parseDryRun(nixOutput)
|
||||||
output.String(host).Bold().Foreground(output.Color("6")),
|
toBuild.show(verbose)
|
||||||
)
|
toFetch.show(verbose)
|
||||||
s := spinner.New(
|
|
||||||
spinner.CharSets[14],
|
|
||||||
100*time.Millisecond,
|
|
||||||
spinner.WithSuffix(msg),
|
|
||||||
spinner.WithColor("fgHiMagenta"),
|
|
||||||
)
|
|
||||||
s.Start()
|
|
||||||
return s
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *Oizys) NixDryRun(verbose bool, rest ...string) {
|
func (o *Oizys) NixDryRun(verbose bool, rest ...string) {
|
||||||
|
@ -217,7 +217,7 @@ func (o *Oizys) NixDryRun(verbose bool, rest ...string) {
|
||||||
fmt.Println(string(result))
|
fmt.Println(string(result))
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
ParseDryRunOutput(string(result), verbose)
|
showDryRunResult(string(result), verbose)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *Oizys) NixosRebuild(subcmd string, rest ...string) {
|
func (o *Oizys) NixosRebuild(subcmd string, rest ...string) {
|
||||||
|
@ -258,11 +258,6 @@ func (o *Oizys) CacheBuild(rest ...string) {
|
||||||
runCommand(cmd)
|
runCommand(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CheckFlake(flake string) {
|
|
||||||
if _, err := os.Stat(flake); errors.Is(err, fs.ErrNotExist) {
|
|
||||||
log.Fatalln("path to flake:", flake, "does not exist")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (o *Oizys) CheckFlake() {
|
func (o *Oizys) CheckFlake() {
|
||||||
if _, err := os.Stat(o.flake); errors.Is(err, fs.ErrNotExist) {
|
if _, err := os.Stat(o.flake); errors.Is(err, fs.ErrNotExist) {
|
||||||
|
@ -277,3 +272,17 @@ func Output(flake string, host string) string {
|
||||||
host,
|
host,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func nixSpinner(host string) *spinner.Spinner {
|
||||||
|
msg := fmt.Sprintf("%s %s", " evaluating derivation for:",
|
||||||
|
output.String(host).Bold().Foreground(output.Color("6")),
|
||||||
|
)
|
||||||
|
s := spinner.New(
|
||||||
|
spinner.CharSets[14],
|
||||||
|
100*time.Millisecond,
|
||||||
|
spinner.WithSuffix(msg),
|
||||||
|
spinner.WithColor("fgHiMagenta"),
|
||||||
|
)
|
||||||
|
s.Start()
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue