1
Fork 0

Moar progress

This commit is contained in:
caem 2025-01-12 02:57:46 +01:00
parent 9c5f454a1c
commit 4830f943b4
Signed by: caem
GPG key ID: 69A830D03203405F
11 changed files with 219 additions and 16 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
secrets/
dotfiles/zsh/.zcompdump
dotfiles/nvim/lazy-lock.json
result

View file

@ -2,11 +2,12 @@
{
imports = [
./persist.nix
./disko.nix
./packages.nix
];
users.allowNoPasswordLogin = true; /* DEBUG */
time.timeZone = "Europe/Berlin";
networking = {
@ -19,6 +20,7 @@
efi.canTouchEfiVariables = true;
grub = {
enable = true;
device = "/dev/nvme0"; # [managed by install.sh] { grub device }
efiSupport = true;
gfxmodeEfi = "1920x1080";
};

View file

@ -1,5 +0,0 @@
{ ... }:
{
}

50
hosts/vm/default.nix Normal file
View file

@ -0,0 +1,50 @@
{ pkgs, lib, ... }:
{
imports = [
./disko.nix
./packages.nix
];
users.allowNoPasswordLogin = true; /* DEBUG */
time.timeZone = "Europe/Berlin";
networking = {
hostName = "vm";
useDHCP = lib.mkDefault true;
};
boot = {
loader = {
grub = {
enable = true;
device = "/dev/nvme0n1"; # [managed by install.sh] { grub device }
gfxmodeEfi = "1920x1080";
};
};
tmp.useTmpfs = true;
kernelPackages = pkgs.linuxPackages_xanmod_latest;
supportedFilesystems = [ "btfs" "vfat" "xfs" ];
initrd = {
availableKernelModules = [ "nvme" "xhci_pci" "ahci"
"usbhid" "usb_storage" "sd_mod" ];
};
};
services = {
fstrim.enable = true;
btrfs.autoScrub.enable = true;
};
fileSystems = {
# These are system specific. If you have any additional drives that are not
# your root device you can add and mount them here. Added nofail so that you can
# install this configuration on a device without it exploding when you don't have
# these specific partitions.
};
system.stateVersion = "24.11"; # [managed by install.sh] { state version }
}

64
hosts/vm/disko.nix Normal file
View file

@ -0,0 +1,64 @@
{ ... }:
{
disko.devices = {
disk = {
master = {
type = "disk";
device = ""; # [managed by install.sh] { device }
content = {
type = "gpt";
partitions = {
ESP = {
priority = 1;
name = "efi";
start = "1M";
end = "1024M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"umask=0077"
"noatime"
];
};
};
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" "-L nixos" ];
postCreateHook = ''
TMP_MNT=$(mktemp -d)
MNT_PART="" # [managed by install.sh] { root partition }
mount "$MNT_PART" "$TMP_MNT" -o subvol=/
trap 'umount "$TMP_MNT"; rm -rf "$TMP_MNT"' EXIT
btrfs subvolume snapshot "$TMP_MNT/root" "$TMP_MNT/blank"
'';
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = [
"noatime"
"compress=zstd"
];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [
"noatime"
"compress=zstd"
];
};
};
};
};
};
};
};
};
};
}

14
hosts/vm/packages.nix Normal file
View file

@ -0,0 +1,14 @@
{ ... }:
{
imports = let
modules = ../../modules/nixos;
in [
"${modules}/core"
"${modules}/hardware/audio"
"${modules}/hardware/gpu/graphics.nix"
"${modules}/multimedia"
"${modules}/desktop/gnome"
];
}

View file

@ -6,3 +6,75 @@
#
# This script aims to automate the deployment of my configuration
# on a new machine.
args_ensure_extra_arg() {
if [ -z "$2" ] || [ "$(echo "$2" | cut -c 1-1)" = "-" ]; then
>&2 echo "Argument '$1' requires an extra argument. Run --help for more info."
exit 1
fi
}
args_ensure_is_set() {
if [ -z "$2" ]; then
>&2 echo "Argument '$1' is required to be set. Please consult the README or run again with --help."
fi
}
args() {
while [ -n "$1" ]; do
case "$1" in
"-h" | "--help")
echo ""
echo "$0 - Installation script for my NixOS configuration"
echo ""
echo "arguments:"
echo " -h|--help Print this and exit"
echo " -d|--device [device] (required) The device you want to install NixOS on to"
echo " -o|--host [hostname] (required) The host from ./hosts you want to install"
echo ""
echo "origin: https://github.com/c4em/dotnix"
echo ""
exit 0
;;
"-d" | "--device")
args_ensure_extra_arg "$@"
if [ ! -b "$2" ]; then
>&2 echo "'$2' is not a valid block device. Make sure you selected the right drive"
exit 1
fi
DOTNIX_INSTALL_DEVICE="$2"
shift 2
;;
"-o" | "--host")
args_ensure_extra_arg "$@"
if [ ! -f "./hosts/$2" ]; then
>&2 echo "Invalid hostname '$2'. Make sure it exists in ./hosts"
exit 1
fi
DOTNIX_HOSTNAME="$2"
shift 2
;;
*)
>&2 echo "Unrecognized argument '$1'. Run with --help to view accepted arguments."
exit 1
;;
esac
done
args_ensure_is_set "--device" "$DOTNIX_INSTALL_DEVICE"
args_ensure_is_set "--host" "$DOTNIX_HOSTNAME"
}
main () {
args "$@"
}
set -e
main "$@"

View file

@ -30,6 +30,7 @@
};
home.persistence."/nix/persist/home/caem" = {
allowOther = true;
directories = [
"documents"
"download"

View file

@ -3,11 +3,7 @@
{
fonts = {
packages = with pkgs; [
(nerdfonts.override {
fonts = [
"GoMono"
];
})
nerdfonts
ipafont
noto-fonts-emoji
cantarell-fonts

View file

@ -0,0 +1,9 @@
{ ... }:
{
hardware = {
graphics = {
enable = true;
enable32Bit = true;
};
};
}

View file

@ -1,12 +1,11 @@
{ config, ... }:
{
hardware = {
graphics = {
enable = true;
enable32Bit = true;
};
imports = [
../graphics.nix
];
hardware = {
nvidia = {
open = true;
modesetting.enable = true;