nixos-home-flake/modules/system/configuration.nix

203 lines
4.8 KiB
Nix
Raw Permalink Normal View History

2024-02-21 21:18:36 +01:00
{ config, pkgs, inputs, lib, user, hostName, ... }:
{
nixpkgs.config.allowUnfree = true;
2024-02-21 22:54:04 +01:00
# Remove unecessary preinstalled packages
2024-02-21 21:18:36 +01:00
environment.defaultPackages = [ ];
environment.sessionVariables = { GTK_USE_PORTAL = "1"; };
services.printing.enable = true;
programs.zsh.enable = true;
programs.wireshark.enable = true;
environment.etc.openvpn.source = "${pkgs.update-resolv-conf}/libexec/openvpn";
2024-02-21 22:54:04 +01:00
# Laptop-specific packages (the other ones are installed in `packages.nix`)
2024-02-21 21:18:36 +01:00
environment.systemPackages = with pkgs; [
acpi
tlp
git
pciutils
greetd.tuigreet
virt-manager
glib-networking
];
services.greetd = {
enable = true;
settings = {
default_session = {
2024-02-21 22:54:04 +01:00
command =
"${pkgs.greetd.tuigreet}/bin/tuigreet --time --greeting 'Welcome to NixOS!' --cmd Hyprland";
2024-02-21 21:18:36 +01:00
user = "${user}";
};
};
};
services.openssh.enable = true;
2024-02-21 22:54:04 +01:00
systemd.services.sshd.wantedBy = lib.mkForce [ ];
2024-02-21 21:18:36 +01:00
programs.ssh.startAgent = true;
services.hardware.bolt.enable = true;
2024-02-21 22:54:04 +01:00
hardware.logitech.wireless.enable = true;
2024-02-21 21:18:36 +01:00
hardware.logitech.wireless.enableGraphical = true;
programs.hyprland.xwayland.enable = true;
2024-02-21 22:54:04 +01:00
virtualisation.libvirtd.enable = true;
2024-02-21 21:18:36 +01:00
fonts = {
packages = with pkgs; [
jetbrains-mono
2024-02-21 22:54:04 +01:00
roboto
openmoji-color
(nerdfonts.override { fonts = [ "FiraCode" ]; })
(nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
2024-02-21 21:18:36 +01:00
];
fontconfig = {
hinting.autohint = true;
2024-02-21 22:54:04 +01:00
defaultFonts = { emoji = [ "OpenMoji Color" ]; };
2024-02-21 21:18:36 +01:00
};
};
xdg = {
icons.enable = true;
portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-hyprland
xdg-desktop-portal-gtk
];
};
};
xdg.portal.config.common.default = "*";
programs.dconf.enable = true;
services.dbus.packages = with pkgs; [ dconf ];
services.dbus.enable = true;
services.gvfs = {
enable = true;
package = lib.mkForce pkgs.gnome3.gvfs;
};
2024-02-21 22:54:04 +01:00
# Firmware Updater
2024-02-21 21:18:36 +01:00
services.fwupd.enable = true;
2024-02-21 22:54:04 +01:00
# Nix settings, auto cleanup and enable flakes
2024-02-21 21:18:36 +01:00
nix = {
settings.auto-optimise-store = true;
settings.allowed-users = [ "${user}" ];
gc = {
automatic = true;
dates = "weekly";
2024-02-21 22:52:05 +01:00
options = "--delete-older-than 14d";
2024-02-21 21:18:36 +01:00
};
extraOptions = ''
experimental-features = nix-command flakes
keep-outputs = true
keep-derivations = true
2024-02-21 22:54:04 +01:00
'';
2024-02-21 21:18:36 +01:00
};
2024-02-21 22:54:04 +01:00
# Boot settings: clean /tmp/, latest kernel and enable bootloader
2024-02-21 21:18:36 +01:00
boot = {
tmp.cleanOnBoot = true;
loader = {
systemd-boot.enable = true;
systemd-boot.editor = false;
efi.canTouchEfiVariables = true;
timeout = 0;
};
};
2024-02-21 22:54:04 +01:00
# Set up locales (timezone and keyboard layout)
2024-02-21 21:18:36 +01:00
time.timeZone = "Europe/Ljubljana";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "en";
};
2024-02-21 22:54:04 +01:00
# Set up user and enable sudo
2024-02-21 21:18:36 +01:00
users.users.${user} = {
isNormalUser = true;
extraGroups = [ "input" "wheel" "networkmanager" "libvirtd" "wireshark" ];
2024-02-21 22:54:04 +01:00
initialHashedPassword =
"$6$wqCHereET3WM6UIA$XeJIgGkmO2/zAkktN2JCx5hLNS3kSj6seVQBdSWoMeJ5MOrIha6B/HiDjHI4oKDKYhYVwjgQFqGpncU6OI7Ud/"; # password: d3fault
2024-02-21 21:18:36 +01:00
shell = pkgs.zsh;
};
2024-02-21 22:54:04 +01:00
# Set up networking and secure it
2024-02-21 21:18:36 +01:00
networking = {
networkmanager.enable = true;
hostName = "${hostName}";
2024-02-21 22:54:04 +01:00
firewall.enable =
false; # This one is necessary to expose ports to the netwok. Usefull for smbserver, responder, http.server, ...
extraHosts = ""; # For adding hosts.
2024-02-21 21:18:36 +01:00
};
2024-02-21 22:54:04 +01:00
# Set environment variables
2024-02-21 21:18:36 +01:00
environment.variables = {
NIXOS_CONFIG_DIR = "$HOME/.config/nixos/";
NIXPKGS_ALLOW_INSECURE = "1";
XDG_DATA_HOME = "$HOME/.local/share";
GTK_RC_FILES = "$HOME/.local/share/gtk-1.0/gtkrc";
GTK2_RC_FILES = "$HOME/.local/share/gtk-2.0/gtkrc";
MOZ_ENABLE_WAYLAND = "1";
EDITOR = "nvim";
DIRENV_LOG_FORMAT = "";
ANKI_WAYLAND = "1";
DISABLE_QT5_COMPAT = "0";
LIBSEAT_BACKEND = "logind";
GTK_USE_PORTAL = "1";
NIXPKGS_ALLOW_UNFREE = "1";
};
environment.localBinInPath = true;
2024-02-21 22:54:04 +01:00
# Security
2024-02-21 21:18:36 +01:00
security = {
sudo.enable = true;
2024-02-21 22:54:04 +01:00
# Extra security
2024-02-21 21:18:36 +01:00
protectKernelImage = true;
2024-02-21 22:54:04 +01:00
pam.services.gtklock.text =
lib.readFile "${pkgs.gtklock}/etc/pam.d/gtklock";
2024-02-21 21:18:36 +01:00
};
2024-02-21 22:54:04 +01:00
# Sound (PipeWire)
sound.enable = true;
2024-02-21 21:18:36 +01:00
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
2024-02-21 22:54:04 +01:00
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
2024-02-21 21:18:36 +01:00
hardware = {
bluetooth.enable = true;
opengl = {
enable = true;
driSupport = true;
};
};
2024-02-21 22:54:04 +01:00
virtualisation.waydroid.enable =
true; # For mobile app pentesting TODO: Move to module.
2024-02-21 21:18:36 +01:00
programs.adb.enable = true;
services.blueman.enable = true;
2024-02-21 22:52:05 +01:00
# Do not touch
2024-02-21 21:18:36 +01:00
system.stateVersion = "23.11";
}