MCPcopy Index your code
hub / github.com/jetify-com/devbox / cacheConfigureCmd

Function cacheConfigureCmd

internal/boxcli/cache.go:82–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80}
81
82func cacheConfigureCmd() *cobra.Command {
83 username := ""
84 cmd := &cobra.Command{
85 Use: "configure",
86 Short: "Configure Nix to use the Devbox cache as a substituter",
87 Long: heredoc.Doc(`
88 Configure Nix to use the Devbox cache as a substituter.
89
90 If the current Nix installation is multi-user, this command grants the Nix
91 daemon access to Devbox caches by making the following changes:
92
93 - Adds the current user to Nix's list of trusted users in the system nix.conf.
94 - Adds the cache credentials to ~root/.aws/config.
95
96 Configuration requires sudo, but only needs to happen once. The changes persist
97 across Devbox accounts and organizations.
98
99 This command is a no-op for single-user Nix installs that aren't running the
100 Nix daemon.
101 `),
102 Hidden: true,
103 Args: cobra.MaximumNArgs(0),
104 RunE: func(cmd *cobra.Command, args []string) error {
105 if username == "" {
106 u, _ := user.Current()
107 username = u.Username
108 }
109 return nixcache.ConfigureReprompt(cmd.Context(), username)
110 },
111 }
112 cmd.Flags().StringVar(&username, "user", "", "")
113 return cmd
114}
115
116func cacheCredentialsCmd() *cobra.Command {
117 flags := credentialsFlags{}

Callers 1

cacheCmdFunction · 0.85

Calls 1

ConfigureRepromptFunction · 0.92

Tested by

no test coverage detected