diff --git a/pkgs/oizys/internal/oizys/ignored.txt b/pkgs/oizys/internal/oizys/ignored.txt new file mode 100644 index 0000000..7693d95 --- /dev/null +++ b/pkgs/oizys/internal/oizys/ignored.txt @@ -0,0 +1,21 @@ +ld-library-path +builder.pl +profile +system-path +nixos-help +nixos-install +nixos-version +nixos-manual-html +nixos-rebuild +nixos-configuration-reference-manpage +nixos-generate-config +nixos-enter +nixos-container +nixos-build-vms +nixos-wsl-version +nixos-wsl-welcome-message +nixos-wsl-welcome +restic-gdrive +gitea +lock +code diff --git a/pkgs/oizys/internal/oizys/main.go b/pkgs/oizys/internal/oizys/main.go index 0469e2c..44a9d32 100644 --- a/pkgs/oizys/internal/oizys/main.go +++ b/pkgs/oizys/internal/oizys/main.go @@ -255,6 +255,12 @@ func splitDrv(drv string) (string, string) { return drvName, hash } +const tableTmpl = `# Building Derivations +| derivation | hash | +|---|---| +%s +` + func writeDervationsToStepSummary(drvs []string) { tableRows := make([]string, len(drvs)) for i, drv := range drvs { @@ -264,16 +270,7 @@ func writeDervationsToStepSummary(drvs []string) { name, hash, ) } - - o.writeToGithubStepSummary( - fmt.Sprintf(`# Building Derivations -| derivation | hash | -|---|---| -%s -`, - strings.Join(tableRows, "\n"), - ), - ) + o.writeToGithubStepSummary(fmt.Sprintf(tableTmpl, strings.Join(tableRows, "\n"))) } func NixBuild(minimal bool, rest ...string) { diff --git a/pkgs/oizys/internal/oizys/nix.go b/pkgs/oizys/internal/oizys/nix.go index 696d30c..e246e44 100644 --- a/pkgs/oizys/internal/oizys/nix.go +++ b/pkgs/oizys/internal/oizys/nix.go @@ -1,6 +1,7 @@ package oizys import ( + _ "embed" "encoding/json" "errors" "fmt" @@ -12,22 +13,21 @@ import ( "github.com/charmbracelet/log" ) -var ignoredMap = stringSliceToMap( - []string{ - // nix - "ld-library-path", "builder.pl", "profile", "system-path", - // nixos - "nixos-help", - "nixos-install", "nixos-version", - "nixos-manual-html", "nixos-rebuild", - "nixos-configuration-reference-manpage", - "nixos-generate-config", "nixos-enter", - "nixos-container", "nixos-build-vms", - "nixos-wsl-version", "nixos-wsl-welcome-message", "nixos-wsl-welcome", - // trivial packages - "restic-gdrive", "gitea", "lock", "code", - }, -) +//go:embed ignored.txt +var ignoredList string +var ignoredMap = stringToMap(ignoredList) + +func stringToMap(s string) map[string]struct{} { + return stringSliceToMap(strings.Split(s, "\n")) +} + +func stringSliceToMap(slice []string) map[string]struct{} { + hashMap := make(map[string]struct{}, len(slice)) + for _, s := range slice { + hashMap[s] = struct{}{} + } + return hashMap +} type Derivation struct { InputDrvs map[string]interface{} @@ -72,13 +72,7 @@ func drvNotIgnored(drv string) bool { return !ok } -func stringSliceToMap(slice []string) map[string]struct{} { - hashMap := make(map[string]struct{}, len(slice)) - for _, s := range slice { - hashMap[s] = struct{}{} - } - return hashMap -} + func drvsToInputs(derivation map[string]Derivation) []string { var drvs []string