Skip to content

stfl/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My nix home-manager config

nix run . -- build --flake .
nix run . -- switch -b backup --flake .

Update

nix flake update
nix run . -- build --flake .
nvd diff /nix/var/nix/profiles/per-user/${USER}/home-manager result

read "Continue? [Enter] → Yes, [Ctrl]+[C] → No."
nix run . -- switch -b backup --flake .

Break down

Update the flake

nix flake update

Build the new generation

nix run . -- build --flake .

And compare the new version to the currently installed generation

nvd diff result /nix/var/nix/profiles/per-user/${USER}/home-manager

Compare current-generation with X generation

BASE_VERSION=265
nvd diff /nix/var/nix/profiles/per-user/${USER}/home-manager{,-${BASE_VERSION}-link}

Compare two generations:

nvd diff /nix/var/nix/profiles/per-user/${USER}/home-manager-{265,267}-link

Read the news

nix run . -- news --flake .

Setup nix on Debian 12

add user to sudoers (because it’s much more convinient)

/sbin/usermod -a -G sudo $USER

install package nix-setup-systemd

apt-get -y install nix nix-setup-systemd

Add user to nix-users group

/sbin/usermod -a -G nix-users $USER

reboot // logout>login

update global nix config config /sudo

max-jobs = auto

experimental-features = nix-command flakes

Bootstrap the config

Install git (which is not present on PVE base install)

apt-get install -y git

Clone the repo

git clone [email protected]:stfl/dotfiles.git ~/.config/dotfiles
nix run . -- switch -b backup --flake .

Setup Emacs

https://github.com/stfl/doom.d#installation

swaylock

[2023-09-07 Thu] - swaylock from nix does not work with home-manager on Debian with LDAP…

install swaylock from Debian repo

apt install swaylock

UPDATE not using LDAP anymore.. TODO: swaylock requires some pam config..

cat /etc/pam.d/swaylock #

#

auth include login

set nix installed zsh as default shell

NOTE this will not work on the Workstation at Proxmox with LDAP login because the login shell is configured via LDAP

when trying to set a nix installed shell as default it will cause an error as follows:

chsh -s home/stefan.nix-profile/bin/zsh Password: chsh: home/stefan.nix-profile/bin/zsh is an invalid shell

manually ad /home/stefan/.nix-profile/bin/zsh to /etc/passwd

Alternatively, add the following to /etc/shells to mark nix installed shells as valid shells.

/home/stefan/.nix-profile/bin/zsh
/home/stefan/.nix-profile/bin/bash
/home/stefan/.nix-profile/bin/fish

then run this to enabel this shell

chsh -s /home/stefan/.nix-profile/bin/zsh

On the Proxmox workstation setting ~~/.nix-profile/bin/zsh~ as the login shell does not work because it is set set via LDAP. As a workaround I install zsh via apt, set /bin/zsh as LDAP Login shell and still set programs.zsh.enable = true in nix.

Let’s hope the versions and nix config will not diverge too much….

Access user journal

Per default, I cannot access the user’s own journal journalctl --user. I am fine with granting access to the system’s journal.

/sbin/usermod -a -G systemd-journal slendl

Set default boot target to multi-user

systemctl set-default multi-user.target

Install in Debian System

some packages need to be installed in the Debian System itself for various reasons. The following list is very likely outdated!!

for building some things in emacs (vterm, sqlite) I need built tools. I don’t want to polute my dev environment - which requires Debian build tooling - I need to install these from the system.

  • build-essential
  • cmake
  • libtool
  • libtool-bin
  • libnotify-bin

starting sway from login shell

Even though I patched the wayland.windowManager.sway.package with nixGL it does not start up properly, so I need to start it with the nixGL wrapper

swaylock does not work (still true?) from nix.. so use swaylock from the system

swaylock
[2023-10-03 Tue] swaylock from nix is broken
mtr-tiny
mtr requires root and we cannot install into the system path from home-manager

Setup ZSA udev rules for ErgoDox EZ

I own three ErgoDox EZ (because I love them so much and want them everywhere). Installing zsh-udev-rules with home-manager installs the udev rules in ~~/.nix-profile/lib/udev/…~

I want to direclty install the udev rules in Debian by following the official tutorial

DEBIAN_FRONTEND=noninteractive
apt-get install -y libusb-1.0.0-dev

tangle the following to /etc/udev/rules.d/50-zsa.rules

# Rules for Oryx web flashing and live training
KERNEL=="hidraw*", ATTRS{idVendor}=="16c0", MODE="0664", GROUP="plugdev"
KERNEL=="hidraw*", ATTRS{idVendor}=="3297", MODE="0664", GROUP="plugdev"

# Legacy rules for live training over webusb (Not needed for firmware v21+)
  # Rule for all ZSA keyboards
  SUBSYSTEM=="usb", ATTR{idVendor}=="3297", GROUP="plugdev"
  # Rule for the Moonlander
  SUBSYSTEM=="usb", ATTR{idVendor}=="3297", ATTR{idProduct}=="1969", GROUP="plugdev"
  # Rule for the Ergodox EZ
  SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="1307", GROUP="plugdev"
  # Rule for the Planck EZ
  SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="6060", GROUP="plugdev"

# Wally Flashing rules for the Ergodox EZ
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666"
KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666"

# Keymapp / Wally Flashing rules for the Moonlander and Planck EZ
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666", SYMLINK+="stm32_dfu"
# Keymapp Flashing rules for the Voyager
SUBSYSTEMS=="usb", ATTRS{idVendor}=="3297", MODE:="0666", SYMLINK+="ignition_dfu"
sudo groupadd plugdev
sudo usermod -aG plugdev $USER

Setup Syncthing

Configure logind on Debian 12

I am using i3wm, installed through nix home-manager. System-wide configuration like logind to configure PowerKey and so on cannot be managed through home-manager and need to be configured separately.

NOTE Tangle a single src block with C-u prefix command or SPC u in doomemacs.

  • SPC u C-c C-v t

with hibernate

If hibernate is working use

/etc/systemd/logind.conf.d/90_config.conf

[Login]
HandlePowerKey=suspend-then-hibernate
IdleAction=suspend-then-hibernate
IdleActionSec=20m

/etc/systemd/sleep.conf.d/90_config.conf

[Sleep]
HibernateDelaySec=1h

without hibernate

/etc/systemd/logind.conf.d/90_config.conf

[Login]
HandlePowerKey=suspend
IdleAction=suspend
IdleActionSec=20m

reload systemd config

systemctl daemon-reload

Docker

Installing Docker via home-manager does not make any sense because it’s a system component which must be managed by the underlying distro.

Install it directly via apt

apt-get install docker docker-compose -y

Add unprivileged user stefan to the docker group to enable interacting with the docker daemon without sudo.

usermod -a -G docker $USER

reboot

Bashrc for root

I am using the system frequently as root, so I want to have a decently configured bashrc as root which I want to version as well.

Symlink root’s .bashrc to the config file in this repo.

ln /home/slendl/.config/dotfiles/config/bash/.bashrc.root /root/.bashrc -sf

password-store

gpg --edit-key <password-store-key>
> trust
> 5 # trust ultimately

org-protocol in Brave Brower

Redit about policy Brave Doku

Install the org-protocol policy system-wide. Brave and Chrome do not seem to allow specifying policies in /home

{
  "AutoLaunchProtocolsFromOrigins": [
    {
      "allowed_origins": [ "*" ],
      "protocol": "org-protocol2"
    }
  ]
}

This could possibly be overwritten by passing --user-data-dir to Brave.

Brave nix source

nixos-rebuild

nixos-rebuild switch --flake ".#"

on target-host

nixos-rebuild \
    --target-host [email protected] \
    --use-remote-sudo \
    switch \
    --flake ".#nixos-vm"

NixOS Setup

The easiest solution is to do a remote setup. Having the nixos config on an existing machine and connect to the new system via ssh.

On the installation target, I need to change the password, so that ssh will work.

passwd

Partitioning

Partioning with an ESP and a single large partition with ext4.

Setup

mount /dev/sda3 /mnt
mkdir -p /mnt/boot
mount /dev/sda1 /mnt/boot
swapon /dev/sda2

generate the hardware-configuration.nix

nixos-generate-config --root /mnt --dir .

copy the hardware-configuration to the git repo

HOST=kondor
mkdir -p hosts/$HOST
scp [email protected]:hardware-configuration.nix hosts/$HOST
cp hosts/nixos-vm/{default,home}.nix hosts/$HOST

… customize hardware-configuration.nix, default.nix and home.nix

Installation

you will need to get the config to the target, because remote nixos-install does not exist…

THIS DOES NOT WORK, BECAUSE THERE IS NOT rsync ON THE TARGET

rsync -ravh ./ [email protected]:dotfiles/ --exclude /

On the target, run nixos-install

HOST=kondor
nixos-install --root /mnt --flake .#$HOST

Repair NixOS Installation via Live ISO

To repair a NixOS installation when booted to a live ISO:

* Mount the partitions to /mnt and enter the special nixos chroot:

nixos-enter
cd /path/to/dotfiles
nixos-rebuild switch --flake .#nixos-vm

About

nix home-manager based config...

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages