empty.nix/configuration.nix

109 lines
3.2 KiB
Nix
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
config,
pkgs,
simintech,
stm32cubemx,
inputs,
...
}:
let
serverIP = "10.0.174.12";
hasBootPartition = config.fileSystems ? "/boot";
isNvidia = (builtins.readFile (pkgs.runCommandLocal "isNvidia" {} ''
${pkgs.pciutils}/bin/lspci | ${pkgs.busybox}/bin/grep NVIDIA | ${pkgs.busybox}/bin/grep VGA > $out
'')) != "";
in
{
users.users.student = {
isNormalUser = true;
initialPassword = "student"; # вход беспарольный, но пароль student
extraGroups = [ "video" "sound" "input" "storage" ];
packages = [];
};
imports = [ ./hardware-configuration.nix ];
# если машина установлена на диск с Windows,
# то она позволяет "увидеть" и выбрать Windows в течение 30 с
# иначе - 5 c таймаута (для виртуалок)
boot.loader = if hasBootPartition then {
efi.canTouchEfiVariables = true;
timeout = 30;
grub = {
enable = true;
efiSupport = true;
device = "nodev";
useOSProber = true;
theme = "${pkgs.sleek-grub-theme.override{ withStyle = "orange"; withBanner = "Выберите ОС"; }}";
};
} else {
timeout = 5;
grub = {
enable = true;
device = "/dev/sda";
theme = "${pkgs.sleek-grub-theme.override{ withStyle = "orange"; withBanner = "Загрузчик Linux"; }}";
};
};
time.hardwareClockInLocalTime = hasBootPartition;
# настройки Nix
nixpkgs.config.allowUnfree = true;
nix.settings.auto-optimise-store = true;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
##### СЕТЕВЫЕ НАСТРОЙКИ #######
# каждый компьютер виден под уникальным именем через Avahi
services.avahi = {
hostName = "nixos"
+ builtins.readFile ((pkgs.runCommandLocal "uuid" {} ''
mkdir $out
cat /proc/sys/kernel/random/uuid > $out/uuid
'')+"/uuid");
enable = true;
nssmdns4 = true;
publish = {
enable = true;
hinfo = true;
addresses = true;
};
};
# каждый компьютер имеет выход в интернет
networking.networkmanager.enable = true;
networking.hostName = "nixos";
# каждый компьютер ресолвит DNS-запросы СТРОГО через наш сервер
networking.nameservers = [ serverIP ];
# каждый компьютер знает, что kafpi.local - это адрес нашего сервера
networking.hosts."${serverIP}" = [ "kafpi.local" ];
#### ЛОКАЛИЗАЦИЯ #####
time.timeZone = "Europe/Moscow";
i18n.defaultLocale = "ru_RU.UTF-8";
console = {
font = "cyr-sun16";
useXkbConfig = true;
};
####### ПРОЧИЕ НАСТРОЙКИ #######
environment.systemPackages = with pkgs; [
vim
tree
wget
git
];
# удаленный доступ в пределах нашей сети
services.openssh = {
enable = true;
settings.PermitRootLogin = "yes";
};
# НЕ МЕНЯТЬ, иначе придётся все компы переустанавливать, а не обновлять
system.stateVersion = "24.05";
}