diff --git a/README.md b/README.md index 1610dcc..a4f4ad9 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ mkShell { - `defaultLicense`: the default license SPDX identifier used accross the project. - `defaultCopyright`: the default copyright text used accross the project. +- `downloadLicenses`: whether to download automatically the missing licenses detectd in the project. - `annotations`: The list of [annotations](https://reuse.software/spec-3.3/#reusetoml) for this project ### reuse git-hook diff --git a/default.nix b/default.nix index afa1563..2804a7f 100644 --- a/default.nix +++ b/default.nix @@ -65,6 +65,8 @@ let defaultLicense = "EUPL-1.2"; defaultCopyright = "2024 Tom Hubrecht "; + downloadLicenses = true; + annotations = [ # Basic paths { diff --git a/modules/reuse.nix b/modules/reuse.nix index 3597667..f8badb8 100644 --- a/modules/reuse.nix +++ b/modules/reuse.nix @@ -12,15 +12,18 @@ let inherit (lib) filterAttrs + getExe getExe' mapAttrs' mkDefault mkOption nameValuePair + optionalString ; inherit (lib.types) attrsOf + bool either enum listOf @@ -76,6 +79,14 @@ in ''; }; + downloadLicenses = mkOption { + type = bool; + default = false; + description = '' + Try to download all licenses present in the configuration. + ''; + }; + annotations = mkOption { type = listOf ( submodule ( @@ -175,6 +186,8 @@ in cp --no-preserve=mode,ownership ${result} "$GIT_WC/REUSE.toml" && echo "nix-reuse: Updated REUSE.toml" fi fi + + ${optionalString config.downloadLicenses "${getExe pkgs.reuse} download --all"} ''; }; }