Skip to content

coolcmyk/d34th

Repository files navigation


My NixOS Configuration

Screenshot Screenshot

More Previews

Screenshot Screenshot Screenshot

Installation

Note

Before proceeding with the installation, review the following files to customise your setup:

  • hosts/Default/variables.nix: Contains host-specific variables.
  • hosts/Default/host-packages.nix: Lists installed packages for the host.
  • hosts/Default/default.nix: Defines imports for the host configuration.

You can install this configuration either on a running system or from the NixOS live installer. The minimal ISO is recommended and can be downloaded from the official NixOS website.

Installation Steps

  1. Clone the Repository:

    git clone https://github.com/Sly-Harvey/NixOS.git ~/NixOS
  2. Navigate to the Directory:

    cd ~/NixOS
  3. Run the Installation Script:

    ./install.sh

    The install.sh and rebuild scripts automates the setup process, including hosts, username, and applying the configuration. It also automatically generates the hardware-configuration.nix file based on your system's detected hardware, eliminating the need to manually generate hardware-configuration.nix.


Usage

Switching or Creating Hosts

To switch to an existing host or create a new one:

  1. Automatic: Run the installation script again to select or create another host:

    ./install.sh
  2. Manual:

    • Copy the hosts/Default directory to a new directory (e.g., hosts/NewHost).

    • Modify hosts/NewHost/variables.nix to suit your needs.

    • Update hosts/NewHost/host-packages.nix to include desired packages.

    • Add the new host to flake.nix in the nixosConfigurations section, for example:

      nixosConfigurations = {
        Default = mkHost "Default";
        NewHost = mkHost "NewHost";
      };
    • Rebuild the system using method 3 or 4 below (specifying the new host name). Once rebuilt, any of the rebuilding methods can be used, as the host name will be implicitly recognised.

Rebuilding the System

To apply changes or rebuild the system, use one of the following methods:

  1. Using a Keyboard Shortcut: Press Super + U to trigger a rebuild.

  2. Using the rebuild Script in a Terminal:

    rebuild
  3. Using nixos-rebuild:

    sudo nixos-rebuild switch --flake ~/NixOS#<HOST>
  4. Using nh Tool:

    nh os switch --hostname <HOST>

Replace <HOST> with the name of your host (e.g., Default).

Rollback to a Generation

  • List available generations in the terminal:

    list-gens
  • Rollback to a specific generation (replace N with the generation number):

    rollback N

Viewing Keybindings

To view configured keybindings:

  • Press Super + ? to display the keybinding overview.
  • Press Super + Ctrl + K same as above.

Development Shells

This configuration includes pre-configured development shells for various programming languages and frameworks, making it easy to start new projects or work in isolated environments.

Initialising a New Project

To create a new project from a template:

nix flake init -t ~/NixOS#<TEMPLATE_NAME>

To create a new project directory with a template:

nix flake new -t ~/NixOS#<TEMPLATE_NAME> <PROJECT_NAME>

Replace <TEMPLATE_NAME> with the name of a template defined in dev-shells/default.nix (e.g., python, node, etc.).

Entering a Development Shell

If direnv is configured, navigate to the project directory, and the shell will activate automatically. Otherwise, manually enter the shell:

cd <PROJECT_NAME>
nix develop

Credits/Inspiration

Credit Reason
Hyprland-Dots Script and Waybar templates
HyDE Some more useful scripts
rofi Rofi launcher templates
dev-templates Development templates
Vimjoyer Short, simple, concise guides and info
Star History Star History Chart

About

nix dotfiles

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors