Declarative configuration of REUSE in your Nix shells
Find a file
2024-12-12 10:34:37 +01:00
LICENSES feat(nix-reuse): Init 2024-12-12 10:18:22 +01:00
modules feat(nix-reuse): Disable the version option 2024-12-12 10:34:13 +01:00
npins feat(nix-reuse): Init 2024-12-12 10:18:22 +01:00
.envrc feat(nix-reuse): Init 2024-12-12 10:18:22 +01:00
.gitignore feat(nix-reuse): Init 2024-12-12 10:18:22 +01:00
default.nix feat(nix-reuse): Init 2024-12-12 10:18:22 +01:00
README.md fix(README): This is not nix-actions 2024-12-12 10:34:37 +01:00
REUSE.toml feat(nix-reuse): Init 2024-12-12 10:18:22 +01:00
shell.nix feat(nix-reuse): Init 2024-12-12 10:18:22 +01:00

Integration of reuse with Nix

Features

  • Provides a shell hook to generate the REUSE.toml file
  • Provides a hook to be used with git-hooks.nix

Getting started

REUSE.toml generation

npins

  1. Add nix-reuse to your sources:
npins add git https://git.dgnum.eu/DGNum/nix-reuse
  1. Integrate workflows to shell.nix:
let
    sources = import ./npins;
    reuse = (import sources.nix-reuse { }).install {
        defaultLicense = "EUPL-1.2";
        defaultCopyright = "Jane Doe <jane.doe@example.com>";

        annotations = [
            {
                path = [
                    ".envrc"
                    ".gitignore"
                    "REUSE.toml"
                ];
            }
            {
                path = "npins/*";
                license = "EUPL-1.2";
                copyright = "The [npins](https://github.com/andir/npins) contributors";
            }
        ];
    };
in

with (import sources.nixpkgs { });

mkShell {
    packages = [ ... ];

    inherit (reuse) shellHook;
}

Options

  • defaultLicense: the default license SPDX identifier used accross the project.
  • defaultCopyright: the default copyright text used accross the project.
  • annotations: The list of annotations for this project

reuse git-hook

npins

  1. Add nix-reuse to your sources:
npins add git https://git.dgnum.eu/DGNum/nix-reuse
  1. Integrate reuse to git hooks:
let
    sources = import ./npins;
    git-checks = (import sources."git-hooks.nix").run {
        src = ./.;

        hooks = {
            reuse = (import sources.nix-reuse { }).hook {
                enable = true;
            };
        };
    };
in

with (import sources.nixpkgs { });

mkShell {
    packages = [ ... ];

    inherit (git-checks) shellHook;
}