Skip to content

kachick/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotfiles

Home Status Home Status Nix Status CI - Go Status Container Status

Personal dotfiles that can be placed in the public repository
Also known as 盆栽(bonsai) 🌳

block-beta
    columns 3

    block:os:3
        nixos(("❄")) macos(("🍎")) windows(("πŸͺŸ"))
    end

    block:vm:3
        lima("Lima") quickemu("Quickemu") wsl2("WSL2")
    end

    block:container:3
        podman("🦭") k8s("☸️") 
    end

    nixos --> lima
    nixos --> quickemu
    macos --> lima
    windows --> wsl2

    vm --> container
    nixos --> container
Loading

For visitors

If you are using Podman, you can test the pre-built ubuntu container-image as follows.

bash <(curl -fsSL https://raw.githubusercontent.com/kachick/dotfiles/main/containers/sandbox-with-ghcr.bash) latest

Or, you can directly use some commands with nix run without any installation steps.

nix run 'github:kachick/dotfiles#todo'

List them

nix flake show 'github:kachick/dotfiles' --json 2>/dev/null | jq '.packages | ."x86_64-linux" | to_entries | map("\(.key) # \(.value.description)")'

NixOS

List defined hostnames

nix eval --json 'github:kachick/dotfiles#nixosConfigurations' --apply 'builtins.attrNames' | jq '.[]'

Using flake style is disabled in NixOS by default and you should inject git command to use flakes.

NOTICE: This command might drop all existing users except which defined in configurations.

nix --extra-experimental-features 'nix-command flakes' shell 'github:NixOS/nixpkgs/nixos-24.11#git' \
  --command sudo nixos-rebuild switch \
  --flake "github:kachick/dotfiles#$(hostname)" \
  --show-trace

If you are experimenting to setup NixOS just after installing from their installer and want to avoid impure mode,
See generic configuration for my current workaround.

This repository intentionally reverts the home-manager NixOS module.
So, you should activate the user dotfiles with standalone home-manager even though NixOS.
See GH-680 for background

passwd user
su - user
nix run 'github:kachick/dotfiles#home-manager' -- switch -b backup --flake 'github:kachick/dotfiles#user@nixos-desktop'

Finally, reboot the device

sudo reboot now

home-manager

List definitions

nix eval --json 'github:kachick/dotfiles#homeConfigurations' --apply 'builtins.attrNames' | jq '.[]'

Ubuntu

  1. Install Nix package manager with DeterminateSystems/nix-installer to enable Flakes by default.

    curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
  2. Make sure there is a nix directory that is used in the home-manager.
    This is a workaround, See the thread for detail

    mkdir -p ~/.local/state/nix/profiles
  3. Restart current shell to load Nix as a PATH

    bash
  4. Apply dotfiles

    nix run 'github:kachick/dotfiles#home-manager' -- switch -b backup --flake 'github:kachick/dotfiles#wsl-ubuntu'
  5. Apply system level dotfiles with sudo for nix command

    sudoc nix run 'github:kachick/dotfiles#apply-system'
  6. Enable tailscale ssh if required

    sudoc tailscale up --ssh

Podman on Ubuntu

  1. Install uidmap without Nix for use of podman even if the podman will be installed from nixpkgs

    sudo apt-get install --assume-yes uidmap
  2. Make sure the cgroup v1 is disabled if you on WSL, See the docs

  3. Make sure you can run containers as podman run public.ecr.aws/debian/debian:12.6-slim cat /etc/os-release

Debian

After installing missing tools, you can complete same steps as Ubuntu

sudo apt update
sudo apt upgrade
sudo apt install --assume-yes curl
sudo apt install --assume-yes dbus-user-session # For podman

Remember to set special config and reboot if you on WSL

echo '
[boot]
systemd=true' | sudo tee /etc/wsl.conf

Windows

  1. Install WSL2 with default Ubuntu. Activate home-manager as kachick@wsl-ubuntu
  2. Install NixOS-WSL. Activate home-manager with $(whoami)@wsl-nixos
  3. Adjust Windows experience as written in extracted steps and as written in CI for further detail.

Multi-booting on Windows and Linux

Check traps

macOS

I basically give up to maintain macOS environment.

  1. Apply home-manager with kachick@macbook for minimum packages.
  2. Install some packages without Nix
  3. Use Lima for development tasks.

Lima

  1. Setup Lima with default Ubuntu guest
  2. In the lima as limactl start, apply home-manager with kachick@lima
  3. You can run containers as lima nerdctl run --rm hello-world. You can also use podman after above Podman on Ubuntu setups

How to setup secrets

Extracted to wiki

Shorthand

If you are developing this repository, putting .env makes easy reactivations.

echo 'HM_HOST_SLUG=wsl-ubuntu' > .env

Then you can enable configurations with

task apply