Skip to content

Commit

Permalink
feat: implement fup-repl blueprint #127
Browse files Browse the repository at this point in the history
  • Loading branch information
gytis-ivaskevicius committed Oct 2, 2023
1 parent f9d088f commit 24b3a16
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
7 changes: 6 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
20 changes: 20 additions & 0 deletions lib/fup-repl.nix
Original file line number Diff line number Diff line change
@@ -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
''
25 changes: 0 additions & 25 deletions lib/overlay.nix

This file was deleted.

0 comments on commit 24b3a16

Please sign in to comment.