2026-04-06T15:08:52+00:00

This commit is contained in:
2026-04-06 15:08:52 +00:00
parent 8cbfcef591
commit 0b9a3d17f3
+14 -101
View File
@@ -1,140 +1,53 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, modulesPath, ... }:
{
# Import NixOS QEMU guest profile for optimal virtio support
imports = [
"${modulesPath}/profiles/qemu-guest.nix"
];
# boot.loader.grub.device = "/dev/vda";
# fileSystems."/" = {
# device = "/dev/vda1";
# fsType = "ext4";
# };
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";
fileSystems."/" = {
device = "/dev/vda1";
fsType = "ext4";
};
boot.kernelParams = [
"console=ttyS0,115200"
"console=tty1"
];
# QEMU guest agent for VM management (memory stats, filesystem freeze, etc.)
services.qemuGuest.enable = true;
systemd.services."serial-getty@ttyS0" = {
enable = true;
wantedBy = [ "getty.target" ]; # to start at boot
serviceConfig.Restart = "always"; # restart when session is closed
};
# network and proxy
networking.hostName = "minimal";
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Stockholm";
# Select internationalisation properties.
i18n.defaultLocale = "sv_SE.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "sv-latin1";
};
# Define a user account. Don't forget to set a password with passwd.
security.sudo.wheelNeedsPassword = false;
programs.zsh.enable = true;
users.mutableUsers = true;
users.users.kalle = {
isNormalUser = true;
initialHashedPassword = "$6$92TJx1rnVZ8ZBWGk$.0CUy9wLNbfNdmkwhnQCOomFiy.oJA2bSzLOixoQS3UyV/BITD55IhEVfr05VUVJtjcUoVIE1We99qEAWAbkE/";
shell = pkgs.zsh;
extraGroups = [ "wheel" "docker" "networkmanager" "video" "audio" ]; # Enable sudo for the user.
packages = with pkgs; [
# common sense
zsh
tmux
fzf
bat
fd
];
extraGroups = [ "wheel" "docker" "networkmanager" "video" "audio" ];
packages = with pkgs; [ zsh tmux fzf bat fd ];
};
# system packages
environment.systemPackages = with pkgs; [
# basic stuff
vim
btrfs-progs
cloud-utils
# net
wireguard-tools
inetutils
wget
mosh
rsync
git
vim btrfs-progs cloud-utils
wireguard-tools inetutils wget mosh rsync git
];
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Auto-grow root filesystem on boot (for live disk resize support)
# Works with VIRTIO-SCSI (/dev/sda) - detects partition layout automatically
systemd.services.auto-grow-root = {
description = "Auto-grow root filesystem";
wantedBy = [ "multi-user.target" ];
after = [ "local-fs.target" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
path = with pkgs; [ cloud-utils parted e2fsprogs btrfs-progs util-linux ];
script = ''
set -euo pipefail
ROOT_DEV=$(findmnt -n -o SOURCE /)
ROOT_DISK=$(lsblk -no PKNAME "$ROOT_DEV" | head -1)
# If partitioned, grow partition first
if [[ "$ROOT_DEV" =~ [0-9]$ ]]; then
PART_NUM=$(echo "$ROOT_DEV" | grep -oE '[0-9]+$')
growpart "/dev/$ROOT_DISK" "$PART_NUM" 2>/dev/null || true
fi
# Grow filesystem
FSTYPE=$(findmnt -n -o FSTYPE /)
case "$FSTYPE" in
ext4) resize2fs "$ROOT_DEV" 2>/dev/null || true ;;
btrfs) btrfs filesystem resize max / 2>/dev/null || true ;;
esac
'';
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "25.05"; # Did you read the comment?
system.stateVersion = "25.05";
}