Autogenerated documentation from ./cells/std/*
.
Cell: std
The std
Cell
β¦ is the only cell in divnix/std
and provides only very limited functionality.
- It contains the TUI, in
./cli
. - It contains a
devshellProfile
in./devshellProfiles
. - It contains a growing number of second level library functions in
./lib
. - Packages that are used in std devshells are proxied in
./packages
.
Thatβs it.
Block: cli
No documentation
Block: devshellProfiles
std
βs devshellProfiles
This Cell Block only exports a single default
devshellProfile.
Any std
ized repository should include this into its numtide/devshell
in order to provide any visitor with the fully pre-configured std
TUI.
It also wires & instantiates a decent ADR tool. Or were you planning to hack away without some minimal conscious effort of decision making and recording? π
Usage Example
# ./nix/_automation/devshells.nix
{
inputs,
cell,
}: let
l = nixpkgs.lib // builtins;
inherit (inputs) nixpkgs;
inherit (inputs.std) std;
in
l.mapAttrs (_: std.lib.mkShell) {
# `default` is a special target in newer nix versions
# see: harvesting below
default = {
name = "My Devshell";
# make `std` available in the numtide/devshell
imports = [ std.devshellProfiles.default ];
};
}
# ./flake.nix
{
inputs.std.url = "github:divnix/std";
outputs = inputs:
inputs.std.growOn {
inherit inputs;
cellsFrom = ./nix;
cellBlocks = [
/* ... */
(inputs.std.blockTypes.devshells "devshells")
];
}
# soil for compatiblity ...
{
# ... with `nix develop` - `default` is a special target for `nix develop`
devShells = inputs.std.harvest inputs.self ["automation" "devshells"];
};
}
Target: default
No description
This Cell Block has only a single target, called default
.
Please consult the Cell Blockβs Readme for more information.
Block: errors
Error Message Functions
This Cell Block comprises several error message functions that can be used in different situations.
Target: removeBy
No description
removeBy
{inputs}: time: body: let
l = inputs.nixpkgs.lib // builtins;
ansi = import ./ansi.nix;
pad = s: let
n = 17;
prefix = l.concatStringsSep "" (l.genList (_: " ") (n - (l.stringLength s)));
in
prefix + s;
indent = s: let
n = 5;
prefix = l.concatStringsSep "" (l.genList (_: " ") n);
lines = l.splitString "\n" s;
in
" π β " + (l.concatStringsSep "\n${prefix}β " lines);
warn = let
apply =
l.replaceStrings
(map (key: "{${key}}") (l.attrNames ansi))
(l.attrValues ansi);
in
msg:
l.trace (apply "π₯ {bold}{196}Standard Deprecation Notices - {220}run `std check' to show!{reset}")
l.traceVerbose (apply "\n{202}${msg}{reset}");
in
warn ''
ββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
πͺ β {bold}Action Required !{un-bold}
ββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
{italic}${indent body}{un-italic}
ββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π
β {bold}Scheduled Removal: ${pad time}{un-bold}
ββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
''
Target: requireInput
No description
requireInput
{inputs}: input: url: target: let
l = inputs.nixpkgs.lib // builtins;
# other than `divnix/blank`
isBlank = input: inputs.${input}.sourceInfo.narHash == "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=";
ansi = import ./ansi.nix;
pad = n: s: let
prefix = l.concatStringsSep "" (l.genList (_: " ") n);
in
prefix + s;
indent = s: let
n = 5;
prefix = l.concatStringsSep "" (l.genList (_: " ") n);
lines = l.splitString "\n" s;
in
l.concatStringsSep "\n${prefix}β " lines;
warn = let
apply =
l.replaceStrings
(map (key: "{${key}}") (l.attrNames ansi))
(l.attrValues ansi);
in
msg: l.trace (apply "π {bold}{200}Standard Input Overloading{reset}${msg}") "";
body = ''
In order to use ${target}, add to {bold}flake.nix{un-bold}:
inputs.std.inputs.${input}.url =
"${url}";
'';
inputs' = let
names = l.attrNames (l.removeAttrs inputs ["self" "cells" "blank"]);
nameLengths = map l.stringLength names;
maxNameLength =
l.foldl'
(max: v:
if v > max
then v
else max)
0
nameLengths;
lines =
l.map (
name: "- ${name}${
if isBlank name
then pad (maxNameLength - (l.stringLength name)) " | blanked out"
else ""
}"
)
names;
in
"Declared Inputs:\n" + (l.concatStringsSep "\n" lines);
in
assert l.assertMsg (! (isBlank input)) (warn ''
ββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ποΈ β {bold}Input Overloading for ${target}{un-bold}
ββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π β {italic}${indent body}{un-italic}
ββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π β ${indent inputs'}
ββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
''); inputs
Block: nixago
No documentation
Block: packages
No documentation