Compare commits

..

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

5 changed files with 115 additions and 28 deletions

View File

@ -1,10 +1,22 @@
# maintainers # maintainers
This flake provides two bundlers that compile information about the maintainership of packages. This flake provides two [Nix bundlers](https://github.com/NixOS/bundlers) that compile information about the maintainership of packages.
## #unmaintained (#default) Usage:
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! ```
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!
Note that many derivations have no `.meta.maintainers`, e.g. `fetchTarball`. This list specificaly includes packages that _have_ a `.meta.maintainers` that is empty. Note that many derivations have no `.meta.maintainers`, e.g. `fetchTarball`. This list specificaly includes packages that _have_ a `.meta.maintainers` that is empty.

65
checks.nix Normal file
View File

@ -0,0 +1,65 @@
{
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,18 +2,40 @@
outputs = outputs =
{ self, nixpkgs, ... }: { self, nixpkgs, ... }:
let 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"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
lib = import ./lib.nix { inherit pkgs; };
inherit (lib) allMaintainers expandInput noMaintainers;
in in
{ {
bundlers."x86_64-linux" = rec { lib = forAllSystems (system: import ./lib.nix { pkgs = nixpkgsFor.${system}; });
default = unmaintained;
bundlers = forAllSystems (
system:
let
inherit (self.lib.${system}) allMaintainers expandInput noMaintainers;
in
{
default = self.bundlers.${system}.unmaintained;
all = drv: allMaintainers (expandInput drv); all = drv: allMaintainers (expandInput drv);
unmaintained = drv: noMaintainers (expandInput drv); unmaintained = drv: noMaintainers (expandInput drv);
}; }
);
formatter."x86_64-linux" = pkgs.nixfmt-rfc-style; formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
checks = forAllSystems (
system:
import ./checks.nix {
inherit self;
inherit (nixpkgs.lib) nixosSystem;
pkgs = nixpkgsFor.${system};
}
);
}; };
} }

17
lib.nix
View File

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

1
result Symbolic link
View File

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