1
0
Fork 0
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:
Robert Hensing 2024-06-30 13:01:45 +02:00 committed by GitHub
commit c3c5ecc05e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 4 deletions

View file

@ -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;

View file

@ -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