2019-11-10 10:01:49 +00:00
|
|
|
My dotfiles - including my vim, terminal and font configs.
|
2021-04-03 09:54:58 +01:00
|
|
|
Mostly focusing on setting things up on NixOS, but supporting other OSes where possible.
|
2013-10-09 18:53:50 +01:00
|
|
|
|
2021-04-03 12:52:05 +01:00
|
|
|
## bootstrap new machine with NixOS:
|
2019-11-10 10:11:15 +00:00
|
|
|
|
2021-04-03 09:54:58 +01:00
|
|
|
1. boot the target machine from the livecd
|
2021-04-11 10:29:38 +01:00
|
|
|
2. change password for the default user `nixos`
|
|
|
|
3. ssh from another, already bootstrapped, machine
|
2021-04-11 08:54:23 +01:00
|
|
|
|
2021-09-17 21:24:14 +01:00
|
|
|
remote (sata + MBR):
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo su -
|
|
|
|
parted /dev/sda -- mklabel msdos
|
|
|
|
parted /dev/sda -- rm 1
|
|
|
|
parted /dev/sda -- rm 2
|
|
|
|
parted /dev/sda -- rm 3
|
|
|
|
parted /dev/sda -- rm 4
|
|
|
|
parted /dev/sda -- mkpart primary 1MiB 1GiB
|
|
|
|
parted /dev/sda -- mkpart primary 1GiB 100%
|
|
|
|
cryptsetup luksFormat /dev/sda2
|
|
|
|
```
|
2021-04-11 10:25:32 +01:00
|
|
|
|
2021-09-17 21:24:14 +01:00
|
|
|
remote (sata):
|
2021-04-11 08:54:23 +01:00
|
|
|
```bash
|
|
|
|
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
|
|
|
|
```
|
|
|
|
|
2021-06-26 18:55:09 +01:00
|
|
|
remote (nvme):
|
|
|
|
```bash
|
|
|
|
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
|
2021-06-26 21:20:30 +01:00
|
|
|
parted /dev/nvme0n1 -- rm 5
|
2021-06-26 18:55:09 +01:00
|
|
|
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):
|
2021-04-11 10:25:32 +01:00
|
|
|
|
2021-04-11 08:54:23 +01:00
|
|
|
```bash
|
|
|
|
cryptsetup luksOpen /dev/sda2 crypt
|
|
|
|
```
|
|
|
|
|
2021-06-26 18:55:09 +01:00
|
|
|
remote (nvme):
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cryptsetup luksOpen /dev/nvme0n1p2 crypt
|
|
|
|
```
|
|
|
|
|
2021-09-17 21:24:14 +01:00
|
|
|
remote (sata+MBR):
|
|
|
|
|
|
|
|
```bash
|
|
|
|
mkfs.ext2 /dev/sda1 -L boot
|
|
|
|
```
|
|
|
|
|
|
|
|
remote (sata + GPT):
|
2021-04-11 10:25:32 +01:00
|
|
|
|
2021-04-11 08:54:23 +01:00
|
|
|
```bash
|
|
|
|
mkfs.fat -F 32 -n boot /dev/sda1
|
2021-09-17 21:24:14 +01:00
|
|
|
```
|
|
|
|
|
2021-10-01 10:00:02 +01:00
|
|
|
remote (nvme + GPT):
|
|
|
|
|
|
|
|
```bash
|
|
|
|
mkfs.fat -F 32 -n boot /dev/nvme0n1p1
|
|
|
|
```
|
|
|
|
|
2021-09-17 21:24:14 +01:00
|
|
|
remote (sata):
|
|
|
|
|
|
|
|
```bash
|
2021-04-11 08:54:23 +01:00
|
|
|
mkfs.btrfs -L nixos /dev/mapper/crypt
|
2021-09-17 18:16:43 +01:00
|
|
|
cryptsetup luksClose crypt
|
|
|
|
cryptsetup luksOpen /dev/sda2 crypt
|
2021-04-11 08:54:23 +01:00
|
|
|
mount /dev/disk/by-label/nixos /mnt
|
|
|
|
mkdir -p /mnt/boot
|
|
|
|
mount /dev/disk/by-label/boot /mnt/boot
|
|
|
|
nixos-generate-config --root /mnt
|
2021-04-11 09:28:06 +01:00
|
|
|
```
|
|
|
|
|
2021-06-26 18:55:09 +01:00
|
|
|
remote (nvme):
|
|
|
|
|
|
|
|
```bash
|
|
|
|
mkfs.fat -F 32 -n boot /dev/nvme0n1p1
|
|
|
|
mkfs.btrfs -L nixos /dev/mapper/crypt
|
2021-06-26 21:20:30 +01:00
|
|
|
cryptsetup luksClose crypt
|
|
|
|
cryptsetup luksOpen /dev/nvme0n1p2 crypt
|
|
|
|
mount /dev/disk/by-label/nixos /mnt
|
2021-06-26 18:55:09 +01:00
|
|
|
mkdir -p /mnt/boot
|
|
|
|
mount /dev/disk/by-label/boot /mnt/boot
|
|
|
|
nixos-generate-config --root /mnt
|
|
|
|
```
|
|
|
|
|
2021-04-11 10:25:32 +01:00
|
|
|
local:
|
|
|
|
|
2021-04-11 09:28:06 +01:00
|
|
|
```bash
|
2021-04-11 10:25:32 +01:00
|
|
|
tar -cvz . > ../dotfiles.tar.gz
|
|
|
|
scp ../dotfiles.tar.gz nixos@remote:/tmp
|
|
|
|
```
|
|
|
|
|
|
|
|
remote:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
mkdir -p /mnt/home/cyryl/dev/dotfiles/
|
|
|
|
tar -xvf /tmp/dotfiles.tar.gz -C /mnt/home/cyryl/dev/dotfiles
|
2021-09-17 20:35:24 +01:00
|
|
|
# merge /mnt/etc/nixos/hardware-configuration.nix into /mnt/home/cyryl/dev/dotfiles/nixos/boxes/bootstrap/hardware-configuration.nix
|
2021-06-26 18:55:09 +01:00
|
|
|
nix-shell -p nixUnstable git
|
2021-09-17 18:16:43 +01:00
|
|
|
cd /mnt/home/cyryl/dev/dotfiles/
|
2021-10-01 10:00:02 +01:00
|
|
|
systemd-inhibit nixos-install --flake '.#bootstrap'
|
2021-04-11 10:25:32 +01:00
|
|
|
passwd cyryl
|
2021-04-11 10:39:37 +01:00
|
|
|
chown cyryl -R /home/cyryl
|
2021-04-11 10:29:38 +01:00
|
|
|
reboot
|
2021-04-11 08:54:23 +01:00
|
|
|
```
|
2021-04-03 12:52:05 +01:00
|
|
|
|
2021-09-18 08:57:40 +01:00
|
|
|
|
|
|
|
ctrl-alt-f1 cyryl login:
|
2021-04-11 10:39:37 +01:00
|
|
|
|
|
|
|
```bash
|
|
|
|
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/
|
2021-04-11 11:47:26 +01:00
|
|
|
sudo ln -vfs /home/cyryl/dev/dotfiles/nixos/boxes/HOSTNAME/default.nix /etc/nixos/configuration.nix
|
2021-09-18 08:57:40 +01:00
|
|
|
sudo nixos-rebuild switch --flake '.#HOSTNAME'
|
2021-04-11 10:39:37 +01:00
|
|
|
reboot
|
|
|
|
```
|
2021-04-11 10:29:38 +01:00
|
|
|
|
2021-04-11 11:47:26 +01:00
|
|
|
```bash
|
2021-09-18 08:57:40 +01:00
|
|
|
cd ~/dev/dotfiles/
|
|
|
|
nixos-install --flake '.#'
|
2021-04-11 11:47:26 +01:00
|
|
|
ssh-keygen -t ed25519
|
2021-04-11 12:18:00 +01:00
|
|
|
# syncthing
|
|
|
|
# vault
|
2021-04-11 11:47:26 +01:00
|
|
|
# firefox sync
|
|
|
|
# bitwarden
|
|
|
|
# add key to sr.ht
|
|
|
|
cd ~/dev/dotfiles
|
|
|
|
git checkout nixos/boxes/bootstrap
|
|
|
|
```
|
|
|
|
|
2021-05-29 23:33:19 +01:00
|
|
|
### Good Links [tm]
|
|
|
|
* https://nixpk.gs/pr-tracker.html
|
|
|
|
* https://pr-tracker.nevarro.space/
|
|
|
|
|
|
|
|
### inspiration
|
2021-05-30 11:39:35 +01:00
|
|
|
* start with flakes - https://github.com/mjlbach/nix-dotfiles/blob/4777ae6cf1a2bf88f5320a300e05bbe7ada57df8/nixos/flake.nix#L1-L10
|
|
|
|
* flakes - https://github.com/MatthewCroughan/nixcfg/blob/master/flake.nix#L45 for T480
|
2021-05-29 23:33:19 +01:00
|
|
|
* 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
|
|
|
|
* https://github.com/expipiplus1/dotfiles/blob/3d6ca2c8bcba3181bfe7bf16d331baf407c7a9dd/tests/home-test.nix - testing on CI
|
2021-05-30 11:39:35 +01:00
|
|
|
* https://git.knightsofthelambdacalcul.us/hazel/etc
|
2021-05-29 23:33:19 +01:00
|
|
|
|
|
|
|
### things to check out
|
2021-05-30 11:39:35 +01:00
|
|
|
* https://github.com/ryantm/agenix
|
2021-05-29 23:33:19 +01:00
|
|
|
* `nix-top`
|
2021-05-30 11:39:35 +01:00
|
|
|
* naersk for genpass
|
2021-05-29 23:33:19 +01:00
|
|
|
* https://github.com/divnix/devos
|
2021-05-30 11:39:35 +01:00
|
|
|
* https://github.com/tazjin/nix-1p
|
|
|
|
* https://github.com/nix-community/neovim-nightly-overlay
|
2021-06-09 07:48:39 +01:00
|
|
|
* install ISO - https://christine.website/blog/my-homelab-2021-06-08
|
2021-05-29 23:33:19 +01:00
|
|
|
|
2021-05-30 11:39:35 +01:00
|
|
|
### 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; };
|
|
|
|
};
|
|
|
|
```
|
2021-05-29 23:33:19 +01:00
|
|
|
|
2021-11-24 10:33:12 +00:00
|
|
|
## Ubuntu
|
|
|
|
```
|
|
|
|
sudo apt install git vim curl
|
|
|
|
curl -L https://nixos.org/nix/install | sh
|
|
|
|
```
|
|
|
|
|
|
|
|
make sure
|
|
|
|
|
|
|
|
```
|
|
|
|
if [ -e /home/cyryl/.nix-profile/etc/profile.d/nix.sh ]; then . /home/cyryl/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer
|
|
|
|
export NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH
|
|
|
|
``` is in `~/.profile`
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
reboot
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
nix-shell '<home-manager>' -A install
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
mkdir dev
|
|
|
|
cd dev
|
|
|
|
git clone https://git.sr.ht/~cyplo/dotfiles
|
|
|
|
cd dotfiles
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
ln -vfs /home/cyryl/dev/dotfiles/nixos/home-other-os.nix /home/cyryl/.config/nixpkgs/home.nix
|
|
|
|
home-manager switch
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2021-04-03 12:52:05 +01:00
|
|
|
## guix
|
|
|
|
|
|
|
|
I'm just starting to play with guix, these are just loose notes:
|