-
-
Save benpye/ab5a9b2aec1f5ec18c17a64fb3da098e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, lib, pkgs, ... }: | |
with lib; | |
let | |
fromOctalStr = value: | |
let | |
toOctalDigit = d: | |
{ | |
"0" = 0; | |
"1" = 1; | |
"2" = 2; | |
"3" = 3; | |
"4" = 4; | |
"5" = 5; | |
"6" = 6; | |
"7" = 7; | |
}.${d}; | |
octalMul = x: y: x * 8 + (toOctalDigit y); | |
in builtins.foldl' octalMul 0 (stringToCharacters value); | |
toSocket = name: value: | |
if value == null | |
then null | |
else if name == "SockPathMode" | |
then fromOctalStr value | |
else value; | |
toSockets = name: value: | |
if value == null | |
then null | |
else mapAttrs toSocket value; | |
toUserAgent = name: value: | |
if value == null | |
then null | |
else if name == "Umask" | |
then fromOctalStr value | |
else if name == "Sockets" | |
then mapAttrs toSockets value | |
else value; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment