1
0
Fork 0
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:
Robert Hensing 2024-06-30 12:54:51 +02:00
parent 2a55567fcf
commit ec690b9358

View file

@ -1,12 +1,19 @@
{ stdenv, lib, runtimeShell }: { 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. # Example package in the style that `mkDerivation`-based packages in Nixpkgs are written.
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
name = "hello"; name = "hello";
src = lib.cleanSourceWith { src = toSource {
src = ./.; root = ./.;
filter = path: type: fileset = unions [
type == "regular" -> baseNameOf path == "hello.sh"; ./hello.sh
];
}; };
buildPhase = '' buildPhase = ''
# Note that Nixpkgs has builder functions for simple packages # Note that Nixpkgs has builder functions for simple packages