refactor: change structure and start using home-manager

This commit is contained in:
2025-11-17 21:09:08 +01:00
parent 2f23076dea
commit 474beb569d
8 changed files with 157 additions and 87 deletions

BIN
hosts/default/.home.nix.swp Normal file

Binary file not shown.

View File

@@ -0,0 +1,142 @@
# 0x29a nixos conifg
{ pkgs, lib, inputs, ... }:
{
imports =
[
./hardware-configuration.nix
inputs.home-manager.nixosModules.default
];
# use flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# configure bootloader
boot.loader.systemd-boot.enable = false;
boot.loader.grub = {
enable = true;
device = "nodev";
efiSupport = true;
};
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelParams = [
"quiet"
"console.ttyS0,115200n8" # allow terminals on serial console
];
# plymouth boot eye candy
boot.initrd.systemd.enable = true;
boot.plymouth.enable = true;
boot.plymouth.theme = "spinner";
# use latest kernel
boot.kernelPackages = pkgs.linuxPackages_latest;
# guest agent for proxmox
services.qemuGuest.enable = true;
# networking
networking.hostName = "nixos";
networking.networkmanager.enable = true;
# time zone.
time.timeZone = "Europe/Amsterdam";
# select internationalisation properties
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
console = {
font = "Lat2-Terminus16";
keyMap = "de_CH-latin1";
};
# xserver config
services.xserver = {
enable = true;
xkb.layout = "ch";
xkb.options = "eurosign:e,caps:escape";
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
dmenu
i3status
];
};
};
# window manager configs
services.displayManager.defaultSession = "none+i3";
programs.i3lock.enable = true;
environment.pathsToLink = [ "/libexec" ];
environment.variables.EDITOR = "vim";
# enable sound
services.pipewire = {
enable = true;
pulse.enable = true;
};
# define a user account
users.users.aaron = {
isNormalUser = true;
group = "users";
extraGroups = [ "wheel" ];
shell = pkgs.zsh;
packages = with pkgs; [
tree
fastfetch
];
};
# browser
programs.firefox.enable = true;
# zsh config
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestions.enable = true;
ohMyZsh = {
enable = true;
plugins = [ "git" "sudo" "python" "ansible" ];
theme = "agnoster";
};
};
# system packages
environment.systemPackages = with pkgs; [
vim
neovim
git
ghostty
kitty
wget
gnupg
];
# Some programs need SUID wrappers
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# enable the OpenSSH daemon
services.openssh.enable = true;
# firewall configs
networking.firewall.allowedTCPPorts = [ 22 ];
# networking.firewall.allowedUDPPorts = [ ... ];
# install state version
system.stateVersion = "25.05"; # Don't change
}

View File

@@ -0,0 +1,40 @@
# 0x29a nixos hardware configuration
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
# boot and initrd configs
boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ahci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ "dm-snapshot" "cryptd" ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-label/nixcrypt";
# file systems
fileSystems."/" =
{ device = "/dev/disk/by-label/nixroot";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-label/nixboot";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-label/nixhome";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/disk/by-label/nixswap"; }
];
# enable dhcp on all interfaces
networking.useDHCP = lib.mkDefault true;
# set host arch
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

112
hosts/default/home.nix Normal file
View File

@@ -0,0 +1,112 @@
{ config, pkgs, ... }:
{
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "aaron";
home.homeDirectory = "/home/aaron";
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "25.05"; # Please read the comment before changing.
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = with pkgs; [
# # Adds the 'hello' command to your environment. It prints a friendly
# # "Hello, world!" when run.
# pkgs.hello
# # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
fastfetch
zip
xz
unzip
p7zip
jq
mtr
iperf3
dnsutils
ldns
socat
nmap
cowsay
file
which
tree
zstd
gnupg
btop
iotop
iftop
strace
ltrace
lsof
sysstat
lm_sensors
ethtool
pciutils
usbutils
];
# configure git
programs.git.settings = {
enable = true;
userName = "aaron";
userEmail = "aaron@0x29a.ch";
};
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
home.file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. These will be explicitly sourced when using a
# shell provided by Home Manager. If you don't want to manage your shell
# through Home Manager then you have to manually source 'hm-session-vars.sh'
# located at either
#
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# /etc/profiles/per-user/aaron/etc/profile.d/hm-session-vars.sh
#
home.sessionVariables = {
# EDITOR = "emacs";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}