-
-
Save webflo-dev/f745ef763cba2128e4b054ebc65d0323 to your computer and use it in GitHub Desktop.
Nix / NixOS : Import all files from current directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{...}: { | |
# imports by full path without copying to /nix/store | |
imports = builtins.map (n: toString ./. + "/${n}") (builtins.attrNames (builtins.removeAttrs (builtins.readDir ./.) [(builtins.unsafeGetAttrPos "_" {_ = null;}).file])); | |
# copies all files from the current directory to /nix/store and imports from /nix/store | |
# imports = builtins.map (n: "${./.}/${n}") (builtins.attrNames (builtins.removeAttrs (builtins.readDir ./.) [(builtins.unsafeGetAttrPos "_" {_ = null;}).file])); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
a more advanced implementation of this thing
https://github.com/yunfachi/nixpkgs-yunfachi/blob/master/lib/umport.nix