Compare commits

...

3 commits

Author SHA1 Message Date
0df4c078d7
add description 2024-05-19 10:35:44 -05:00
93cd78cf85
flake.lock: Update
Flake lock file updates:

• Updated input 'hyprland':
    'git+https://github.com/hyprwm/Hyprland?ref=refs/heads/main&rev=b9c58b6e75f7d0141d8ba88fb3f6f022fed0877a' (2024-05-15)
  → 'git+https://github.com/hyprwm/Hyprland?ref=refs/heads/main&rev=f8857e6072bd85b95393499688872aaf7f088b5b' (2024-05-18)
• Updated input 'hyprland/hyprcursor':
    'github:hyprwm/hyprcursor/cab4746180f210a3c1dd3d53e45c510e309e90e1' (2024-04-20)
  → 'github:hyprwm/hyprcursor/7c3aa03dffb53921e583ade3d4ae3f487e390e7e' (2024-05-15)
• Updated input 'hyprland/hyprlang':
    'github:hyprwm/hyprlang/78fcaa27ae9e1d782faa3ff06c8ea55ddce63706' (2024-04-14)
  → 'github:hyprwm/hyprlang/969cb076e5b76f2e823aeca1937a3e1f159812ee' (2024-05-15)
• Updated input 'hyprland/hyprwayland-scanner':
    'github:hyprwm/hyprwayland-scanner/65c2636484e5cb00583b8a7446c3fb657f568883' (2024-05-13)
  → 'github:hyprwm/hyprwayland-scanner/f5181a068c1b06f2db51f6222e50a0c665a2b0c3' (2024-05-16)
• Updated input 'hyprland/nixpkgs':
    'github:NixOS/nixpkgs/2057814051972fa1453ddfb0d98badbea9b83c06' (2024-05-12)
  → 'github:NixOS/nixpkgs/33d1e753c82ffc557b4a585c77de43d4c922ebb5' (2024-05-15)
• Updated input 'hyprland/xdph':
    'github:hyprwm/xdg-desktop-portal-hyprland/1f228ba2f1f254195c0b571302b37482861abee3' (2024-05-02)
  → 'github:hyprwm/xdg-desktop-portal-hyprland/af7c87a32f5d67eb2ada908a6a700f4e74831943' (2024-05-15)
• Updated input 'lix-module':
    'git+https://git.lix.systems/lix-project/nixos-module?ref=refs/heads/main&rev=87b7b7e4bd936301b139e472589d1966b136f45f' (2024-05-11)
  → 'git+https://git.lix.systems/lix-project/nixos-module?ref=refs/heads/main&rev=53d713eb486f21d653af3ef3528e9a19ecfc45e5' (2024-05-16)
• Updated input 'nix-index-database':
    'github:nix-community/nix-index-database/f9027322f48b427da23746aa359a6510dfcd0228' (2024-05-12)
  → 'github:nix-community/nix-index-database/6b94c48c3bb22d5181333c3fb71beff44116e251' (2024-05-19)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/abd6d48f8c77bea7dc51beb2adfa6ed3950d2585' (2024-05-14)
  → 'github:nixos/nixpkgs/8535fb92661f37ff9f0da3007fbc942f7d134b41' (2024-05-19)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/1750d067a124f636acb7f3f9f758c3b00430e6f9' (2024-05-15)
  → 'github:nix-community/nixpkgs-wayland/6c12f5c0f7dc6d94c332233dbaf67ce1165eadcb' (2024-05-19)
• Updated input 'nixpkgs-wayland/lib-aggregate':
    'github:nix-community/lib-aggregate/09883ca828e8cfaacdb09e29190a7b84ad1d9925' (2024-05-12)
  → 'github:nix-community/lib-aggregate/5fa64b174daa22fe0d20ebbcc0ec2c7905b503f1' (2024-05-19)
• Updated input 'nixpkgs-wayland/lib-aggregate/nixpkgs-lib':
    'github:nix-community/nixpkgs.lib/58e03b95f65dfdca21979a081aa62db0eed6b1d8' (2024-05-12)
  → 'github:nix-community/nixpkgs.lib/0df131b5ee4d928a4b664b6d0cd99cf134d6ab6b' (2024-05-19)
• Updated input 'nixpkgs-wayland/nix-eval-jobs':
    'github:nix-community/nix-eval-jobs/aa477075a0c47503bb2c193802a40a83e3b2d6ab' (2024-05-15)
  → 'github:nix-community/nix-eval-jobs/bb95091f6c6f38f6cfc215a1797a2dd466312c8b' (2024-05-15)
• Updated input 'nixpkgs-wayland/nixpkgs':
    'github:nixos/nixpkgs/2057814051972fa1453ddfb0d98badbea9b83c06' (2024-05-12)
  → 'github:nixos/nixpkgs/4a6b83b05df1a8bd7d99095ec4b4d271f2956b64' (2024-05-17)
• Updated input 'stable':
    'github:nixos/nixpkgs/9ddcaffecdf098822d944d4147dd8da30b4e6843' (2024-05-14)
  → 'github:nixos/nixpkgs/e7cc61784ddf51c81487637b3031a6dd2d6673a2' (2024-05-18)
2024-05-19 10:07:14 -05:00
e6e09537b5
improve oizys-go dry parsing 2024-05-19 10:06:55 -05:00
3 changed files with 87 additions and 78 deletions

View file

@ -210,11 +210,11 @@
]
},
"locked": {
"lastModified": 1713612213,
"narHash": "sha256-zJboXgWNpNhKyNF8H/3UYzWkx7w00TOCGKi3cwi+tsw=",
"lastModified": 1715791817,
"narHash": "sha256-J069Uhv/gCMFLX1dSh2f+9ZTM09r1Nv3oUfocCnWKow=",
"owner": "hyprwm",
"repo": "hyprcursor",
"rev": "cab4746180f210a3c1dd3d53e45c510e309e90e1",
"rev": "7c3aa03dffb53921e583ade3d4ae3f487e390e7e",
"type": "github"
},
"original": {
@ -233,11 +233,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1715798022,
"narHash": "sha256-ofQ2ZlKBgy0otWRN08kbRjObk2Nkz/f+nRjGww/5zMs=",
"lastModified": 1716063601,
"narHash": "sha256-gAuCKupztnqai1tZ6TyCFCRbeFzbggL0Oe0vl0/cwK8=",
"ref": "refs/heads/main",
"rev": "b9c58b6e75f7d0141d8ba88fb3f6f022fed0877a",
"revCount": 4698,
"rev": "f8857e6072bd85b95393499688872aaf7f088b5b",
"revCount": 4719,
"submodules": true,
"type": "git",
"url": "https://github.com/hyprwm/Hyprland"
@ -305,11 +305,11 @@
]
},
"locked": {
"lastModified": 1713121246,
"narHash": "sha256-502X0Q0fhN6tJK7iEUA8CghONKSatW/Mqj4Wappd++0=",
"lastModified": 1715791527,
"narHash": "sha256-HhQ4zvGHrRjR63ltySSeg+x+0jb0lepiutWdnFhLRoo=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "78fcaa27ae9e1d782faa3ff06c8ea55ddce63706",
"rev": "969cb076e5b76f2e823aeca1937a3e1f159812ee",
"type": "github"
},
"original": {
@ -330,11 +330,11 @@
]
},
"locked": {
"lastModified": 1715608589,
"narHash": "sha256-vimNaLjLcoNIvBhF37GaB6PRYEvKMamY3UnDE9M5MW8=",
"lastModified": 1715879663,
"narHash": "sha256-/DwglRvj4XF4ECdNtrCIbthleszAZBwOiXG5A6r0K/c=",
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"rev": "65c2636484e5cb00583b8a7446c3fb657f568883",
"rev": "f5181a068c1b06f2db51f6222e50a0c665a2b0c3",
"type": "github"
},
"original": {
@ -361,11 +361,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1715515815,
"narHash": "sha256-yaLScMHNFCH6SbB0HSA/8DWDgK0PyOhCXoFTdHlWkhk=",
"lastModified": 1716120557,
"narHash": "sha256-rvNq9YolMY1DRMgwdAti8qwNDjkhTsotSWa15/Ch7+A=",
"owner": "nix-community",
"repo": "lib-aggregate",
"rev": "09883ca828e8cfaacdb09e29190a7b84ad1d9925",
"rev": "5fa64b174daa22fe0d20ebbcc0ec2c7905b503f1",
"type": "github"
},
"original": {
@ -401,11 +401,11 @@
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1715442723,
"narHash": "sha256-pXMH7lqr5bT2FjH/3tEdTT/+1+hKx+15WkcGKycWWSM=",
"lastModified": 1715885250,
"narHash": "sha256-IUFYAl3158Ig5vySnRBHoPReb2/S97bjodCo6FhzJv4=",
"ref": "refs/heads/main",
"rev": "87b7b7e4bd936301b139e472589d1966b136f45f",
"revCount": 76,
"rev": "53d713eb486f21d653af3ef3528e9a19ecfc45e5",
"revCount": 81,
"type": "git",
"url": "https://git.lix.systems/lix-project/nixos-module"
},
@ -422,11 +422,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1715765180,
"narHash": "sha256-RJASAKCIdYO5ZaEU/ctDRlPg74yZJTPb7lkRXeiezAw=",
"lastModified": 1715804156,
"narHash": "sha256-GtIHP86Cz1kD9xZO/cKbNQACHKdoT9WFbLJAq6W2EDY=",
"owner": "nix-community",
"repo": "nix-eval-jobs",
"rev": "aa477075a0c47503bb2c193802a40a83e3b2d6ab",
"rev": "bb95091f6c6f38f6cfc215a1797a2dd466312c8b",
"type": "github"
},
"original": {
@ -464,11 +464,11 @@
]
},
"locked": {
"lastModified": 1715483403,
"narHash": "sha256-WMDuQj7J5jbpXI/X/E6FZRKgBFGcaSTvYyVxPnKE6KU=",
"lastModified": 1716088072,
"narHash": "sha256-ZXzV39r4ShjS6lvhOX+oN0Vazg5A/zibJDzE2r1jlRM=",
"owner": "nix-community",
"repo": "nix-index-database",
"rev": "f9027322f48b427da23746aa359a6510dfcd0228",
"rev": "6b94c48c3bb22d5181333c3fb71beff44116e251",
"type": "github"
},
"original": {
@ -495,11 +495,11 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1715474941,
"narHash": "sha256-CNCqCGOHdxuiVnVkhTpp2WcqSSmSfeQjubhDOcgwGjU=",
"lastModified": 1716079763,
"narHash": "sha256-DGRfb7fO7c3XDS3twmuaV5NAGPPdU3W7Q35fjIZc8iY=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "58e03b95f65dfdca21979a081aa62db0eed6b1d8",
"rev": "0df131b5ee4d928a4b664b6d0cd99cf134d6ab6b",
"type": "github"
},
"original": {
@ -516,11 +516,11 @@
"nixpkgs": "nixpkgs_7"
},
"locked": {
"lastModified": 1715797345,
"narHash": "sha256-q2Np+IhOVIHnUhiqgGlsuhIUtRPbd90Odx25ZmxvfHE=",
"lastModified": 1716128119,
"narHash": "sha256-APMa1xFnUIaYfZUaG8PyrHVlLP9ckm7S80k2TUnWjXg=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "1750d067a124f636acb7f3f9f758c3b00430e6f9",
"rev": "6c12f5c0f7dc6d94c332233dbaf67ce1165eadcb",
"type": "github"
},
"original": {
@ -531,11 +531,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1715534503,
"narHash": "sha256-5ZSVkFadZbFP1THataCaSf0JH2cAH3S29hU9rrxTEqk=",
"lastModified": 1715787315,
"narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2057814051972fa1453ddfb0d98badbea9b83c06",
"rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5",
"type": "github"
},
"original": {
@ -579,11 +579,11 @@
},
"nixpkgs_5": {
"locked": {
"lastModified": 1715653339,
"narHash": "sha256-7lR9tpVXviSccl07GXI0+ve/natd24HAkuy1sQp0OlI=",
"lastModified": 1716097317,
"narHash": "sha256-1UMrLtgzielG/Sop6gl6oTSM4pDt7rF9j9VuxhDWDlY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "abd6d48f8c77bea7dc51beb2adfa6ed3950d2585",
"rev": "8535fb92661f37ff9f0da3007fbc942f7d134b41",
"type": "github"
},
"original": {
@ -611,11 +611,11 @@
},
"nixpkgs_7": {
"locked": {
"lastModified": 1715534503,
"narHash": "sha256-5ZSVkFadZbFP1THataCaSf0JH2cAH3S29hU9rrxTEqk=",
"lastModified": 1715961556,
"narHash": "sha256-+NpbZRCRisUHKQJZF3CT+xn14ZZQO+KjxIIanH3Pvn4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2057814051972fa1453ddfb0d98badbea9b83c06",
"rev": "4a6b83b05df1a8bd7d99095ec4b4d271f2956b64",
"type": "github"
},
"original": {
@ -643,11 +643,11 @@
},
"stable": {
"locked": {
"lastModified": 1715668745,
"narHash": "sha256-xp62OkRkbUDNUc6VSqH02jB0FbOS+MsfMb7wL1RJOfA=",
"lastModified": 1716061101,
"narHash": "sha256-H0eCta7ahEgloGIwE/ihkyGstOGu+kQwAiHvwVoXaA0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9ddcaffecdf098822d944d4147dd8da30b4e6843",
"rev": "e7cc61784ddf51c81487637b3031a6dd2d6673a2",
"type": "github"
},
"original": {
@ -793,11 +793,11 @@
]
},
"locked": {
"lastModified": 1714662532,
"narHash": "sha256-Pj2xGSYhapYbXL7sk7TTlOtCZcTfPQoL3fPbZeg7L4Y=",
"lastModified": 1715788457,
"narHash": "sha256-32HOkjSIyANphV0p5gIwP4ONU/CcinhwOyVFB+tL/d0=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "1f228ba2f1f254195c0b571302b37482861abee3",
"rev": "af7c87a32f5d67eb2ada908a6a700f4e74831943",
"type": "github"
},
"original": {

View file

@ -6,7 +6,7 @@ import (
var buildCmd = &cobra.Command{
Use: "build",
Short: "A brief description of your command",
Short: "nix build",
Run: func(cmd *cobra.Command, args []string) {
oizys.NixBuild(args...)
},

View file

@ -51,7 +51,10 @@ func (o *Oizys) Output() string {
)
}
func (o *Oizys) Update(flake string, host string, cache string, verbose bool) {
func (o *Oizys) Update(
flake, host, cache string,
verbose bool,
) {
if host != "" {
o.host = host
}
@ -82,11 +85,10 @@ type packages struct {
desc string
}
func parsePackages(buf string, desc string) *packages {
func parsePackages(lines []string, desc string) *packages {
w, _ := terminalSize()
maxAcceptable := (w / 4) - 1
maxLen := 0
lines := strings.Split(strings.TrimSpace(buf), "\n")[1:]
names := make([]string, len(lines))
for i, pkg := range lines {
s := strings.SplitN(pkg, "-", 2)
@ -174,34 +176,32 @@ func (o *Oizys) GitPull() {
}
}
func ParseDryRunOutput(nixOutput string, verbose bool) {
parts := strings.Split("\n"+nixOutput, "\nthese")
func parseDryRun(buf string) (*packages, *packages) {
lines := strings.Split(strings.TrimSpace(buf), "\n")
var parts [2][]string
i := 0
for _, line := range lines {
if strings.Contains(line, "fetch") {
i++
}
if strings.HasPrefix(line, " ") {
parts[i] = append(parts[i], line)
}
}
if len(parts) != 3 {
if len(parts[0]) + len(parts[1]) == 0 {
log.Println("no changes...")
log.Println("or I failed to parse it into the expected number of parts")
fmt.Println(parts)
return
log.Fatalln("failed to parse nix build --dry-run output")
}
toBuild := parsePackages(parts[1], "packages to build")
toFetch := parsePackages(parts[2], "packages to fetch")
toBuild.show(verbose)
toFetch.show(verbose)
return parsePackages(parts[0], "packages to build"), parsePackages(parts[1], "packages to fetch")
}
func nixSpinner(host string) *spinner.Spinner {
msg := fmt.Sprintf("%s %s", " evaluating derivation for:",
output.String(host).Bold().Foreground(output.Color("6")),
)
s := spinner.New(
spinner.CharSets[14],
100*time.Millisecond,
spinner.WithSuffix(msg),
spinner.WithColor("fgHiMagenta"),
)
s.Start()
return s
func showDryRunResult(nixOutput string, verbose bool) {
toBuild, toFetch := parseDryRun(nixOutput)
toBuild.show(verbose)
toFetch.show(verbose)
}
func (o *Oizys) NixDryRun(verbose bool, rest ...string) {
@ -217,7 +217,7 @@ func (o *Oizys) NixDryRun(verbose bool, rest ...string) {
fmt.Println(string(result))
log.Fatal(err)
}
ParseDryRunOutput(string(result), verbose)
showDryRunResult(string(result), verbose)
}
func (o *Oizys) NixosRebuild(subcmd string, rest ...string) {
@ -258,11 +258,6 @@ func (o *Oizys) CacheBuild(rest ...string) {
runCommand(cmd)
}
func CheckFlake(flake string) {
if _, err := os.Stat(flake); errors.Is(err, fs.ErrNotExist) {
log.Fatalln("path to flake:", flake, "does not exist")
}
}
func (o *Oizys) CheckFlake() {
if _, err := os.Stat(o.flake); errors.Is(err, fs.ErrNotExist) {
@ -277,3 +272,17 @@ func Output(flake string, host string) string {
host,
)
}
func nixSpinner(host string) *spinner.Spinner {
msg := fmt.Sprintf("%s %s", " evaluating derivation for:",
output.String(host).Bold().Foreground(output.Color("6")),
)
s := spinner.New(
spinner.CharSets[14],
100*time.Millisecond,
spinner.WithSuffix(msg),
spinner.WithColor("fgHiMagenta"),
)
s.Start()
return s
}