instant repl for system flake with nixpkgs, use system nixpkgs for nix commands

This commit is contained in:
dusk 2021-04-17 01:38:23 +03:00
parent 4ab26233b7
commit f6fffc51ab
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA
3 changed files with 34 additions and 13 deletions

View File

@ -13,7 +13,7 @@ let
usr = { inherit utils; }; usr = { inherit utils; };
util = utils; util = utils;
nixosPersistence = "${impermanence}/nixos.nix"; nixosPersistence = "${impermanence}/nixos.nix";
nixpkgsFlake = nixpkgs; inputs = inputs;
}; };
modules = modules =

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, util, nixpkgsFlake, ... }: { config, lib, pkgs, util, inputs, ... }:
let let
inherit (util) pkgBin; inherit (util) pkgBin;
inherit (lib) fileContents mkIf; inherit (lib) fileContents mkIf;
@ -86,10 +86,25 @@ in
myip = myip =
"${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1"; "${pkgs.dnsutils}/bin/dig +short myip.opendns.com @208.67.222.222 2>&1";
sys-repl =
"source /etc/set-environment && ${nixBin} repl ${./..}/repl.nix";
}; };
}; };
nix = { nix =
let
flakes = lib.filterAttrs (name: value: value ? outputs) inputs;
nixPath = lib.mapAttrsToList
(name: _: "${name}=${inputs.${name}}")
flakes;
registry = builtins.mapAttrs
(name: v: { flake = v; })
flakes;
in
{
package = pkgs.nixFlakes; package = pkgs.nixFlakes;
autoOptimiseStore = true; autoOptimiseStore = true;
optimise.automatic = true; optimise.automatic = true;
@ -98,7 +113,8 @@ in
extraOptions = '' extraOptions = ''
experimental-features = nix-command flakes ca-references experimental-features = nix-command flakes ca-references
''; '';
registry.nixpkgs.flake = nixpkgsFlake; nixPath = nixPath ++ [ "repl=${./..}/repl.nix" ];
inherit registry;
}; };
# security = { # security = {

5
repl.nix Normal file
View File

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