Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Extracted the skeleton from https://github.com/fgaz/nur-packages.git
  • Loading branch information
fgaz committed Jul 16, 2018
0 parents commit dd95bed
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
result
result-*

23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
language: nix

sudo: false

env:
global:
- CACHIX_CACHE=
- NUR_REPO=<YOUR_NUR_REPO_NAME_HERE>

install:
- nix --version
- travis_retry nix-channel --update
- if [ -n "${CACHIX_CACHE}" ]; then nix-env -if https://github.com/cachix/cachix/tarball/master --substituters https://cachix.cachix.org --trusted-public-keys cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM=; fi
- if [ -n "${CACHIX_CACHE}" ]; then cachix use "${CACHIX_CACHE}"; fi

script:
- export outs=$(nix-build non-broken.nix)
- echo Produced $outs

after_success:
- if [ -n "${CACHIX_CACHE}" ]; then cachix push "${CACHIX_CACHE}" $outs; fi
- curl -XPOST "https://nur-update.herokuapp.com/update?repo=${NUR_REPO}"

22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2018 Francesco Gazzetta

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# nur-packages-template

**A template for [NUR](https://github.com/nix-community/NUR) repositories**

## Setup

1. Fork this repo
2. Add your packages to the [pkgs](./pkgs) directory and to
[default.nix](./default.nix)
* Remember to mark the broken packages as `broken = true;` in the `meta`
attribute, or travis (and consequently caching) will fail!
3. Add your NUR repo name and your cachix repo name (optional) to
[.travis.yml](./.travis.yml)
4. Enable travis for your repo
5. Change your travis and cachix names on the README template section and delete
the rest
6. [Add yourself to NUR](https://github.com/nix-community/NUR#how-to-add-your-own-repository)

## README template

# nur-packages

**My personal [NUR](https://github.com/nix-community/NUR) repository**

[![Build Status](https://travis-ci.com/<YOUR_TRAVIS_USERNAME>/nur-packages.svg?branch=master)](https://travis-ci.com/<YOUR_TRAVIS_USERNAME>/nur-packages)
[![Cachix Cache](https://img.shields.io/badge/cachix-<YOUR_CACHIX_USERNAME>-blue.svg)](https://<YOUR_CACHIX_USERNAME>.cachix.org)


19 changes: 19 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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.

{ callPackage
, libsForQt5
, haskellPackages
, pythonPackages
# , ...
# Add here other callPackage/callApplication/... providers as the need arises
, ... }:

{
example-package = callPackage ./pkgs/example-package { };
# some-qt5-package = libsForQt5.callPackage ./pkgs/some-qt5-package { };
# ...
}

25 changes: 25 additions & 0 deletions non-broken.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file filters out all the broken packages from your package set.
# 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.

let filterSet =
(f: s: builtins.listToAttrs
(map
(n: { name = n; value = builtins.getAttr n s; })
(builtins.filter
(n: f (builtins.getAttr n s))
(builtins.attrNames s)
)
)
);
in filterSet
(p: (builtins.isAttrs p)
&& !(
(builtins.hasAttr "meta" p)
&& (builtins.hasAttr "broken" p.meta)
&& (p.meta.broken)
)
)
(import ./standalone.nix)

15 changes: 15 additions & 0 deletions overlay.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# You can use this file as a nixpkgs overlay.
# It's useful in the case where you don't want to add the whole NUR namespace
# to your configuration.

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
}

9 changes: 9 additions & 0 deletions pkgs/example-package/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{ stdenv }:

stdenv.mkDerivation rec {
name = "example-package-${version}";
version = "1.0";
buildPhase = "echo echo Hello World > example";
installPhase = "install -Dm755 example $out";
}

9 changes: 9 additions & 0 deletions standalone.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 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 {}

0 comments on commit dd95bed

Please sign in to comment.