mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-14 11:47:31 +00:00
Merge pull request #232 from hercules-ci/package-template
Package template
This commit is contained in:
commit
c3c5ecc05e
2 changed files with 21 additions and 4 deletions
10
flake.nix
10
flake.nix
|
@ -33,6 +33,16 @@
|
|||
A minimal flake using flake-parts importing nixpkgs with the unfree option.
|
||||
'';
|
||||
};
|
||||
package = {
|
||||
path = ./template/package;
|
||||
description = ''
|
||||
A flake with a simple package:
|
||||
- Nixpkgs
|
||||
- callPackage
|
||||
- src with fileset
|
||||
- a check with runCommand
|
||||
'';
|
||||
};
|
||||
};
|
||||
flakeModules = {
|
||||
easyOverlay = ./extras/easyOverlay.nix;
|
||||
|
|
|
@ -1,12 +1,19 @@
|
|||
{ stdenv, lib, runtimeShell }:
|
||||
|
||||
let
|
||||
# Bring fileset functions into scope.
|
||||
# See https://nixos.org/manual/nixpkgs/stable/index.html#sec-functions-library-fileset
|
||||
inherit (lib.fileset) toSource unions;
|
||||
in
|
||||
|
||||
# Example package in the style that `mkDerivation`-based packages in Nixpkgs are written.
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
name = "hello";
|
||||
src = lib.cleanSourceWith {
|
||||
src = ./.;
|
||||
filter = path: type:
|
||||
type == "regular" -> baseNameOf path == "hello.sh";
|
||||
src = toSource {
|
||||
root = ./.;
|
||||
fileset = unions [
|
||||
./hello.sh
|
||||
];
|
||||
};
|
||||
buildPhase = ''
|
||||
# Note that Nixpkgs has builder functions for simple packages
|
||||
|
|
Loading…
Reference in a new issue