Skip to content
mymePublic

About

My collection of dotfiles

Resources

Stars

28 stars

Watchers

1 watching

Forks

Repository files navigation

NixOS Configuration

This repository contains the NixOS system and user profile configuration files for my machines. For an overview and more thorough description, read NixOS: Confederation (myme.no).

I rarely install new machines and thus haven't really invested the time to automate this process in a good way. The steps under Installation are most likely borken or incomplete. Your best bet is to download and install NixOS following the regular documentation, then simply build and update using nixos-rebuild switch --flake ..

Installation

Install SSH keys on machine

Use a local keyboard and mouse or remote console to start up a shell on the machine. Then add public keys as desired to .ssh/authorized_keys for remote access.

$ mkdir .ssh
$ curl -o .ssh/authorized_keys https://github.com/myme.keys

Jump into dev shell

# shorthand for `nix develop` (with --extra-experimental-features)
./dev

Copy installation files to host

The following command will prompt for one of the deploy.nodes hosts to copy the installation files to.

$ nixbs-copy

Alternatively export NIX_INSTALL_HOST in the environment to override:

$ NIX_INSTALL_HOST=10.20.30.40 nixbs-copy

SSH to remote host

$ nixbs-ssh

Generate hardware configuration

$ nixos-generate-config --show-hardware-config

Drop into dev shell

$ cd nixos
$ ./dev

Format disks with disko

$ sudo disko ./machine/<hostname>/disk.nix

or using flake notation:

$ sudo disko --flake .#<hostname>

Start NixOS installation

Begin the installation by invoking the install script, either on console or over SSH:

$ sudo nixbs-install

The command will prompt for a system profile to install.

Post-install

Installing emacs dependencies:

$ ~/.emacs.d/bin/doom sync

After launching emacs, install all-the-icons:

(all-the-icons-install-fonts t)

Updating

$ sudo nixos-rebuild <switch|test|build> --flake .

macOS

Apply new configurations using nix-darwin:

$ sudo darwin-rebuild switch --flake .

Mosh over Tailscale

Import modules/tailnet-mosh.nix in the Mac's nix-darwin configuration and set myme.tailnetMosh.enable, myme.tailnetMosh.user, and myme.tailnetMosh.ipv4. Add the client's public key to users.users.<name>.openssh.authorizedKeys.keys. The module disables macOS Remote Login and runs key-only OpenSSH on 127.0.0.1:2222. After switching locally, publish the listener to the tailnet from the Mac with Tailscale Serve:

$ TAILSCALE_BE_CLI=1 /Applications/Tailscale.app/Contents/MacOS/Tailscale serve --bg --tcp=22 tcp://127.0.0.1:2222

Connect to the Mac's Tailscale IPv4 address. Mosh bootstraps through Serve over SSH, then sends UDP directly to that address. If the tailnet policy restricts traffic, allow the client to reach the Mac on TCP 22 and UDP 60001–60999.

Non-NixOS Linux / Windows Subsystem for Linux (WSL)

Install

$ nixbs-build-home <machine>
$ ./result/activate

Update

Either use the build-home.sh script above or the following once Home Manager is installed:

$ home-manager <build|switch> --flake .#<machine>

Troubleshooting

Gnome

Some dconf settings seem to not be applied correctly. Particularly the custom binding p to swith to the workspace on the left.

Running the following resolves this (but is obviously annoying):

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left '[]'
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "['<Super>p']"

About

My collection of dotfiles

Resources

Stars

28 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages