README.md: repo example
This commit is contained in:
parent
5bb26d12a9
commit
fa7b11c557
1 changed files with 58 additions and 5 deletions
63
README.md
63
README.md
|
|
@ -36,7 +36,7 @@ For NixOS add the following to your `/etc/nixos/configuration.nix`:
|
|||
nur = pkgs.callPackage (import (builtins.fetchGit {
|
||||
url = "https://github.com/nix-community/NUR";
|
||||
})) {};
|
||||
}
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -79,23 +79,76 @@ DO NOT import packages for example `with import <nixpkgs> {};`.
|
|||
Instead take all dependency you want to import from nixpkgs by function arguments.
|
||||
Each repository should return a set of nix derivations:
|
||||
|
||||
```
|
||||
```nix
|
||||
{ callPackage }:
|
||||
{
|
||||
inxi = callPackage ./inxi {};
|
||||
}
|
||||
```
|
||||
|
||||
In this example `inxi` would be a directory
|
||||
In this example `inxi` would be a directory containing a `default.nix`:
|
||||
|
||||
```nix
|
||||
{ stdenv, fetchFromGitHub
|
||||
, makeWrapper, perl
|
||||
, dmidecode, file, hddtemp, nettools, iproute, lm_sensors, usbutils, kmod, xlibs
|
||||
}:
|
||||
|
||||
let
|
||||
path = [
|
||||
dmidecode file hddtemp nettools iproute lm_sensors usbutils kmod
|
||||
xlibs.xdpyinfo xlibs.xprop xlibs.xrandr
|
||||
];
|
||||
in stdenv.mkDerivation rec {
|
||||
name = "inxi-${version}";
|
||||
version = "3.0.14-1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "smxi";
|
||||
repo = "inxi";
|
||||
rev = version;
|
||||
sha256 = "0wyv8cqwy7jlv2r3j7w8ri73iywawnaihww39vlpnpjjcz1b37hw";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
install -D -m755 inxi $out/bin/inxi
|
||||
install -D inxi.1 $out/man/man1/inxi.1
|
||||
wrapProgram $out/bin/inxi \
|
||||
--prefix PATH : ${ stdenv.lib.makeBinPath path }
|
||||
'';
|
||||
|
||||
buildInputs = [ perl ];
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "System information tool";
|
||||
homepage = https://github.com/smxi/inxi;
|
||||
license = licenses.gpl3;
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
You can use `nix-shell` or `nix-build` to build your packages:
|
||||
|
||||
```console
|
||||
$ nix-shell -E 'with import <nixpkgs>{}; (callPackage ./default.nix {}).inxi'
|
||||
nix-shell> inxi
|
||||
nix-shell> find $buildInputs
|
||||
```
|
||||
|
||||
```console
|
||||
$ nix-build -E 'with import <nixpkgs>{}; (callPackage ./default.nix {})'
|
||||
```
|
||||
|
||||
Add your own repository to in the `repos.json` of NUR:
|
||||
|
||||
```
|
||||
```console
|
||||
$ git clone https://github.com/nix-community/NUR
|
||||
# open and modify repos.json in an editor
|
||||
```
|
||||
|
||||
```
|
||||
```json
|
||||
{
|
||||
"repos": {
|
||||
"mic92": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue