Home-manager: ungoogled-chromium with extensions?

ok, got it working! basically, it’s possible also to write it in the “sha256:…” format, with the output given in the error. So, the final config snippet would be:

        extensions =
        let
          createChromiumExtensionFor = browserVersion: { id, sha256, version }:
            {
              inherit id;
              crxPath = builtins.fetchurl {
                url = "https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&prodversion=${browserVersion}&x=id%3D${id}%26installsource%3Dondemand%26uc";
                name = "${id}.crx";
                inherit sha256;
              };
              inherit version;
            };
          createChromiumExtension = createChromiumExtensionFor (lib.versions.major pkgs.ungoogled-chromium.version);
        in
        [
          (createChromiumExtension {
            # ublock origin
            id = "cjpalhdlnbpafiamejdnhcphjbkeiagm";
            sha256 = "sha256:026l3wq4x7rg9f0dz4xiig25x8b7h0syil1d09hbpfzv0yg5bm4m";
            version = "1.37.2";
          })
          (createChromiumExtension {
            # dark reader
            id = "eimadpbcbfnmbkopoojfekhnkhdbieeh";
            sha256 = "sha256:1xw996dmkzsx2pmilb3ivyfnjckm2g1f2sx10yd4nllqbz5076mm";
            version = "4.9.34";
          })
        ];

Ah - and in order to get the nix-prefetch-url working properly I just passed it the --name argument, so that it renames the file afterwards. I think it might be a bug in the code that manages the naming of the downloaded file?

λ nix-prefetch-url --name arst.crx 'https://clients2.google.com/service/u
redirect&acceptformat=crx2,crx3&prodversion=92&x=id%3Dcjpalhdlnbpafiamejd
allsource%3Dondemand%26uc'
path is '/nix/store/yh1zgrdab3k7c7ad3wa6nx785ckdwp8x-arst.crx'
026l3wq4x7rg9f0dz4xiig25x8b7h0syil1d09hbpfzv0yg5bm4m