{ config, userSettings, fetchurl, stdenv, pkgs, ... }:

let
  version = userSettings.version;
in

{
  nixpkgs.overlays = [
    (self: super:
      {
  iceslWithBetaLink = pkgs.icesl.overrideAttrs (oldAttrs: {
        pname = "IceSL-${version}";
        version = "2.5.3-beta5";

     src = if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl {
       url = "https://icesl.loria.fr/assets/other/download.php?build=${version}@version=stable&os=amd64";
       extension = "zip";
       #sha256 = "sha256-kR6pJodgIw1N6mfhoA58N3mlkCuKPkxQ2nvs2BGgIj0=";
       hash = "";
       #hash = "sha256-kR6pJodgIw1N6mfhoA58N3mlkCuKPkxQ2nvs2BGgIj0=";
      } else if stdenv.hostPlatform.system == "i686-linux" then fetchurl {
       url = "https://icesl.loria.fr/assets/other/download.php?build=${version}@version=stable&osi386";
       extension = "zip";
       #sha256 = "sha256-kR6pJodgIw1N6mfhoA58N3mlkCuKPkxQ2nvs2BGgIj0=";
      } else throw "Unsupported architecture";
    });
  })
 ];
}
