{"id":19119782,"url":"https://github.com/wintermi/nix-macos-devbox","last_synced_at":"2025-02-22T12:26:13.381Z","repository":{"id":206030842,"uuid":"715652283","full_name":"wintermi/nix-macos-devbox","owner":"wintermi","description":"A simple guide to installing Nix on macOS and then then using the JetPack.io Devbox as your Primary Package Manager.","archived":false,"fork":false,"pushed_at":"2023-11-12T23:43:41.000Z","size":10,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-16T04:36:00.549Z","etag":null,"topics":["devbox","nix"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wintermi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-07T15:07:46.000Z","updated_at":"2024-12-20T01:43:46.000Z","dependencies_parsed_at":"2023-11-11T15:24:17.413Z","dependency_job_id":"ba6f92ea-2486-4654-b585-1df6735bc0be","html_url":"https://github.com/wintermi/nix-macos-devbox","commit_stats":null,"previous_names":["wintermi/nix-darwin-bootstrap","wintermi/nix-macos-bootstrap"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wintermi%2Fnix-macos-devbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wintermi%2Fnix-macos-devbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wintermi%2Fnix-macos-devbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wintermi%2Fnix-macos-devbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wintermi","download_url":"https://codeload.github.com/wintermi/nix-macos-devbox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240173047,"owners_count":19759684,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devbox","nix"],"created_at":"2024-11-09T05:11:07.479Z","updated_at":"2025-02-22T12:26:13.358Z","avatar_url":"https://github.com/wintermi.png","language":null,"readme":"\u003cimg src=\"https://daiderd.com/nix-darwin/images/nix-darwin.png\" width=\"200px\" alt=\"logo\" /\u003e\n\n# **Create a Devbox via Nix on macOS**\n\n[![License](https://img.shields.io/github/license/wintermi/nix-macos-devbox)](https://github.com/wintermi/nix-macos-devbox/blob/main/LICENSE)\n[![Built with Devbox](https://jetpack.io/img/devbox/shield_moon.svg)](https://jetpack.io/devbox/docs/contributor-quickstart/)\n\n## Overview\n\nA simple guide to installing [Nix](https://nixos.org/) on macOS and then using the [JetPack.io Devbox](https://www.jetpack.io/devbox/) as your Primary Package Manager.\n\n## Installing Nix\n\n\u003e **Note**\n\u003e Note: The last time I tested these instructions was November 2023.\n\nTo install [`Nix`](https://nixos.org/) on your macOS computer follow these steps.\n\n### Install Dependencies\n\nInstall the Xcode Command Line Tools, which is a collection of tools for software developers that run on the command line, in the Terminal application.\n\n```zsh\nxcode-select --install\n```\n\n### Install Nix\n\nInstall Nix using the [Determinate Nix Installer](https://github.com/DeterminateSystems/nix-installer)! Which is a fast, friendly, and reliable tool to help you use Nix with Flakes everywhere.\n\nExecute the following command from a macOS Terminal application and when prompted select all of the defaults.\n\n```zsh\ncurl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install\n```\n\nOnce the above is complete, you will need to add the following line to your `~/.zshrc` file to ensure the Nix binaries are available within your system path:\n\n```zsh\nsource '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\n```\n\nOn completion, I would recommend restarting your computer. This is normally not required, although I have encountered certain scenarios when it has been. So to avoid debugging any issues, restart your computer.\n\n## Installing Devbox\n\nThere are a couple of options which could be followed when installing the [JetPack.io Devbox](https://www.jetpack.io/devbox/) on macOS. However, since we went through the process of first installing Nix, the best option in my opinion is to install using Nix.\n\nSince we started with a clean install of Nix we must first add the available Nix Package channels which will be used when installing software. This can be achieved by executing the following commands from a macOS Terminal application.\n\n```zsh\nnix-channel --add https://nixos.org/channels/nixpkgs-23.05-darwin nixpkgs;\nnix-channel --add https://nixos.org/channels/nixpkgs-unstable unstable;\nnix-channel --update;\n```\n\nOnce complete, execute the following command to install the Devbox package.\n\n```zsh\nnix-env -iA unstable.devbox\n```\n\nJetPack.io provides a great set of documentation on how to use Devbox, which can be found [here](https://www.jetpack.io/devbox/docs/).\n\n### Using Devbox as your Primary Package Manager\n\nIn addition to managing isolated development environments, you can use Devbox as a general package manager. Devbox Global allows you to add packages to a global `devbox.json`. This is useful for installing a standard set of tools you want to use across multiple Devbox Projects.\n\n### Adding and Managing Global Packages\n\nYou can install a package using `devbox global add [\u003cpackage\u003e]`, where the package names should be a list of [Nix Packages](https://www.nixhub.io/) you want to install.\n\nFor example, if we wanted to install ripgrep, vim, and git to our global profile, we could run:\n\n```zsh\ndevbox global add ripgrep wget git\n```\n\nOnce installed, the packages will be available whenever you start a Devbox Shell, even if it's not included in the project's `devbox.json`.\n\nTo view a full list of global packages, you can run `devbox global list`:\n\n```zsh\ndevbox global list\n```\n\n### Using Global Packages in your Host Shell\n\nIf you want to make your global packages available in your host shell, you can add them to your shell PATH. Running `devbox global shellenv` will print the command necessary to source the packages.\n\nAdd the following command to your `~/.zshrc` file:\n\nOnce the above is complete, you will need to add the following line to your `.zshrc` file to ensure the Nix binaries are available within your system path:\n\n```zsh\neval \"$(devbox global shellenv --init-hook)\"\n```\n\nMake sure to add this hook before any other hooks that use your global packages.\n\n### Sharing Your Global Config with Git\n\nYou can use Git to synchronize your `devbox global` config across multiple machines using `devbox global push \u003cremote\u003e` and `devbox global pull \u003cremote\u003e`.\n\nYour global `devbox.json` and any other files in the Git remote will be stored in `$XDG_DATA_HOME/devbox/global/default`. If `$XDG_DATA_HOME` is not set, it will default to `~/.local/share/devbox/global/default`. You can view the current global directory by running `devbox global path`.\n\n## Execute Garbage Collection for Nix\n\n```zsh\nnix-collect-garbage\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwintermi%2Fnix-macos-devbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwintermi%2Fnix-macos-devbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwintermi%2Fnix-macos-devbox/lists"}