2021-11-15 17:43:04 +01:00
|
|
|
# nixos
|
|
|
|
|
2021-11-29 10:55:16 +01:00
|
|
|
This repository contains my configuration for my Nixos systems.
|
|
|
|
I don't provide any garantuees that it will work on other systems.
|
|
|
|
In addition some of the scripts required for installation will destroy your data when used.
|
|
|
|
|
2024-01-08 10:19:48 +01:00
|
|
|
## Preparation
|
2022-09-06 19:43:47 +02:00
|
|
|
|
2024-01-08 10:19:48 +01:00
|
|
|
On a PC you don't have to do anything special.
|
2022-09-06 19:43:47 +02:00
|
|
|
|
2024-01-08 10:19:48 +01:00
|
|
|
For a Raspberry Pi you need to prepare the SD card first with a UEFI partition. On a PC navigate into this project and run the following commands:
|
2021-11-20 16:30:25 +01:00
|
|
|
|
2024-01-08 10:19:48 +01:00
|
|
|
- `nix-shell`
|
|
|
|
- `sudo create-uefi-partition.sh`
|
|
|
|
|
|
|
|
This will format the SD card at `/dev/mmcblk0`, create a partition and download and copy all the required files for running UEFI on a Pi 4.
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
1. Insert an USB stick with the latest NixOS ISO into your device.
|
2022-01-25 14:14:03 +01:00
|
|
|
1. `curl https://git.2li.ch/Nebucatnetzer/nixos/archive/master.tar.gz | tar xz`
|
2024-01-08 10:19:48 +01:00
|
|
|
1. `cd nixos && nix-shell setup-shell.nix`
|
|
|
|
1. For a normal PC run: `sudo ./scripts/format-disk.py` on a Raspberry Pi 4 run: `sudo ./scripts/format-sdcard.py`
|
|
|
|
1. `sudo nixos-install --no-root-passwd --root /mnt --impure --flake .#SYSTEMNAME`
|
|
|
|
|
|
|
|
When everything is finished you can reboot the system and remove the USB stick. You have now a fully encrypted NixOS system.
|
2021-11-29 10:55:16 +01:00
|
|
|
|
2022-01-17 11:23:55 +01:00
|
|
|
## Update remote systems
|
|
|
|
|
2023-07-22 14:33:00 +02:00
|
|
|
Simply run the script `scripts/remote_switch.sh` and it will iterate over
|
|
|
|
all defined systems. With the option `-r` the systems will reboot as well.
|
2022-01-17 11:23:55 +01:00
|
|
|
|
2021-11-29 10:55:16 +01:00
|
|
|
## Non-Nixos System
|
|
|
|
|
2022-01-25 18:19:00 +01:00
|
|
|
1. `scripts/install-home-manager.sh`
|
2023-05-27 17:51:15 +02:00
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
|
|
### Options template
|
|
|
|
|
|
|
|
```nix
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.programs.NAME;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
programs.NAME.enable = lib.mkEnableOption "DESCRIPTION";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
};
|
|
|
|
}
|
|
|
|
```
|