mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-26 09:20:44 -06:00
Compare commits
1 commit
d8c067a48f
...
83916c7b0e
Author | SHA1 | Date | |
---|---|---|---|
|
83916c7b0e |
7 changed files with 83 additions and 128 deletions
2
.github/workflows/nightly.yml
vendored
2
.github/workflows/nightly.yml
vendored
|
@ -56,7 +56,7 @@ jobs:
|
||||||
--print-build-logs
|
--print-build-logs
|
||||||
|
|
||||||
- name: Commit Updates
|
- name: Commit Updates
|
||||||
run: git push --set-upstream --force origin flake-lock
|
run: git push --set-upstream --force-with-lease origin flake-lock
|
||||||
|
|
||||||
build-full:
|
build-full:
|
||||||
needs: build-minimal
|
needs: build-minimal
|
||||||
|
|
88
flake.lock
88
flake.lock
|
@ -90,11 +90,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1719994518,
|
"lastModified": 1712014858,
|
||||||
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
|
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
|
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -305,11 +305,11 @@
|
||||||
"xdph": "xdph"
|
"xdph": "xdph"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720896272,
|
"lastModified": 1720731503,
|
||||||
"narHash": "sha256-zo1lDMsxjEyko/P+KfCLNYZrCAWQOrX90/J31nqzpy4=",
|
"narHash": "sha256-Qlm0IRnOrI64RW/SEvW9rA1ytVvPS1CsVvRataNvStI=",
|
||||||
"ref": "refs/heads/main",
|
"ref": "refs/heads/main",
|
||||||
"rev": "bc6b0880dda2607a80f000c134f573c970452a0f",
|
"rev": "e728e56cbc6af0a9be1276b2cf8e019a894016e7",
|
||||||
"revCount": 4925,
|
"revCount": 4917,
|
||||||
"submodules": true,
|
"submodules": true,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/hyprwm/Hyprland/"
|
"url": "https://github.com/hyprwm/Hyprland/"
|
||||||
|
@ -498,11 +498,11 @@
|
||||||
"lix": {
|
"lix": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720825173,
|
"lastModified": 1720733512,
|
||||||
"narHash": "sha256-YZ7043PFS6LalHAyGeO7qRLeZIevwjHRbbMkpixjwhM=",
|
"narHash": "sha256-vq9CLDvqSSvH4L7YhDa0ihTOrAry4jntKiuoNb5n98M=",
|
||||||
"rev": "a8f443d96011c11ad726c2a28a37752bd56c12cc",
|
"rev": "4b109ec1a8fc4550150f56f0f46f2f41d844bda8",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/a8f443d96011c11ad726c2a28a37752bd56c12cc.tar.gz"
|
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/4b109ec1a8fc4550150f56f0f46f2f41d844bda8.tar.gz"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
|
@ -540,11 +540,11 @@
|
||||||
"treefmt-nix": "treefmt-nix"
|
"treefmt-nix": "treefmt-nix"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720931326,
|
"lastModified": 1719247822,
|
||||||
"narHash": "sha256-QHajV5BjfaMWbiOAJ/MGH+exXo+CjzUpkxxEtz0ZZ2k=",
|
"narHash": "sha256-qbtex5uSOUQnK4797JztyTQWlnlhEsE8x5g5qs5DgvQ=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nix-eval-jobs",
|
"repo": "nix-eval-jobs",
|
||||||
"rev": "c132534bc68eb48479a59a3116ee7ce0f16ce12b",
|
"rev": "9bed665aa71907dcacc8ae6dba1a3055a9ff2de7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -562,11 +562,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720066371,
|
"lastModified": 1703863825,
|
||||||
"narHash": "sha256-uPlLYH2S0ACj0IcgaK9Lsf4spmJoGejR9DotXiXSBZQ=",
|
"narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nix-github-actions",
|
"repo": "nix-github-actions",
|
||||||
"rev": "622f829f5fe69310a866c8a6cd07e747c44ef820",
|
"rev": "5163432afc817cf8bd1f031418d1869e4c9d5547",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -582,11 +582,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720926593,
|
"lastModified": 1720334033,
|
||||||
"narHash": "sha256-fW6e27L6qY6s+TxInwrS2EXZZfhMAlaNqT0sWS49qMA=",
|
"narHash": "sha256-X9pEvvHTVWJphhbUYqXvlLedOndNqGB7rvhSvL2CIgU=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nix-index-database",
|
"repo": "nix-index-database",
|
||||||
"rev": "5fe5b0cdf1268112dc96319388819b46dc051ef4",
|
"rev": "685e40e1348007d2cf76747a201bab43d86b38cb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -679,11 +679,11 @@
|
||||||
"nixpkgs": "nixpkgs_7"
|
"nixpkgs": "nixpkgs_7"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720932034,
|
"lastModified": 1720662315,
|
||||||
"narHash": "sha256-7tz2witA6mIxX3250WyhD8rvXQxlSzQFEDdVLYvzEU8=",
|
"narHash": "sha256-r0a7rtlx5GzJ57izpq58B30sAzSIH2V/ctwIsMV51rY=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs-wayland",
|
"repo": "nixpkgs-wayland",
|
||||||
"rev": "09a28c6e377ae40c67d79f0a98c5bff3c59457b8",
|
"rev": "8f132445454c6b9f0b21952953885007b961310a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -742,11 +742,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_5": {
|
"nixpkgs_5": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720875497,
|
"lastModified": 1720687749,
|
||||||
"narHash": "sha256-1Al1qDC8Q/s4viPq4ln8jfHWZxYl+Nb49dNFISFpqBY=",
|
"narHash": "sha256-nqJ+iK/zyqCJ/YShqCpZ2cJKE1UtjZIEUWLUFZqvxcA=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "b729601a9e6c459fd8884dea513af143111bed54",
|
"rev": "6af55cb91ca2005516b9562f707bb99c8f79bf77",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -758,11 +758,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_6": {
|
"nixpkgs_6": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720781449,
|
"lastModified": 1719082008,
|
||||||
"narHash": "sha256-po3TZO9kcZwzvkyMJKb0WCzzDtiHWD34XeRaX1lWXp0=",
|
"narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "8b5a3d5a1d951344d683b442c0739010b80039db",
|
"rev": "9693852a2070b398ee123a329e68f0dab5526681",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -774,11 +774,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_7": {
|
"nixpkgs_7": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720768451,
|
"lastModified": 1720542800,
|
||||||
"narHash": "sha256-EYekUHJE2gxeo2pM/zM9Wlqw1Uw2XTJXOSAO79ksc4Y=",
|
"narHash": "sha256-ZgnNHuKV6h2+fQ5LuqnUaqZey1Lqqt5dTUAiAnqH0QQ=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "7e7c39ea35c5cdd002cd4588b03a3fb9ece6fad9",
|
"rev": "feb2849fdeb70028c70d73b848214b00d324a497",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -851,11 +851,11 @@
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720924256,
|
"lastModified": 1720600679,
|
||||||
"narHash": "sha256-P9yElKsIEk6rp2AK3wf2vQQIlPh+BQQkvE+9BKg5BWs=",
|
"narHash": "sha256-HRwuZ9o0E6UwCkIVeFHdHI0/5pmsNqbwtqTIj9bJNWo=",
|
||||||
"owner": "roc-lang",
|
"owner": "roc-lang",
|
||||||
"repo": "roc",
|
"repo": "roc",
|
||||||
"rev": "0284248320e1a72bb5823bd7005c6521c1c70857",
|
"rev": "b65e65f0a416e40ef4112535b82b38f2e2455834",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1054,11 +1054,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720930114,
|
"lastModified": 1711963903,
|
||||||
"narHash": "sha256-VZK73b5hG5bSeAn97TTcnPjXUXtV7j/AtS4KN8ggCS0=",
|
"narHash": "sha256-N3QDhoaX+paWXHbEXZapqd1r95mdshxToGowtjtYkGI=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "treefmt-nix",
|
"repo": "treefmt-nix",
|
||||||
"rev": "b92afa1501ac73f1d745526adc4f89b527595f14",
|
"rev": "49dc4a92b02b8e68798abd99184f228243b6e3ac",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1150,11 +1150,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720920089,
|
"lastModified": 1720747212,
|
||||||
"narHash": "sha256-L6y1TI4caiJwKQBiBhU748F5Cv6563el0QOh6Zapk3s=",
|
"narHash": "sha256-zhxs/o9oNkB9ZszRsseG6qYqfKz29314FE7mdqcAGrc=",
|
||||||
"owner": "Cloudef",
|
"owner": "Cloudef",
|
||||||
"repo": "zig2nix",
|
"repo": "zig2nix",
|
||||||
"rev": "b6655dcc31af1b20d4e112306c46c110ce5d967d",
|
"rev": "141b1b633b585e52388620b84c4d2f438b92a45a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -1174,11 +1174,11 @@
|
||||||
"zig-overlay": "zig-overlay"
|
"zig-overlay": "zig-overlay"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720799773,
|
"lastModified": 1720719728,
|
||||||
"narHash": "sha256-JeQuI0LLjCdI1zgHQu9n0tA3CEz8EZ0qHUFAYqWURA0=",
|
"narHash": "sha256-uPe4sqNB661tIi4U6YvHR9BpN8ozIcmxUJxcxI9tD1o=",
|
||||||
"owner": "zigtools",
|
"owner": "zigtools",
|
||||||
"repo": "zls",
|
"repo": "zls",
|
||||||
"rev": "ef50085f7b7136c1e1b26438141bb005743f38c1",
|
"rev": "b8dd9cbbcc7591159f28eb41c21315f5ef5ca995",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
package oizys
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
|
|
||||||
"github.com/charmbracelet/log"
|
|
||||||
"oizys/internal/ui"
|
|
||||||
)
|
|
||||||
|
|
||||||
type GitRepo struct {
|
|
||||||
path string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *GitRepo) git(rest ...string) *exec.Cmd {
|
|
||||||
args := []string{"-C", g.path}
|
|
||||||
args = append(args, rest...)
|
|
||||||
cmd := exec.Command("git", args...)
|
|
||||||
// logCmd(cmd)
|
|
||||||
return cmd
|
|
||||||
}
|
|
||||||
|
|
||||||
func GitPull(workDir string) {
|
|
||||||
g := GitRepo{workDir}
|
|
||||||
cmdOutput, err := g.git("status", "--porcelain").Output()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(cmdOutput) > 0 {
|
|
||||||
fmt.Println("unstaged commits, cowardly exiting...")
|
|
||||||
ui.ShowFailedOutput(cmdOutput)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
cmdOutput, err = g.git("pull").CombinedOutput()
|
|
||||||
if err != nil {
|
|
||||||
ui.ShowFailedOutput(cmdOutput)
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -11,12 +11,12 @@ import (
|
||||||
"github.com/charmbracelet/log"
|
"github.com/charmbracelet/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func LogCmd(cmd *exec.Cmd) {
|
func logCmd(cmd *exec.Cmd) {
|
||||||
log.Debugf("CMD: %s", strings.Join(cmd.Args, " "))
|
log.Debugf("CMD: %s", strings.Join(cmd.Args, " "))
|
||||||
}
|
}
|
||||||
|
|
||||||
func CmdOutputWithSpinner(cmd *exec.Cmd, msg string, stderr bool) (output []byte, err error) {
|
func cmdOutputWithSpinner(cmd *exec.Cmd, msg string, stderr bool) (output []byte, err error) {
|
||||||
LogCmd(cmd)
|
logCmd(cmd)
|
||||||
s := startSpinner(msg)
|
s := startSpinner(msg)
|
||||||
if stderr {
|
if stderr {
|
||||||
output, err = cmd.CombinedOutput()
|
output, err = cmd.CombinedOutput()
|
||||||
|
@ -38,8 +38,8 @@ func startSpinner(msg string) *spinner.Spinner {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExitWithCommand(cmd *exec.Cmd) {
|
func exitWithCommand(cmd *exec.Cmd) {
|
||||||
LogCmd(cmd)
|
logCmd(cmd)
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
|
@ -1,4 +1,4 @@
|
||||||
package ui
|
package oizys
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -11,17 +11,6 @@ import (
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ShowFailedOutput(buf []byte) {
|
|
||||||
arrow := lipgloss.
|
|
||||||
NewStyle().
|
|
||||||
Bold(true).
|
|
||||||
Foreground(lipgloss.Color("9")).
|
|
||||||
Render("->")
|
|
||||||
for _, line := range strings.Split(strings.TrimSpace(string(buf)), "\n") {
|
|
||||||
fmt.Println(arrow, line)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: seperate parsing and displaying of packages
|
// TODO: seperate parsing and displaying of packages
|
||||||
func terminalSize() (int, int) {
|
func terminalSize() (int, int) {
|
||||||
fd := os.Stdout.Fd()
|
fd := os.Stdout.Fd()
|
||||||
|
@ -36,13 +25,13 @@ func terminalSize() (int, int) {
|
||||||
return w, h
|
return w, h
|
||||||
}
|
}
|
||||||
|
|
||||||
type Packages struct {
|
type packages struct {
|
||||||
desc string
|
desc string
|
||||||
names []string
|
names []string
|
||||||
pad int
|
pad int
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParsePackages(lines []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
|
||||||
|
@ -59,7 +48,7 @@ func ParsePackages(lines []string, desc string) *Packages {
|
||||||
names[i] = name
|
names[i] = name
|
||||||
}
|
}
|
||||||
sort.Strings(names)
|
sort.Strings(names)
|
||||||
return &Packages{names: names, pad: maxLen + 1, desc: desc}
|
return &packages{names: names, pad: maxLen + 1, desc: desc}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ellipsis(s string, maxLen int) string {
|
func ellipsis(s string, maxLen int) string {
|
||||||
|
@ -73,7 +62,7 @@ func ellipsis(s string, maxLen int) string {
|
||||||
return string(runes[0:maxLen-3]) + "..."
|
return string(runes[0:maxLen-3]) + "..."
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Packages) Show(verbose bool) {
|
func (p *packages) show(verbose bool) {
|
||||||
p.summary()
|
p.summary()
|
||||||
if !verbose || (len(p.names) == 0) {
|
if !verbose || (len(p.names) == 0) {
|
||||||
return
|
return
|
||||||
|
@ -92,7 +81,7 @@ func (p *Packages) Show(verbose bool) {
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Packages) summary() {
|
func (p *packages) summary() {
|
||||||
fmt.Printf("%s: %s\n",
|
fmt.Printf("%s: %s\n",
|
||||||
p.desc,
|
p.desc,
|
||||||
lipgloss.NewStyle().
|
lipgloss.NewStyle().
|
||||||
|
@ -101,3 +90,14 @@ func (p *Packages) summary() {
|
||||||
Render(fmt.Sprint(len(p.names))),
|
Render(fmt.Sprint(len(p.names))),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func showFailedOutput(buf []byte) {
|
||||||
|
arrow := lipgloss.
|
||||||
|
NewStyle().
|
||||||
|
Bold(true).
|
||||||
|
Foreground(lipgloss.Color("9")).
|
||||||
|
Render("->")
|
||||||
|
for _, line := range strings.Split(strings.TrimSpace(string(buf)), "\n") {
|
||||||
|
fmt.Println(arrow, line)
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,10 +10,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
"github.com/charmbracelet/log"
|
|
||||||
|
|
||||||
e "oizys/internal/exec"
|
"github.com/charmbracelet/log"
|
||||||
"oizys/internal/ui"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var o *Oizys
|
var o *Oizys
|
||||||
|
@ -131,7 +129,7 @@ func git(rest ...string) *exec.Cmd {
|
||||||
args := []string{"-C", o.flake}
|
args := []string{"-C", o.flake}
|
||||||
args = append(args, rest...)
|
args = append(args, rest...)
|
||||||
cmd := exec.Command("git", args...)
|
cmd := exec.Command("git", args...)
|
||||||
e.LogCmd(cmd)
|
logCmd(cmd)
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,18 +141,18 @@ func GitPull() {
|
||||||
|
|
||||||
if len(cmdOutput) > 0 {
|
if len(cmdOutput) > 0 {
|
||||||
fmt.Println("unstaged commits, cowardly exiting...")
|
fmt.Println("unstaged commits, cowardly exiting...")
|
||||||
ui.ShowFailedOutput(cmdOutput)
|
showFailedOutput(cmdOutput)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdOutput, err = git("pull").CombinedOutput()
|
cmdOutput, err = git("pull").CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.ShowFailedOutput(cmdOutput)
|
showFailedOutput(cmdOutput)
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseDryRun(buf string) (*ui.Packages, *ui.Packages) {
|
func parseDryRun(buf string) (*packages, *packages) {
|
||||||
lines := strings.Split(strings.TrimSpace(buf), "\n")
|
lines := strings.Split(strings.TrimSpace(buf), "\n")
|
||||||
var parts [2][]string
|
var parts [2][]string
|
||||||
i := 0
|
i := 0
|
||||||
|
@ -175,8 +173,8 @@ func parseDryRun(buf string) (*ui.Packages, *ui.Packages) {
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ui.ParsePackages(parts[0], "packages to build"),
|
return parsePackages(parts[0], "packages to build"),
|
||||||
ui.ParsePackages(parts[1], "packages to fetch")
|
parsePackages(parts[1], "packages to fetch")
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Refactor this and above
|
// TODO: Refactor this and above
|
||||||
|
@ -205,8 +203,8 @@ func parseDryRun2(buf string) ([]string, []string) {
|
||||||
// TODO: refactor to account for --debug and not --verbose?
|
// TODO: refactor to account for --debug and not --verbose?
|
||||||
func showDryRunResult(nixOutput string, verbose bool) {
|
func showDryRunResult(nixOutput string, verbose bool) {
|
||||||
toBuild, toFetch := parseDryRun(nixOutput)
|
toBuild, toFetch := parseDryRun(nixOutput)
|
||||||
toFetch.Show(o.debug)
|
toFetch.show(o.debug)
|
||||||
toBuild.Show(true)
|
toBuild.show(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Dry(verbose bool, minimal bool, rest ...string) {
|
func Dry(verbose bool, minimal bool, rest ...string) {
|
||||||
|
@ -231,7 +229,7 @@ func Dry(verbose bool, minimal bool, rest ...string) {
|
||||||
lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("6")).Render(o.host),
|
lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("6")).Render(o.host),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
result, err := e.CmdOutputWithSpinner(cmd, spinnerMsg, true)
|
result, err := cmdOutputWithSpinner(cmd, spinnerMsg, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("failed to dry-run nix build", "err", err, "output", string(result))
|
log.Fatal("failed to dry-run nix build", "err", err, "output", string(result))
|
||||||
}
|
}
|
||||||
|
@ -257,7 +255,7 @@ func NixosRebuild(subcmd string, rest ...string) {
|
||||||
cmd.Args = append(cmd.Args, "--print-build-logs")
|
cmd.Args = append(cmd.Args, "--print-build-logs")
|
||||||
}
|
}
|
||||||
cmd.Args = append(cmd.Args, rest...)
|
cmd.Args = append(cmd.Args, rest...)
|
||||||
e.ExitWithCommand(cmd)
|
exitWithCommand(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NixBuild(nom bool, minimal bool, rest ...string) {
|
func NixBuild(nom bool, minimal bool, rest ...string) {
|
||||||
|
@ -284,7 +282,7 @@ func NixBuild(nom bool, minimal bool, rest ...string) {
|
||||||
cmd.Args = append(cmd.Args, "--log-format", "multiline")
|
cmd.Args = append(cmd.Args, "--log-format", "multiline")
|
||||||
}
|
}
|
||||||
cmd.Args = append(cmd.Args, rest...)
|
cmd.Args = append(cmd.Args, rest...)
|
||||||
e.ExitWithCommand(cmd)
|
exitWithCommand(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *Oizys) writeToGithubStepSummary(txt string) {
|
func (o *Oizys) writeToGithubStepSummary(txt string) {
|
||||||
|
@ -334,12 +332,12 @@ func CacheBuild(rest ...string) {
|
||||||
args = append(args, NixosConfigAttrs()...)
|
args = append(args, NixosConfigAttrs()...)
|
||||||
args = append(args, rest...)
|
args = append(args, rest...)
|
||||||
cmd := exec.Command("cachix", args...)
|
cmd := exec.Command("cachix", args...)
|
||||||
e.ExitWithCommand(cmd)
|
exitWithCommand(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func CI(rest ...string) {
|
func CI(rest ...string) {
|
||||||
args := []string{"workflow", "run", "build.yml", "-F", fmt.Sprintf("hosts=%s", o.host)}
|
args := []string{"workflow", "run", "build.yml", "-F", fmt.Sprintf("hosts=%s", o.host)}
|
||||||
args = append(args, rest...)
|
args = append(args, rest...)
|
||||||
cmd := exec.Command("gh", args...)
|
cmd := exec.Command("gh", args...)
|
||||||
e.ExitWithCommand(cmd)
|
exitWithCommand(cmd)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/charmbracelet/log"
|
"github.com/charmbracelet/log"
|
||||||
e "oizys/internal/exec"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var ignoredMap = stringSliceToMap(
|
var ignoredMap = stringSliceToMap(
|
||||||
|
@ -129,7 +128,7 @@ func toBuildNixosConfiguration() []string {
|
||||||
if o.resetCache {
|
if o.resetCache {
|
||||||
systemCmd.Args = append(systemCmd.Args, "--narinfo-cache-negative-ttl", "0")
|
systemCmd.Args = append(systemCmd.Args, "--narinfo-cache-negative-ttl", "0")
|
||||||
}
|
}
|
||||||
result, err := e.CmdOutputWithSpinner(
|
result, err := cmdOutputWithSpinner(
|
||||||
systemCmd,
|
systemCmd,
|
||||||
fmt.Sprintf("running dry build for: %s", strings.Join(NixosConfigAttrs(), " ")),
|
fmt.Sprintf("running dry build for: %s", strings.Join(NixosConfigAttrs(), " ")),
|
||||||
true,
|
true,
|
||||||
|
@ -144,7 +143,7 @@ func toBuildNixosConfiguration() []string {
|
||||||
func evaluateDerivations(drvs ...string) map[string]Derivation {
|
func evaluateDerivations(drvs ...string) map[string]Derivation {
|
||||||
cmd := exec.Command("nix", "derivation", "show", "-r")
|
cmd := exec.Command("nix", "derivation", "show", "-r")
|
||||||
cmd.Args = append(cmd.Args, drvs...)
|
cmd.Args = append(cmd.Args, drvs...)
|
||||||
out, err := e.CmdOutputWithSpinner(cmd,
|
out, err := cmdOutputWithSpinner(cmd,
|
||||||
fmt.Sprintf("evaluating derivations %s", strings.Join(drvs, " ")),
|
fmt.Sprintf("evaluating derivations %s", strings.Join(drvs, " ")),
|
||||||
false)
|
false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue