{pkgs, config, ...}: 
let 
  globals = import ../../config/globals.nix;
in {
  imports = [
    ../../modules/common/nix.nix
    ../../modules/hardware/bepovim.nix
    ../../modules/desktop/xorg-bspwm.nix
    ../../modules/common/base.nix
    ../../modules/common/fonts.nix
    ../../modules/common/networking.nix
    ../../modules/common/plymouth.nix
    ../../modules/common/audio.nix
    ../../modules/common/bluetooth.nix
    ../../modules/common/gaming.nix
    ../../modules/common/lockscreen.nix
    ../../modules/common/energy.nix
    ../../modules/common/qemu.nix
    ../../modules/common/smtp.nix

    ../../modules/hardware/firmware.nix
    ../../modules/hardware/gpu-amd.nix
    ../../modules/hardware/sensors-zenpower.nix
    
    ../../modules/services/printing.nix

    ../../modules/virtual/kvm-amd.nix
    ../../modules/virtual/vfio.nix
  ];

  networking.hostName = "pennsardin";

  boot.kernelPackages = pkgs.linuxPackages_latest;
  boot.extraModulePackages = [ config.boot.kernelPackages.nct6687d ];
  boot.kernelModules = [ "nct6683" "k10temp" "i2c-dev" ] ;
  boot.swraid.enable = true;

  environment.systemPackages = with pkgs; [
    lm_sensors
    btrfs-progs
    cifs-utils
    evtest
    git
    vim
    wget
    curl
    ripgrep
    fd
    pciutils
    usbutils
    p7zip
    gdu
    glances
    parted
    tmux
    xorg.xauth
    xorg.xkbcomp
    xorg.xev
  ];

  services.openssh = {
    enable = true;
    settings = {
      X11Forwarding = true;
      X11DisplayOffset = 10;
      X11UseLocalhost = true ;
    };
  };

  fileSystems = {
    "/" = {
      device = "/dev/disk/by-uuid/b1a1ae71-4277-45d5-a3d2-f49354f263d4";
      fsType = "ext4";
    };
    "/boot" = {
      device = "/dev/disk/by-uuid/1DB2-7A0F";
      fsType = "vfat";
      options = ["fmask=0077" "dmask=0077"];
    };
    "/proc" = {
      device = "proc";
      fsType = "proc";
      options = ["defaults" "hidepid=2"];
      neededForBoot = true;
    };
    "/home/lomig/Documents" = {
      device = "/srv/raid/home-data/Documents";
      options = [ "bind" ];
    };
    "/home/lomig/Images" = {
      device = "/srv/raid/home-data/Images";
      options = [ "bind" ];
    };
    "/home/lomig/Musique" = {
      device = "/srv/raid/home-data/Musique";
      options = [ "bind" ];
    };
    "/home/lomig/Téléchargements" = {
      device = "/srv/raid/home-data/Téléchargements";
      options = [ "bind" ];
    };
    "/home/lomig/Vidéos" = {
      device = "/srv/raid/home-data/Vidéos";
      options = [ "bind" ];
    };
    "/home/lomig/nixos-config" = {
      device = "/srv/raid/home-data/nixos-config";
      options = [ "bind" ];
    };
    "/srv/raid" = {
      device = "/dev/disk/by-uuid/85f72160-4720-463a-9dc6-7c5216733f2b";
      fsType = "btrfs";
      options = [ "defaults" "nofail" "x-systemd.device-timeout=10" ];
    };
  };

  swapDevices = [];

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

  home-manager = {
    useGlobalPkgs = true;
    users.lomig = import ../../hm/users/lomig-desktop.nix;
  };

  networking = {
    useNetworkd = true;
    firewall.allowedTCPPorts = [22 80 5900 5901 5902];
    interfaces = {
      enp11s0 = {
        useDHCP = false;
        wakeOnLan.enable = true ;
        };
      br0 = {
        useDHCP = false;
        ipv4.addresses = [
          {
            address = globals.network.pennsardin.ip;
            prefixLength = 24;
          }
        ];
      };
    };

    defaultGateway = {
      interface = "br0";
      address = globals.network.gateway;
    };
    nameservers = [ globals.network.gateway  "1.1.1.1"];
    bridges.br0.interfaces = ["enp11s0"];
  };
  systemd.network = {
    enable = true;
    netdevs."br0" = {
      netdevConfig = {
        Name = "br0";
        Kind = "bridge";
      };
    };
    networks."br0" = {
      matchConfig.Name = "br0";
    };
    networks."enp11s0" = {
      matchConfig.Name = "enp11s0";
      networkConfig.Bridge = "br0";
    };
  };

  system.stateVersion = "25.05"; # pour éviter les hurlements inutiles
}
# vim: set ts=2 sw=2 sts=2 et :

