mirror of
https://github.com/willemml/dotfiles.nix.git
synced 2025-04-12 19:27:17 +00:00
36 lines
1 KiB
Nix
36 lines
1 KiB
Nix
# Copyright (c) 2018 Terje Larsen
|
|
|
|
# This work is licensed under the terms of the MIT license.
|
|
# For a copy, see https://opensource.org/licenses/MIT.
|
|
|
|
# https://github.com/terlar/nix-config/blob/00c8a3622e8bc4cb522bbf335e6ede04ca07da40/flake-parts/lib/default.nix
|
|
|
|
{ self
|
|
, lib
|
|
, ...
|
|
}: {
|
|
flake.lib = {
|
|
kebabCaseToCamelCase =
|
|
builtins.replaceStrings (map (s: "-${s}") lib.lowerChars) lib.upperChars;
|
|
|
|
importDirToAttrs = dir:
|
|
lib.pipe dir [
|
|
lib.filesystem.listFilesRecursive
|
|
(builtins.filter (lib.hasSuffix ".nix"))
|
|
(map (path: {
|
|
name = lib.pipe path [
|
|
toString
|
|
(lib.removePrefix "${toString dir}/")
|
|
(lib.removeSuffix "/default.nix")
|
|
(lib.removeSuffix ".nix")
|
|
self.lib.kebabCaseToCamelCase
|
|
(builtins.replaceStrings [ "/" ] [ "-" ])
|
|
];
|
|
value = import path;
|
|
}))
|
|
builtins.listToAttrs
|
|
];
|
|
|
|
mk-mac-binpkg = import ../../packages/mk-mac-binpkg.nix;
|
|
};
|
|
}
|