mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-09-11 14:35:30 +03:00
examples: add readme for packages examples
This commit is contained in:
parent
62f9486535
commit
0f2d06b43e
34
examples/packages/README.md
Normal file
34
examples/packages/README.md
Normal file
@ -0,0 +1,34 @@
|
||||
# package examples
|
||||
|
||||
This directory contains examples for modules defining packages.
|
||||
All modules can be used as templates to create new packages.
|
||||
|
||||
Each package module is defined by a directory containing a `default.nix`.
|
||||
|
||||
## How to use
|
||||
|
||||
All examples are self contained via their own `flake.nix`.
|
||||
|
||||
To use multiple packages in a repository, keep only each packages' `default.nix` and put them under a top-level `flake.nix` instead, as shown in the `repo examples` in [/examples](../../examples).
|
||||
|
||||
## Usage example
|
||||
|
||||
For example, in order to initialize a php-package from `packages/single-language/php-package/`:
|
||||
|
||||
```shellSession
|
||||
# create new single package repo for php
|
||||
$ mkdir my-dream2nix-package
|
||||
$ cd my-dream2nix-package
|
||||
$ nix flake init -t github:nix-community/dream2nix#templates.php-package
|
||||
wrote: /tmp/my-dream2nix-package/flake.nix
|
||||
wrote: /tmp/my-dream2nix-package/default.nix
|
||||
|
||||
# git add (in case git is used)
|
||||
git add .
|
||||
|
||||
# interact with the package
|
||||
$ nix flake show
|
||||
[...]
|
||||
$ nix build
|
||||
[...]
|
||||
```
|
@ -20,7 +20,10 @@
|
||||
|
||||
dream2nixFlake = import ../../. {};
|
||||
|
||||
packageCategories = readDir ../../examples/packages;
|
||||
packageCategories =
|
||||
lib.filterAttrs
|
||||
(name: type: type == "directory")
|
||||
(readDir ../../examples/packages);
|
||||
|
||||
readExamples = dirName: let
|
||||
examplesPath = ../../examples/packages + "/${dirName}";
|
||||
|
Loading…
Reference in New Issue
Block a user