Nixpkgs: Difference between revisions

imported>Puzzlewolf
m update reference to current stable version
imported>User
No edit summary
Line 110: Line 110:


=== Building all of the packages you maintain ===
=== Building all of the packages you maintain ===
Save as build.nix inside nixpkgs git clone. This snippet is based on maintainers/scripts/update.nix script.
<syntaxhighlight lang="nix">
{ pkgs ? import <nixpkgs> {}, maintainer }:
with pkgs.lib;
let
  maintainer_ = maintainers.${maintainer};
  packagesWith = cond: return: set:
      (pkgs.lib.flatten
        (pkgs.lib.mapAttrsToList
          (name: pkg:
            let
              result = builtins.tryEval (
                if pkgs.lib.isDerivation pkg && cond name pkg
                  then [(return name pkg)]
                else if pkg.recurseForDerivations or false || pkg.recurseForRelease or false
                  then packagesWith cond return pkg
                else []
              );
            in
              if result.success then result.value
              else []
          )
          set
        )
      );
in     
      packagesWith (name: pkg:
                                (if builtins.hasAttr "maintainers" pkg.meta
                                  then (if builtins.isList pkg.meta.maintainers
                                          then builtins.elem maintainer_ pkg.meta.maintainers
                                          else maintainer_ == pkg.meta.maintainers
                                        )
                                  else false
                                )
                  )
                  (name: pkg: pkg)
                  pkgs
</syntaxhighlight>
Run the command:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
nix-build build.nix --argstr maintainer your-nick
nix-build maintainers/scripts/build.nix --argstr maintainer your-nick
</syntaxhighlight>
</syntaxhighlight>