{
  config,
  pkgs,
  lib,
  inputs,
  hostName,
  ...
}:
{
  imports = [
    #../nixos/profiles/debug.nix
    ../nixos/profiles/graphical.nix
    #../nixos/profiles/irssi.nix
    ../nixos/profiles/lang-fr.nix
    ../nixos/profiles/desktop.nix
    ../nixos/profiles/printing.nix
    #../nixos/profiles/radio.nix
    ../nixos/profiles/tor.nix
    ../nixos/profiles/bluetooth.nix
    ../nixos/profiles/home.nix
    #blackberry/backup.nix
    blackberry/hardware.nix
    blackberry/nebula.nix
    blackberry/networking.nix
    #blackberry/pixiecore.nix
    blackberry/nix-ssh.nix
  ];

  # Lower kernel's security for better performances
  security.kernel.mitigations = "off";

  home-manager.users.julm = {
    imports = [ ../homes/julm.nix ];
  };
  users.users.root = {
    openssh.authorizedKeys.keys = map lib.readFile [
      # For nix -L run .#pumpkin.switch
      ../users/julm/ssh/oignon.pub
      ../users/julm/ssh/pumpkin.pub
      ../users/julm/ssh/blackberry.pub
    ];
  };
  users.users.julm = {
    isNormalUser = true;
    uid = 1000;
    # Put the hashedPassword in /nix/store,
    # though /etc/shadow is not world readable...
    # printf %s $(mkpasswd -m md5crypt)
    hashedPassword = lib.readFile blackberry/users/julm/login/hashedPassword.clear;
    extraGroups = [
      "adbusers"
      "dialout"
      "lp"
      "networkmanager"
      "plugdev" # For rtl-sdr
      "scanner"
      "tor"
      "video"
      "wheel"
      "wireshark"
      #"ipfs"
      config.services.davfs2.davGroup
      #"vboxusers"
    ];
    # If created, zfs-mount.service would require:
    # zfs set overlay=yes ${hostName}/home
    createHome = false;
    openssh.authorizedKeys.keys = map lib.readFile [
      ../users/julm/ssh/oignon.pub
      ../users/julm/ssh/pumpkin.pub
      ../users/julm/ssh/losurdo.pub
    ];
  };

  nix = {
    extraOptions = '''';
    settings = {
      substituters = [
      ];
      trusted-public-keys = map lib.readFile [
      ];
    };
    nixPath = lib.mkForce [ "nixpkgs=${inputs.nixpkgs}" ];
  };

  environment.systemPackages = [
    #pkgs.riseup-vpn # Can't be installed by home-manager because it needs to install policy-kit rules
  ];

  boot.extraModulePackages = [
    #config.boot.kernelPackages.v4l2loopback
  ];

  programs.fuse.userAllowOther = true;

  systemd.automounts = [
    {
      where = "/mnt/aubergine";
      automountConfig.TimeoutIdleSec = "5 min";
    }
  ];
  fileSystems =
    let
      # Use the user's gpg-agent session to query
      # for the password of the SSH key when auto-mounting.
      sshAsUser = pkgs.writeScript "sshAsUser" ''
        user="$1"; shift
        exec ${pkgs.sudo}/bin/sudo -i -u "$user" \
          ${pkgs.openssh}/bin/ssh "$@"
      '';
      options = [
        "user"
        "uid=julm"
        "gid=users"
        "allow_other"
        "exec" # Override "user"'s noexec
        "noatime"
        "nosuid"
        "_netdev"
        "ssh_command=${sshAsUser}\\040julm"
        "noauto"
        "x-gvfs-hide"
        "x-systemd.automount"
        #"Compression=yes" # YMMV
        # Disconnect approximately 2*15=30 seconds after a network failure
        "ServerAliveCountMax=1"
        "ServerAliveInterval=15"
        "dir_cache=no"
        #"reconnect"
      ];
    in
    {
      "/mnt/aubergine" = {
        device = "${pkgs.sshfs-fuse}/bin/sshfs#julm@aubergine.sp:/";
        fsType = "fuse";
        inherit options;
      };
    };

  networking.firewall.extraCommands = ''
    ip46tables -A nixos-fw -i wg-intra -p tcp -m tcp --dport 8000 -j ACCEPT
  '';

  services.xserver = {
    xkb = {
      layout = "fr,us(altgr-intl)";
    };
    desktopManager = {
      session = [
        # Let the session be generated by home-manager
        {
          name = "home-manager";
          start = ''
            ${pkgs.runtimeShell} $HOME/.hm-xsession &
            waitPID=$!
          '';
        }
      ];
    };
  };

  services.displayManager = {
    defaultSession = "home-manager";
    #defaultSession = "none+xmonad";
    #defaultSession = "mate";
    #defaultSession = "cinnamon";
    autoLogin = {
      user = config.users.users.julm.name;
    };
  };

  # This value determines the NixOS release with which your system is to be
  # compatible, in order to avoid breaking some software such as database
  # servers. You should change this only after NixOS release notes say you should.
  system.stateVersion = "24.05"; # Did you read the comment?
}