Compare commits
48 Commits
624861cab9
...
main
Author | SHA1 | Date | |
---|---|---|---|
88ea191493 | |||
905fe12714 | |||
1954beb8cc | |||
3353717da7 | |||
2559cba6ff | |||
bd3eca6f69 | |||
132f860713 | |||
82e18d878b | |||
702a23d79e | |||
015518753e | |||
e9416202dd | |||
3106cd4b62 | |||
7a4a74a673 | |||
729d5eaefe | |||
91d1c698cf | |||
a8147c6f05 | |||
9392afbb1e | |||
0bd101e1a2 | |||
8c6cfa275a | |||
fdb5a0afc4 | |||
df84387d13 | |||
151264c66f | |||
d4e0c6daf0 | |||
5c02580724 | |||
99732d8d23 | |||
3df2dd0922 | |||
ad3ab51ffe | |||
6fe4177dae | |||
033768feae | |||
6d43261a16 | |||
01a9588b81 | |||
930f93b68d | |||
679757e6f9 | |||
6aabc00703 | |||
74eaf03572 | |||
c35583ca3a | |||
681a0706f1 | |||
47a4441639 | |||
d3e792fb52 | |||
2e2ca7c41e | |||
4c3fdff8a2 | |||
6971d6d9f2 | |||
ad1b628bce | |||
4d4dff45ee | |||
e3acff7193 | |||
66d2fefc7a | |||
a378e909a1 | |||
759dabef33 |
29
.gitea/workflows/nixos.yml
Normal file
29
.gitea/workflows/nixos.yml
Normal file
@ -0,0 +1,29 @@
|
||||
name: NixOS Configuration Check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
nixos-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v22
|
||||
|
||||
- name: Show Nix version
|
||||
run: nix --version
|
||||
|
||||
- name: Run nix flake check
|
||||
run: nix flake check
|
||||
|
||||
- name: Attempt to build configuration (optional)
|
||||
run: |
|
||||
nix build .#nixosConfigurations.desktop.config.system.build.toplevel
|
||||
nix build .#nixosConfigurations.laptop.config.system.build.toplevel
|
||||
nix build .#nixosConfigurations.vm.config.system.build.toplevel
|
@ -17,7 +17,7 @@
|
||||
modules = [
|
||||
./hosts/laptop.nix
|
||||
./modules/common.nix
|
||||
./modules/hyprland.nix
|
||||
./modules/applications.nix
|
||||
./modules/networking.nix
|
||||
./modules/user.nix
|
||||
];
|
||||
@ -27,7 +27,7 @@
|
||||
modules = [
|
||||
./hosts/desktop.nix
|
||||
./modules/common.nix
|
||||
./modules/hyprland.nix
|
||||
./modules/applications.nix
|
||||
./modules/networking.nix
|
||||
./modules/user.nix
|
||||
];
|
||||
@ -37,7 +37,7 @@
|
||||
modules = [
|
||||
./hosts/vm.nix
|
||||
./modules/common.nix
|
||||
./modules/hyprland.nix
|
||||
./modules/applications.nix
|
||||
./modules/networking.nix
|
||||
./modules/user.nix
|
||||
];
|
||||
|
@ -12,17 +12,10 @@
|
||||
nvidiaSettings = true;
|
||||
};
|
||||
|
||||
boot.initrd.luks.devices = {
|
||||
root = {
|
||||
device = "/dev/sda2";
|
||||
preLVM = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Dual display configuration
|
||||
services.xserver = {
|
||||
screenSection = ''
|
||||
Option "metamodes" "HDMI-0: 1920x1080 +0+0, DP-0: 1920x1080 +1920+0"
|
||||
Option "metamodes" "HDMI-0: 1920x1080 +0+1080, DP-0: 1920x1080 +1920+1080, DP-1: 2560x1440 +3840+0"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
@ -6,19 +6,11 @@
|
||||
# Intel VA-API for GPU acceleration
|
||||
hardware.opengl = {
|
||||
enable = true;
|
||||
driSupport = true;
|
||||
extraPackages = with pkgs; [
|
||||
intel-media-driver
|
||||
libva-utils
|
||||
];
|
||||
};
|
||||
|
||||
boot.initrd.luks.devices = {
|
||||
root = {
|
||||
device = "/dev/sda2";
|
||||
preLVM = true;
|
||||
};
|
||||
};
|
||||
|
||||
services.xserver.videoDrivers = [ "intel" ];
|
||||
}
|
||||
|
@ -6,14 +6,6 @@
|
||||
# Use DHCP for networking
|
||||
networking.useDHCP = true;
|
||||
|
||||
# Disk encryption setup
|
||||
boot.initrd.luks.devices = {
|
||||
root = {
|
||||
device = "/dev/sda2";
|
||||
preLVM = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Hyprland setup without GPU acceleration
|
||||
services.xserver.enable = true;
|
||||
services.xserver.videoDrivers = [ ];
|
||||
|
63
install.sh
63
install.sh
@ -1,32 +1,53 @@
|
||||
# Assuming /dev/sda is the target disk
|
||||
parted /dev/sda -- mklabel gpt
|
||||
#!/usr/bin/env bash
|
||||
|
||||
parted /dev/sda -- mkpart ESP fat32 1MiB 513MiB
|
||||
parted /dev/sda -- set 1 boot on
|
||||
set -euo pipefail
|
||||
|
||||
parted /dev/sda -- mkpart primary ext4 513MiB 100%
|
||||
# Replace with your actual repo
|
||||
REPO_URL="https://git.luke-else.co.uk/luke-else/nixos-config.git"
|
||||
HOSTNAME="vm" # Change to desktop/laptop/vm if needed
|
||||
TARGET_DISK="/dev/sda"
|
||||
MOUNT_POINT="/mnt"
|
||||
|
||||
mkfs.fat -F32 -n BOOT /dev/sda1
|
||||
mkfs.ext4 /dev/sda2
|
||||
# Confirm before wiping the disk
|
||||
echo "WARNING: This will erase ALL data on ${TARGET_DISK}!"
|
||||
read -p "Type YES to continue: " confirm
|
||||
[[ "$confirm" == "YES" ]] || { echo "Aborting."; exit 1; }
|
||||
|
||||
mount /dev/sda2 /mnt
|
||||
cryptsetup luksFormat /dev/sda2
|
||||
cryptsetup open /dev/sda2 root
|
||||
mkfs.ext4 /dev/mapper/root
|
||||
mount /dev/mapper/root /mnt
|
||||
# 1. Wipe the disk and create new GPT partition table
|
||||
wipefs -a "$TARGET_DISK"
|
||||
parted -s "$TARGET_DISK" mklabel gpt
|
||||
|
||||
mkdir -p /mnt/boot
|
||||
mount /dev/sda1 /mnt/boot
|
||||
# 2. Create partitions
|
||||
# - EFI (512M)
|
||||
# - Root (rest of the disk)
|
||||
parted -s "$TARGET_DISK" mkpart primary fat32 1MiB 513MiB
|
||||
parted -s "$TARGET_DISK" set 1 esp on
|
||||
parted -s "$TARGET_DISK" mkpart primary ext4 513MiB 100%
|
||||
|
||||
mkdir -p /mnt/etc/nixos
|
||||
git clone https://git.luke-else.co.uk/luke-else/nixos-config.git /mnt/etc/nixos
|
||||
EFI_PART="${TARGET_DISK}1"
|
||||
CRYPT_PART="${TARGET_DISK}2"
|
||||
|
||||
nixos-generate-config --root /mnt
|
||||
# 3. Format the EFI partition
|
||||
mkfs.fat -F32 -n EFI "$EFI_PART"
|
||||
|
||||
nixos-install --flake /mnt/etc/nixos#vm
|
||||
# 4. Set up LUKS encryption for root
|
||||
echo "Setting up LUKS encryption on ${CRYPT_PART}"
|
||||
cryptsetup luksFormat "$CRYPT_PART"
|
||||
cryptsetup open "$CRYPT_PART" cryptroot
|
||||
|
||||
passwd
|
||||
# 5. Format root and mount
|
||||
mkfs.ext4 -L cryptroot /dev/mapper/cryptroot
|
||||
mount /dev/mapper/cryptroot "$MOUNT_POINT"
|
||||
|
||||
reboot
|
||||
# 6. Create and mount boot directory
|
||||
mkdir -p "$MOUNT_POINT/boot"
|
||||
mount "$EFI_PART" "$MOUNT_POINT/boot"
|
||||
|
||||
# sudo nixos-rebuild switch --flake ~/nixos-config#vm
|
||||
# 7. Clone your NixOS config
|
||||
mkdir -p "$MOUNT_POINT/etc/nixos"
|
||||
git clone "$REPO_URL" "$MOUNT_POINT/etc/nixos"
|
||||
|
||||
# 8. Install NixOS
|
||||
nixos-install --flake "$MOUNT_POINT/etc/nixos#${HOSTNAME}" --no-root-passwd
|
||||
|
||||
echo "✅ NixOS installation complete! You may now reboot."
|
@ -1,11 +1,15 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
xwayland.enable = true;
|
||||
programs = {
|
||||
zsh.enable = true;
|
||||
ssh.startAgent = true;
|
||||
hyprland = {
|
||||
enable = true;
|
||||
xwayland.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
services.displayManager = {
|
||||
enable = true;
|
||||
defaultSession = "hyprland";
|
||||
@ -21,5 +25,11 @@
|
||||
discordo
|
||||
spotify-player
|
||||
bitwarden
|
||||
freshfetch # Fetch utility
|
||||
git
|
||||
cryptsetup
|
||||
parted
|
||||
vim
|
||||
htop
|
||||
];
|
||||
}
|
@ -1,30 +1,39 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Bootloader
|
||||
boot.loader.grub = {
|
||||
enable = true;
|
||||
device = "nodev";
|
||||
efiSupport = true;
|
||||
# Bootloader: systemd-boot with EFI support
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# Use systemd-boot instead of GRUB
|
||||
boot.loader = {
|
||||
systemd-boot.enable = true;
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
|
||||
boot.initrd = {
|
||||
supportedFilesystems = [ "ext4" ];
|
||||
luks.devices."cryptroot".device = "/dev/disk/by-partlabel/cryptroot";
|
||||
};
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/mapper/root";
|
||||
device = "/dev/mapper/cryptroot";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [{ device = "/swapfile"; size = 4096; }];
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-partlabel/ESP";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
# Locales and timezone
|
||||
swapDevices = [{
|
||||
device = "/swapfile";
|
||||
size = 4096;
|
||||
}];
|
||||
|
||||
# Locale and timezone
|
||||
time.timeZone = "Europe/London";
|
||||
i18n.defaultLocale = "en_GB.UTF-8";
|
||||
|
||||
# UFW Firewall
|
||||
networking.firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [ 22 ]; # Allow SSH
|
||||
};
|
||||
|
||||
# Enable SSH
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
@ -33,4 +42,16 @@
|
||||
PasswordAuthentication = false;
|
||||
};
|
||||
};
|
||||
|
||||
# Enable Docker
|
||||
virtualisation.docker.enable = true;
|
||||
|
||||
# PipeWire for audio
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
pulse.enable = true;
|
||||
};
|
||||
|
||||
# Bluetooth
|
||||
services.blueman.enable = true;
|
||||
}
|
||||
|
@ -10,6 +10,10 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [ 22 ]; # Allow SSH
|
||||
};
|
||||
useDHCP = true;
|
||||
};
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
users.users."luke-else" = {
|
||||
isNormalUser = true;
|
||||
home = "/home/luke-else";
|
||||
shell = pkgs.bash;
|
||||
shell = pkgs.zsh;
|
||||
extraGroups = [ "wheel" "networkmanager" "docker" ];
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user