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)
* Remember to mark the broken packages as `broken = true;` in the `meta`
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
[.travis.yml](./.travis.yml)
* 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.
# It should return a set of nix derivations.
# It should NOT import <nixpkgs>. Instead, you should take all dependencies as
# arguments.
# It should return a set of nix derivations
# and optionally the special attributes `lib`, `modules` and `overlays`.
# 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
, libsForQt5
, haskellPackages
, pythonPackages
# , ...
# Add here other callPackage/callApplication/... providers as the need arises
, ... }:
{ pkgs ? import <nixpkgs> {} }:
{
example-package = callPackage ./pkgs/example-package { };
# some-qt5-package = libsForQt5.callPackage ./pkgs/some-qt5-package { };
# The `lib`, `modules`, and `overlay` names are special
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
# broken your CI will not try to build them and the non-broken packages will
# be added to the cache.
{ pkgs ? import <nixpkgs> {} }:
let filterSet =
(f: s: builtins.listToAttrs
(f: g: s: builtins.listToAttrs
(map
(n: { name = n; value = builtins.getAttr n s; })
(builtins.filter
(n: f (builtins.getAttr n s))
(n: f n && g (builtins.getAttr n s))
(builtins.attrNames s)
)
)
);
in filterSet
(n: !(n=="lib"||n=="overlays"||n=="modules")) # filter out non-packages
(p: (builtins.isAttrs p)
&& !(
(builtins.hasAttr "meta" p)
@ -21,5 +23,5 @@ in filterSet
&& (p.meta.broken)
)
)
(import ./standalone.nix)
(import ./default.nix { inherit pkgs; })

View File

@ -4,12 +4,18 @@
self: super:
import ./default.nix {
callPackage = super.callPackage;
libsForQt5 = super.libsForQt5;
haskellPackages = super.haskellPackages;
pythonPackages = super.pythonPackages;
# ...
# Add here other callPackage/callApplication/... providers as the need arises
}
let filterSet =
(f: g: s: builtins.listToAttrs
(map
(n: { name = n; value = builtins.getAttr n s; })
(builtins.filter
(n: f n && g (builtins.getAttr n s))
(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 {}