Skip to content

Latest commit

 

History

History
61 lines (51 loc) · 2.68 KB

README.md

File metadata and controls

61 lines (51 loc) · 2.68 KB

My Personal NixOS config

This is my personal nixos configuration. It is an attempt at a modular nix config structure to support multiple machines and even users. I've taken a fair amount of inspiration from EmergentMind's config, as well as a heap of others I can't recall. However, this config is separated from the home configuration; it is only a system config! I use it in conjunction with my home manager config found in my dotfiles repo.

This config:

  • Is just a NixOS system config, very barebones and no user config (apart from initial setup)
  • Uses flakes
  • Uses the unstable channel for nixpkgs
  • Is meant to be used with home manager as a standalone, non-root utility

Tip

Feel free to take inspiration from this config as I have from others.

Bootstrapping

As a reminder to myself and as a resource to anyone seeking inspiration, here is the bootstrapping process:

  1. Get an ISO from here

  2. Follow the installation steps, with or without a desktop environment (we'll install our own in a moment anyway)

  3. If it wasn't in your ISO of choice, fetch git using nixpkgs, like so:

    $ nix-shell -p git

    ...or add it to the default nixos config and rebuild:

    # configuration.nix
    environment.systemPackages = [
        pkgs.git
    ];
    $ sudo nixos-rebuild switch
  4. Move to where you want your config. It can be anywhere, I currently have it in ~/nixos-config (meaning I would run git clone in ~/)

  5. Clone the repo:

    $ git clone [email protected]:otytlandsvik/nixos-config.git
  6. Create a host specific config to bootstrap the new host under nixos-config/hosts. Simply copy another config as a template and setup specifics accordingly

Warning

Remember to copy the hardware-configuration.nix file that NixOS generated for your system! It should be at /etc/nixos/

  1. If you need another user, create one by using nixos/config/hosts/common/users/ole as a template
  2. Add the new host as an output in the flake
  3. Rebuild referencing this new output (as an example, if the new output was hostname):
    $ sudo nixos-rebuild switch --flake .#hostname

Note

The . here specifies the cwd. It must be a path to the directory containing the flake.nix file, followed by #hostname

Now, if you opted for sway as the window manager, run

$ exec sway

to start it. That's it for the system config!

Home manager config

To bootrap the home configuration for my user, follow the steps in my dotfiles repo.