nixconfigs/nixos/configuration.nix

282 lines
7.3 KiB
Nix
Raw Normal View History

2018-09-25 23:09:53 +02:00
# 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, ... }:
let
2021-06-09 10:05:51 +02:00
unstable = import <nixos-unstable> { };
localfork = import /home/spiollinux/src/nixpkgs { };
2018-09-25 23:09:53 +02:00
2020-02-16 21:58:51 +01:00
in
{
2018-09-25 23:09:53 +02:00
imports =
2020-02-16 21:58:51 +01:00
[
# Include the results of the hardware scan.
2018-09-25 23:09:53 +02:00
./hardware-configuration.nix
./packages.nix
];
2019-11-22 20:01:11 +01:00
services.davfs2.enable = true;
# try newer kernels
2020-03-08 02:10:28 +01:00
#boot.kernelPackages = pkgs.linuxPackages_latest;
# use old kernel because 5.4 and 5.5 might be buggy with intel graphics
2021-06-03 13:28:46 +02:00
#boot.kernelPackages = pkgs.linuxPackages_4_19;
2018-09-25 23:09:53 +02:00
services.fstrim.enable = true;
2018-10-25 01:30:53 +02:00
services.btrfs.autoScrub =
2020-02-16 21:58:51 +01:00
{
enable = true;
2019-01-14 13:24:34 +01:00
fileSystems = [ "/" "/home" ];
};
2018-10-25 01:30:53 +02:00
2018-10-13 19:58:56 +02:00
# exfat support
#boot.extraModulePackages = [ config.boot.kernelPackages.exfat-nofuse ];
2018-09-25 23:09:53 +02:00
2020-02-16 21:58:51 +01:00
zramSwap =
{
enable = true;
2019-01-14 13:24:34 +01:00
memoryPercent = 20;
};
boot.kernel.sysctl."vm.swappiness" = 9;
2018-09-26 14:03:53 +02:00
# powermanagement
2020-02-16 21:58:51 +01:00
services.tlp =
{
enable = true;
2020-11-21 01:56:47 +01:00
settings = {
"SATA_LINKPWR_ON_BAT" = "medium_power";
"SATA_LINKPWR_ON_AC" = "max_performance";
};
};
2018-09-25 23:09:53 +02:00
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# make the boot look good
boot.plymouth.enable = true;
2018-09-25 23:09:53 +02:00
networking.hostName = "thinknix";
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
2020-03-08 02:10:28 +01:00
# configure console
console = {
font = "Lat2-Terminus16";
keyMap = "de";
};
2018-09-25 23:09:53 +02:00
# Select internationalisation properties.
i18n = {
defaultLocale = "de_DE.UTF-8";
};
# Set your time zone.
time.timeZone = "Europe/Berlin";
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs.bash.enableCompletion = true;
programs.wireshark =
{
enable = true;
2021-06-09 10:06:20 +02:00
package = pkgs.wireshark;
};
2020-06-09 22:26:02 +02:00
programs.adb.enable = true;
2018-09-25 23:09:53 +02:00
# programs.mtr.enable = true;
# programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
2020-02-16 21:58:51 +01:00
#programs.ssh.startAgent = true;
2018-09-25 23:09:53 +02:00
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
2021-06-09 10:05:51 +02:00
networking.firewall.allowedTCPPortRanges = [{ from = 1714; to = 1764; }];
networking.firewall.allowedUDPPortRanges = [{ from = 1714; to = 1764; }]; # for KDE connect
2018-09-25 23:09:53 +02:00
# Or disable the firewall altogether.
# networking.firewall.enable = false;
2020-02-16 21:58:51 +01:00
2018-09-25 23:09:53 +02:00
networking.networkmanager.enable = true;
services.avahi.enable = true;
2018-09-25 23:09:53 +02:00
# Enable CUPS to print documents.
2020-02-16 21:58:51 +01:00
services.printing =
{
enable = true;
2018-09-26 15:20:59 +02:00
drivers = [ pkgs.hplip ];
};
# scanners
hardware.sane =
{
enable = true;
extraBackends = [ pkgs.hplip ];
2018-09-26 15:20:59 +02:00
};
2018-09-25 23:09:53 +02:00
# Enable sound.
sound.enable = true;
hardware.pulseaudio = {
enable = true;
# decouple pulseaudio application and sink volumes
daemon.config = { flat-volumes = "no"; };
# C3D2 hq music
zeroconf.discovery.enable = true;
zeroconf.publish.enable = true;
};
2018-09-25 23:09:53 +02:00
2018-09-26 15:24:25 +02:00
# Bluetooth
hardware.bluetooth = {
enable = true;
2021-06-03 13:28:46 +02:00
settings.General.Disable = "Headset"; # disable headset profile
};
hardware.pulseaudio = {
2022-04-01 16:14:59 +02:00
package = pkgs.pulseaudioFull;
};
2018-09-26 15:24:25 +02:00
2022-05-01 16:25:15 +02:00
# Nitrokey support
services.udev.packages = [ pkgs.nitrokey-udev-rules ];
2018-09-25 23:09:53 +02:00
# Enable the X11 windowing system.
services.xserver.enable = true;
services.xserver.layout = "de";
services.xserver.xkbOptions = "eurosign:e";
# Enable touchpad support.
services.xserver.libinput.enable = true;
# while libinput also supports graphic tablets, enable more-specific wacom driver
services.xserver.wacom.enable = true;
2018-09-25 23:09:53 +02:00
# Enable the KDE Desktop Environment.
services.xserver.displayManager.sddm.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
# dconf required for several Gnome applications like Cawbird
programs.dconf.enable = true;
2020-01-24 20:09:14 +01:00
# Flatpak support
services.flatpak.enable = true;
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ];
2018-09-25 23:09:53 +02:00
# Define a user account. Don't forget to set a password with passwd.
users.users.spiollinux = {
2018-09-25 23:09:53 +02:00
isNormalUser = true;
uid = 1000;
2020-06-09 22:26:02 +02:00
extraGroups = [ "vboxusers" "wheel" "networkmanager" "scanner" "lp" "wireshark" "dialout" "cdrom" "input" "adbusers" ];
2018-09-25 23:09:53 +02:00
shell = pkgs.zsh;
};
# enable virtualbox support
virtualisation.virtualbox.host = {
enable = true;
#enableExtensionPack = true;
};
# allow PUEL license
nixpkgs.config.whitelistedLicenses = [ pkgs.lib.licenses.virtualbox-puel ];
users.extraGroups.vboxusers.members = [ "spiollinux" ];
2020-02-16 21:58:51 +01:00
programs.zsh =
{
enable = true;
2018-10-07 16:49:34 +02:00
autosuggestions.enable = true;
};
2018-09-25 23:09:53 +02:00
# profile sync daemon
services.psd.enable = true;
2018-10-13 22:11:30 +02:00
2018-09-26 15:16:04 +02:00
services.smartd =
2020-02-16 21:58:51 +01:00
{
enable = true;
devices = [{ device = "/dev/sda"; } { device = "/dev/sdb"; }];
2018-09-26 15:16:04 +02:00
};
# block certain sites to prevent procrastination
systemd.services.procrastinationstop = {
serviceConfig.Type = "oneshot";
wantedBy = [ ];
script = ''
ln -sf ${pkgs.writeText "blockedHosts" ''
127.0.0.1 localhost
::1 localhost
127.0.0.2 ${config.networking.hostName}
::1 ${config.networking.hostName}
::1 twitter.com
127.0.0.1 twitter.com
::1 api.twitter.com
127.0.0.1 api.twitter.com
::1 toot.matereal.eu
127.0.0.1 toot.matereal.eu
::1 tagesschau.de
127.0.0.1 tagesschau.de
::1 dnn.de
127.0.0.1 www.dnn.de
::1 www.dnn.de
127.0.0.1 dnn.de
''} /etc/hosts
'';
};
systemd.services.procrastinationstart = {
serviceConfig.Type = "oneshot";
wantedBy = [ ];
script = ''
ln -sf /etc/static/hosts /etc/hosts
'';
};
2018-10-31 00:20:14 +01:00
2020-02-16 21:58:51 +01:00
fonts = {
2021-06-03 13:28:46 +02:00
fontDir.enable = true;
2020-02-16 21:58:51 +01:00
fontconfig.enable = true;
fontconfig.includeUserConf = true;
2020-02-16 21:58:51 +01:00
};
2018-10-31 00:20:14 +01:00
# Enable all sysrq functions (useful to recover from some issues):
boot.kernel.sysctl."kernel.sysrq" = 1; # NixOS default: 16 (only the sync command)
# keep build-time deps around for offline-rebuilding
nix.extraOptions = ''
gc-keep-outputs = true
gc-keep-derivations = true
trusted-users = spiollinux
2022-07-03 11:46:48 +02:00
experimental-features = nix-command
'';
# use all cores for building
nix.buildCores = 0;
# override tmpdir for daemon
#systemd.services.nix-daemon.environment.TMPDIR = "/var/tmp";
2018-09-25 23:09:53 +02:00
2019-10-02 22:26:15 +02:00
# package debugging
# programs.sysdig.enable = true;
2019-10-02 22:26:15 +02:00
# declarative containers
containers = {
2021-06-09 10:05:51 +02:00
# hash2PubSim = import ./Hash2PubTestbed.nix
# {
# inherit pkgs config;
# experimentUid = config.users.users.spiollinux.uid;
# projectDir = "/home/spiollinux/Seafile/Studium/Semester11/INF-PM-FP-ANW";
# };
};
# stop NetworkManager from managing virtual interfaces
networking.networkmanager.unmanaged = [ "interface-name:ve-*" ];
2018-09-25 23:09:53 +02:00
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "18.09"; # Did you read the comment?
2018-09-25 23:09:53 +02:00
}