This repository is a Nix Flake. To use it, your Nix usage should have the experimental features nix-command
and flakes
enabled. See the wiki for more details.
- If you're on NixOS already there's not much else needed regarding applying system-level configs. Run
sudo nixos-rebuild switch --flake .#<HOSTNAME>
to apply the desired system configuration. To install NixOS, see the instructions on the official site. - (Non-NixOS), install Nix, preferably using the Determinate Nix installer. I recommend it because it has some functionalities that the official installer still does not have, such as enabling the
flakes
experimental feature by default, but read just below.- This installer will suggest installing Determinate System's downstream distribution for Nix, setting certain configs and adding other utilities, all of them tiered to enterprise/corporate usage. Vanilla Nix is enough for (almost) all use cases. The installer will prompt you something along the lines of
Cut the fuss with Determinate Nix?
to which you can press[n]o
and continue with the standard Nix installation. I hope they make this opt-in instead. - You can always install with the official Nix installation script instead, with
sh <(curl -L <https://nixos.org/nix/install>)
.
- This installer will suggest installing Determinate System's downstream distribution for Nix, setting certain configs and adding other utilities, all of them tiered to enterprise/corporate usage. Vanilla Nix is enough for (almost) all use cases. The installer will prompt you something along the lines of
- (macOS) If you want to use the
nix-darwin
configurations, installnix-darwin
via switching to one of the existing configs directly withnix run nix-darwin/master#darwin-rebuild -- switch --flake .#<HOSTNAME>
.- If there's no config you desire to apply just yet, follow the instructions to do a basic installation at the
nix-darwin
repo.
- If there's no config you desire to apply just yet, follow the instructions to do a basic installation at the
- To use the
home-manager
configurations, installhome-manager
via switching to one of the existing configs directly withnix run home-manager/master -- switch --flake .#<USER>@<HOSTNAME>
.- If you do not have an existing config that is applicable, follow the instructions to do a basic installation at the
home-manager
repo.
- If you do not have an existing config that is applicable, follow the instructions to do a basic installation at the
- Enjoy!
To speed up the build processes, you can use my binary cache as substituter. If using cachix
, you can enable it quickly with cachix use davsanchez
, but this would modify your local ~ /.config/nix/nix.conf
which is not very declarative. I have configured it in this flake's nixConfig
, but when running some builds for the first time your user might not be considered trusted, so the config might be ignored with a warning. This will change when you configure Nix to trust your user. I'll try to elaborate more on how to use this in the future.
You might want to get rid of the configs and the programs that manage it, either for temporary maintenance reasons (e.g. at the time of writing this, nix-darwin
recommends to just reinstall Nix if you're manually bumping a config's stateVersion
, though generally you should not be doing that) or maybe because you just don't want to use Nix anymore (you should not be doing that either :D). In any case, you can uninstall everything by going through these steps.
-
(macOS) Uninstall
nix-darwin
withnix --extra-experimental-features "nix-command flakes" run nix-darwin#darwin-uninstaller
. -
After running the command above you might run into problems regarding SSL CA certs. With an error like this one:
error: unable to download 'https://cache.nixos.org/d9l4i5phhrwy8f0yjp5yj4ri65z9cxzb.narinfo': Problem with the SSL CA cert (path? access rights?) (77)
To fix this issue, restore the old link to
/etc/ssl/certs/ca-certificates.crt
:# Check that it exists with ls -la /etc/ssl/certs/ca-certificates.crt # Remove it and restore it sudo rm /etc/ssl/certs/ca-certificates.crt sudo ln -s /nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt
-
Uninstall
home-manager
vianix run home-manager/master -- uninstall
. -
(Non-NixOS) Uninstall Nix altogether.
- If you used the Determinate Nix installer, just do
/nix/nix-installer uninstall
. - If you used the standard Nix installation script, follow the uninstall instructions in the Nix Reference Manual.
- If you used the Determinate Nix installer, just do
The cool thing of Nix is that, any time you want to come back, you can get the exact same configs you last used (same program versions, everything) by repeating the installation commands above this section. Cool!
Mainly the nix-starter-configs
templates, but the repo might have diverged from it as of now. It's always interesting to check other people's configs though, after all you're checking mine :)
github:misterio77/nix-starter-configs
github:sherubthakur/dotfiles
github:hlissner/dotfiles
github:dustinlyons/nixos-config
github:tars0x9752/home
github:Misterio77/nix-config
- Notes on Flakes by @zimbatm
- Getting started with Nix Flakes and devshell
- Flakes aren't real and cannot hurt you
Usually accompanied by the message "An update is ready to install. Visual Studio Code is trying to add a new helper tool".
This is usually caused due to VSCod{e,ium} residing in a different path than /Applications
. To fix, according to microsoft/vscode#7426 (comment):
sudo chown $USER ~/Library/Caches/com.vscodium.ShipIt/* # or com.microsoft.VSCode.ShipIt/*
xattr -dr com.apple.quarantine ~/Applications/Home\ Manager\ Apps/VSCodium.app # Or Visual\ Studio\ Code.app