4.1 KiB
4.1 KiB
My dotfiles - including my vim, terminal and font configs. Mostly focusing on setting things up on NixOS, but supporting other OSes where possible.
bootstrap new machine with NixOS:
- boot the target machine from the livecd
- change password for the default user
nixos
- ssh from another, already bootstrapped, machine
remote (sata):
sudo su -
# `efibootmgr -b 000x -B` if you want to remove entry number x
yes | parted /dev/sda -- mklabel gpt
parted /dev/sda -- rm 1
parted /dev/sda -- rm 2
parted /dev/sda -- rm 3
parted /dev/sda -- rm 4
parted /dev/sda -- mkpart ESP fat32 1MiB 1GiB
parted /dev/sda -- set 1 esp on
parted /dev/sda -- mkpart primary 1GiB 100%
cryptsetup luksFormat /dev/sda2
remote (nvme):
sudo su -
# `efibootmgr -b 000x -B` if you want to remove entry number x
yes | parted /dev/nvme0n1 -- mklabel gpt
parted /dev/nvme0n1 -- rm 1
parted /dev/nvme0n1 -- rm 2
parted /dev/nvme0n1 -- rm 3
parted /dev/nvme0n1 -- rm 4
parted /dev/nvme0n1 -- mkpart ESP fat32 1MiB 1GiB
parted /dev/nvme0n1 -- set 1 esp on
parted /dev/nvme0n1 -- mkpart primary 1GiB 100%
cryptsetup luksFormat /dev/nvme0n1p2
remote (sata):
cryptsetup luksOpen /dev/sda2 crypt
remote (nvme):
cryptsetup luksOpen /dev/nvme0n1p2 crypt
remote (sata):
mkfs.fat -F 32 -n boot /dev/sda1
mkfs.btrfs -L nixos /dev/mapper/crypt
sleep 1
mount /dev/disk/by-label/nixos /mnt
mkdir -p /mnt/boot
mount /dev/disk/by-label/boot /mnt/boot
nixos-generate-config --root /mnt
nixos-install
remote (nvme):
mkfs.fat -F 32 -n boot /dev/nvme0n1p1
mkfs.btrfs -L nixos /dev/mapper/crypt
sleep 1
mount /dev/mapper/crypt /mnt
mkdir -p /mnt/boot
mount /dev/disk/by-label/boot /mnt/boot
nixos-generate-config --root /mnt
nixos-install
local:
tar -cvz . > ../dotfiles.tar.gz
scp ../dotfiles.tar.gz nixos@remote:/tmp
remote:
mkdir -p /mnt/home/cyryl/dev/dotfiles/
tar -xvf /tmp/dotfiles.tar.gz -C /mnt/home/cyryl/dev/dotfiles
cp /mnt/etc/nixos/hardware-configuration.nix /mnt/home/cyryl/dev/dotfiles/nixos/boxes/hostname/
nix-shell -p nixUnstable git
nixos-install --flake '.#hostname-bootstrap'
reboot
ctrl-alt-f1 root login:
nixos-rebuild switch
passwd cyryl
chown cyryl -R /home/cyryl
reboot
gui-login as cyryl:
cd ~/dev/dotfiles/
mkdir -p nixos/boxes/HOSTNAME
cp nixos/boxes/bootstrap/2.nix nixos/boxes/HOSTNAME/default.nix
cp nixos/boxes/bootstrap/hardware-configuration.nix nixos/boxes/HOSTNAME/
sudo ln -vfs /home/cyryl/dev/dotfiles/nixos/boxes/HOSTNAME/default.nix /etc/nixos/configuration.nix
sudo nixos-rebuild switch --upgrade
reboot
ssh-keygen -t ed25519
# syncthing
# vault
# firefox sync
# bitwarden
# add key to sr.ht
cd ~/dev/dotfiles
git remote add git@git.sr.ht:~cyplo/dotfiles
git checkout nixos/boxes/bootstrap
Good Links [tm]
inspiration
- start with flakes -
4777ae6cf1/nixos/flake.nix (L1-L10)
- flakes - https://github.com/MatthewCroughan/nixcfg/blob/master/flake.nix#L45 for T480
- https://github.com/cole-mickens/nixcfg/tree/main
- https://git.sr.ht/~afontaine/nix/tree/main/item/andrew/mail/default.nix#L125-129 - proton mail bridge
3d6ca2c8bc/tests/home-test.nix
- testing on CI- https://git.knightsofthelambdacalcul.us/hazel/etc
things to check out
- https://github.com/ryantm/agenix
nix-top
- naersk for genpass
- https://github.com/divnix/devos
- https://github.com/tazjin/nix-1p
- https://github.com/nix-community/neovim-nightly-overlay
- install ISO - https://christine.website/blog/my-homelab-2021-06-08
flakes
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, ... }@inputs: {
nixosConfigurations = {
hyacinth = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(import ./machines/hyacinth)
];
specialArgs = { inherit inputs; };
};
guix
I'm just starting to play with guix, these are just loose notes: