Compare commits

...

No commits in common. "github" and "master" have entirely different histories.

5 changed files with 28 additions and 115 deletions

View File

@ -1,25 +1,13 @@
# maintainers
This flake provides two [Nix bundlers](https://github.com/NixOS/bundlers) that compile information about the maintainership of packages.
This flake provides two bundlers that compile information about the maintainership of packages.
Usage:
## #unmaintained (#default)
```
nix bundle --bundler github:Jaculabilis/maintainers [installable]
```
where `installable` is a flake reference to a derivation or a NixOS configuration. For example, if you have NixOS configs on GitHub, you would use `github:myusername/nixos-configs#nixosConfigurations.mycomputer`. If your configs are elsewhere, you could use the more generic `git+https://git.example.com/myusername/nixos-configs#nixosConfigurations.mycomputer`, or even run against a local checkout using `path:.#nixosConfigurations.mycomputer`.
The default bundler is `#unmaintained`. You can specify a bundler by name using `--bundler github:Jaculabilis/maintainers#bundlername`.
## Bundlers
### unmaintained
This bundler accepts a derivation or a NixOS configuration and returns a report containing a list of derivations in the closure of the input that have no maintainer in nixpkgs. (Put simply: it returns a list of unmaintained dependency packages.) Each package is accompanied by a link to the package source in nixpkgs. If you see a package in your report that you care about, sign up as a maintainer!
This bundler accepts a derivation or a NixOS configuration and returns a report containing a list of derivations in the closure of the input that have no maintainer in nixpkgs. Each package is accompanied by a link to the package source in nixpkgs. If you see a package in your report that you care about, sign up as a maintainer!
Note that many derivations have no `.meta.maintainers`, e.g. `fetchTarball`. This list specificaly includes packages that _have_ a `.meta.maintainers` that is empty.
### all
## #all
This bundler accepts a derivation or a NixOS configuration and returns a report containing a list of every derivation in the closure of the input and the GitHub usernames of the maintainers. You can use this to see if there are packages you depend on that could use some additional maintainership, e.g. yours!

View File

@ -1,65 +0,0 @@
{
self,
nixosSystem,
pkgs,
...
}:
let
# A dummy package with no maintainer
orphanPkg = pkgs.stdenv.mkDerivation {
name = "dummy-unmaintained-package";
installPhase = ''
echo "dummy-unmaintained-package" > $out
'';
meta = {
maintainers = [ ];
};
};
# A dummy package with a maintainer
parentPkg = pkgs.stdenv.mkDerivation {
name = "dummy-maintained-package";
buildInputs = [ orphanPkg ];
installPhase = ''
echo "dummy-maintained-package" > $out
'';
meta = {
maintainers = [ { github = "github"; } ];
};
};
# A dummy NixOS config with an unmaintained package in its closure
config = nixosSystem {
inherit (pkgs) system;
modules = [
(
{ ... }:
{
environment.systemPackages = [ parentPkg ];
# Boilerplate so nixosSystem compiles
fileSystems."/" = {
device = "/dev/dvd";
fsType = "ext4";
};
boot.loader.grub.device = "/dev/dvd";
system.stateVersion = "24.05";
}
)
];
};
inherit (self.bundlers.${pkgs.system}) all unmaintained;
grepCheck =
name: search: target:
pkgs.runCommandLocal name { } ''
wc -l ${target} >> test.log
grep ${search} ${target} >> test.log
cp test.log $out
'';
in
{
package = grepCheck "package" orphanPkg.name (unmaintained orphanPkg);
packageClosure = grepCheck "packageClosure" orphanPkg.name (unmaintained parentPkg);
configClosure = grepCheck "configClosure" orphanPkg.name (unmaintained config);
}

View File

@ -2,40 +2,18 @@
outputs =
{ self, nixpkgs, ... }:
let
supportedSystems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
lib = import ./lib.nix { inherit pkgs; };
inherit (lib) allMaintainers expandInput noMaintainers;
in
{
lib = forAllSystems (system: import ./lib.nix { pkgs = nixpkgsFor.${system}; });
bundlers."x86_64-linux" = rec {
default = unmaintained;
all = drv: allMaintainers (expandInput drv);
unmaintained = drv: noMaintainers (expandInput drv);
};
bundlers = forAllSystems (
system:
let
inherit (self.lib.${system}) allMaintainers expandInput noMaintainers;
in
{
default = self.bundlers.${system}.unmaintained;
all = drv: allMaintainers (expandInput drv);
unmaintained = drv: noMaintainers (expandInput drv);
}
);
formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
checks = forAllSystems (
system:
import ./checks.nix {
inherit self;
inherit (nixpkgs.lib) nixosSystem;
pkgs = nixpkgsFor.${system};
}
);
formatter."x86_64-linux" = pkgs.nixfmt-rfc-style;
};
}

17
lib.nix
View File

@ -1,6 +1,7 @@
{ pkgs, ... }:
let
inherit (builtins)
genericClosure
hasAttr
head
length
@ -9,7 +10,16 @@ let
tail
;
inherit (pkgs) runCommandLocal writeText;
inherit (pkgs.lib) concatLines concatStringsSep filter;
inherit (pkgs.lib)
concatLines
concatLists
concatMap
concatStringsSep
filter
isDerivation
isList
mapAttrsToList
;
inherit (import ./closure.nix { inherit pkgs; }) drvClosure;
in
rec {
@ -61,7 +71,10 @@ rec {
expandInput =
input:
if (input.class or null == "nixos") && (input._type or null == "configuration") then
[ input.config.system.build.toplevel ] ++ input.config.environment.systemPackages
[
input.config.system.build.toplevel
input.config.environment.systemPackages
]
else
input;
}

1
result
View File

@ -1 +0,0 @@
/nix/store/jji7927zp2qx8j5yazg8hj32mgpqlf76-check-nixos-config