diff --git a/flake.nix b/flake.nix index 519c1ba3..0f633040 100644 --- a/flake.nix +++ b/flake.nix @@ -15,11 +15,16 @@ exportPackages = import ./lib/exportPackages.nix fupArgs; genPkgOverlay = import ./lib/genPkgOverlay.nix; internal-functions = import ./lib/internal-functions.nix; - overlay = import ./lib/overlay.nix; + overlay = final: prev: { + __dontExport = true; + fup-repl = final.callPackage ./lib/fup-repl.nix { }; + }; + in rec { inherit overlay; + blueprints.fup-repl = ./lib/fup-repl.nix; nixosModules.autoGenFromInputs = import ./lib/options.nix; darwinModules.autoGenFromInputs = import ./lib/options.nix; diff --git a/lib/fup-repl.nix b/lib/fup-repl.nix new file mode 100644 index 00000000..7db79c2e --- /dev/null +++ b/lib/fup-repl.nix @@ -0,0 +1,20 @@ +{ writeShellScriptBin, coreutils, gnused }: +let + example = command: desc: ''\n\u001b[33m ${command}\u001b[0m - ${desc}''; +in +writeShellScriptBin "repl" '' + case "$1" in + "-h"|"--help"|"help") + printf "%b\n\e[4mUsage\e[0m: \ + ${example "repl" "Loads system flake if available."} \ + ${example "repl /path/to/flake.nix" "Loads specified flake."}\n" + ;; + *) + if [ -z "$1" ]; then + nix repl ${./repl.nix} + else + nix repl --arg flakePath $(${coreutils}/bin/readlink -f $1 | ${gnused}/bin/sed 's|/flake.nix||') ${./repl.nix} + fi + ;; + esac +'' diff --git a/lib/overlay.nix b/lib/overlay.nix deleted file mode 100644 index fedbfd77..00000000 --- a/lib/overlay.nix +++ /dev/null @@ -1,25 +0,0 @@ -final: prev: -let - example = command: desc: ''\n\u001b[33m ${command}\u001b[0m - ${desc}''; -in -{ - __dontExport = true; - - fup-repl = final.writeShellScriptBin "repl" '' - case "$1" in - "-h"|"--help"|"help") - printf "%b\n\e[4mUsage\e[0m: \ - ${example "repl" "Loads system flake if available."} \ - ${example "repl /path/to/flake.nix" "Loads specified flake."}\n" - ;; - *) - if [ -z "$1" ]; then - nix repl ${./repl.nix} - else - nix repl --arg flakePath $(${final.coreutils}/bin/readlink -f $1 | ${final.gnused}/bin/sed 's|/flake.nix||') ${./repl.nix} - fi - ;; - esac - ''; -} -