Edit flake.nix
and change hostName
and userName
.
Install nix
sh <(curl -L https://nixos.org/nix/install)
On a fresh MacOS install you can run the following to bootstrap your system.
make darwin # answer no to editing the file, then yes for all
sudo rm /etc/nix/nix.conf
make bootstrap
make test
make install
make rollback
Your flake includes a development shell which includes tools
like niv
(for dependency management), alejandra
(nix code formatter).
nix develop
Edit nix/homeConfigurations/your-username.nix
and add
the desired values for home.programs
, for example, if
you like to use exa:
home.programs = with pkgs; [ exa ];
Your flake can use niv to declare
external source dependencies, like .dmg
applications distributed via
github releases or for MacOS apps not available via nixpkgs
.
See niv --help
and the niv homepage for
more instructions on adding, updating and removing dependencies.
Suppose we would like to install Keytty.
First, we need to determine the .dmg
url from keytty's releases page.
And then add a dependency using niv
.
niv add Keytty -t 'https://github.com/keytty/shelter/releases/download/<version>/Keytty.<version>.dmg' -v '1.2.8'
After adding the Keytty
dependency at version 1.2.8
, we can install it
by editing nix/homeConfigurations/your-username.nix
:
home.programs = [ pkgs.nivApps.Keytty ] # NOTE: same name as niv-managed dependency.