Skip to content

My operating system and development environment using NixOS, Nix, and Home Manager

License

Notifications You must be signed in to change notification settings

zenoix/walnut-environment

Repository files navigation


Walnut Environment

Screenshots

As at 04/10/2024

Desktop1

Desktop2

Rofi

Hyprlock

Environment

Type Program
Browser Firefox
Cursor Catppuccin Cursor
Display Manager Sddm
Editor Neovim
Fetch Fastfetch
File Manager Thunar
Launcher Rofi
Lockscreen Hypridle + Hyprlock
Media Player Not yet configured
Notification Daemon Dunst
Screenshot Software Grim + Slurp + Swappy
Shell Zsh
Status Bar Waybar
Terminal Ghostty
Terminal Font Monaspace Neon
Theme Catppuccin Mocha
Window Manager Hyprland

Layout

walnut-environment
├── assets                  # Assets used in configurations
├── homeManagerModules      # Home manager modules
│   ├── ...
│   └── README.md           # Readme explaining home manager modules layout
├── hosts                   # Different hosts and their configurations
│   └── walnut-nixos
├── modules                 # System modules
│   ├── ...
│   └── README.md           # Readme explaining modules layout
├── nonNix                  # Non-Nix files and configurations
│   └── ...
├── overlays                # Overlays
├── flake.nix               # Flake (main entry point)
└── flake.lock              # Flake lock file

Setup

First clone and place the directory in the right place

git clone https://github.com/zenoix/walnut-environment
mv walnut-environment $HOME # Config should be placed in ~/
cd $HOME/walnut-environment

You'll want to then edit flake.nix's personal attribute set to your own information so that it has your username, hostname, timezone, local, city, and git information. For example:

let
  system = "x86_64-linux";

  personal = {
    user = "bob";
    host = "mycomputer";
    timeZone = "America/New_York";
    defaultLocale = "en_US.UTF-8";
    city = "New York";

    # Used for gitconfig
    gitUser = "gituser1234";
    gitEmail = "gituser1234@gmail.com";
  };

  ...
in
{
  ...

The remaining steps depend on if you are using NixOS, home-manager, or both. At the end of the setup section, there are instructions for creating and adding more hosts.

NixOS Setup

If you're using NixOS, you'll want to replace the hardware configuration file in the hosts/walnut-nixos directory:

rm hosts/walnut-nixos/hardware-configuration.nix
cp /etc/nixos/hardware-configuration.nix hosts/wanut-nixos/hardware-configuration.nix

Lastly, to rebuild the system, use

sudo nixos-rebuild switch --flake ~/walnut-environment

and/or for home manager

home-manager switch --flake ~/walnut-environment

Tip

You may need to add the following to your current NixOS configuration (/etc/nixos/configuration.nix) if you haven't enabled flakes before:

nix.settings.experimental-features = [
 "nix-command"
 "flakes"
];
and rebuild your system to enable flakes.

These two switch commands are aliased in my home manager configuration to rb and hms respectively which makes future rebuilding easier.

Home Manager Setup

First, start with installing Nix (the package manager) by following the instructions on the NixOS website.

Tip

In my experience, Nix and home manager only work when multi-user installation is used.

Then after installing Nix, you can create a temporary shell with home manager installed:

nix-shell -p home-manager

Important

Do not close or restart your terminal as home manager will not be permanently installed yet at this point.

Lastly, run the following command to get everything set up (including permanently having home manager installed):

home-manager --extra-experimental-features "nix-command flakes" switch --flake ~/walnut-environment

This command is aliased in my home manager configuration to hms which makes future rebuilding easier.

Nix Darwin

TODO

Setting Up New Hosts

TODO

Secrets

This configuration uses sops-nix for secrets management. The two files of relevance are .sops.yaml and secrets.yaml. To allow a new host to decrypt secrets, you can add your standalone dev access key to ~/.config/sops/age/keys.txt in the following format:

# public key: age17r0pvv7rl7u4psfcm6p23l99ldh2sqmyq0jg63hnqj8htxhv05fqa4jvsj
AGE-SECRET-KEY-...

For NixOS configuration, you need to set walnut.sops.enable = true and then add the following snipppet with the secrets you want to use:

  sops = {
    secrets = {
      example-secret = { };
    };
  };

For home manager, you need to import inputs.sops-nix.homeManagerModules.sops and then add the following snippet with the secrets you want to use:

  sops = {
    # This is the walnut/dev key and needs to have been copied to this location on the host
    age.keyFile = "/home/${personal.user}/.config/sops/age/keys.txt";

    defaultSopsFile = ../../secrets.yaml;
    validateSopsFiles = false;

    secrets = {
      example-secret = { };
    };
  };

You then need to run nix-shell -p sops --run "sops updatekeys secrets.yaml".

To edit the secrets, you can run nix-shell -p sops --run "sops secrets.yaml".

More information on sops-nix can be found by following EmergentMind's amazing sops-nix tutorials.

Netskope Issue

I've had issues with Netskope interfering with Nix where it causes SSL errors. If you also get that problem, try the solution in this GitHub issue comment.

Configuration

TODO

Credits:

Wallpapers are from reddit:

Firefox CSS was modified from mimipile's firefoxCSS repo

README header was modified from Frost Pheonix's catppuccin config

Rofi was modified from Sukhmancs' nixos config

Fastfetch was modified from LierB's fastfetch presets

Some waybar components were taken from Spelljinxer's dotfiles

About

My operating system and development environment using NixOS, Nix, and Home Manager

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published