{ config, pkgs, ... }:

{
  imports = [
    ./hardware-configuration.nix
    # Удалите или закомментируйте следующую строку, если не используете home-manager
    # <home-manager/nixos>
  ];

  nixpkgs.config.allowUnfree = true;

  boot.loader.grub = {
    enable = true;
    version = 2;
    device = "/dev/sdb";
    useOSProber = true;  # Используем старую опцию
    # enableOSProber = true;  # Можно попробовать использовать, если обновитесь до NixOS 23.05 и установите system.stateVersion = "23.05"
  };

  networking = {
    hostName = "nixos";
    networkmanager.enable = true;
    firewall.enable = true;
  };

  time.timeZone = "Europe/Moscow";

  i18n = {
    defaultLocale = "en_US.UTF-8";
    supportedLocales = [ "en_US.UTF-8" "ru_RU.UTF-8" ];
    extraLocaleSettings = {
      LC_ADDRESS = "ru_RU.UTF-8";
      LC_IDENTIFICATION = "ru_RU.UTF-8";
      LC_MEASUREMENT = "ru_RU.UTF-8";
      LC_MONETARY = "ru_RU.UTF-8";
      LC_NAME = "ru_RU.UTF-8";
      LC_NUMERIC = "ru_RU.UTF-8";
      LC_PAPER = "ru_RU.UTF-8";
      LC_TELEPHONE = "ru_RU.UTF-8";
      LC_TIME = "ru_RU.UTF-8";
    };
  };

  services = {
    xserver = {
      enable = true;
      displayManager.gdm.enable = true;
      desktopManager.gnome.enable = true;
      layout = "us,ru";
      xkbVariant = "";
      xkbOptions = "grp:alt_shift_toggle";
      videoDrivers = [ "nvidia" ];
    };
    printing.enable = true;
    flatpak.enable = true;
    # Настройки звука с использованием PipeWire
    pipewire = {
      enable = false;
      alsa.enable = true;
      pulse.enable = false;
      jack.enable = true;
    };
  };

  users.users.m = {
    isNormalUser = true;
    extraGroups = [ "wheel" "docker" ];
    shell = pkgs.zsh;
  };

  virtualisation.docker.enable = true;

  environment.systemPackages = with pkgs; [
    neovim
    wget curl
    git htop
    zsh
    firefox google-chrome
    gnome.gnome-tweaks gnome.dconf-editor
    # Добавьте остальные пакеты по вашему выбору
  ];

  nix.settings.experimental-features = [ "nix-command" "flakes" ];

  nix.gc = {
    automatic = true;
    dates = "weekly";
  };

  system.stateVersion = "22.11"; # Установлено на версию, с которой вы начали использовать NixOS
} [m@nixos:~]$ sudo nixos-rebuild switch 
[sudo] password for m: 
building Nix...
building the system configuration...
error:
       Failed assertions:
       - Using PipeWire as the sound server conflicts with PulseAudio. This option requires `hardware.pulseaudio.enable` to be set to false
       - users.users.m.shell is set to zsh, but
       programs.zsh.enable is not true. This will cause the zsh
       shell to lack the basic nix directories in its PATH and might make
       logging in as that user impossible. You can fix it with:
       programs.zsh.enable = true;
(use '--show-trace' to show detailed location information)

[m@nixos:~]$ sudo nixos-rebuild switch 
building Nix...
building the system configuration...
error: The option `services.pipewire.enable' has conflicting definition values:
       - In `/etc/nixos/configuration.nix': false
       - In `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/desktops/gnome/gnome-remote-desktop.nix': true
       Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.
(use '--show-trace' to show detailed location information)

[m@nixos:~]$