NixOSConfig/lib/configuration.nix

231 lines
4.9 KiB
Nix

{ config, lib, machine, pkgs, ... }: {
imports = [
./modules/custom-build-vm.nix
./modules/custom-sops-nix.nix
./modules/git.nix
./modules/my-users.nix
./modules/sddm.nix
./modules/unfree.nix
./modules/xone.nix
];
config = {
system.stateVersion = "23.11";
# Map host keys into VM and launch vm using `virt-viewer`
virtualisation =
let
vmConfig = {
virtualisation = {
sharedHostKeys = true;
sharedUserKeys = true;
usb-redirect = true;
virt-viewer = true;
cores = 4;
memorySize = 4 * 1024;
};
};
in {
vmVariant = vmConfig;
vmVariantWithBootLoader = vmConfig;
};
sops = {
defaultSopsFile = ../secrets/global.yaml;
age = {
sshKeyPaths = [
"/etc/ssh/ssh_host_ed25519_key"
];
};
secrets.default_password.neededForUsers = true;
};
boot.loader = {
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
grub = {
efiSupport = true;
device = "nodev";
useOSProber = true;
minegrub-theme = {
enable = true;
splash = "";
};
};
};
users.myUsers = machine.config.users;
services.fwupd.enable = true;
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
users =
lib.attrsets.concatMapAttrs (username: user:
let
getUserModule = pkgs.callPackage (import ./utils/user-module.nix);
in {
${username} = (getUserModule {
inherit machine;
user = { name = username; } // user;
});
})
machine.config.users;
};
# Networking
networking = {
hostName = machine.name;
networkmanager.enable = true;
};
# Set time zone
time.timeZone = machine.config.timeZone;
# Configure keyboard layout
console.keyMap = machine.config.keyMap;
services.xserver.xkb.layout = machine.config.keyboardLayout;
i18n.extraLocaleSettings = machine.config.localeSettings;
# Graphics
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
services.xserver.videoDrivers = lib.optional machine.config.nvidia "nvidia";
hardware.nvidia = lib.optionalAttrs machine.config.nvidia {
modesetting.enable = true;
powerManagement.finegrained = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
# Drivers
hardware.xone.enable = (lib.mkIf machine.config.xone true);
# Enable KDE Plasma
services.xserver.enable = true;
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
};
services.desktopManager.plasma6.enable = true;
# Programs
programs = {
firefox.enable = true;
kdeconnect.enable = true;
ssh.startAgent = true;
git = {
enable = true;
lfs.enable = true;
};
fish.enable = true;
zsh.enable = true;
screen = {
enable = true;
};
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
configure = {
customRC = "set clipboard+=unnamed,unnamedplus";
packages.myNVimPackage =
with pkgs.vimPlugins;
{
start = [
vim-wayland-clipboard
zoxide-vim
];
};
};
};
tmux.enable = true;
htop.enable = true;
};
environment = {
systemPackages =
with pkgs;
[
aliae
powershell
oh-my-posh
neofetch
tldr
wget
btop
nvtopPackages.full
numbat
lsof
zoxide
fzf
sl
bb
terminal-parrot
rar
goldwarden
gitflow
wl-clipboard
xclip
maliit-keyboard
gnome.dconf-editor
networkmanager-openconnect
networkmanager-openvpn
nextcloud-client
librewolf
logseq
rnote
texliveFull
xournalpp
] ++ (lib.optionals machine.config.school [
teams-for-linux
temurin-bin-17
gradle
jetbrains.idea-ultimate
]);
};
services.udev.extraRules = lib.strings.concatLines (
lib.optional machine.config.school ''
SUBSYSTEM=="usb", ATTR{idVendor}=="0483", MODE="0666"
'');
services.power-profiles-daemon.enable = true;
# Fonts
fonts.packages =
with pkgs; [
(nerdfonts.override {
fonts = [
"CascadiaCode"
];
})
cascadia-code
ttf-ms-win11
twitter-color-emoji
];
};
}