nix/hosts/xps15/configuration.nix
2026-03-03 00:42:25 -05:00

208 lines
4.1 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
tuigreet = lib.getExe pkgs.tuigreet;
hyprSession = pkgs.writeShellScript "hypr-session" ''
for _hm in "/etc/profiles/per-user/$(id -un)" "$HOME/.nix-profile"; do
[ -f "$_hm/etc/profile.d/hm-session-vars.sh" ] && . "$_hm/etc/profile.d/hm-session-vars.sh" && break
done
unset _hm
_tf="''${XDG_STATE_HOME:-$HOME/.local/state}/theme"
THEME="$(cat "$_tf" 2>/dev/null)" || THEME="midnight"
export THEME
unset _tf
exec start-hyprland
'';
in
{
imports = [
./hardware-configuration.nix
./hardware.nix
];
boot.loader.grub = {
enable = true;
efiSupport = true;
useOSProber = true;
configurationLimit = 5;
gfxmodeEfi = "1920x1200,auto";
fontSize = 36;
mirroredBoots = [
{
path = "/boot";
efiSysMountPoint = "/efi";
devices = [ "nodev" ];
}
];
};
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/efi";
boot.kernelParams = [
"loglevel=3"
"quiet"
];
networking.hostName = "xps15";
networking.wireless.iwd = {
enable = true;
settings = {
General.EnableNetworkConfiguration = true;
Settings.AutoConnect = true;
};
};
services.automatic-timezoned.enable = true;
services.geoclue2.enable = true;
services.pcscd.enable = true;
documentation.man = {
enable = true;
generateCaches = true;
};
i18n.defaultLocale = "en_US.UTF-8";
security.pam.services.hyprlock = { };
security.doas = {
enable = true;
extraRules = [
{
groups = [ "wheel" ];
persist = true;
keepEnv = true;
}
];
};
environment.etc."gitconfig".text = ''
[safe]
directory = /home/barrett/.config/nix
directory = /home/barrett/.cache/nix/tarball-cache
'';
environment.binsh = "${pkgs.dash}/bin/dash";
users.users.barrett = {
isNormalUser = true;
extraGroups = [
"wheel"
"docker"
"libvirt"
"storage"
"power"
];
shell = pkgs.bash;
};
programs.bash = {
enable = true;
shellAliases = {
g = "git";
nv = "nvim";
};
};
programs.hyprland = {
enable = true;
portalPackage = pkgs.xdg-desktop-portal-hyprland;
};
hardware.bluetooth.enable = true;
services.keyd = {
enable = true;
keyboards.default = {
ids = [ "*" ];
settings = {
main = {
capslock = "overload(control, esc)";
leftcontrol = "capslock";
leftmeta = "A-x";
rightalt = "f13";
};
};
};
};
services.pipewire = {
enable = true;
alsa.enable = true;
jack.enable = true;
pulse.enable = true;
wireplumber.enable = true;
};
services.greetd = {
enable = true;
settings.default_session = {
command = "${tuigreet} --time --asterisks --cmd ${hyprSession}";
user = "greeter";
};
};
services.openssh.enable = true;
services.tailscale.enable = true;
virtualisation.docker.enable = true;
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
xdg.portal = lib.mkIf config.programs.hyprland.enable {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
];
config.common = {
default = [
"hyprland"
"gtk"
];
};
};
security.sudo.enable = true;
fonts.fontconfig.defaultFonts = {
sansSerif = [ "SF Pro Display" ];
monospace = [ "Berkeley Mono" ];
serif = [ "Times New Roman" ];
};
environment.systemPackages = with pkgs; [
vim
wget
git
dash
ntfs3g
efibootmgr
dmidecode
];
nix.settings = {
auto-optimise-store = true;
use-xdg-base-directories = true;
experimental-features = [
"nix-command"
"flakes"
];
trusted-users = [
"root"
"barrett"
];
};
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
systemd.services.nix-gc.serviceConfig.ExecStartPost =
"/nix/var/nix/profiles/system/bin/switch-to-configuration boot";
system.stateVersion = "24.11";
}