diff --git a/spack_repo/packages/icon-nwp/package.py b/spack_repo/packages/icon-nwp/package.py
index 95de07b3764c449e3a522033013353b23f4c03ef..4df813b371ecfdf0b9020ac6bf4c378fae7e915e 100644
--- a/spack_repo/packages/icon-nwp/package.py
+++ b/spack_repo/packages/icon-nwp/package.py
@@ -92,9 +92,9 @@ class IconNwp(Package):
                 url = "{}://{}:{}@{}/{}".format(parsed.scheme, user, password, parsed.netloc, parsed.path)
 
         if "+lmu" in self.spec:
-            self.fetcher[0].url = self.git = "https://gitlab.physik.uni-muenchen.de/LDAP_w2w-b3/icon.git"
+            self.fetcher.url = self.git = "https://gitlab.physik.uni-muenchen.de/LDAP_w2w-b3/icon.git"
         else:
-            self.fetcher[0].url = self.git = url
+            self.fetcher.url = self.git = url
 
         super(IconNwp, self).do_fetch(mirror_only)
 
diff --git a/templates/real-from-d2-ana/build_env.sh b/templates/real-from-d2-ana/build_env.sh
index cffbf36eb3725dc589c69b3160a84c4ab40f1175..9d7f3f46840e16a1f10e6a6ad3965757226db29c 100644
--- a/templates/real-from-d2-ana/build_env.sh
+++ b/templates/real-from-d2-ana/build_env.sh
@@ -55,3 +55,13 @@ if [ ! -f "${definitions_tar_file}" ]; then
   # Create a file containing the environment variable that needs to be set in order to use DWD's definitions:
   echo "export ECCODES_DEFINITION_PATH=${WORKDIR}/definitions.edzw-${eccodes_version}-1" >eccodes_defs.env
 fi
+
+
+# Build dwd-icon-tools
+SPACK_BUILD_ECCODES="%ECCODES.BUILD_CMD%" #"eccodes %%SPACK.COMPILER%target=x86_64_v2"
+
+#if [ "${SPACK_LOAD_ECCODES}" == "build_cmd" ]; then SPACK_LOAD_DWDICONTOOLS=${SPACK_BUILD_DWDICONTOOLS}; fi
+if [ ! -z "$SPACK_BUILD_ECCODES" ]; then
+  spack install --reuse $SPACK_BUILD_ECCODES
+  spack load --first ${SPACK_BUILD_ECCODES}
+fi
diff --git a/templates/real-from-d2-ana/prepare_date_remote.sh b/templates/real-from-d2-ana/prepare_date_remote.sh
index a8faf1ad4d138ee2ab509ec0528e1afefff1e894..9514c4b210f925ef2ac92ca5a0f4163909118a4e 100644
--- a/templates/real-from-d2-ana/prepare_date_remote.sh
+++ b/templates/real-from-d2-ana/prepare_date_remote.sh
@@ -16,8 +16,8 @@ if [ "${IC_DATA_IS_LOCAL}" != "True" ]; then
   load_spack "%spack.init%" "%spack.root%" "%spack.url%" "%spack.branch%" "%spack.externals%" "%spack.compiler%" "%spack.disable_local_config%" "%spack.user_cache_path%" "%spack.user_config_path%" "%spack.upstreams%"
 
   # Load icon module
-  spack load --first eccodes
-  spack load --first dwd-icon-tools
+  spack load --first %ECCODES.BUILD_CMD%
+  spack load --first  %ECCODES.LOAD_CMD%
 
   # Set environment variable for eccodes-dwd definitions:
   source ${WORKDIR}/eccodes_defs.env