diff --git a/nix/configuration/flake.nix b/nix/configuration/flake.nix index af0ac6d9..3b857a9e 100644 --- a/nix/configuration/flake.nix +++ b/nix/configuration/flake.nix @@ -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; diff --git a/nix/configuration/repl.nix b/nix/configuration/repl.nix new file mode 100644 index 00000000..e21db83b --- /dev/null +++ b/nix/configuration/repl.nix @@ -0,0 +1,5 @@ +let + flake = builtins.getFlake (toString ./.); + nixpkgs = import { }; +in +{ inherit flake; } // flake // builtins // nixpkgs // nixpkgs.lib // flake.nixosConfigurations