❄ Personal NixOS Flake Manager
nixos home-manager go nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(rui): lower-case function names

Fuwn e4939a72 1b3449f1

+15 -15
+15 -15
rui.go
··· 94 94 nh, err := exec.LookPath("nh") 95 95 extraArgs := []string{} 96 96 97 - if err := Notify("Queued home switch"); err != nil { 97 + if err := notify("Queued home switch"); err != nil { 98 98 return err 99 99 } 100 100 ··· 103 103 } 104 104 105 105 if err == nil && !c.Bool("force-home-manager") { 106 - err = Command(nh, append([]string{"home", "switch", "--"}, 106 + err = command(nh, append([]string{"home", "switch", "--"}, 107 107 extraArgs...)...) 108 108 } else { 109 109 user := c.String("user") ··· 118 118 flake = os.Getenv("FLAKE") 119 119 } 120 120 121 - err = Command("home-manager", append([]string{"switch", 121 + err = command("home-manager", append([]string{"switch", 122 122 "--flake", fmt.Sprintf("%s#%s", flake, user)}, 123 123 extraArgs...)...) 124 124 } 125 125 126 126 if err != nil { 127 - return Notify(fmt.Sprintf("Failed to switch home: %s", err.Error())) 127 + return notify(fmt.Sprintf("Failed to switch home: %s", err.Error())) 128 128 } 129 129 130 - return Notify("Home switched") 130 + return notify("Home switched") 131 131 }, 132 132 }, 133 133 { ··· 158 158 flake = fmt.Sprintf("%s#%s", flake, user) 159 159 } 160 160 161 - return Command("home-manager", append([]string{"news", "--flake", 161 + return command("home-manager", append([]string{"news", "--flake", 162 162 flake}, extraArgs...)...) 163 163 }, 164 164 }, ··· 181 181 Action: func(c *cli.Context) error { 182 182 nh, err := exec.LookPath("nh") 183 183 184 - if err := Notify("Queued OS switch"); err != nil { 184 + if err := notify("Queued OS switch"); err != nil { 185 185 return err 186 186 } 187 187 188 188 if err == nil && !c.Bool("force-nixos-rebuild") { 189 - err = Command(nh, "os", "switch") 189 + err = command(nh, "os", "switch") 190 190 } else { 191 191 escalator := "sudo" 192 192 ··· 210 210 flake = os.Getenv("FLAKE") 211 211 } 212 212 213 - err = Command(escalator, "nixos-rebuild", "switch", "--flake", 213 + err = command(escalator, "nixos-rebuild", "switch", "--flake", 214 214 fmt.Sprintf("%s#%s", flake, hostname)) 215 215 } 216 216 217 217 if err != nil { 218 - return Notify(fmt.Sprintf("Failed to switch OS: %s", err.Error())) 218 + return notify(fmt.Sprintf("Failed to switch OS: %s", err.Error())) 219 219 } 220 220 221 - return Notify("OS switched") 221 + return notify("OS switched") 222 222 }, 223 223 }, 224 224 }, ··· 241 241 } 242 242 } 243 243 244 - return Command(editor, flake) 244 + return command(editor, flake) 245 245 }, 246 246 }, 247 247 }, 248 248 }).Run(os.Args) 249 249 } 250 250 251 - func Command(name string, args ...string) error { 251 + func command(name string, args ...string) error { 252 252 cmd := exec.Command(name, args...) 253 253 cmd.Stdin = os.Stdin 254 254 cmd.Stdout = os.Stdout ··· 257 257 return cmd.Run() 258 258 } 259 259 260 - func Notify(message string) error { 260 + func notify(message string) error { 261 261 notifySend, err := exec.LookPath("notify-send") 262 262 263 263 if err != nil { ··· 265 265 } 266 266 267 267 if configuration.Notify { 268 - return Command(notifySend, "Rui", message) 268 + return command(notifySend, "Rui", message) 269 269 } 270 270 271 271 return nil