mirror of
https://codeberg.org/privacy1st/nix-git
synced 2024-12-23 02:36:05 +01:00
contact info
This commit is contained in:
parent
553a10c92d
commit
1b1f941528
@ -2,11 +2,47 @@
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
# TODO: Once `lib.string.trim` is available in stable nix, remove the below.
|
||||
# Copied from https://github.com/NixOS/nixpkgs/blob/5633bcff0c6162b9e4b5f1264264611e950c8ec7/lib/strings.nix#L362-L434
|
||||
trim = trimWith {
|
||||
start = true;
|
||||
end = true;
|
||||
};
|
||||
trimWith =
|
||||
{
|
||||
start ? false,
|
||||
end ? false,
|
||||
}:
|
||||
let
|
||||
# Define our own whitespace character class instead of using
|
||||
# `[:space:]`, which is not well-defined.
|
||||
chars = " \t\r\n";
|
||||
|
||||
# To match up until trailing whitespace, we need to capture a
|
||||
# group that ends with a non-whitespace character.
|
||||
regex =
|
||||
if start && end then
|
||||
"[${chars}]*(.*[^${chars}])[${chars}]*"
|
||||
else if start then
|
||||
"[${chars}]*(.*)"
|
||||
else if end then
|
||||
"(.*[^${chars}])[${chars}]*"
|
||||
else
|
||||
"(.*)";
|
||||
in
|
||||
s:
|
||||
let
|
||||
# If the string was empty or entirely whitespace,
|
||||
# then the regex may not match and `res` will be `null`.
|
||||
res = lib.match regex s;
|
||||
in
|
||||
lib.optionalString (res != null) (lib.head res);
|
||||
|
||||
contact_name = "Daniel Langbein";
|
||||
# The file `phone-number` contains only one line with our phone number, e.g. +49 0173 ...
|
||||
# Be aware that the phone number will be written to the nix store in plaintext!
|
||||
# TODO: strip the read string (no tailing newlines)
|
||||
contact_phone = (builtins.readFile ../secrets/phone-number);
|
||||
contact_phone = trim (builtins.readFile ../secrets/phone-number);
|
||||
contact_mail = "daniel@systemli.org";
|
||||
|
||||
# https://wiki.nixos.org/wiki/Shell_Scripts
|
||||
|
Loading…
Reference in New Issue
Block a user