NixOSConfig/lib/configuration.nix

69 lines
1.7 KiB
Nix
Raw Normal View History

2024-05-11 18:04:14 +00:00
{ lib, machine, ... }: {
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-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-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-11 18:04:14 +00:00
users.myUsers = machine.config.users;
2024-05-07 20:02:12 +00:00
2024-05-09 00:06:59 +00:00
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
users =
lib.attrsets.concatMapAttrs (username: user:
let
2024-05-11 18:04:14 +00:00
hostname = machine.name;
2024-05-09 00:06:59 +00:00
getUserConfig = import ./utils/user-config.nix { inherit lib; };
configPath = getUserConfig { inherit hostname username; };
in
if (configPath != null)
then {
${username} = { pkgs, ... }@args: import configPath ({
userConfig = {
inherit hostname username;
} // user;
} // args);
}
else {})
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-11 18:04:14 +00:00
networking.hostName = machine.name;
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-05-01 16:58:39 +00:00
};
}