Giter Club home page Giter Club logo

nixos-configuration's Introduction

NixOS configurations

My personal NixOS configurations. Clone the repository:

git clone https://[email protected]/jluttine/nixos-configuration /etc/nixos
cd /etc/nixos

Decrypt some encrypted configuration:

yadm -Y /etc/nixos/.yadm decrypt

If your hostname isn't included in the configuration file alternatives, symlinks aren't created properly. See Yadm manuals for more information.

Installing NixOS

Boot to NixOS installer.

Setting up internet connection

The installer needs internet connection. If you need to set up WLAN:

nmcli dev wifi connect <name> password <password>

Test internet connection:

ping google.com

Creating fully encrypted file system

DISK=/dev/sda
sgdisk --zap-all $DISK
fdisk $DISK

Create GPT partition table. If using BIOS (with GPT), create 1M partition of type BIOS boot (e.g., partition id 4). Then, create partitions for boot (e.g., partition id 1 assumed below and 1GB) and (encrypted) root (partition id 2 assumed below). The BIOS boot partition won't be given any filesystem, it is just for grub.

After fdisk, prepare an encrypted root file system:

cryptsetup -y -v luksFormat "$DISK"2
cryptsetup open "$DISK"2 cryptroot
mkfs.ext4 -L nixos-root /dev/mapper/cryptroot
mount -t ext4 /dev/mapper/cryptroot /mnt

Optionally, test that the encrypted file system works:

umount /mnt
cryptsetup close cryptroot
cryptsetup open "$DISK"2 cryptroot
mount -t ext4 /dev/mapper/cryptroot /mnt

Prepare boot partition:

mkfs.ext4 -L nixos-boot "$DISK"1
mkdir /mnt/boot
mount -t ext4 "$DISK"1 /mnt/boot

Fetching configuration

Create folder under which configuration will be fetched:

mkdir -p /mnt/etc

Set the hostname so yadm will use correct host specific configurations.

hostname <name>

Get the configuration from GitHub using yadm:

nix-shell -p yadm -p git -p gnupg1orig
yadm clone https://github.com/jluttine/nixos-configuration.git -w /mnt/etc/nixos -Y /mnt/etc/nixos/.yadm
yadm -Y /mnt/etc/nixos/.yadm decrypt
yadm -Y /mnt/etc/nixos/.yadm alt
exit

This funny thing is done because nixos-install changes root and yadm has created symlinks with /mnt at the beginning:

ln -s .. /mnt/mnt

Note: After you have booted to the newly installed NixOS system, run to fix the symlinks and to remove the hack symlink:

yadm -Y /mnt/etc/nixos/.yadm alt
rm /mnt

Generate hardware configuration automatically:

nixos-generate-config --root /mnt

Installing

Install the system:

nixos-install

Reboot to the new system:

reboot

nixos-configuration's People

Contributors

jluttine avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.