dotfiles/lib/nixos/configuration.nix

305 lines
6.8 KiB
Nix
Raw Normal View History

{
inputs,
desktop ? false,
hostname,
self,
}:
2024-03-18 20:33:28 +00:00
{ pkgs, ... }:
let
username = "opdavies";
in
{
2024-09-23 07:49:12 +00:00
imports = [ ../../modules/nixos/desktop ];
2024-09-13 12:49:25 +00:00
nixpkgs.config = {
allowUnfree = true;
permittedInsecurePackages = [ "electron-27.3.11" ];
};
2023-07-30 21:53:42 +00:00
# Bootloader.
2024-06-09 20:05:01 +00:00
boot = {
loader = {
systemd-boot = {
enable = true;
configurationLimit = 10;
};
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
};
};
services.thermald.enable = true;
services.power-profiles-daemon.enable = false;
services.tlp = {
enable = true;
settings = {
PCIE_ASPM_ON_BAT = "powersupersave";
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_MAX_PERF_ON_AC = "100";
CPU_MAX_PERF_ON_BAT = "30";
STOP_CHARGE_THRESH_BAT1 = "95";
STOP_CHARGE_THRESH_BAT0 = "95";
};
};
2023-06-15 18:33:41 +00:00
systemd.extraConfig = ''
DefaultTimeoutStopSec=10s
'';
networking.hostName = hostname;
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/London";
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_GB.UTF-8";
LC_IDENTIFICATION = "en_GB.UTF-8";
LC_MEASUREMENT = "en_GB.UTF-8";
LC_MONETARY = "en_GB.UTF-8";
LC_NAME = "en_GB.UTF-8";
LC_NUMERIC = "en_GB.UTF-8";
LC_PAPER = "en_GB.UTF-8";
LC_TELEPHONE = "en_GB.UTF-8";
LC_TIME = "en_GB.UTF-8";
};
# Enable the X11 windowing system.
services.xserver.enable = true;
services.xserver = {
2024-02-02 22:06:04 +00:00
xkb = {
layout = "gb";
variant = "";
};
};
# Configure console keymap
console.keyMap = "uk";
2023-08-21 16:40:04 +00:00
services.avahi.enable = true;
2024-01-14 09:11:03 +00:00
services.avahi.nssmdns4 = true;
2023-08-21 16:40:04 +00:00
services.avahi.openFirewall = true;
services.printing.enable = true;
# Enable sound with pipewire.
sound.enable = true;
2024-03-22 23:38:40 +00:00
hardware.pulseaudio.enable = false;
2024-06-15 11:17:07 +00:00
security = {
polkit.enable = true;
rtkit.enable = true;
};
2024-03-22 23:38:40 +00:00
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
users.users.${username} = {
isNormalUser = true;
description = "Oliver Davies";
extraGroups = [
"docker"
"networkmanager"
"wheel"
];
2024-03-18 20:33:28 +00:00
packages = with pkgs; [ ];
};
security.sudo.wheelNeedsPassword = false;
# List packages installed in system profile. To search, run:
# $ nix search wget
2024-05-23 16:14:07 +00:00
environment.systemPackages =
with pkgs;
[
2024-09-11 19:38:52 +00:00
fastfetch
2024-08-19 20:08:41 +00:00
mermaid-cli
2024-05-23 16:14:07 +00:00
mkcert
2024-10-01 20:46:05 +00:00
taskopen
taskwarrior3
taskwarrior-tui
2024-05-23 16:14:07 +00:00
ttyper
yt-dlp
]
++ pkgs.lib.optionals desktop [
acpi
2024-02-14 12:17:50 +00:00
arandr
2024-07-10 11:50:00 +00:00
backintime
bluetuith
brightnessctl
cpufrequtils
libnotify
2024-07-21 12:11:22 +00:00
pmutils
2024-09-04 06:55:42 +00:00
ffmpegthumbnailer
2024-10-02 21:24:50 +00:00
libreoffice
2024-09-21 09:23:54 +00:00
logseq
2024-01-25 07:20:37 +00:00
rclone
rclone-browser
shotwell
2024-05-22 20:33:45 +00:00
slack
2024-04-30 07:46:09 +00:00
vscode
xfce.thunar
xfce.thunar-volman
xfce.tumbler
2023-12-21 12:00:05 +00:00
# Games.
2024-02-10 18:55:47 +00:00
zeroad
];
2024-10-14 20:04:49 +00:00
services.jellyfin.enable = true;
services.jellyfin.openFirewall = true;
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
2023-08-24 21:39:35 +00:00
services.openssh.enable = true;
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [
9003 # xdebug
];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# 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 = "22.11"; # Did you read the comment?
2023-04-05 17:00:00 +00:00
programs.zsh.enable = true;
programs.zsh.histSize = 5000;
users.defaultUserShell = "/etc/profiles/per-user/${username}/bin/zsh";
2023-05-03 21:19:59 +00:00
2023-05-09 18:09:12 +00:00
zramSwap.enable = true;
nix = {
gc = {
automatic = true;
2024-02-07 23:28:44 +00:00
dates = "daily";
options = "--delete-older-than 7d";
};
2023-06-03 10:08:16 +00:00
optimise.automatic = true;
settings = {
auto-optimise-store = true;
experimental-features = [
"nix-command"
"flakes"
];
warn-dirty = false;
};
2023-06-03 10:08:16 +00:00
};
# Make Caps lock work as an Escape key on press and Ctrl on hold.
services.interception-tools =
let
dfkConfig = pkgs.writeText "dual-function-keys.yaml" ''
MAPPINGS:
- KEY: KEY_CAPSLOCK
TAP: KEY_ESC
HOLD: KEY_LEFTCTRL
'';
in
{
enable = true;
plugins = pkgs.lib.mkForce [ pkgs.interception-tools-plugins.dual-function-keys ];
udevmonConfig = ''
- JOB: "${pkgs.interception-tools}/bin/intercept -g $DEVNODE | ${pkgs.interception-tools-plugins.dual-function-keys}/bin/dual-function-keys -c ${dfkConfig} | ${pkgs.interception-tools}/bin/uinput -d $DEVNODE"
DEVICE:
NAME: "AT Translated Set 2 keyboard"
EVENTS:
EV_KEY: [[KEY_CAPSLOCK, KEY_ESC, KEY_LEFTCTRL]]
'';
};
2023-06-04 15:30:17 +00:00
2023-06-13 18:51:56 +00:00
system.autoUpgrade = {
enable = true;
flake = inputs.self.outPath;
flags = [
"--update-input"
"nixpkgs"
"--no-write-lock-file"
"-L" # print build logs
];
dates = "08:00";
randomizedDelaySec = "45min";
2023-06-13 18:51:56 +00:00
};
services.gvfs.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
2024-03-14 23:33:00 +00:00
pinentryPackage = pkgs.pinentry-qt;
};
programs.firefox = {
enable = true;
2024-03-18 20:33:28 +00:00
languagePacks = [ "en-GB" ];
preferences = {
"intl.accept_languages" = "en-GB, en";
"intl.regional_prefs.use_os_locales" = true;
};
};
2024-01-09 20:40:10 +00:00
services.blueman.enable = true;
services.cron = {
enable = true;
2024-06-11 22:45:00 +00:00
systemCronJobs = [ "* * * * * opdavies /home/${username}/.local/bin/notify-battery" ];
};
services.auto-cpufreq.enable = true;
services.udev = {
enable = true;
extraRules = ''
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl"
'';
};
}