Add a command to launch a repl of the current flake.

This commit is contained in:
Tom Alexander 2025-11-20 00:34:25 -05:00
parent f651241f20
commit 3348feb613
Signed by: talexander
GPG Key ID: 36C99E8B3C39D85F
2 changed files with 29 additions and 0 deletions

View File

@ -90,6 +90,30 @@
];
};
}
(
{
config,
lib,
pkgs,
...
}:
let
repl_path = toString ./.;
nix-self-repl = pkgs.writeShellScriptBin "nix-self-repl" ''
source /etc/set-environment
nix repl "${repl_path}/repl.nix" "$@"
'';
# If we wanted the current version of a flake then we'd just launch
# nix repl
# and then run:
# :lf /path/to/flake
in
{
config = {
environment.systemPackages = lib.mkIf config.nix.enable [ nix-self-repl ];
};
}
)
];
}
) nodes;

View File

@ -0,0 +1,5 @@
let
flake = builtins.getFlake (toString ./.);
nixpkgs = import <nixpkgs> { };
in
{ inherit flake; } // flake // builtins // nixpkgs // nixpkgs.lib // flake.nixosConfigurations