{ lib, config, ... }@top: let inherit (config) flake-file; inherit (import ./../dev/modules/_lib lib) inputsExpr nixCode; inputsString = '' # DO-NOT-EDIT: Generated by github:vic/flake-file. # To re-generate use: nix-shell . -A flake-file.sh --run write-inputs '' + (nixCode { expr = inputsExpr flake-file.inputs; }); inputsFile = pkgs: pkgs.stdenvNoCC.mkDerivation { name = "inputs"; passAsFile = [ "inputsString" ]; inherit inputsString; phases = [ "copy" ]; copy = '' cp $inputsStringPath $out ''; }; write-inputs = pkgs: pkgs.writeShellApplication { name = "write-inputs"; text = '' cd ${flake-file.intoPath} cat ${inputsFile pkgs} > "''${1:-inputs.nix}" ${lib.getExe pkgs.nixfmt} "''${1:-inputs.nix}" ''; }; shell = pkgs: pkgs.mkShell { buildInputs = map (f: f pkgs) (lib.attrValues flake-file.apps); }; in { config.flake-file.apps = { inherit write-inputs; }; options.flake-file = { pkgs = lib.mkOption { type = lib.types.raw; description = "nixpkgs instance for unflake generator"; default = import (top.inputs.nixpkgs or ) { }; }; apps = lib.mkOption { type = lib.types.lazyAttrsOf (lib.types.functionTo lib.types.package); default = { }; description = "Attrs of (pkgs -> app) to include in shell"; }; intoPath = lib.mkOption { internal = true; visible = false; type = lib.types.str; default = "."; }; inputsFile = lib.mkOption { type = lib.types.raw; readOnly = true; internal = true; visible = false; default = inputsFile; }; sh = lib.mkOption { type = lib.types.raw; readOnly = true; internal = true; visible = false; default = shell flake-file.pkgs; }; }; }