Skip to content

DustVoice/nix-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DustVoice's Nix(OS) & Home-Manager config

This is my dendritic Nix(OS) & Home-Manager configuration. Nix besonderes!

It utilizes framework called Den:

Modular, context-aware and aspect-oriented dendritic Nix configurations

After getting familiar with the dendritic approach compared to a more "traditional" flake setup (e.g., EmergentMind's config), I settled on a layout heavily inspired by vic's own config.

It is definitely not something for the faint of heart and if you're unfamiliar with Nix in general, the syntax, or even just flakes, I'd recommend a simpler approach at first.

Bootstrap on NixOS

To bootstrap a (predefined!) device, simply use

sudo nixos-rebuild switch --flake github:DustVoice/nix-config#hostname

where hostname corresponds to a hostname defined in modules/my/hosts.nix.

WSL

As I normally use my own username instead of the default nixos user used by the NixOS-WSL image, special care is needed when bootstrapping (and therefore changing the default user) on WSL.

According to the NixOS-WSL documentation, you'd need to

  1. Rebuild the boot instead of directly switching to it

    sudo nixos-rebuild boot --flake github:DustVoice/nix-config#hostname
  2. Exit the WSL shell and terminate the distro

    wsl.exe -t NixOS
  3. Start a shell as the root user and immediately exit, applying the new generation

    wsl.exe -d NixOS --user root exit
  4. Stop the distro again

    wsl.exe -t NixOS
  5. Finally open a WSL shell with (hopefully) everything applied.

    NOTE: This doesn't transfer any files from the nixos user's home directory to the newly created user!

Proxy

When bootstrapping behind a proxy, some intermediate steps become necessary. Although the correct proxy configuration should be present for the specific hostname, bootstrapping the system needs to know about the proxy.

Make sure that your %USERPROFILE%\.wslconfig includes autoProxy=true under the [wsl] section, or even better, that you're on a recent enough version where this setting is the default. You can also find this setting in the new WSL Settings app included with recent WSL versions, under the Network tab.

With the aforementioned automatic proxy setting propagation, the only remaining issue is that sudo doesn't simply inherit those values. To circumvent this for bootstrapping (correct env_keep configuration is included in modules/my/hosts.nix), simply add the --preserve-env=http_proxy,https_proxy,HTTP_PROXY,HTTPS_PROXY parameter, or even easier the -E flag (preserves all environment variables), to the sudo command.

sudo -E nixos-rebuild switch --flake github:DustVoice/nix-config#hostname

Bootstrap on Generic Linux

To utilize the standalone home-manager configurations defined in modules/my/hosts.nix on non-NixOS systems:

  1. First install Nix (the Package Manager)

  2. Then install home-manager

    nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
    nix-channel --update
  3. Then build and run the home-manager configuration

    home-manager --extra-experimental-features "nix-command flakes" --flake github:DustVoice/nix-config#username switch

    where username corresponds to a username for which a standalone home-manager config has been defined in modules/my/hosts.nix

About

Dendritic NixOS & Home-Manager configuration - Nix besonderes!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors