From 8d1dbd0e1f914ae42026d5df2f04499128533648 Mon Sep 17 00:00:00 2001 From: DavHau Date: Thu, 14 Sep 2023 11:37:36 +0200 Subject: [PATCH] fix(lock): remove flakes command from error The suggested copy paste attribute path is often wrong as it depends on the individual repository setup that dream2nix doesn't control. Instead now simply hint to `nix run` the .lock attribute --- modules/dream2nix/core/lock/default.nix | 33 +++++++++---------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/modules/dream2nix/core/lock/default.nix b/modules/dream2nix/core/lock/default.nix index 6c212cf8..5d1c7af3 100644 --- a/modules/dream2nix/core/lock/default.nix +++ b/modules/dream2nix/core/lock/default.nix @@ -133,44 +133,33 @@ json.dump(checksum, f, indent=2) ''; + updateHint = '' + To create or update the lock file, run: + + bash -c $(nix-build ${config.lock.refresh.drvPath} --no-link)/bin/refresh + + Alternatively `nix run` the .lock attribute of your package. + ''; + errorMissingFile = '' The lock file ${config.paths.package}/${config.paths.lockFile} for drv-parts module '${config.name}' is missing. - To update it without flakes: - - bash -c $(nix-build ${config.lock.refresh.drvPath} --no-link)/bin/refresh - - To update it using flakes: - - nix run -L .#${config.name}.config.lock.refresh + ${updateHint} ''; errorOutdated = '' The lock file ${config.paths.package}/${config.paths.lockFile} for drv-parts module '${config.name}' is outdated. - To update it without flakes: - - bash -c $(nix-build ${config.lock.refresh.drvPath} --no-link)/bin/refresh - - To update it using flakes: - - nix run -L .#${config.name}.config.lock.refresh + ${updateHint} ''; errorOutdatedField = field: '' The lock file ${config.paths.package}/${config.paths.lockFile} for drv-parts module '${config.name}' does not contain field `${field}`. - To update it without flakes: - - bash -c $(nix-build ${config.lock.refresh.drvPath} --no-link)/bin/refresh - - To update it using flakes: - - nix run -L .#${config.name}.config.lock.refresh - + ${updateHint} ''; fileContent =