Skip to content

Latest commit

 

History

History
120 lines (90 loc) · 2.22 KB

README.md

File metadata and controls

120 lines (90 loc) · 2.22 KB

Nix Configuration

Setup

First clone this repository. To configure wifi run nmtui.

mkdir develop && cd develop
nix-shell -p git
git clone https://github.com/Ekhorn/nix_config

Copy the hardware configuration to the host directory.

mkdir hosts/new-host/
cp /etc/nixos/hardware-configuration.nix hosts/new-host/

Symlink nix flake to /etc/nixos/flake.nix.

sudo rm -rf /etc/nixos/*
sudo ln -s ~/develop/nix_config/flake.nix /etc/nixos/flake.nix

Setup user in configuration, and adjust to your liking.

cp hosts/pc-koen/configuration.nix hosts/new-host
cp hosts/pc-koen/home.nix hosts/new-host
nano hosts/new-host/configuration.nix
nano hosts/new-host/home.nix

Create and add new ssh key.

ssh-keygen
cat ~/.ssh/id_*.pub >> modules/nixos/authorized_keys
git commit -m "conf: add authorized public key"

Lastly, rebuild the nixos configuration and reboot.

sudo nixos-rebuild switch .#new-host
reboot

Post-install Secrets Configuration

Update password manager.

unison
keepassxc ~/Desktop/$USER.kdbx

Then copy GPG from other system.

ssh other@hostname 'gpg --export-secret-keys -a "$(gpg -K | rg -o "[A-F0-9]{40}")"' | gpg --import
gpg --edit-key "$(gpg -K | rg -o "[A-F0-9]{40}")"
seahorse

Mounting drives

List drives

lsblk -f -o NAME,UUID,FSTYPE,SIZE

Set drive to mount

nvim hosts/new-host/hardware-configuration.nix
fileSystems."/mnt/hdd" =
  { device = "/dev/disk/by-uuid/uuid";
    fsType = "ext4";
  };

NixOS Anyhwere

nix run github:nix-community/nixos-anywhere -- \
  --generate-hardware-config nixos-generate-config ./<configuration-name>/hardware-configuration.nix --no-substitute-on-destination \
  --flake .#<configuration-name> root@<ip address>
ssh user@<ip address>
ssh root@<ip address>
passwd user
  services.openssh = {
    enable = true;
    ports = [ 22 ];
    settings = {
      # PasswordAuthentication = false;
      # PermitRootLogin = "no";
      # UsePAM = false;
      # KbdInteractiveAuthentication = false;
    };
  };
nixos-rebuild --target-host user@ip-address --use-remote-sudo switch --flake .#<configuration-name>