NixOSConfig/lib/configuration.nix

213 lines
4.4 KiB
Nix
Raw Normal View History

2024-05-07 22:33:39 +00:00
{ config, lib, machine, pkgs, ... }: {
2024-05-01 16:58:39 +00:00
imports = [
./modules/custom-build-vm.nix
2024-05-03 12:02:42 +00:00
./modules/custom-sops-nix.nix
2024-05-08 14:48:52 +00:00
./modules/git.nix
2024-05-07 20:02:12 +00:00
./modules/my-users.nix
2024-05-07 20:31:56 +00:00
./modules/sddm.nix
2024-05-08 14:16:42 +00:00
./modules/unfree.nix
2024-05-08 07:58:18 +00:00
./modules/xone.nix
2024-06-11 23:35:30 +00:00
];
2024-05-01 16:58:39 +00:00
config = {
system.stateVersion = "23.11";
2024-05-01 17:16:40 +00:00
# Map host keys into VM and launch vm using `virt-viewer`
2024-05-01 16:58:39 +00:00
virtualisation =
let
vmConfig = {
virtualisation = {
sharedHostKeys = true;
sharedUserKeys = true;
2024-05-08 09:13:07 +00:00
usb-redirect = true;
2024-05-01 16:58:39 +00:00
virt-viewer = true;
2024-05-07 11:57:22 +00:00
cores = 4;
memorySize = 4 * 1024;
2024-05-01 16:58:39 +00:00
};
};
in {
vmVariant = vmConfig;
vmVariantWithBootLoader = vmConfig;
};
2024-05-01 23:20:46 +00:00
sops = {
defaultSopsFile = ../secrets/global.yaml;
age = {
sshKeyPaths = [
"/etc/ssh/ssh_host_ed25519_key"
];
};
2024-05-02 02:23:57 +00:00
secrets.default_password.neededForUsers = true;
2024-05-01 23:20:46 +00:00
};
2023-12-01 11:58:02 +00:00
boot.loader = {
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
grub = {
efiSupport = true;
device = "nodev";
useOSProber = true;
2024-05-09 09:52:28 +00:00
minegrub-theme = {
enable = true;
splash = "";
};
2023-12-01 11:58:02 +00:00
};
};
2024-05-11 18:04:14 +00:00
users.myUsers = machine.config.users;
2024-05-07 20:02:12 +00:00
2024-05-09 01:39:01 +00:00
services.fwupd.enable = true;
2024-05-09 00:06:59 +00:00
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
users =
lib.attrsets.concatMapAttrs (username: user:
let
2024-05-11 19:35:13 +00:00
getUserModule = pkgs.callPackage (import ./utils/user-module.nix);
in {
${username} = (getUserModule {
inherit machine;
user = { name = username; } // user;
});
})
2024-05-11 18:04:14 +00:00
machine.config.users;
2024-05-09 00:06:59 +00:00
};
2024-05-01 16:58:39 +00:00
# Networking
2024-05-07 20:41:15 +00:00
networking = {
hostName = machine.name;
networkmanager.enable = true;
};
2024-05-07 11:57:46 +00:00
# Set time zone
2024-05-11 18:04:14 +00:00
time.timeZone = machine.config.timeZone;
2024-05-07 12:11:22 +00:00
# Configure keyboard layout
2024-05-11 18:04:14 +00:00
console.keyMap = machine.config.keyMap;
services.xserver.xkb.layout = machine.config.keyboardLayout;
2024-05-07 12:31:38 +00:00
2024-05-11 18:04:14 +00:00
i18n.extraLocaleSettings = machine.config.localeSettings;
2024-04-09 21:11:14 +00:00
2024-05-07 22:33:39 +00:00
# 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;
};
2024-05-08 07:58:18 +00:00
# Drivers
hardware.xone.enable = (lib.mkIf machine.config.xone true);
2024-04-09 21:11:25 +00:00
# Enable KDE Plasma
2024-05-09 11:27:15 +00:00
services.xserver.enable = true;
2024-04-09 21:11:14 +00:00
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
};
2024-04-09 21:11:25 +00:00
services.desktopManager.plasma6.enable = true;
2024-05-07 23:06:15 +00:00
# Programs
2024-05-08 13:36:29 +00:00
programs = {
ssh.startAgent = true;
2024-05-08 13:38:28 +00:00
git = {
enable = true;
lfs.enable = true;
};
2024-05-08 13:36:29 +00:00
fish.enable = true;
zsh.enable = true;
screen = {
enable = true;
};
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
2024-05-09 10:49:51 +00:00
configure = {
customRC = "set clipboard+=unnamed,unnamedplus";
packages.myNVimPackage =
with pkgs.vimPlugins;
{
start = [
vim-wayland-clipboard
zoxide-vim
];
};
};
2024-05-08 13:36:29 +00:00
};
tmux.enable = true;
htop.enable = true;
};
2024-05-08 14:48:52 +00:00
environment = {
systemPackages =
with pkgs;
[
2024-05-09 11:58:36 +00:00
aliae
2024-05-08 14:48:52 +00:00
powershell
neofetch
tldr
wget
btop
nvtopPackages.full
numbat
lsof
zoxide
fzf
sl
bb
terminal-parrot
rar
goldwarden
gitflow
2024-05-09 10:49:51 +00:00
wl-clipboard
2024-05-09 11:32:22 +00:00
xclip
2024-05-09 12:33:15 +00:00
maliit-keyboard
2024-05-09 13:03:15 +00:00
gnome.dconf-editor
networkmanager-openconnect
networkmanager-openvpn
2024-05-08 14:48:52 +00:00
];
};
2024-05-08 09:34:03 +00:00
2024-05-09 12:33:50 +00:00
services.power-profiles-daemon.enable = true;
2024-05-08 09:34:03 +00:00
# Fonts
fonts.packages =
with pkgs; [
(nerdfonts.override {
fonts = [
"CascadiaCode"
];
})
2024-05-09 13:03:15 +00:00
cascadia-code
2024-05-10 08:41:26 +00:00
ttf-ms-win11
2024-05-10 10:20:36 +00:00
twitter-color-emoji
2024-05-08 09:34:03 +00:00
];
2024-05-01 16:58:39 +00:00
};
}