https://github.com/kachick/dotfiles
π€€βπ³
https://github.com/kachick/dotfiles
dotfiles flakes home-manager nixos
Last synced: about 1 year ago
JSON representation
π€€βπ³
- Host: GitHub
- URL: https://github.com/kachick/dotfiles
- Owner: kachick
- License: mit
- Created: 2021-04-04T11:05:57.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-05-07T07:43:16.000Z (about 1 year ago)
- Last Synced: 2025-05-07T08:14:17.579Z (about 1 year ago)
- Topics: dotfiles, flakes, home-manager, nixos
- Language: Nix
- Homepage:
- Size: 2.51 MB
- Stars: 19
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# dotfiles
[](https://github.com/kachick/dotfiles/actions/workflows/ci-home.yml?query=branch%3Amain+)
[](https://github.com/kachick/dotfiles/actions/workflows/windows.yml?query=branch%3Amain+)
[](https://github.com/kachick/dotfiles/actions/workflows/ci-nix.yml?query=branch%3Amain+)
[](https://github.com/kachick/dotfiles/actions/workflows/ci-go.yml?query=branch%3Amain+)
[](https://github.com/kachick/dotfiles/actions/workflows/container.yml?query=branch%3Amain+)
Personal dotfiles that can be placed in the public repository\
Also known as [ηζ ½(bonsai)](https://en.wikipedia.org/wiki/Bonsai) π³
```mermaid
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
```
## For visitors
If you are using [Podman](https://podman.io/), you can test the pre-built [ubuntu container-image](containers) as follows.
```bash
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.
```bash
nix run 'github:kachick/dotfiles#todo'
```
List them
```bash
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
```bash
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](https://www.reddit.com/r/NixOS/comments/18jyd0r/cleanest_way_to_run_git_commands_on_fresh_nixos/).
**NOTICE: This command might drop all existing users except which defined in configurations.**
```bash
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](nixos/hosts/generic) for my current workaround.
Finally, reboot the device
```bash
sudo reboot now
```
## home-manager
List definitions
```bash
nix eval --json 'github:kachick/dotfiles#homeConfigurations' --apply 'builtins.attrNames' | jq '.[]'
```
## Ubuntu
1. Install [Nix](https://nixos.org/) package manager with [DeterminateSystems/nix-installer](https://github.com/DeterminateSystems/nix-installer) to enable [Flakes](https://nixos.wiki/wiki/Flakes) by default.
```bash
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
```
1. Make sure there is a nix directory that is used in the home-manager.\
This is a workaround, See [the thread](https://www.reddit.com/r/Nix/comments/1443k3o/comment/jr9ht5g/?utm_source=reddit&utm_medium=web2x&context=3) for detail
```bash
mkdir -p ~/.local/state/nix/profiles
```
1. Restart current shell to load Nix as a PATH
```bash
bash
```
1. Apply dotfiles
```bash
nix run 'github:kachick/dotfiles#home-manager' -- switch -b backup --flake 'github:kachick/dotfiles#wsl-ubuntu'
```
1. Apply system level dotfiles with [sudo for nix command](https://github.com/kachick/dotfiles/commit/2e47c6655dc74a4a56495fdcbebb9d15b0b57313)
```bash
sudoc nix run 'github:kachick/dotfiles#apply-system'
```
1. Enable tailscale ssh if required
```bash
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
- "shadow" in nixpkg is not enough for podman -
```bash
sudo apt-get install --assume-yes uidmap
```
1. Make sure the cgroup v1 is disabled if you on WSL, See [the docs](windows/WSL/README.md)
1. 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
```bash
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
```bash
echo '
[boot]
systemd=true' | sudo tee /etc/wsl.conf
```
## Windows
1. Install [WSL2](windows/WSL/README.md) with default Ubuntu. Activate home-manager as `kachick@wsl-ubuntu`
1. Install [NixOS-WSL](https://github.com/nix-community/NixOS-WSL). Activate home-manager with `$(whoami)@wsl-nixos`
1. Adjust Windows experience as written in [extracted steps](windows/README.md) and as written in [CI](.github/workflows/windows.yml) for further detail.
## Multi-booting on Windows and Linux
Check [traps](./windows/Multi-booting.md)
## macOS
I basically [give up to maintain macOS environment](https://github.com/kachick/dotfiles/issues/911).
1. Apply home-manager with `kachick@macbook` for minimum packages.
1. Install [some packages](https://github.com/kachick/dotfiles/wiki/macOS) without Nix
1. Use [Lima](#lima) for development tasks.
## Lima
1. Setup [Lima](https://github.com/lima-vm/lima) with default Ubuntu guest
1. In the lima as `limactl start`, apply home-manager with `kachick@lima`
1. 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](https://github.com/kachick/dotfiles/wiki/Encryption)
## Shorthand
If you are developing this repository, putting `.env` makes easy reactivations.
```bash
echo 'HM_HOST_SLUG=wsl-ubuntu' > .env
```
Then you can enable configurations with
```bash
task apply
```