mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-14 11:47:31 +00:00
template/package: Use fileset
This commit is contained in:
parent
2a55567fcf
commit
ec690b9358
1 changed files with 11 additions and 4 deletions
|
@ -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