{"id":13562115,"url":"https://github.com/mitchellh/nixos-config","last_synced_at":"2025-05-14T05:10:44.596Z","repository":{"id":40601672,"uuid":"261367423","full_name":"mitchellh/nixos-config","owner":"mitchellh","description":"My NixOS configurations.","archived":false,"fork":false,"pushed_at":"2025-05-10T22:00:38.000Z","size":3932,"stargazers_count":2437,"open_issues_count":13,"forks_count":226,"subscribers_count":42,"default_branch":"main","last_synced_at":"2025-05-13T13:18:34.341Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://twitter.com/mitchellh/status/1346136404682625024","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mitchellh.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,"zenodo":null}},"created_at":"2020-05-05T05:13:41.000Z","updated_at":"2025-05-13T07:00:07.000Z","dependencies_parsed_at":"2023-10-05T04:17:17.083Z","dependency_job_id":"fc46392a-8f38-451b-a641-6ec0492e30b9","html_url":"https://github.com/mitchellh/nixos-config","commit_stats":{"total_commits":315,"total_committers":8,"mean_commits":39.375,"dds":"0.041269841269841234","last_synced_commit":"fb394b863656fb0b933024142c05077665f99ca9"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fnixos-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fnixos-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fnixos-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fnixos-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitchellh","download_url":"https://codeload.github.com/mitchellh/nixos-config/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"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":[],"created_at":"2024-08-01T13:01:04.725Z","updated_at":"2025-05-14T05:10:44.553Z","avatar_url":"https://github.com/mitchellh.png","language":"Nix","funding_links":[],"categories":["Nix","Nix Configurations","others"],"sub_categories":[],"readme":"# NixOS System Configurations\n\nThis repository contains my NixOS system configurations. This repository\nisn't meant to be a turnkey solution to copying my setup or learning Nix,\nso I want to apologize to anyone trying to look for something \"easy\". I've\ntried to use very simple Nix practices wherever possible, but if you wish\nto copy from this, you'll have to learn the basics of Nix, NixOS, etc.\n\nI don't claim to be an expert at Nix or NixOS, so there are certainly\nimprovements that could be made! Feel free to suggest them, but please don't\nbe offended if I don't integrate them, I value having my config work over\nhaving it be optimal.\n\n## How I Work\n\nI like to use macOS as the host OS and NixOS within a VM as my primary\ndevelopment environment. I use the graphical applications on the host\n(browser, calendars, mail app, iMessage, etc.) but I do almost everything\ndev-related in the VM (editor, compilation, databases, etc.).\n\nInevitably I get asked **why?** I genuinely like the macOS application\necosystem, and I'm pretty \"locked in\" to their various products such as\niMessage. I like the Apple hardware, and I particularly like that my hardware\nalways Just Works with excellent performance, battery life, and service.\nHowever, I prefer the Linux environment for almost all my dev work. I find\nthat modern computers are plenty fast enough for the best of both worlds.\n\nHere is what it ends up looking like:\n\n![Screenshot](https://raw.githubusercontent.com/mitchellh/nixos-config/main/.github/images/screenshot.png)\n\nNote that I usually full screen the VM so there isn't actually a window,\nand I three-finger swipe or use other keyboard shortcuts to active that\nwindow.\n\n### Common Questions Related To This Workflow\n\n**How does web application development work?** I use the VM's IP. Even\nthough it isn't strictly static, it never changes since I rarely run\nother VMs. You just have to make sure software in the VM listens\non `0.0.0.0` so that it isn't only binding to loopback.\n\n**Does copy/paste work?** Yes.\n\n**Do you use shared folders?** I set up a shared folder so I can access\nthe home directory of my host OS user, but I very rarely use it. I primarily\nonly use it to access browser downloads. You can see this setup in these\nNix files.\n\n**Do you ever launch graphical applications in the VM?** Sometimes, but rarely.\nI'll sometimes do OAuth flows and stuff using FireFox in the VM. Most of the\ntime, I use the host OS browser.\n\n**Do you have graphical performance issues?** For the types of graphical\napplications I run (GUIs, browsers, etc.), not really. VMware (and other\nhypervisors) support 3D acceleration on macOS and I get really smooth\nrendering because of it.\n\n**This can't actually work! This only works on a powerful workstation!**\nI've been doing this since late 2020, and I've developed\n[a lot of very real software](https://www.hashicorp.com/). It works for me.\nI also use this VM on a MacBook Pro (to be fair, it is maxed out on specs),\nand I have no issues whatsoever.\n\n**Does this work with Apple Silicon Macs?** Yes, I use VMware Fusion\nbut my configurations also work for Parallels and UTM. Folder syncing,\nclipboards, and graphics acceleration all work. I've been using an\nApple Silicon Mac full time since Nov 2021 with this setup.\n\n**Does this work on Windows?** Yes, I've tested this setup with both\nHyper-V and VMware Workstation Pro and it works great in either case.\n\n## Setup (VM)\n\nVideo: https://www.youtube.com/watch?v=ubDMLoWz76U\n\n**Note:** This setup guide will cover VMware Fusion because that is the\nhypervisor I use day to day. The configurations in this repository also\nwork with UTM (see `vm-aarch64-utm`) and Parallels (see `vm-aarch64-prl`) but\nI'm not using that full time so they may break from time to time. I've also\nsuccessfully set up this environment on Windows with VMware Workstation and\nHyper-V.\n\nYou can download the NixOS ISO from the\n[official NixOS download page](https://nixos.org/download.html#nixos-iso).\nThere are ISOs for both `x86_64` and `aarch64` at the time of writing this.\n\nCreate a VMware Fusion VM with the following settings. My configurations\nare made for VMware Fusion exclusively currently and you will have issues\non other virtualization solutions without minor changes.\n\n  * ISO: NixOS 23.05 or later.\n  * Disk: SATA 150 GB+\n  * CPU/Memory: I give at least half my cores and half my RAM, as much as you can.\n  * Graphics: Full acceleration, full resolution, maximum graphics RAM.\n  * Network: Shared with my Mac.\n  * Remove sound card, remove video camera, remove printer.\n  * Profile: Disable almost all keybindings\n  * Boot Mode: UEFI\n\nBoot the VM, and using the graphical console, change the root password to \"root\":\n\n```\n$ sudo su\n$ passwd\n# change to root\n```\n\nAt this point, verify `/dev/sda` exists. This is the expected block device\nwhere the Makefile will install the OS. If you setup your VM to use SATA,\nthis should exist. If `/dev/nvme` or `/dev/vda` exists instead, you didn't\nconfigure the disk properly. Note, these other block device types work fine,\nbut you'll have to modify the `bootstrap0` Makefile task to use the proper\nblock device paths.\n\nAlso at this point, I recommend making a snapshot in case anything goes wrong.\nI usually call this snapshot \"prebootstrap0\". This is entirely optional,\nbut it'll make it super easy to go back and retry if things go wrong.\n\nRun `ifconfig` and get the IP address of the first device. It is probably\n`192.168.58.XXX`, but it can be anything. In a terminal with this repository\nset this to the `NIXADDR` env var:\n\n```\n$ export NIXADDR=\u003cVM ip address\u003e\n```\n\nThe Makefile assumes an Intel processor by default. If you are using an\nARM-based processor (M1, etc.), you must change `NIXNAME` so that the ARM-based\nconfiguration is used:\n\n```\n$ export NIXNAME=vm-aarch64\n```\n\n**Other Hypervisors:** If you are using Parallels, use `vm-aarch64-prl`.\nIf you are using UTM, use `vm-aarch64-utm`. Note that the environments aren't\n_exactly_ equivalent between hypervisors but they're very close and they\nall work.\n\nPerform the initial bootstrap. This will install NixOS on the VM disk image\nbut will not setup any other configurations yet. This prepares the VM for\nany NixOS customization:\n\n```\n$ make vm/bootstrap0\n```\n\nAfter the VM reboots, run the full bootstrap, this will finalize the\nNixOS customization using this configuration:\n\n```\n$ make vm/bootstrap\n```\n\nYou should have a graphical functioning dev VM.\n\nAt this point, I never use Mac terminals ever again. I clone this repository\nin my VM and I use the other Make tasks such as `make test`, `make switch`, etc.\nto make changes my VM.\n\n## Setup (macOS/Darwin)\n\n**THIS IS OPTIONAL AND UNRELATED TO THE VM WORK.** I recommend you ignore\nthis unless you're interested in using Nix to manage your Mac too.\n\nI share some of my Nix configurations with my Mac host and use Nix\nto manage _some_ aspects of my macOS installation, too. This uses the\n[nix-darwin](https://github.com/LnL7/nix-darwin) project. I don't manage\n_everything_ with Nix, for example I don't manage apps, some of my system\nsettings, Homebrew, etc. I plan to migrate some of those in time.\n\nTo utilize the Mac setup, first install Nix using some Nix installer.\nThere are two great installers right now:\n[nix-installer](https://github.com/DeterminateSystems/nix-installer)\nby Determinate Systems and [Flox](https://floxdev.com/). The point of both\nfor my configs is just to get the `nix` CLI with flake support installed.\n\nOnce installed, clone this repo and run `make`. If there are any errors,\nfollow the error message (some folders may need permissions changed,\nsome files may need to be deleted). That's it.\n\n**WARNING: Don't do this without reading the source.** This repository\nis and always has been _my_ configurations. If you blindly run this,\nyour system may be changed in ways that you don't want. Read my source!\n\n## Setup (WSL)\n\n**THIS IS OPTIONAL AND UNRELATED TO THE VM WORK.** I recommend you ignore\nthis unless you're interested in using Nix to manage your WSL\n(Windows Subsystem for Linux) environment, too.\n\nI use Nix to build a WSL root tarball for Windows. I then have my entire\nNix environment on Windows in WSL too, which I use to for example run\nNeovim amongst other things. My general workflow is that I only modify\nmy WSL environment outside of WSL, rebuild my root filesystem, and\nrecreate the WSL distribution each time there are system changes. My system\nchanges are rare enough that this is not annoying at all.\n\nTo create a WSL root tarball, you must be running on a Linux machine\nthat is able to build `x86_64` binaries (either directly or cross-compiling).\nMy `aarch64` VMs are all properly configured to cross-compile to `x86_64`\nso if you're using my NixOS configurations you're already good to go.\n\nRun `make wsl`. This will take some time but will ultimately output\na tarball in `./result/tarball`. Copy that to your Windows machine.\nOnce it is copied over, run the following steps on Windows:\n\n```\n$ wsl --import nixos .\\nixos .\\path\\to\\tarball.tar.gz\n...\n\n$ wsl -d nixos\n...\n\n# Optionally, make it the default\n$ wsl -s nixos\n```\n\nAfter the `wsl -d` command, you should be dropped into the Nix environment.\n_Voila!_\n\n## FAQ\n\n### Why do you still use `niv`?\n\nI am still transitioning into a fully flaked setup. During this transition\n(which is indefinite, I'm in no rush), I'm using both.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellh%2Fnixos-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitchellh%2Fnixos-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellh%2Fnixos-config/lists"}