Skip to content

sectore/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotfiles

Nix + Home Manager on Ubuntu

Install Nix

👀 Multi-user installation (recommended) https://nixos.org/download.html#nix-quick-install

Enable Flakes

👀 https://nixos.wiki/wiki/Flakes#Permanent

👀 nix/README

Install standalone Home Manager

👀 https://nix-community.github.io/home-manager/index.xhtml#sec-install-standalone

nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update

nix-shell '<home-manager>' -A install

Check installation

nix-env --query --installed
home-manager-path

# or

home-manager --version
25.05-pre

Checkout and symlink dotfiles

git pull [email protected]:sectore/dotfiles.git
cd dotfiles

Symlink home-manager, nix and zed folder to ~/.config using stow based on YT vid Stow has forever changed the way I manage my dotfiles

stow . -t ~/.config

Side note: home-manager provides programs.zed-editor, but it errors while creating symlinks to settings.json etc., which Zed tries to override. That ends in errors such as

Permission denied (os error 13) at path "/nix/store/..."
# or
Failed to write settings to file "/nix/store/xxr...-zed-user-settings"

Very similar to zed-industries/zed#16618

Solution is just to add pkgs.zed-editor to home.packages and symlink Zed's settings files etc. located in ~/dotfiles/zed/ by using stow.

Activate configuration of home-manager after setup or any future changes:

home-manager switch

Configuration of Home Manager and programs

Change default shell to zsh

Home Manager can't change the default shell, so we need to do it manually:

# `which zsh`
which zsh
~/.nix-profile/bin/zsh

# add it to `/etc/shells`
sudo vi /etc/shells

# change shell to `zsh`
chsh -s ~/.nix-profile/bin/zsh

Reference:

NixGL

To access the GPU, programs need access to OpenGL and Vulkan libraries. While this works transparently on NixOS, it does not on other Linux systems. A solution is provided by NixGL, which can be integrated into Home Manager.

^ https://nix-community.github.io/home-manager/index.xhtml#sec-usage-gpu-non-nixos

Needed to run Zed, Ghostty, Bevy etc.

From Bevy's docs:

If running nix on a non NixOS system (such as ubuntu, arch etc.), NixGL is additionally required, to link graphics drivers into the context of software installed by nix:

Installation

nixGL docs recommends to install nixGL via nix-channel

# add channel
nix-channel --add https://github.com/nix-community/nixGL/archive/main.tar.gz nixgl
nix-channel --update
# install nixGL
nix-env -iA nixgl.auto.nixGLDefault
# double check
which nixGL
# install nixGLNvidia
nix-env -if https://github.com/guibou/nixGL/archive/main.tar.gz -A auto.nixGLNvidia
# double check
which nixGLNvidia-550.120
# (after setting a symlink in `zsh.nix`)
which nixGLNvidia

Uninstall

nix-env -e nixGL
nix-channel --remove nixgl
nix-channel --update

Acknowledge

About

personal dotfiles

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages