Icy-Thought / snowflake

A repository which contains my current Nix (flake-based) setup!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Snowflake

Stars Issues Size

Table of Contents

Desktop Preview

XMonad

XMonad

Emacs

Emacs

Neovim

Neovim

Introduction

A hamerspace containing a declarative NixOS environment consisting of many hand-crafted configurations, ranging from: Kitty, Alacritty, Doom-Emacs, Zathura to many other applications which can be found in the ./home directory.

Warning

This repository, similar to other dotfile/configuration repositories, is subjected to change. The reader ought to read through the commit history before blindly cloning, fetching or updating the necessary files required to power up their NixOS environment!

In this README I will attempt to explain how to replicate my NixOS setup or achieve similar feats. If you find this guide not as useful as it was designed to be, do submit an issue requesting a change for the specific sections you found to be confusing. Or submit a push request (PR) to this repository and hopefully we can produce better results together!

Throughout my Nix journey, I've came across two interesting projects and among those projects are Nix-Flakes and Home-Manager. (Both projects will be introduced later in this README.) These projects have been setup in such manner that allows its users to carefully tune their system environments to their liking!

Note

This project is still in its early stages! Henceforth one should familiarize themselves with the Risks that comes with the usage of such experimental features.

Getting Started

NixOS Installer

As of 22.05 the NixOS ISO comes equipped with a well-developed installer that reduces the "complexity" of installing NixOS on your device! Therefore manual intervention should not be required for a minimal installation.

Prepare System Environment for Nix-Flake

Don't forget to append the following lines of code to your /etc/nixos/configuration.nix:

nix.package = pkgs.nixUnstable;
nix.extraOptions = ''
  experimental-features = nix-command flakes
'';

Nix-Flake: Beginning of a Journey

1. Cloning Snowflake

git clone --depth 1 https://github.com/Icy-Thought/Snowflake.git

2. Creating hosts/deviceX Directory

cd snowflake && cp -r templates/hosts/desktop hosts/deviceX

where deviceX is the name you'd like to give to your host device. This name will later be used when installing/updating your new NixOS setup.

3. Replace hardware.nix with hardware-configuration.nix

Suggestion: before replacing hardware.nix with your hardware-configuration.nix:

  1. view the file and see what you'd like to retain
  2. rename the file (backup)
  3. add your Nix generated hardware configuration .nix file
  4. paste your desired configurations in your new file

OTHERWISE, proceed by executing the command below.

cp /etc/nixos/hardware-configuration.nix deviceX/hardware.nix

4. Replacing Necessary Configuration Entries

1. Snowflake Directory

Warning

As of now, my snowflake directory is expected to be placed inside ~/Workspace/public/snowflake/. And for your configuration to work properly you are expected to place the directory in that exact location!

Modify snowflake.dir to point to the location where you are keeping the snowflake repository:

dir = mkOpt path (findFirst pathExists (toString ../.) [
"${config.user.home}/git/icy-thought/snowflake"
"/etc/snowflake"
]);

2. Remove Redundant CPU Setting

For the sake of making things quicker (not the wisest choice), I have added both Intel and AMD CPU settings in the hardware.nix template. Therefore you ought to remove the one not being used.

There might be other configurations that you need to add to your hardware.nix file, therefore it is the wisest choice to always look (grep hardware.) in the NixOS Manual.

hardware.cpu.amd.updateMicrocode = true;
hardware.cpu.intel.updateMicrocode = true;

3. Hide Your File-system From Nautilus & Dolphin

Note

By default, Nautilus & Dolphin does not hide system partitions from mounted devices category.

I have chosen to hide those partitions from the mounted devices category of the mentioned file managers. I have also added several kernel parameters and other device-specific configurations for my setup in this repository. (check hosts/deviceX)

What you are required to edit is:

  1. fileSystems entries in default.nix.
  2. The specific parts which you wish to exclude from your setup, such as: kernel parameters, modules to disable, packages to be installed among other configurations.

(Example): hiding /boot from Nautilus mounted devices.

fileSystems."/boot" = {
  device = "/dev/disk/by-label/BOOT";
  fsType = "vfat";
  options = [ "x-gvfs-hide" ]; # For hiding boot partition entry in Nautilus.
};

Warning

Make sure to replace /dev/disk/by-uuid/xyz (or partuuid) with /dev/disk/by-label/X, where X follows the label you have chosen to name your partitions with during your partition setup.

5. Installing Nix-Flake System

Note

Before rebuilding our NixOS system with our new device configurations, we ought to make our flake.nix aware of our new device directory (deviceX). Otherwise you'll run into #25!

git add ./hosts/deviceX/*

After completing your setup, there remains one command to be executed (device = directory name of your device placed inside hosts, which in this case is deviceX:

nixos-rebuild switch --use-remote-sudo --flake .#deviceX --impure";
reboot

Congratulations! ๐ŸŽ‰

You have successful installed your/my personally hand-crafted/replicated Nix-Flake environment. I hope it suits your needs, if not then you are always welcome to propose changes or fork the project and customize the repository to your heart's content!

Useful Links

  • NixOS Manual: A manual for the newcomer to read and understand different parts of the NixOS distribution.
  • Home-Manager: Helps you manage your ~/home related configurations.
  • Nix Pills: A series written to familiarize the user with the Nix programming language.
  • Nixpkgs Unstable: A manual which introduces the Nix-language to people unfamiliar with the wonders of this language.
  • Nix Flake MVP: A written Nix guide by edolstra.
  • A Tour of Nix: a beautifully crafted introduction into the Nix programming language.

Special Thanks

About

A repository which contains my current Nix (flake-based) setup!

License:GNU Affero General Public License v3.0


Languages

Language:Nix 71.4%Language:Haskell 10.2%Language:Python 8.2%Language:CSS 5.6%Language:Lua 2.9%Language:SCSS 0.8%Language:Common Lisp 0.8%Language:NewLisp 0.1%