mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-25 00:10:44 -06:00
Compare commits
5 commits
02f2cea594
...
7b5ec6510f
Author | SHA1 | Date | |
---|---|---|---|
|
7b5ec6510f | ||
2865ec8264 | |||
7e6aa1f57f | |||
34773c08f3 | |||
ff6074ef4b |
7 changed files with 93 additions and 46 deletions
2
.github/workflows/update.yml
vendored
2
.github/workflows/update.yml
vendored
|
@ -101,7 +101,7 @@ jobs:
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
echo "# System Diff" >> $GITHUB_STEP_SUMMARY
|
echo "# System Diff" >> $GITHUB_STEP_SUMMARY
|
||||||
diff=$(nix store diff-closures ./current ./updated)
|
diff=$(nix run "nixpkgs#nvd" ./current ./updated)
|
||||||
echo "$diff"
|
echo "$diff"
|
||||||
echo "$diff" >> summary.md
|
echo "$diff" >> summary.md
|
||||||
echo "$diff" | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' >> $GITHUB_STEP_SUMMARY
|
echo "$diff" | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
16
README.md
16
README.md
|
@ -15,22 +15,30 @@ See below for the currently maintained hosts.
|
||||||
<th>system</th>
|
<th>system</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://upload.wikimedia.org/wikipedia/commons/7/70/Runic_letter_othalan.svg"></td>
|
<td>
|
||||||
|
<img src="https://upload.wikimedia.org/wikipedia/commons/1/16/Runic_letter_othalan.png" height="100">
|
||||||
|
</td>
|
||||||
<td>othalan</td>
|
<td>othalan</td>
|
||||||
<td>Thinkpad Carbon X1 Gen 9</td>
|
<td>Thinkpad Carbon X1 Gen 9</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://upload.wikimedia.org/wikipedia/commons/d/df/Runic_letter_algiz.svg"></td>
|
<td>
|
||||||
|
<img src="https://upload.wikimedia.org/wikipedia/commons/1/14/Runic_letter_algiz.png" height="100">
|
||||||
|
</td>
|
||||||
<td>algiz</td>
|
<td>algiz</td>
|
||||||
<td>Hetzner VPS hosting forgejo, soft-serve & gts</td>
|
<td>Hetzner VPS hosting forgejo, soft-serve & gts</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://upload.wikimedia.org/wikipedia/commons/5/57/Runic_letter_mannaz.svg"></td>
|
<td>
|
||||||
|
<img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/Runic_letter_mannaz.png" height="100">
|
||||||
|
</td>
|
||||||
<td>mannaz</td>
|
<td>mannaz</td>
|
||||||
<td>Custom AMD Tower with Nvidia 1050ti</td>
|
<td>Custom AMD Tower with Nvidia 1050ti</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://upload.wikimedia.org/wikipedia/commons/3/3f/Runic_letter_naudiz.svg"></td>
|
<td>
|
||||||
|
<img src="https://upload.wikimedia.org/wikipedia/commons/b/b9/Runic_letter_naudiz.png" height="100">
|
||||||
|
</td>
|
||||||
<td>naudiz</td>
|
<td>naudiz</td>
|
||||||
<td>Nixos-WSL for those times I'm trapped on windows</td>
|
<td>Nixos-WSL for those times I'm trapped on windows</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
38
flake.lock
38
flake.lock
|
@ -5,11 +5,11 @@
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720360803,
|
"lastModified": 1721234873,
|
||||||
"narHash": "sha256-dinkhlPUUcPiw8MAujBjE6ee5SYJnYhgup6ovjPahhw=",
|
"narHash": "sha256-7BQ6AkXRfDiyO63fV7Vi9jk0CQE44CzJ5j5olKmCizY=",
|
||||||
"owner": "daylinmorgan",
|
"owner": "daylinmorgan",
|
||||||
"repo": "f1multiviewer-flake",
|
"repo": "f1multiviewer-flake",
|
||||||
"rev": "d5ecfcbffb830f6d1325ea1c1680e61f6363e451",
|
"rev": "b711311e5b431c6794afbfc2d001fed67f00c99d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -305,11 +305,11 @@
|
||||||
"xdph": "xdph"
|
"xdph": "xdph"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721157817,
|
"lastModified": 1721160190,
|
||||||
"narHash": "sha256-G93msn9eSKDjkWJlualhXvrOsEL6gQN3hjDEll+H8VE=",
|
"narHash": "sha256-dnC7b/C8QRPoGs2H2cAYWmrTRVhN5m1xDpyrNTqV8r8=",
|
||||||
"ref": "refs/heads/main",
|
"ref": "refs/heads/main",
|
||||||
"rev": "da956c8a979471282db6790f5fa5dcec320ec226",
|
"rev": "293e687389a19b369f312c5c335c9afe7c886be1",
|
||||||
"revCount": 4928,
|
"revCount": 4929,
|
||||||
"submodules": true,
|
"submodules": true,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/hyprwm/Hyprland/"
|
"url": "https://github.com/hyprwm/Hyprland/"
|
||||||
|
@ -499,10 +499,10 @@
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721094616,
|
"lastModified": 1721094616,
|
||||||
"narHash": "sha256-xeE9I/oGt+Iz7AwnadBlzSJRk8I5y1XKYt2ifV/2eo0=",
|
"narHash": "sha256-GUH5+B1JztzDNSN1D7KbndrYSq0LWvVIJnuWKHlpN3Q=",
|
||||||
"rev": "d094dd0396a9ec0b4ce725412cc73c6d9af31021",
|
"rev": "ef0de7c79f3b32f66db447220d26eae7e7c07b19",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/d094dd0396a9ec0b4ce725412cc73c6d9af31021.tar.gz"
|
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/ef0de7c79f3b32f66db447220d26eae7e7c07b19.tar.gz"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
|
@ -627,11 +627,11 @@
|
||||||
"nixpkgs": "nixpkgs_4"
|
"nixpkgs": "nixpkgs_4"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721037029,
|
"lastModified": 1721226275,
|
||||||
"narHash": "sha256-wuHiinPG5CzCUBr9I51g+IRhP/69Y9gRVh+QnEtFnyI=",
|
"narHash": "sha256-fwTSeMR1senkBPaKQyOkbkmFu3+8jj3UHoLZ3TcrOfw=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NixOS-WSL",
|
"repo": "NixOS-WSL",
|
||||||
"rev": "f6db2d325bdf57d39a3ae43376bdf2a020a6aad2",
|
"rev": "8ebede998342477736e0d0acdcc13ddb166a335f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -742,11 +742,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_5": {
|
"nixpkgs_5": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721080040,
|
"lastModified": 1721116560,
|
||||||
"narHash": "sha256-USDsS90/88RJibP3gEcH1AaVt+JpnX4XCUD9bAJP5I4=",
|
"narHash": "sha256-++TYlGMAJM1Q+0nMVaWBSEvEUjRs7ZGiNQOpqbQApCU=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "b2c1f10bfbb3f617ea8e8669ac13f3f56ceb2ea2",
|
"rev": "9355fa86e6f27422963132c2c9aeedb0fb963d93",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -851,11 +851,11 @@
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721081452,
|
"lastModified": 1721213019,
|
||||||
"narHash": "sha256-vtpHbfU7BMrHj6Dn/azl7vFwhpIj7+OW9MacF9ac3BI=",
|
"narHash": "sha256-WAdO4ioyjTt87pwb9MYGioqmXPecUdvZVW6Su6ELNWs=",
|
||||||
"owner": "roc-lang",
|
"owner": "roc-lang",
|
||||||
"repo": "roc",
|
"repo": "roc",
|
||||||
"rev": "5cf4a4af1f01c7cab4cd21ad0974967bb2a3b9ca",
|
"rev": "2002868b56cde0abfad38bda55dc27efe6bb8598",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"oizys/internal/oizys"
|
"oizys/internal/github"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/charmbracelet/log"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -12,11 +14,28 @@ var ciCmd = &cobra.Command{
|
||||||
Use: "ci",
|
Use: "ci",
|
||||||
Short: "offload build to GHA",
|
Short: "offload build to GHA",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
oizys.CI(args...)
|
inputs := make(map[string]interface{})
|
||||||
|
if includeLock {
|
||||||
|
log.Debug("including lock file in inputs")
|
||||||
|
inputs["lockFile"] = readLockFile()
|
||||||
|
}
|
||||||
|
github.CreateDispatch("build.yml", ref, inputs)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var includeLock bool
|
||||||
|
var ref string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(ciCmd)
|
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,24 +16,29 @@ var updateCmd = &cobra.Command{
|
||||||
Short: "update and run nixos rebuild",
|
Short: "update and run nixos rebuild",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
run := github.GetLastUpdateRun()
|
run := github.GetLastUpdateRun()
|
||||||
|
md, err := github.GetUpateSummary(run.GetID())
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
fmt.Println(md)
|
||||||
if preview {
|
if preview {
|
||||||
md, err := github.GetUpateSummary(run.GetID())
|
os.Exit(0)
|
||||||
if err != nil {
|
}
|
||||||
log.Fatal(err)
|
if !yes && !ui.Confirm("proceed with system update?") {
|
||||||
}
|
os.Exit(0)
|
||||||
fmt.Println(md)
|
|
||||||
if !ui.Confirm("proceed with system update?") {
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
oizys.UpdateRepo()
|
oizys.UpdateRepo()
|
||||||
oizys.NixosRebuild("switch")
|
oizys.NixosRebuild("switch")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var preview bool
|
var (
|
||||||
|
preview bool
|
||||||
|
yes bool
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(updateCmd)
|
rootCmd.AddCommand(updateCmd)
|
||||||
updateCmd.Flags().BoolVar(&preview, "preview", false, "confirm nix store diff")
|
updateCmd.Flags().BoolVar(&preview, "preview", false, "confirm nix store diff")
|
||||||
|
updateCmd.Flags().BoolVar(&yes, "yes", false, "reply yes to all confirm prompts")
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,3 +152,27 @@ func ReadMarkdownFromZip(zipData []byte, fileName string) (string, error) {
|
||||||
// Return the markdown content as string
|
// Return the markdown content as string
|
||||||
return string(content), nil
|
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,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"oizys/internal/git"
|
"oizys/internal/git"
|
||||||
|
// "oizys/internal/github"
|
||||||
"oizys/internal/ui"
|
"oizys/internal/ui"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
@ -316,16 +317,6 @@ func CacheBuild(rest ...string) {
|
||||||
e.ExitWithCommand(cmd)
|
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() {
|
func UpdateRepo() {
|
||||||
log.Info("rebasing HEAD on origin/flake-lock")
|
log.Info("rebasing HEAD on origin/flake-lock")
|
||||||
o.repo.Fetch()
|
o.repo.Fetch()
|
||||||
|
|
Loading…
Reference in a new issue