diff options
-rw-r--r-- | TODOs.org | 4 | ||||
-rw-r--r-- | _config.yml | 1 | ||||
-rw-r--r-- | _layouts/index.html | 2 | ||||
-rw-r--r-- | _pastebins/gnu-guix-systemd-daemon-for-nixos.md | 24 | ||||
-rw-r--r-- | _pastebins/guix-builder-user-creation-commands.md | 17 | ||||
-rw-r--r-- | _pastebins/guix-users-in-nixos-system-configuration.md | 44 | ||||
-rw-r--r-- | _pastebins/nix-pinning.md | 29 | ||||
-rw-r--r-- | _pastebins/nix-string-padding.md | 10 | ||||
-rw-r--r-- | _pastebins/rpn-macro-setup.md | 27 |
9 files changed, 154 insertions, 4 deletions
@@ -1,3 +1 @@ -* Tasks -** Code line number -Maybe https://joshdick.net/2017/05/29/controlling_whitespace_and_empty_lines_in_jekyll.html +https://duckduckgo.com/?q=wCAG+accessibility+guidelines&t=ffab&ia=web diff --git a/_config.yml b/_config.yml index 91d9e90..78cdf1b 100644 --- a/_config.yml +++ b/_config.yml @@ -18,6 +18,7 @@ exclude: - vendor/ - spelling/ - scripts/ + - result collections: pastebins: diff --git a/_layouts/index.html b/_layouts/index.html index 037e0e3..0ec683d 100644 --- a/_layouts/index.html +++ b/_layouts/index.html @@ -2,7 +2,7 @@ layout: default --- <h1>{{ site.t.recent_posts[page.lang] }}</h1> -{% assign lposts=site.posts | where:"lang", page.lang | sort: 'date' %} +{% assign lposts=site.posts | where:"lang", page.lang | sort: 'date' | reverse %} {% if lposts.size > 0 %} <ul> {%- for post in lposts -%} diff --git a/_pastebins/gnu-guix-systemd-daemon-for-nixos.md b/_pastebins/gnu-guix-systemd-daemon-for-nixos.md new file mode 100644 index 0000000..0580993 --- /dev/null +++ b/_pastebins/gnu-guix-systemd-daemon-for-nixos.md @@ -0,0 +1,24 @@ +--- +title: GNU Guix systemd daemon for NixOS +date: 2018-07-13 +layout: pastebin +lang: en +--- + +```nix + # Derived from Guix guix-daemon.service.in + # https://git.savannah.gnu.org/cgit/guix.git/tree/etc/guix-daemon.service.in?id=00c86a888488b16ce30634d3a3a9d871ed6734a2 + systemd.services.guix-daemon = { + enable = true; + description = "Build daemon for GNU Guix"; + serviceConfig = { + ExecStart = "/var/guix/profiles/per-user/root/guix-profile/bin/guix-daemon --build-users-group=guixbuild"; + Environment="GUIX_LOCPATH=/root/.guix-profile/lib/locale"; + RemainAfterExit="yes"; + StandardOutput="syslog"; + StandardError="syslog"; + TaskMax= 8192; + }; + wantedBy = [ "multi-user.target" ]; + }; +``` diff --git a/_pastebins/guix-builder-user-creation-commands.md b/_pastebins/guix-builder-user-creation-commands.md new file mode 100644 index 0000000..356fe4b --- /dev/null +++ b/_pastebins/guix-builder-user-creation-commands.md @@ -0,0 +1,17 @@ +--- +title: Guix builder user creation commands +date: 2018-07-13 +layout: pastebin +lang: en +--- + +```shell +groupadd --system guixbuild +for i in `seq -w 1 10`; +do + useradd -g guixbuild -G guixbuild \ + -d /var/empty -s `which nologin` \ + -c "Guix build user $i" --system \ + guixbuilder$i; +done +``` diff --git a/_pastebins/guix-users-in-nixos-system-configuration.md b/_pastebins/guix-users-in-nixos-system-configuration.md new file mode 100644 index 0000000..f7c8440 --- /dev/null +++ b/_pastebins/guix-users-in-nixos-system-configuration.md @@ -0,0 +1,44 @@ +--- +title: Guix users in NixOS system configuration +date: 2018-07-13 +layout: pastebin +lang: en +--- + +```nix + users = { + mutableUsers = false; + + extraUsers = + let + andrehUser = { + andreh = { + # my custom user config + }; + }; + # From the Guix manual: + # https://www.gnu.org/software/guix/manual/en/html_node/Build-Environment-Setup.html#Build-Environment-Setup + buildUser = (i: + { + "guixbuilder${i}" = { # guixbuilder$i + group = "guixbuild"; # -g guixbuild + extraGroups = ["guixbuild"]; # -G guixbuild + home = "/var/empty"; # -d /var/empty + shell = pkgs.nologin; # -s `which nologin` + description = "Guix build user ${i}"; # -c "Guix buid user $i" + isSystemUser = true; # --system + }; + } + ); + in + # merge all users + pkgs.lib.fold (str: acc: acc // buildUser str) + andrehUser + # for i in `seq -w 1 10` + (map (pkgs.lib.fixedWidthNumber 2) (builtins.genList (n: n+1) 10)); + + extraGroups.guixbuild = { + name = "guixbuild"; + }; + }; +``` diff --git a/_pastebins/nix-pinning.md b/_pastebins/nix-pinning.md new file mode 100644 index 0000000..4239511 --- /dev/null +++ b/_pastebins/nix-pinning.md @@ -0,0 +1,29 @@ +--- +title: Nix pinning +date: 2018-07-11 +layout: pastebin +lang: en +--- + +```nix +let + # Pin the nixpkgs version + stdenv = pkgs.stdenv; + pkgsOriginal = import <nixpkgs> {}; + pkgsSrc = pkgsOriginal.fetchzip { + url = "https://github.com/NixOS/nixpkgs/archive/18.03.zip"; + sha256 = "0hk4y2vkgm1qadpsm4b0q1vxq889jhxzjx3ragybrlwwg54mzp4f"; + }; + + pkgs = import (pkgsSrc) {}; + + buildNodeJS = pkgs.callPackage <nixpkgs/pkgs/development/web/nodejs/nodejs.nix> {}; + +in rec { + nodeFromNVMRC = buildNodeJS { + version = "8.7.0"; + sha256 = "16mml3cwjnq7yf9yd67d2dybav3nvbnk89fkixs1wz7fd26d05ss"; + patches = []; + }; +} +``` diff --git a/_pastebins/nix-string-padding.md b/_pastebins/nix-string-padding.md new file mode 100644 index 0000000..8de9048 --- /dev/null +++ b/_pastebins/nix-string-padding.md @@ -0,0 +1,10 @@ +--- +title: Nix string padding +date: 2018-07-13 +layout: pastebin +lang: en +--- + +```nix +padString = (n: if n < 10 then "0" + toString n else toString n) +``` diff --git a/_pastebins/rpn-macro-setup.md b/_pastebins/rpn-macro-setup.md new file mode 100644 index 0000000..5ebe3ab --- /dev/null +++ b/_pastebins/rpn-macro-setup.md @@ -0,0 +1,27 @@ +--- +title: RPN macro setup +date: 2016-04-05 +layout: pastebin +lang: en +--- + +```lisp +(defmacro rpn (body) + (rpn-expander body)) + +(defun rpn-expander (body) + (mapcar (lambda (x) + (if (listp x) + (rpn-expander x) + x)) + (reverse body))) + +(rpn ((2 1 +) 2 *)) +; => 6 + +#| +Just a quick stub. + +One could easily improve #'RPN-EXPANDER in order to better suit one's needs. +|# +``` |