nixos/system/common.nix

140 lines
2.9 KiB
Nix

{ inputs, config, pkgs, lib, ... }:
let flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
in
{
# Bootloader
boot.loader.grub.enable = true;
boot.loader.grub.device = lib.mkDefault "/dev/sda";
# Networking
networking.networkmanager.enable = true;
services.openssh.enable = true;
services.tailscale.enable = true;
# Router shared filesystem
fileSystems."/home/andrey/Public" = {
device = "root@192.168.0.3:/mnt/sda1";
fsType = "sshfs";
options = [
"nodev"
"noatime"
"allow_other"
"reconnect"
"noauto"
"x-systemd.automount"
"IdentityFile=/home/andrey/.ssh/id_ed25519"
];
};
# l10n and i8n
time.timeZone = "Europe/Riga";
i18n.defaultLocale = "en_US.UTF-8";
# Editor
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
defaultEditor = true;
};
# Nix
nixpkgs.config.allowUnfree = true;
nix = {
settings = {
trusted-users = [ "andrey" ];
experimental-features = [ "nix-command" "flakes" ];
flake-registry = "";
nix-path = config.nix.nixPath;
};
channel.enable = false;
registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs;
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
};
# Users
users.mutableUsers = false;
users.users.andrey = {
isNormalUser = true;
initialHashedPassword = "$y$j9T$mGZT4otEkrc94e.Ile.P20$BoxfgxCiacs.tYoEp7S5AjcP.aMUBrsaCJYJkBot635";
extraGroups = [ "wheel" "cdrom" "networkmanager" "audio" "dialout" "scanner" "lp" "adbusers" ];
};
security.sudo.execWheelOnly = true;
security.sudo.wheelNeedsPassword = false;
# Printers and scanners
hardware.sane.enable = true;
services.printing.enable = true;
services.printing.drivers = [ pkgs.cnijfilter2 ];
programs.system-config-printer.enable = true;
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
programs.adb.enable = true;
# Distcc
services.distccd = {
enable = true;
allowedClients = [ "192.168.0.0/24" ];
stats.enable = true;
};
# Programs
programs = {
git = {
enable = true;
config = {
init.defaultBranch = "master";
url."https://github.com/".insteadOf = [ "gh:" "github:" ];
url."https://git.psf.lt/".insteadOf = [ "psf:" "gitea:" ];
};
};
};
# Packages
environment.systemPackages = with pkgs; [
alsa-utils
];
hardware.bluetooth = {
enable = true;
settings.General.Enable = "Source,Sink,Media,Socket";
};
# Xorg
security.rtkit.enable = true;
services = {
xserver.enable = true;
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
libinput.touchpad = {
naturalScrolling = true;
disableWhileTyping = false;
tappingDragLock = false;
};
};
}