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 }:
|
{ 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
|
||||||
|
|
Loading…
Reference in a new issue