my personal nixos-config on an old ASUS laptop.
Use i3blocks
Use polybar
- Here are some skills of using
NixOS
,live-server
and dotfiles used on my NixOS. - Wallpaper are from 李擎洲:九尾·妖狐 and 彭雄渾 and Free 4k Wallpaper Photos.
- bspwm's config is from ghomasHudson/bspwm-dwm. And add some customized change like keybindings to open dmenu's scripts.
- TVbsp.sh is a script for turning off laptop's screen and setting up workspaces on the external screen.
- lay.sh is a script for showing windows layout on polybar in bspwm.
- If you want to learn bspwm, check this: Bspwm Basics.
- I use tofi as a replacement of dmenu in Hyprland.
- In NixOS, you should use an overlay to fix the waybar's workspace module if you want to use Hyprland. (In my config, it can show workspaces but it can not be clicked.)
Steps for updating NixOS:
- Check and set the latest channel
sudo nix-channel --list
If the channel is not the newest, run:
sudo nix-channel --remove nixos
sudo nix-channel --add https://nixos.org/channels/nixos-XX.XX nixos
See Chapter 4. Upgrading NixOS to check the latest channel.
2. Update the channel
sudo nix-channel --update
- Update the packages To update all packages declared in NixOS’ configuration.nix, use:
sudo nixos-rebuild switch
How to Show all packages installed in NixOS ?
- Show
environment.systemPackages
in/etc/nixos/configuration.nix
nix-store --query --requisites /run/current-system | cut -d- -f2- | sort | uniq | bat
or
nix-store --query --requisites /run/current-system | cut -c 45-200 | sort | uniq | bat
sudo nix-env -p /nix/var/nix/profiles/system --list-generations
How to Delete Old Generations On NixOS ?
For system-wide, run:
- You can change
30d
to the days you want.
sudo nix-collect-garbage --delete-older-than 30d
or you can run sudo nix-collect-garbage -d
to delete all old generations. (Of course, this would make rollback impossible.)
- Then run the rebuild command to clean the boot entries of old generations of nixos.
sudo nixos-rebuild switch
For per-user, run those commands without sudo
. Check the Nix Reference Manual for more detailed information.
- Check Installing NPM Packages Globally in NixOS first.
- After installing
NPM
and doing the config for npm in shell's rc, runnpm install -g live-server
.
- After installing
- Then check live-server's config.
- Remember that the file
.live-server.json
should put in your home directory. Set the root for live-server, then use the commandlive-server
in that root directory. It should work smoothly.
- Remember that the file
Next time when installing NixOS, make /efi
(/boot
) big enough (like 1~2GB), or you will have to delete boot menu constantly.(Of course, maybe it is because I care about the space of /boot
too much).