This is my personal nix-config. It is always a work in progress as I love tweaking.
| host | home-manager profile | system |
|---|---|---|
| framework-16 | zshen@framework-16 | x86_64-linux |
| Zhongjies-MacBook-Pro | zshen@Zhongjies-MacBook-Pro.local | aarch64-darwin |
- install nix (https://zero-to-nix.com/start/install)
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --determinate- clone this repo
- setup keys.txt (for sops-nix)
age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt";# first time setup
nix run nix-darwin --extra-experimental-features 'nix-command flakes' -- switch --flake .#mac-m1-max
# switch
nh darwin switch .
darwin-rebuild --list-generations
darwin-rebuild switch --switch-generation 41- switch NixOS
nh os switch .- test NixOS (TBD)
# useful nix cmds
nix run github:zhongjis/nix-update-input # upgrade specific input
nh search <query> # search nixpkgsThis flake provides reusable development environment templates. Use them to quickly set up project-specific dev shells.
| Template | Description | Includes |
|---|---|---|
java8 |
Java 8 development environment | JDK 8, Maven, Lombok |
nodejs22 |
Node.js 22 development environment | Node.js 22, pnpm |
Create a new project from a template:
# Create a new directory with the template
nix flake new -t github:zhongjis/nix-config#nodejs22 ./my-project
# Or initialize in current directory
nix flake new -t github:zhongjis/nix-config#java8 .Enter the development shell:
# After creating from template
cd my-project
nix develop
# Or use direnv for automatic activation
echo "use flake" > .envrc
direnv allowList available templates:
nix flake show github:zhongjis/nix-configI use sops-nix's home-manager module.
nix run nixpkgs#sops -- secrets.yaml # view secretsmore about sops see https://github.com/getsops/sops#2usage
NOTE: most of the changes (like for neovim) are changed on the way while im using it. this list just for later in case I have nothing to do.
see here
adding inputs
inputs = {
trouble-nvim = {
url = "github:folke/trouble.nvim";
flake = false;
};
}override in overlays
modifications = final: prev: rec {
vimPlugins =
prev.vimPlugins
// {
trouble-nvim =
prev.vimUtils.buildVimPlugin
{
name = "trouble.nvim";
src = inputs.trouble-nvim;
};
};
};