2024-04-05 16:09:51 +02:00
|
|
|
{ nix-config, pkgs, lib, config, ... }:
|
2024-04-03 14:05:28 +02:00
|
|
|
|
|
|
|
let
|
2024-04-06 01:38:56 +02:00
|
|
|
inherit (lib) mkOption mkEnableOption;
|
2024-04-04 15:41:32 +02:00
|
|
|
inherit (lib.types) str listOf;
|
2024-04-03 14:05:28 +02:00
|
|
|
inherit (pkgs.nixVersions) nix_2_19;
|
2024-04-05 16:59:48 +02:00
|
|
|
inherit (cfg) username iHaveLotsOfRam;
|
2024-04-05 16:09:51 +02:00
|
|
|
inherit (builtins) attrValues;
|
2024-04-03 15:43:02 +02:00
|
|
|
|
2024-04-04 15:41:32 +02:00
|
|
|
cfg = config.modules.system;
|
2024-04-03 14:05:28 +02:00
|
|
|
in
|
2023-06-22 17:54:12 +02:00
|
|
|
{
|
2024-04-05 16:09:51 +02:00
|
|
|
imports = attrValues {
|
|
|
|
inherit (nix-config.inputs.home-manager.nixosModules) home-manager;
|
|
|
|
};
|
|
|
|
|
2024-04-04 15:41:32 +02:00
|
|
|
options.modules.system = {
|
2024-04-04 22:36:08 +02:00
|
|
|
username = mkOption {
|
|
|
|
type = str;
|
|
|
|
default = "user";
|
|
|
|
};
|
|
|
|
|
2024-04-04 15:41:32 +02:00
|
|
|
timeZone = mkOption {
|
|
|
|
type = str;
|
|
|
|
default = "America/New_York";
|
|
|
|
};
|
2024-04-04 03:28:50 +02:00
|
|
|
|
2024-04-04 15:41:32 +02:00
|
|
|
defaultLocale = mkOption {
|
|
|
|
type = str;
|
|
|
|
default = "ja_JP.UTF-8";
|
2024-04-03 13:30:40 +02:00
|
|
|
};
|
|
|
|
|
2024-04-04 15:41:32 +02:00
|
|
|
supportedLocales = mkOption {
|
|
|
|
type = listOf str;
|
|
|
|
default = [ "ja_JP.UTF-8/UTF-8" "en_US.UTF-8/UTF-8" "fr_FR.UTF-8/UTF-8" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
stateVersion = mkOption {
|
|
|
|
type = str;
|
|
|
|
default = "22.11";
|
|
|
|
};
|
2024-04-05 16:59:48 +02:00
|
|
|
|
|
|
|
iHaveLotsOfRam = mkEnableOption "tmpfs on /tmp";
|
2024-04-03 14:05:28 +02:00
|
|
|
};
|
|
|
|
|
2024-04-04 15:41:32 +02:00
|
|
|
config = {
|
|
|
|
boot = {
|
2024-04-05 17:26:22 +02:00
|
|
|
tmp =
|
|
|
|
if iHaveLotsOfRam
|
2024-04-05 16:59:48 +02:00
|
|
|
then { useTmpfs = true; }
|
|
|
|
else { cleanOnBoot = true; };
|
2024-04-03 14:05:28 +02:00
|
|
|
|
2024-04-04 15:41:32 +02:00
|
|
|
loader = {
|
|
|
|
systemd-boot = {
|
|
|
|
enable = true;
|
|
|
|
editor = false;
|
|
|
|
configurationLimit = 10;
|
|
|
|
};
|
|
|
|
|
|
|
|
timeout = 0;
|
|
|
|
efi.canTouchEfiVariables = true;
|
|
|
|
};
|
2024-04-03 14:05:28 +02:00
|
|
|
};
|
|
|
|
|
2024-04-04 15:41:32 +02:00
|
|
|
systemd = {
|
|
|
|
extraConfig = "DefaultTimeoutStopSec=10s";
|
|
|
|
services.NetworkManager-wait-online.enable = false;
|
|
|
|
};
|
2024-04-03 15:16:18 +02:00
|
|
|
|
2024-04-04 15:41:32 +02:00
|
|
|
nix = {
|
|
|
|
package = nix_2_19;
|
2024-04-03 13:14:47 +02:00
|
|
|
|
2024-04-04 15:41:32 +02:00
|
|
|
settings = {
|
|
|
|
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
|
|
|
|
auto-optimise-store = true;
|
|
|
|
warn-dirty = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
zramSwap = {
|
|
|
|
enable = true;
|
|
|
|
memoryPercent = 100;
|
|
|
|
};
|
2024-04-03 13:14:47 +02:00
|
|
|
|
2024-04-04 15:41:32 +02:00
|
|
|
time = {
|
|
|
|
inherit (cfg) timeZone;
|
|
|
|
};
|
|
|
|
|
|
|
|
i18n = {
|
|
|
|
inherit (cfg) defaultLocale supportedLocales;
|
|
|
|
};
|
|
|
|
|
|
|
|
system = {
|
|
|
|
inherit (cfg) stateVersion;
|
|
|
|
};
|
2024-04-04 22:00:09 +02:00
|
|
|
|
|
|
|
users = {
|
|
|
|
mutableUsers = false;
|
|
|
|
|
2024-04-04 22:36:08 +02:00
|
|
|
users.${username} = {
|
|
|
|
isNormalUser = true;
|
|
|
|
uid = 1000;
|
|
|
|
password = "user";
|
|
|
|
extraGroups = [ "wheel" "networkmanager" ];
|
2024-04-04 22:00:09 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
home-manager = {
|
|
|
|
useGlobalPkgs = true;
|
|
|
|
useUserPackages = true;
|
|
|
|
|
|
|
|
sharedModules = [{
|
|
|
|
home.stateVersion = "22.11";
|
|
|
|
programs.man.generateCaches = true;
|
|
|
|
}];
|
|
|
|
|
2024-04-04 22:36:08 +02:00
|
|
|
users.${username}.home = {
|
|
|
|
inherit username;
|
|
|
|
|
|
|
|
homeDirectory = "/home/${username}";
|
2024-04-04 22:00:09 +02:00
|
|
|
};
|
|
|
|
};
|
2024-04-06 01:38:56 +02:00
|
|
|
|
|
|
|
virtualisation.vmVariant = {
|
|
|
|
virtualisation = {
|
|
|
|
memorySize = 4096;
|
|
|
|
cores = 4;
|
|
|
|
|
|
|
|
qemu.options = [
|
|
|
|
"-device virtio-vga-gl"
|
|
|
|
"-display sdl,gl=on,show-cursor=off"
|
|
|
|
"-audio pa,model=hda"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.sessionVariables = {
|
|
|
|
WLR_NO_HARDWARE_CURSORS = "1";
|
|
|
|
};
|
|
|
|
|
|
|
|
services.interception-tools.enable = lib.mkForce false;
|
|
|
|
networking.resolvconf.enable = lib.mkForce true;
|
|
|
|
|
|
|
|
boot.enableContainers = false;
|
|
|
|
};
|
2024-04-03 15:43:02 +02:00
|
|
|
};
|
2023-06-22 17:54:12 +02:00
|
|
|
}
|