Completed centralized update

This commit is contained in:
Filippo Berto 2021-06-14 07:01:37 +02:00
parent ef5b48d142
commit 83c9c72688
15 changed files with 328 additions and 138 deletions

188
nixos/base.nix Normal file
View file

@ -0,0 +1,188 @@
{}:
{
imports =
[
# Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix
./laptop.nix
./pentablet.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# # Cross-build arm
boot.binfmt.emulatedSystems = [ "armv7l-linux" "aarch64-linux" ];
# Use same ACPI identifier as Dell Ubuntu
boot.kernelParams = [
"acpi_osi=Linux-Dell-Video"
];
networking = {
hostName = "odin";
networkmanager.enable = true;
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
useDHCP = false;
interfaces = {
enp60s0.useDHCP = true;
wlp0s20f3.useDHCP = true;
virbr0.useDHCP = true;
};
# Configure network proxy if necessary
# proxy.default = "http://user:password@proxy:port/";
# proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Open ports in the firewall.
# firewall.allowedTCPPorts = [ ... ];
# firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# firewall.enable = false;
};
# Set your time zone.
time.timeZone = "Europe/Rome";
# Select internationalisation properties.
i18n.defaultLocale = "it_IT.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "it";
};
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the GNOME 3 Desktop Environment.
# services.xserver.displayManager.gdm = {
# enable = true;
# wayland = true;
# nvidiaWayland = true;
# };
services.xserver.desktopManager.gnome.enable = true;
services.xserver.displayManager.sddm.autoNumlock = true;
services.xserver.displayManager.sddm.enable = true;
services.xserver.windowManager.bspwm.enable = true;
# Configure keymap in X11
services.xserver.layout = "it";
services.xserver.xkbOptions = "eurosign:e;";
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
# services.pipewire = {
# enable = true;
# pulse.enable = true;
# jack.enable = true;
# alsa = {
# enable = true;
# support32Bit = true;
# };
# };
# Enable touchpad support (enabled default in most desktopManager).
services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.bertof = {
isNormalUser = true;
extraGroups = [ "wheel" "input" ]; # Enable sudo for the user.
shell = pkgs.zsh;
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
tmux
firefox
kakoune
vim
];
# 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;
};
programs.steam.enable = true;
programs.dconf.enable = true;
programs.zsh = {
enable = true;
syntaxHighlighting.enable = true;
};
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Cooling management
services.thermald.enable = true;
services.snapper = {
configs = let
bertofExtraConfig = ''
ALLOW_USERS="bertof"
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
'';
in
{
bertof_home = { subvolume = "/home/bertof"; extraConfig = bertofExtraConfig; };
bertof_images = { subvolume = "/home/bertof/Immagini"; extraConfig = bertofExtraConfig; };
bertof_music = { subvolume = "/home/bertof/Musica"; extraConfig = bertofExtraConfig; };
bertof_videos = { subvolume = "/home/bertof/Video"; extraConfig = bertofExtraConfig; };
bertof_hdd_games = { subvolume = "/home/bertof/Giochi/HDD"; extraConfig = bertofExtraConfig; };
bertof_ssd_games = { subvolume = "/home/bertof/Giochi/SSD"; extraConfig = bertofExtraConfig; };
};
};
services.dbus.packages = with pkgs; [ gnome.dconf ];
services.gnome.gnome-keyring.enable = true;
hardware.bluetooth.enable = true;
services.blueman.enable = true;
services.zerotierone = { enable = true; joinNetworks = [ "8056c2e21cf9c753" ]; };
services.gvfs.enable = true;
services.tlp.enable = false;
# Clamav
services.clamav = { daemon.enable = true; updater.enable = true; };
# Virtualisation
virtualisation = { kvmgt.enable = true; libvirtd.enable = true; };
# Allow completion for system packages
environment.pathsToLink = [ "/share/zsh" ];
security.sudo.extraConfig = ''
Defaults pwfeedback
'';
# Allow non free packages
nixpkgs.config.allowUnfree = true;
# 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 = "21.05"; # Did you read the comment?
}

19
nixos/intel.nix Normal file
View file

@ -0,0 +1,19 @@
# 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, ... }:
{
imports = [
<nixos-hardware/common/cpu/intel>
./base.nix
];
# This runs only Intel and nvidia does not drain power.
##### disable nvidia for a very nice battery life.
hardware.nvidiaOptimus.disable = true;
boot.blacklistedKernelModules = [ "nouveau" "nvidia" ];
services.xserver.videoDrivers = [ "intel" ];
hardware.opengl.driSupport32Bit = true;
}

27
nixos/laptop.nix Normal file
View file

@ -0,0 +1,27 @@
{ config, lib, ... }:
{
# SSD swappines
boot.kernel.sysctl = {
"vm.swappiness" = lib.mkDefault 1;
};
# Atheros WiFi module
boot.blacklistedKernelModules = lib.optionals (!config.hardware.enableRedistributableFirmware) [
"ath3k"
];
# ACPI support
boot = {
kernelModules = [ "acpi_call" ];
extraModulePackages = with config.boot.kernelPackages; [ acpi_call ];
};
# Touchpad support
services.xserver.libinput.enable = lib.mkDefault true;
# SSD trim service
services.fstrim.enable = lib.mkDefault true;
# Hard disk protection if the laptop falls:
services.hdapsd.enable = lib.mkDefault true;
}

24
nixos/nvidia.nix Normal file
View file

@ -0,0 +1,24 @@
# 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, ... }:
{
imports =
[
<nixos-hardware/common/cpu/intel>
./base.nix
];
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia.prime = {
offload.enable = false;
sync.enable = true;
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
# hardware.nvidia.modesetting.enable = true;
# hardware.nvidia.package = pkgs.linuxPackages.nvidia_x11;
hardware.opengl.driSupport32Bit = true;
}

11
nixos/pentablet.nix Normal file
View file

@ -0,0 +1,11 @@
{ config, lib, pkgs, modulesPath, ...}:
{
# udev rules
services.udev.extraRules = ''
KERNEL=="uinput",MODE:="0666",OPTIONS+="static_node=uinput"
SUBSYSTEMS=="usb",ATTRS{idVendor}=="28bd",MODE:="0666"
'';
# XP-Pen tablet driver
environment.systemPackages = [ pkgs.pentablet-driver ];
}