Update to the new NUR format

See https://github.com/nix-community/NUR/issues/45
master
Francesco Gazzetta 2018-07-21 15:55:00 +02:00
parent 3ad2553ead
commit 8055d108f0
8 changed files with 54 additions and 32 deletions

View File

@ -9,6 +9,7 @@
[default.nix](./default.nix) [default.nix](./default.nix)
* Remember to mark the broken packages as `broken = true;` in the `meta` * Remember to mark the broken packages as `broken = true;` in the `meta`
attribute, or travis (and consequently caching) will fail! attribute, or travis (and consequently caching) will fail!
* Library functions, modules and overlays go in the respective directories
3. Add your NUR repo name and your cachix repo name (optional) to 3. Add your NUR repo name and your cachix repo name (optional) to
[.travis.yml](./.travis.yml) [.travis.yml](./.travis.yml)
* If you use cachix you should also add your cache's private key to travis' * If you use cachix you should also add your cache's private key to travis'

View File

@ -1,19 +1,21 @@
# This file describes your repository contents. # This file describes your repository contents.
# It should return a set of nix derivations. # It should return a set of nix derivations
# It should NOT import <nixpkgs>. Instead, you should take all dependencies as # and optionally the special attributes `lib`, `modules` and `overlays`.
# arguments. # It should NOT import <nixpkgs>. Instead, you should take pkgs as an argument.
# Having pkgs default to <nixpkgs> is fine though, and it lets you use short
# commands such as:
# nix-build -A mypackage
{ callPackage { pkgs ? import <nixpkgs> {} }:
, libsForQt5
, haskellPackages
, pythonPackages
# , ...
# Add here other callPackage/callApplication/... providers as the need arises
, ... }:
{ {
example-package = callPackage ./pkgs/example-package { }; # The `lib`, `modules`, and `overlay` names are special
# some-qt5-package = libsForQt5.callPackage ./pkgs/some-qt5-package { }; lib = import ./lib { inherit pkgs; }; # functions
modules = import ./modules; # NixOS modules
overlays = import ./overlays; # nixpkgs overlays
example-package = pkgs.callPackage ./pkgs/example-package { };
# some-qt5-package = pkgs.libsForQt5.callPackage ./pkgs/some-qt5-package { };
# ... # ...
} }

8
lib/default.nix Normal file
View File

@ -0,0 +1,8 @@
{ pkgs }:
with pkgs.lib; {
# Add your library functions here
#
# hexint = x: hexvals.${toLower x};
}

6
modules/default.nix Normal file
View File

@ -0,0 +1,6 @@
{
# Add your NixOS modules here
#
# my-module = import ./my-module;
}

View File

@ -2,18 +2,20 @@
# It's what gets built by CI, so if you correctly mark broken packages as # It's what gets built by CI, so if you correctly mark broken packages as
# broken your CI will not try to build them and the non-broken packages will # broken your CI will not try to build them and the non-broken packages will
# be added to the cache. # be added to the cache.
{ pkgs ? import <nixpkgs> {} }:
let filterSet = let filterSet =
(f: s: builtins.listToAttrs (f: g: s: builtins.listToAttrs
(map (map
(n: { name = n; value = builtins.getAttr n s; }) (n: { name = n; value = builtins.getAttr n s; })
(builtins.filter (builtins.filter
(n: f (builtins.getAttr n s)) (n: f n && g (builtins.getAttr n s))
(builtins.attrNames s) (builtins.attrNames s)
) )
) )
); );
in filterSet in filterSet
(n: !(n=="lib"||n=="overlays"||n=="modules")) # filter out non-packages
(p: (builtins.isAttrs p) (p: (builtins.isAttrs p)
&& !( && !(
(builtins.hasAttr "meta" p) (builtins.hasAttr "meta" p)
@ -21,5 +23,5 @@ in filterSet
&& (p.meta.broken) && (p.meta.broken)
) )
) )
(import ./standalone.nix) (import ./default.nix { inherit pkgs; })

View File

@ -4,12 +4,18 @@
self: super: self: super:
import ./default.nix { let filterSet =
callPackage = super.callPackage; (f: g: s: builtins.listToAttrs
libsForQt5 = super.libsForQt5; (map
haskellPackages = super.haskellPackages; (n: { name = n; value = builtins.getAttr n s; })
pythonPackages = super.pythonPackages; (builtins.filter
# ... (n: f n && g (builtins.getAttr n s))
# Add here other callPackage/callApplication/... providers as the need arises (builtins.attrNames s)
} )
)
);
in filterSet
(n: !(n=="lib"||n=="overlays"||n=="modules")) # filter out non-packages
(p: true) # all packages are ok
(import ./default.nix { pkgs = super; })

6
overlays/default.nix Normal file
View File

@ -0,0 +1,6 @@
{
# Add your overlays here
#
# my-overlay = import ./my-overlay;
}

View File

@ -1,9 +0,0 @@
# You can use this file to build packages without adding the NUR namespace
# or the overlay to your configuration.
# It's also useful for testing and working on the packages.
#
# example:
# nix-build ./standalone.nix -A mypackage
with import <nixpkgs> {}; callPackage ./default.nix {}