mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-25 20:50:44 -06:00
Compare commits
4 commits
95223a9a25
...
389d07413e
Author | SHA1 | Date | |
---|---|---|---|
|
389d07413e | ||
d49e0b044d | |||
435d63b188 | |||
f8754b8105 |
7 changed files with 34 additions and 16 deletions
2
.github/workflows/update.yml
vendored
2
.github/workflows/update.yml
vendored
|
@ -58,7 +58,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
hosts:
|
host:
|
||||||
- othalan
|
- othalan
|
||||||
- algiz
|
- algiz
|
||||||
- mannaz
|
- mannaz
|
||||||
|
|
|
@ -498,11 +498,11 @@
|
||||||
"lix": {
|
"lix": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1721253059,
|
"lastModified": 1721314880,
|
||||||
"narHash": "sha256-GSzKw0vbUMpqKnOa6xJ4Fm1K/f1Cm9SrP0O8BP/6GZs=",
|
"narHash": "sha256-39RhKptnozRK63T4l6TcXGKjCXsvcetC4zCMj+0Xthw=",
|
||||||
"rev": "68567206f244f26f4830030c172d63c3dc9a13a1",
|
"rev": "7b1abf81076c93a84becc310722013e44d850002",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/68567206f244f26f4830030c172d63c3dc9a13a1.tar.gz"
|
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/7b1abf81076c93a84becc310722013e44d850002.tar.gz"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
|
|
|
@ -63,6 +63,11 @@ let
|
||||||
(substring 6 2 longDate)
|
(substring 6 2 longDate)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
flakeVer =
|
||||||
|
flake:
|
||||||
|
"${flake.shortRev or flake.dirtyShortRev}-${mkDate (toString flake.lastModifiedDate)}";
|
||||||
|
|
||||||
|
|
||||||
isNixFile = p: hasSuffix ".nix" p;
|
isNixFile = p: hasSuffix ".nix" p;
|
||||||
isDefaultNixFile = p: hasSuffix "default.nix" p;
|
isDefaultNixFile = p: hasSuffix "default.nix" p;
|
||||||
filterNotDefaultNixFile = paths: filter (p: !(isDefaultNixFile p) && (isNixFile p)) paths;
|
filterNotDefaultNixFile = paths: filter (p: !(isDefaultNixFile p) && (isNixFile p)) paths;
|
||||||
|
@ -81,5 +86,6 @@ in
|
||||||
mkIfIn
|
mkIfIn
|
||||||
isNixFile
|
isNixFile
|
||||||
listNixFilesRecursive
|
listNixFilesRecursive
|
||||||
|
flakeVer
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,23 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib) mkIfIn;
|
inherit (lib) mkIfIn flakeVer;
|
||||||
|
|
||||||
|
version = flakeVer inputs.roc;
|
||||||
cfg = config.oizys.languages;
|
cfg = config.oizys.languages;
|
||||||
rocPkgs = inputs.roc.packages.${pkgs.system};
|
rocPkgs = inputs.roc.packages.${pkgs.system};
|
||||||
|
# I'm setting the versions so the changes are more apparent as flake is updated
|
||||||
|
roc = rocPkgs.cli.overrideAttrs {
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
};
|
||||||
|
lang-server = rocPkgs.lang-server.overrideAttrs {
|
||||||
|
inherit version;
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = mkIfIn "roc" cfg {
|
config = mkIfIn "roc" cfg {
|
||||||
environment.systemPackages = with rocPkgs; [
|
environment.systemPackages = [roc lang-server];
|
||||||
full # cli + lang_server
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ 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())
|
md, err := github.GetUpateSummary(run.GetID(), oizys.GetHost())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,10 +60,11 @@ func GetArtifacts(runID int64) (*github.ArtifactList, *github.Response) {
|
||||||
return artifactList, resp
|
return artifactList, resp
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUpdateSummaryArtifact(runID int64) *github.Artifact {
|
func GetUpdateSummaryArtifact(runID int64, host string) *github.Artifact {
|
||||||
|
artifactName := fmt.Sprintf("%s-summary", host)
|
||||||
artifactList, _ := GetArtifacts(runID)
|
artifactList, _ := GetArtifacts(runID)
|
||||||
for _, artifact := range artifactList.Artifacts {
|
for _, artifact := range artifactList.Artifacts {
|
||||||
if artifact.GetName() == "summary" {
|
if artifact.GetName() == artifactName {
|
||||||
return artifact
|
return artifact
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,8 +72,8 @@ func GetUpdateSummaryArtifact(runID int64) *github.Artifact {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUpdateSummaryUrl(runID int64) *url.URL {
|
func GetUpdateSummaryUrl(runID int64, host string) *url.URL {
|
||||||
artifact := GetUpdateSummaryArtifact(runID)
|
artifact := GetUpdateSummaryArtifact(runID, host)
|
||||||
url, resp, err := client.Actions.DownloadArtifact(context.Background(), "daylinmorgan", "oizys", artifact.GetID(), 4)
|
url, resp, err := client.Actions.DownloadArtifact(context.Background(), "daylinmorgan", "oizys", artifact.GetID(), 4)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("failed to get update summary URL", "artifact", artifact.GetID(), "resp", resp)
|
log.Fatal("failed to get update summary URL", "artifact", artifact.GetID(), "resp", resp)
|
||||||
|
@ -109,8 +110,8 @@ func GetLastUpdateRun() *github.WorkflowRun {
|
||||||
return run
|
return run
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUpateSummary(runID int64) (string, error) {
|
func GetUpateSummary(runID int64, host string) (string, error) {
|
||||||
url := GetUpdateSummaryUrl(runID)
|
url := GetUpdateSummaryUrl(runID, host)
|
||||||
bytes := GetUpdateSummaryFromUrl(url)
|
bytes := GetUpdateSummaryFromUrl(url)
|
||||||
md, err := ReadMarkdownFromZip(bytes, "summary.md")
|
md, err := ReadMarkdownFromZip(bytes, "summary.md")
|
||||||
return md, err
|
return md, err
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"oizys/internal/git"
|
"oizys/internal/git"
|
||||||
|
|
||||||
// "oizys/internal/github"
|
// "oizys/internal/github"
|
||||||
"oizys/internal/ui"
|
"oizys/internal/ui"
|
||||||
"os"
|
"os"
|
||||||
|
@ -99,6 +100,7 @@ func SetHost(name string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetHost() string { return o.host }
|
||||||
func SetVerbose(v bool) {
|
func SetVerbose(v bool) {
|
||||||
o.verbose = v
|
o.verbose = v
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue