Templated from juspay/nixos-unified-template.
Under the hood, it uses nixos-unified. See ./modules to see what's available. We support home-manager (see ./modules/home), nix-darwin (see ./modules/darwin) and NixOS (see ./modules/nixos).
| Platform | Supported By |
|---|---|
| macOS only | ✅ home-manager and/or ✅ nix-darwin |
| NixOS only | ✅ home-manager and ✅ NixOS |
| All platforms | ✅ home-manager only |
If you use, or intend to use, NixOS:
- Install NixOS from Graphical ISO image and reboot.
- Ensure that
/etc/nixos/{configuration.nix, hardware-configuration.nix}are in place. - In a terminal, become
rootand initialize our template under/etc/nixos:sudo su - cd /etc/nixos nix --accept-flake-config --extra-experimental-features "nix-command flakes" \ run github:juspay/omnix -- \ init github:juspay/nixos-unified-template#nixos -o . # Replace HOSTNAME with the hostname you entered above. mv configuration.nix hardware-configuration.nix ./configurations/nixos/HOSTNAME/ nix --extra-experimental-features "nix-command flakes" run
- At this point, you can move
/etc/nixosto anywhere, and initialize a Git repository to track future changes.
If you are on macOS or running other Linux distros:
-
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \ sh -s -- install --no-confirm --extra-conf "trusted-users = $(id -un)"
-
Open a new terminal; Initialize[^omnix] your Nix configuration using this repo as template:
nix --accept-flake-config run github:juspay/omnix -- \ init github:juspay/nixos-unified-template -o ~/nixconfig cd ~/nixconfig
- It will prompt to you choose between home-manager only configuration and nix-darwin configuration (ignore the NixOS template). The latter includes home-manager as well.
- Optionally, you may edit
./modules/{home,darwin}/*.nixto your liking.
-
Run
nix run(or the appropriate command printed by the above command) to activate your configuration.- Does this fail to run? See the Troubleshooting section below.
-
Restart your terminal.
After steps 1-4, you should expect to see the starship prompt:
Whenever you modify your configuration in ./modules/*/*.nix, you should re-run nix run to activate the new configuration.
The configuration repo has flake.nix file in the current directory and some ./modules/{home,darwin,nixos}/*.nix files containing the home-manager, nix-darwin and NixOS configurations respectively that you can review. It also has a justfile, which provides a set of recipes analogous to Make targets to interact with the nix flake.
Run nix run to activate this configuration in your system.
To browse the capabilities of home-manager (and to see what else can go in your ./modules/home/*.nix -- such as shell aliases), consult home-manager options reference. You can also run man home-configuration.nix in the terminal.
Global configuration is in the ./config.nix file. Here, you can specify your user name, email and such settings.