Giter Site home page Giter Site logo

samthepacman / idempotentdots Goto Github PK

View Code? Open in Web Editor NEW
48.0 1.0 2.0 150.26 MB

Configuration for setting up NixOS on tmpfs, my way

License: MIT License

Nix 12.59% Scheme 1.13% Shell 25.36% Emacs Lisp 1.29% Haskell 13.52% Lua 11.41% Perl 6.55% PHP 6.45% Python 6.64% Ruby 5.74% CSS 9.15% Vim Script 0.16%
nixos dotfiles eww widgets swaywm declarative waybar home-manager flakes

idempotentdots's Introduction

BIJUTSU

λ Idempotent Dotfiles

SETTING UP NIXOS , MY WAY


NixOS with tmpfs (Sway WM)

Disclaimer: This is not a community framework or distribution. It's a private configuration and an ongoing experiment while I feel out NixOS. I make no guarantees that it will work out of the box for anyone but myself. It may also change drastically and without warning.



System Default Apps

Shell: Zsh + Starship
DM: GreetD (tuigreet)
WM: Sway + Waybar
Editor: Neovim
Terminal: Alacritty / Kitty / Foot
Launcher: Wofi
Browser: Firefox
GTK Theme: Nordic

NVIM CONFIG


Lets Begin

Flashing the Iso

    • Acquire NixOS 22.11 or newer here
    • Write it to a flash drive dd if=<ur-iso>.iso of=/dev/sdXXX bs=4k status=progress
    • Boot into the installer.
    • Setting up tmpfs

  • for legacy
# Defining a helper variable to make the following commands shorter.
DISK=/dev/disk/by-id/ata-VENDOR-ID-OF-THE-DRIVE

# Create partition table
parted $DISK -- mklabel msdos

# Create a /boot as $DISK-part1
parted $DISK -- mkpart primary ext4 1M 512M
parted $DISK -- set 1 boot on

# Create a /nix as $DISK-part2
parted $DISK -- mkpart primary ext4 512MiB 100%
  • for efi
# Defining a helper variable to make the following commands shorter.
DISK=/dev/disk/by-id/ata-VENDOR-ID-OF-THE-DRIVE

# Create partition table
parted $DISK -- mklabel gpt

# Create a /boot as $DISK-part1
parted $DISK -- mkpart ESP fat32 1MiB 512MiB
parted $DISK -- set 1 boot on

# Create a /nix as $DISK-part2
parted $DISK -- mkpart Nix 512MiB 100%

Step 2 - Creating the file systems

# /boot partition for legacy boot
mkfs.ext4 $DISK-part1

# /boot partition for EFI
mkfs.vfat $DISK-part1

# /nix partition
mkfs.ext4 $DISK-part2

Step 3 - Mounting the file systems

# Mount your root file system
mount -t tmpfs none /mnt

# Create directories
mkdir -p /mnt/{boot,nix,etc/nixos,var/log,etc/NetworkManager}

# Mount /boot and /nix
mount $DISK-part1 /mnt/boot
mount $DISK-part2 /mnt/nix

# Create a directory for persistent directories
mkdir -p /mnt/nix/persist/{etc/nixos,var/log,etc/NetworkManager}

# Bind mount the persistent configuration / logs
mount -o bind /mnt/nix/persist/etc/nixos /mnt/etc/nixos
mount -o bind /mnt/nix/persist/var/log /mnt/var/log
mount -o bind /mnt/nix/persist/etc/NetworkManager /mnt/etc/Networkmanager


  1. Now go ahead and do a nixos-generate-config --root /mnt to get a basic configuration for your system.

    • # git clone https://github.com/sam1431/idempotentdots /mnt/etc/nixos/repo
    • # mv /mnt/etc/nixos/repo/root/* /mnt/etc/nixos/
  2. Cofigure your host under /mnt/etc/nixos/hosts with config you obtained from step 4 ( for a tmpfs layout check this out ). Also require the host file from config.nix

  3. make flakes available to nixos - nix-shell -p git nixFlakes ranger neovim

NOTE

  • the machine won't remember your password after reboot if you use 'passwd'
  • rather
     users.mutableUsers = false;
     # $ nix-shell --run 'mkpasswd -m SHA-512 -s' -p mkpasswd
     users.users.root.initialHashedPassword = "the has you got from the above command"

also shown here

  1. Install nixOS

    # nixos-install --no-root-passwd --flake /mnt/etc/nixos --impure
  • Then reboot

Management

/bin/znx, Inspired by hlissner's /bin/hey ( but written in bash, way more messy and less functionality )

Usage: znx [flags]

   # SYSTEM MANAGEMENT
   rebase / switch - rebuild NixOS
   upgrade - upgrade NixOS
   conf-edit / conf-ed - list all System Config

   # FLAKE MANAGEMENT
   flake-edit / flk-ed - edit Flake config    
   flake-lock / flk-lc - recreate system flake lock [ not available ]
   flake-update / flk-up - update root flake

   # MANUAL GARBAGE COLLECTIONS
   garbage-collect / gc - clean nix store home
   garbage-collect -d / gcd - clean nix store root
   

NOW TO THE DESKTOP PART

PS neovim config doesn't work properly but will be fixed soon


  • Why tmpfs? because I have something similar to a OCD for perfection and I want my system to be as clean as possible

I use tmpfs for /home as mentioned here by creating /home/sam under /nix/persist and giving the user read-write permission to that directory

Some Helpful links

idempotentdots's People

Contributors

samthepacman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

idempotentdots's Issues

All Your ReadMe's Images Are Broken

Not sure if you are working on them or not, but given the styling of them I am assuming its unintentional.

Well if you didn't know, now you know.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.