{ perSystem = { lib, config, ... }: { options.nci.crates = lib.mkOption { type = lib.types.lazyAttrsOf ( lib.types.submoduleWith { modules = [ { options = { numtideDevshell = lib.mkOption { type = lib.types.nullOr lib.types.str; default = null; description = '' If set, the given numtide devshell will be populated with the required packages and environment variables for this crate. ''; }; }; } ]; } ); }; config.devshells = lib.mkMerge ( lib.flatten ( lib.flip lib.mapAttrsToList config.nci.crates ( project: cfg: lib.optional (cfg.numtideDevshell != null) { ${cfg.numtideDevshell} = { packagesFrom = [ config.nci.toolchains.shell ]; packages = (lib.flatten ( map (f: [ (lib.getDev f) f ]) config.nci.outputs.${project}.devShell.packages )) ++ [ config.nci.toolchains.shell ]; env = (lib.mapAttrsToList (k: v: { name = k; value = v; }) config.nci.outputs.${project}.devShell.env) ++ [ { name = "PKG_CONFIG_PATH"; prefix = "$DEVSHELL_DIR/lib/pkgconfig"; } { name = "LD_LIBRARY_PATH"; prefix = "$DEVSHELL_DIR/lib"; } ]; }; } ) ) ); }; }