βοΈ NixOS
- π± window manager: hyprland
- π terminal emulator: kitty
- π shell: zsh
- π text editor: neovim
- π¬ notification: dunst
- π browser: zen
- π· screenshot: satty + grim + slurp
- πΉ screen recorder: wf-recorder + slurp
- π€ fonts: nerd fonts
- π¨ color scheme: kanagawa
- π file manager: yazi / thunar
- π application launcher: rofi
π§ Ubuntu
- π± window manager: gnome with pop!_os shell
- π terminal emulator: kitty
- π shell: zsh
- π text editor: neovim
- π¬ notification: dunst
- π browser: zen
- π€ fonts: nerd fonts
- π¨ color scheme: kanagawa
- π file manager: yazi / thunar
# list all available operations
make help
$ # folder description
$ nix-shell -p tree --run 'tree -d -L 1'
.
βββ home-manager # Install and configure package at user level.
βββ nixos # Install and configure package at system level.
βββ pkgs # Contains Nix custom packages that are not present in nixpkgs.
βββ scripts # Contains some Nix scripts to be use in home-manager or NixOS configuration files, as well as some shell scripts to use outside of Nix.
βββ stow # Configuration files that need to be writeable are symlinked in this folder.
# Clone dotfiles.
nix-shell -p git just
cd ~/.config
git clone https://github.com/l-lin/dotfiles
cd dotfiles
# Install.
just import-keys import-secrets
just update-nixos
just update-home
reboot
# Add navi cheatsheets.
unleash-the-keys
just install-cheatsheets
# Fix dotfiles git remote to use ssh.
wd dotfiles
git remote remove origin && git remote add origin [email protected]:l-lin/dotfiles && git fetch
# install curl to install nix: https://zero-to-nix.com/start/install
sudo apt install curl
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
# Clone dotfiles.
nix-shell -p git just
cd ~/.config
git clone https://github.com/l-lin/dotfiles
cd dotfiles
# Install.
just import-keys import-secrets
just install-home-standalone
just update-home
reboot
# Add navi cheatsheets.
unleash-the-keys
just install-cheatsheets
# Fix dotfiles git remote to use ssh.
wd dotfiles
git remote remove origin && git remote add origin [email protected]:l-lin/dotfiles && git fetch
π Hello, my future self. Yes, you! Here are some notes for you, as I know you are forgetful.
- Find a package in the Nixpkgs.
- Install a new package in home-manager.
- Install Forticlient VPN with SAML
- Add shell script available in
$PATH
in NixOS - Adding external binary to your
$PATH
- I want to downgrade/upgrade a package
- Use a different version of nixpkgs in home-manager
- Share variables between modules
- Running an external binary on NixOS
- XDG folder names and home directory as variables
- Pair bluetooth devices
If you are living dangerously, i.e. you are using the unstable version of nixpkgs
,
each package may be upgraded to their latest version. So you may have some packages
that are not behaving the same as you wanted or are just broken.
Here's a tutorial of someone that used git bisect
to find and fix his issue:
https://ipetkov.dev/blog/bisecting-nix-configurations/.
There's a "Nix way" of configuring package. It is like a good abstraction, but you will prefer to have your configuration in the original format and create symlinks on them.
There are several advantages of doing like this:
- you can refer to the package documentation to make your modification
- you can use linter/treesitter/lsp/whatever on the configuration file
- in case you change your OS (once again), you will still be able to re-use your dotfiles
However, you will not be able to use Nix variables. So if the package does not need to have any Nix variable, you can configure your package like this:
# Create symlink on the whole config/ folder on `~/.config/nvim`.
xdg.configFile.nvim = {
source = ./config;
recursive = true;
};
# Create a symlink on a single file at `~`.
home.file.".gitconfig".source = ./config/.gitconfig;
# If you need to use some Nix option along with the configuration file, you
# can use the Nix builtin function `builtins.readFile`
programs.tmux = {
enable = true;
shell = "${pkgs.zsh}/bin/zsh";
extraConfig = ''
${builtins.readFile ./.tmux.conf}
'';
};
# If you need to write text directly in the nix file, because you need to use
# some nix variable:
xdg.configFile."waybar/colorscheme.css".text = ''
@define-color fg #${palette.base05};
@define-color fg-alt #${palette.base00};
@define-color bg #${palette.base00};
@define-color bg-alt #${palette.base0D};
'';
I know you will think there's no consistency, sometimes I'm using Nix to configure applications, sometimes, I use symlink... I wonder if I should just use Nix / home-manager to handle all the package installation stuff and symlink the configuration files... Only time will tell.
Note
LazyVim is a plugin manager that will download the plugins at "runtime". So it does not quite stick to the NixOS philosophy. It's recommended to migrate to something else, like configuring directly in home-manager, or using NixVim instead.
I'm using a symlink to the ${XDG_CONFIG_HOME}/nvim
folder, so LazyVim works
without much issue, i.e. it will download the plugins, but I can't say the same
about plugins that use downloaded binaries, e.g. LSP servers installed by mason.nvim.
I installed and configured nix-ld, so most binaries should work without any problem. If not please check below on how to configure it.
I still don't know if I want to migrate NeoVim to be fully Nix compliant or keep it like this...
Note
I moved all my NeoVim configuration to the stow/
folder, as updating a NeoVim Lua
file through home-manager resulted in slow feedback (~20s).
I used stylix to manage color schemes and themes. So it should be easy to add new themes without much hassle.
You can add them at the themes folder.
You need to put some secret and use it in some configuration?
Check your secrets private repository.
Sometimes, some commands are not available in the default zsh completions.
However, some tools provide a completion script that is generated for you, e.g.:
just --completion zsh
helm completion zsh
So after adding the completion script in your ${XDG_CONFIG_HOME}/zsh/completions
folder,
you will notice that the completion does not work yet. It's because we are using a plugin
that caches the completion script. So you will need to refresh the cache by calling the
following:
refresh-zsh-completions
Then, open a new terminal session, and you are good to go!
There are lots of Nix documentation, but it's quite hard to find the "right" one depending on your level of understanding of Nix. The official Nix documentation delves a bit too much on the concepts (for the right reasons), whereas I just want to make something work fast.
I found Evertras introduction to home-manager is the best documentation to start with Nix, along with zero-to-nix.
Most of the documentation you will search are the following:
- https://search.nixos.org/packages: search Nix packages
- https://search.nixos.org/options: search NixOS options
- https://mynixos.com/search: search NixOS and home-manager options and packages
- https://home-manager-options.extranix.com/: search home-manager options
- https://nixos.wiki/index.php: more in-depth documentation
- https://nix.dev/search.html: more in-depth documentation
- https://nixos.org/manual/nixos/unstable/index.html#ch-configuration: system level configuration documentation
- https://github.com/NixOS/nixpkgs: code source
- https://noogle.dev/: search Nix functions
- Best introduction to home-manager for newcomer
- Zero to Nix
- Nix pills
- nix.dev
- Installing NixOS with Hyprland
- Declarative management of dotfiles with Nix and Home Manager
- Getting started with the Nix ecosystem
- Writing Nix modules
- Nix module system
- NixOS and flake unofficial book for beginners
- Nix cookbook and survival guide
- Practical Nix flake anatomy
- https://github.com/Misterio77/nix-starter-configs
- https://github.com/GaetanLepage/nix-config
- https://github.com/ryan4yin/nix-config
- https://gitlab.com/Zaney/zaneyos
- https://github.com/notusknot/dotfiles-nix/
- https://github.com/Evertras/nix-systems
- https://github.com/Aylur/dotfiles
- https://github.com/hyper-dot/Arch-Hyprland
- https://github.com/chadcat7/crystal
- https://codeberg.org/justgivemeaname/.dotfiles
- https://gitlab.com/hmajid2301/dotfiles
- https://gitlab.com/usmcamp0811/dotfiles
- https://gitlab.com/librephoenix/nixos-config