Skip to content

bearoffwork/nix-templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bear's nix-templates

Templates

  • home-mini:

    • A minimal home-manager configuration flake.
    • Completely Documented
    • Zsh with prompt (powerlevel10k/starship) options.
    • direnv with nix-direnv for nix-shell auto activation
    • Opt-in git config with github-cli credential helper.
  • [TBD]home-complete:

    • Complete home-manager configuration of my config, though it may not always be up-to-date.
  • php83-nodejs:

    • A dev shell with php 8.3 with only required extension and nodejs, for laravel.
    • A php script to update PhpStorm Interpreter settings to use php in flake.
    nix flake init -t github:bearoffwork/nix-templates#php83-nodejs
    nix flake update
    cp .envrc.example .envrc
    direnv allow

Templates Usage: home-*

Step 1. Update nix.conf

Add yourself to trusted-users.

trusted-users = <$USER>

Enable some features, this is required for this template.

extra-experimental-features = nix-command flakes

Opinionated: follow XDG Base Directory to keep home directory clean.

use-xdg-base-directories = true

After all your nix config will looks like this:

build-users-group = nixbld
trusted-users = <your user name>
extra-experimental-features = nix-command flakes
use-xdg-base-directories = true

Step 2. Get the template

Generate home-manager flake at default location.

# For home-mini
nix flake new -t github:bearoffwork/nix-templates#home-mini ~/.config/home-manager

# [WIP] home-complete

Step 3. Update some required info of config.

Update user hostname and

cd ~/.config/home-manager

# Update template username.
nix run nixpkgs#gnused -- -i "s/{{ username }}/$USER/" flake.nix home.nix

# Update system type declaration.
nix run nixpkgs#gnused -- -i "s/\"{{ system }}\"/$(nix eval --impure --expr 'builtins.currentSystem')/" flake.nix

Step 4. Activate home-manager

If you generate the template at default location.

nix run home-manager switch

It's possible to override home-manager default config directory, for example:

nix flake new -t github:bearoffwork/nix-templates#home-mini ~/src/home
nix run home-manager --flake ~/src/home switch

After home manager activation, you can run following command once you update your config:

home-manager switch

Or this if you're using alternative home-manager config location.

home-manager --flake /path/to/your/config switch

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published