This repo stores some cc's NixOS and home-manager configurations.
Hint: this repo contains my hardware configuration, you shouldn't directly use the config to build your system.
.
├── flake.lock # lock file for the flake
├── flake.nix # main entry point of the flake
├── home # home-manager configurations
│ ├── apps/ # auto-imported app-specific configurations
│ ├── modules/ # reusable modules for home-manager
│ ├── common.nix # common configuration for home-manager
│ └── default.nix # default configuration for home-manager
├── hosts # host-specific configurations
│ ├── <machine>/ # configurations for a specific machine
│ ├── default.nix # import configuration for all hosts
│ └── vars.nix # shared variables used in the host configurations
├── LICENSE # license file
├── modules/ # reusable top-level modules for different purposes
└── README.md # this fileSystem theme is built via stylix
- user packages: nurpkgs
- neovim config: nvim-config
- typora themes: typora-themes
- wallpapers: wallpapers
Below are some miscellaneous notes.
Rebuild and switch the system configuration:
nh os switch ."#$(hostname)"Rebuild the system configuration but not switch:
nh os boot ."#$(hostname)"Pass envrionment variables to nix-daemon (superuser permission required):
#!/usr/bin/env bash
mkdir /run/systemd/system/nix-daemon.service.d
cat > /run/systemd/system/nix-daemon.service.d/override.conf << EOF
[Service]
Environment="<ENV_VAR_NAME>=<ENV_VAR_VALUE>"
EOF
systemctl daemon-reload
systemctl restart nix-daemonClean the machine:
sudo nh clean allThis nixos config is designed to build remote nixos system on a local machine and push it to the remote machine, use with ssh config:
# Note that it required no sudo permission on the local machine
nixos-rebuild --target-host "<remote-host>" --sudo switch --flake ."#<remote-host>" |& nomWith the ssh config like:
Host <remote-host>
User <username>
Hostname <ip-address/domain>
Emergency rollback to the previous boot entry (for grub):
sudo grub-reboot '1>1'
sudo reboot