mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-11-10 00:43:15 -06:00
Compare commits
1 commit
7b5ec6510f
...
02f2cea594
Author | SHA1 | Date | |
---|---|---|---|
|
02f2cea594 |
7 changed files with 35 additions and 82 deletions
2
.github/workflows/update.yml
vendored
2
.github/workflows/update.yml
vendored
|
@ -101,7 +101,7 @@ jobs:
|
|||
|
||||
- run: |
|
||||
echo "# System Diff" >> $GITHUB_STEP_SUMMARY
|
||||
diff=$(nix run "nixpkgs#nvd" ./current ./updated)
|
||||
diff=$(nix store diff-closures ./current ./updated)
|
||||
echo "$diff"
|
||||
echo "$diff" >> summary.md
|
||||
echo "$diff" | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' >> $GITHUB_STEP_SUMMARY
|
||||
|
|
16
README.md
16
README.md
|
@ -15,30 +15,22 @@ See below for the currently maintained hosts.
|
|||
<th>system</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/1/16/Runic_letter_othalan.png" height="100">
|
||||
</td>
|
||||
<td><img src="https://upload.wikimedia.org/wikipedia/commons/7/70/Runic_letter_othalan.svg"></td>
|
||||
<td>othalan</td>
|
||||
<td>Thinkpad Carbon X1 Gen 9</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/1/14/Runic_letter_algiz.png" height="100">
|
||||
</td>
|
||||
<td><img src="https://upload.wikimedia.org/wikipedia/commons/d/df/Runic_letter_algiz.svg"></td>
|
||||
<td>algiz</td>
|
||||
<td>Hetzner VPS hosting forgejo, soft-serve & gts</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/Runic_letter_mannaz.png" height="100">
|
||||
</td>
|
||||
<td><img src="https://upload.wikimedia.org/wikipedia/commons/5/57/Runic_letter_mannaz.svg"></td>
|
||||
<td>mannaz</td>
|
||||
<td>Custom AMD Tower with Nvidia 1050ti</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/b/b9/Runic_letter_naudiz.png" height="100">
|
||||
</td>
|
||||
<td><img src="https://upload.wikimedia.org/wikipedia/commons/3/3f/Runic_letter_naudiz.svg"></td>
|
||||
<td>naudiz</td>
|
||||
<td>Nixos-WSL for those times I'm trapped on windows</td>
|
||||
</tr>
|
||||
|
|
18
flake.lock
18
flake.lock
|
@ -5,11 +5,11 @@
|
|||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721234873,
|
||||
"narHash": "sha256-7BQ6AkXRfDiyO63fV7Vi9jk0CQE44CzJ5j5olKmCizY=",
|
||||
"lastModified": 1720360803,
|
||||
"narHash": "sha256-dinkhlPUUcPiw8MAujBjE6ee5SYJnYhgup6ovjPahhw=",
|
||||
"owner": "daylinmorgan",
|
||||
"repo": "f1multiviewer-flake",
|
||||
"rev": "b711311e5b431c6794afbfc2d001fed67f00c99d",
|
||||
"rev": "d5ecfcbffb830f6d1325ea1c1680e61f6363e451",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -627,11 +627,11 @@
|
|||
"nixpkgs": "nixpkgs_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721226275,
|
||||
"narHash": "sha256-fwTSeMR1senkBPaKQyOkbkmFu3+8jj3UHoLZ3TcrOfw=",
|
||||
"lastModified": 1721037029,
|
||||
"narHash": "sha256-wuHiinPG5CzCUBr9I51g+IRhP/69Y9gRVh+QnEtFnyI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NixOS-WSL",
|
||||
"rev": "8ebede998342477736e0d0acdcc13ddb166a335f",
|
||||
"rev": "f6db2d325bdf57d39a3ae43376bdf2a020a6aad2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -851,11 +851,11 @@
|
|||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721213019,
|
||||
"narHash": "sha256-WAdO4ioyjTt87pwb9MYGioqmXPecUdvZVW6Su6ELNWs=",
|
||||
"lastModified": 1721168706,
|
||||
"narHash": "sha256-PS1tRkpxkDby3mqrCCSChCk4hD93J8ZBAkkQGtEXXVg=",
|
||||
"owner": "roc-lang",
|
||||
"repo": "roc",
|
||||
"rev": "2002868b56cde0abfad38bda55dc27efe6bb8598",
|
||||
"rev": "5b87d82b01679fd7f52748ce895d288642074c84",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"oizys/internal/github"
|
||||
"os"
|
||||
"oizys/internal/oizys"
|
||||
|
||||
"github.com/charmbracelet/log"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -14,28 +12,11 @@ var ciCmd = &cobra.Command{
|
|||
Use: "ci",
|
||||
Short: "offload build to GHA",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
inputs := make(map[string]interface{})
|
||||
if includeLock {
|
||||
log.Debug("including lock file in inputs")
|
||||
inputs["lockFile"] = readLockFile()
|
||||
}
|
||||
github.CreateDispatch("build.yml", ref, inputs)
|
||||
oizys.CI(args...)
|
||||
},
|
||||
}
|
||||
|
||||
var includeLock bool
|
||||
var ref string
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(ciCmd)
|
||||
ciCmd.Flags().BoolVar(&includeLock, "lockfile", false, "include lock file in inputs")
|
||||
ciCmd.Flags().StringVar(&ref, "ref", "main", "git ref to trigger workflow on")
|
||||
}
|
||||
|
||||
func readLockFile() string {
|
||||
dat, err := os.ReadFile("flake.lock")
|
||||
if err != nil {
|
||||
log.Fatal("failed to read flake.lock", "err", err)
|
||||
}
|
||||
return string(dat)
|
||||
}
|
||||
|
|
|
@ -16,29 +16,24 @@ var updateCmd = &cobra.Command{
|
|||
Short: "update and run nixos rebuild",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
run := github.GetLastUpdateRun()
|
||||
md, err := github.GetUpateSummary(run.GetID())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(md)
|
||||
if preview {
|
||||
os.Exit(0)
|
||||
}
|
||||
if !yes && !ui.Confirm("proceed with system update?") {
|
||||
os.Exit(0)
|
||||
md, err := github.GetUpateSummary(run.GetID())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(md)
|
||||
if !ui.Confirm("proceed with system update?") {
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
oizys.UpdateRepo()
|
||||
oizys.NixosRebuild("switch")
|
||||
},
|
||||
}
|
||||
|
||||
var (
|
||||
preview bool
|
||||
yes bool
|
||||
)
|
||||
var preview bool
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(updateCmd)
|
||||
updateCmd.Flags().BoolVar(&preview, "preview", false, "confirm nix store diff")
|
||||
updateCmd.Flags().BoolVar(&yes, "yes", false, "reply yes to all confirm prompts")
|
||||
}
|
||||
|
|
|
@ -152,27 +152,3 @@ func ReadMarkdownFromZip(zipData []byte, fileName string) (string, error) {
|
|||
// Return the markdown content as string
|
||||
return string(content), nil
|
||||
}
|
||||
|
||||
// func CI(rest ...string) {
|
||||
// args := []string{
|
||||
// "workflow", "run", "build.yml",
|
||||
// "-F", fmt.Sprintf("hosts=%s", o.host),
|
||||
// }
|
||||
// args = append(args, rest...)
|
||||
// cmd := exec.Command("gh", args...)
|
||||
// e.ExitWithCommand(cmd)
|
||||
// }
|
||||
|
||||
func CreateDispatch(workflowFileName string, ref string, inputs map[string]interface{}) {
|
||||
event := github.CreateWorkflowDispatchEventRequest{Ref: ref, Inputs: inputs}
|
||||
_, err := client.Actions.CreateWorkflowDispatchEventByFileName(
|
||||
context.Background(),
|
||||
"daylinmorgan",
|
||||
"oizys",
|
||||
workflowFileName,
|
||||
event,
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal("failed to dispatch event", "filename", workflowFileName, "err", err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"fmt"
|
||||
"io/fs"
|
||||
"oizys/internal/git"
|
||||
// "oizys/internal/github"
|
||||
"oizys/internal/ui"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
@ -317,6 +316,16 @@ func CacheBuild(rest ...string) {
|
|||
e.ExitWithCommand(cmd)
|
||||
}
|
||||
|
||||
func CI(rest ...string) {
|
||||
args := []string{
|
||||
"workflow", "run", "build.yml",
|
||||
"-F", fmt.Sprintf("hosts=%s", o.host),
|
||||
}
|
||||
args = append(args, rest...)
|
||||
cmd := exec.Command("gh", args...)
|
||||
e.ExitWithCommand(cmd)
|
||||
}
|
||||
|
||||
func UpdateRepo() {
|
||||
log.Info("rebasing HEAD on origin/flake-lock")
|
||||
o.repo.Fetch()
|
||||
|
|
Loading…
Reference in a new issue