Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
2.6 kB · 93 lines
Nix
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394{ lib, inputs, config, outputs, flakelight, moduleArgs, pkgsFor, ...}: let inherit (lib) warn mkOption; inherit (lib) defaultTo elemAt fileContents last length mapNullable pathExists pipe trace zipAttrsWith ;
hackPkgs = system: assert warn "Ellis's repl: current system `${system}` not supported by current flake, proceeding anyway" true; import inputs.nixpkgs { inherit system; inherit (config.nixpkgs) config; overlays = config.withOverlays ++ [config.packageOverlay]; }; getPkgs = system: pkgsFor.${system} or (hackPkgs system);
hosts = inputs.self.nixosConfigurations;
hostname = if pathExists /etc/hostname then fileContents /etc/hostname else null; thisHost = pipe hostname [ (mapNullable (hn: hosts.${hn} or null)) (defaultTo { config = {}; options = {}; }) ];
zipper = name: vals: if length vals == 1 then elemAt vals 0 else trace "repl: multiple defs for ${name}" (last vals);
# First line is to prevent the first line getting shifted banner = '' You're using: ▄ ██████ ▄▄ ▄▄ ▄▄ ▄▄▄▄ ▀ ▄▄▄▄ ▄█████ ▄▄▄ ▄▄▄ ▄▄ ██▄▄ ██ ██ ██ ███▄▄ ███▄▄ ██ ██▀██ ██▀██ ██ ██▄▄▄▄ ██▄▄▄ ██▄▄▄ ██ ▄▄██▀ ▄▄██▀ ▀█████ ▀███▀ ▀███▀ ██▄▄▄
███ ██ ▄▄ ▄▄ ▄▄ █████▄ ██████ █████▄ ██ ██ ▀▄██ ██ ▀█▄█▀ ██▄▄██▄ ██▄▄ ██▄▄█▀ ██ ██ ██ ██ ██ ██ ██ ██ ██▄▄▄▄ ██ ██████
Stuff in scope: - nixpkgs `lib` functions eg `zipAttrsWith` - all hosts eg `black-mesa` - config from the current host directly eg `programs.firefox.enable` - the values `config`, `options`, `pkgs`, `lib` - The values `self`, `flakelight`, `moduleArgs`, `outputs`, `inputs` '';in { outputs.repl = trace banner zipAttrsWith zipper [ lib thisHost.config hosts { pkgs = hosts.${hostname}.pkgs or (getPkgs builtins.currentSystem); inherit (thisHost) config options; inherit (inputs) self; inherit lib flakelight moduleArgs outputs inputs ; } ];}