Add a nix-flake-repl script.

This commit is contained in:
Tom Alexander
2026-01-01 10:52:00 -05:00
parent d883dda34c
commit 70f3ae6894
6 changed files with 42 additions and 49 deletions

View File

@@ -0,0 +1,38 @@
{
config,
lib,
pkgs,
self,
...
}:
let
nix-flake-repl = pkgs.writeShellScriptBin "nix-flake-repl" ''
source /etc/set-environment
target="''${1:-$(pwd)}"
nix repl --expr "builtins.getFlake \"''$target\""
'';
nix-self-repl = pkgs.writeShellScriptBin "nix-self-repl" ''
source /etc/set-environment
nix repl --expr 'builtins.getFlake "${self}"'
'';
in
{
imports = [ ];
options.me = {
nix_repl.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install nix_repl.";
};
};
config = lib.mkIf config.me.nix_repl.enable {
environment.systemPackages = [
nix-flake-repl
nix-self-repl
];
};
}