59 Matching Annotations
  1. Last 7 days
    1. > (square: (x: y: square x + square y) 3 7) (x: x*x)58

      This can be written up in many other forms, plus the possibility of currying deserves to be pointed out:

      $ nix repl
      nix-repl> (sq: (x: y: sq y + sq x) 2 7) (x: x*x)
      53
      
      nix-repl> (sq: (x: y: sq y + sq x)) (x: x*x)     
      «lambda @ (string):1:11»
      
      nix-repl> (sq: (x: y: sq y + sq x)) (x: x*x) 2
      «lambda @ (string):1:14»
      
      nix-repl> (sq: (x: y: sq y + sq x)) (x: x*x) 2 7
      53
      
      nix-repl> (sq: x: y: sq y + sq x) (x: x*x) 2 7   
      53
      
  2. Jul 2020
    1. The keys will be copied to the heap for the process calling get/0, but the values will not.

      What does this mean?

    1. If the run-time dependencies were shared across all applications depending on the same rebar.config file,

      This sentence is straightforward but I only understood it just now.

      rebar.config can specify the dependencies of all the applications in the umbrella project, but they are not necessarily run-time dependencies. Also, the relx example from the rebar.config above shows how to include an app/lib (in this case, recon) in the final production release, even if it is not a run-time dependency.

      This guide also expands on it a paragraph below:

      The Rebar3 maintainers therefore just decided to keep a clear distinction between the applications that need fetching for the project to build or run (in rebar.config), and the run-time dependencies of each OTP application (in the .app file) which may be part of the default OTP install, and would therefore not be included in rebar.config. Other build tools in the ecosystem let you achieve similar results, but they default to including everything at run-time whereas Rebar3 asks of developers to always be specific in their intent.

    1. mark the workers as permanent or transient, so that if they fail they get restarted

      restart defines when a terminated child process must be restarted.

      • A permanent child process is always restarted.
      • A temporary child process is never restarted (even when the supervisor's restart strategy is rest_for_one or one_for_all and a sibling's death causes the temporary process to be terminated).
      • A transient child process is restarted only if it terminates abnormally, that is, with another exit reason than normal, shutdown, or {shutdown,Term}. https://erlang.org/doc/man/supervisor.html
    1. The most commonly supported tool for this is kerl. Kerl is a wrapper around downloading, compiling, and loading various Erlang/OTP versions on a single system, and will abstract away most annoying operations.
    1. prevent its disclosure to any person not authorized to create the subscriber's digital signature

      So the signature can be used by another entity to create the digital signature if authorized beforehand.

      So if there is a statement that "I authorize [organization] to create a cryptographic key-pair on my behalf, and create the digital signature."

  3. Jun 2020
    1. fetchgit Used with Git. Expects url to a Git repo, rev, and sha256. rev in this case can be full the git commit id (SHA1 hash) or a tag name like refs/tags/v1.0.

      Not only is there no fetchgit (the right one is fetchGit), but there is also no sha256 argument.

      Backtracking: Got to IRC log https://logs.nix.samueldr.com/nixos/2018-08-14 (save on archive.org), search for Unsupported argument 'sha256' to 'fetchGit' (or part of it), and an answer will point to:<br> https://github.com/NixOS/nix/blob/master/src/libexpr/primops/fetchGit.cc#L198-L215

      We are again back to trying things out on hearsay.


      In the home-manager NixOS wiki it also shows a ref argument to fetchGit but it is not documented anywhere. Yay. Anyway, it works without it too.

    1. Why is Nix written in C++ rather than a functional language like Haskell?[ ] Mainly because Nix is intended to be lightweight, easy to learn and portable (zero dependencies). Since 24. April 2017 thanks to Shea Levy and the crowdfunding of 54 community members, nix does not have Perl as dependency anymore.

      There is hnix that is still actively developed (as of 2020/06/21).

    1. Basic Install environment.systemPackages = with pkgs; [ vim ]; or environment.systemPackages = with pkgs; [ vim_configurable ];

      What is the difference between the vim and vim_configurable packages?

      I believe the source for the latter is here.

    1. The easiest way I've found to manage that is to copy hardware-configuration.nix and a minimal version of configuration.nix and import it into the NixOps config for the corresponding machine. (I keep them in a git submodule, but keeping them in the same repo could also make sense.) 1 Pick your reaction

      If I understood it correctly, take the hardware-configration.nix from the target machine, and put it into the NixOps config.

      Also relevant: Minimal NixOS config for Nixops deployment (discourse)

  4. docs.microsoft.com docs.microsoft.com
    1. az disk revoke-access Revoke a resource's read access to a managed disk.

      Here's why it's important to revoke access (rom Upload a VHD to Azure or copy a managed disk to another region - Azure PowerShell):

      After the upload is complete, and you no longer need to write any more data to the disk, revoke the SAS. Revoking the SAS will change the state of the managed disk and allow you to attach the disk to a VM.

    1. Install the latest version of NixOps. $ nix-env -i nixops

      ... or list it in environment.systemPackages in /etc/nixos/configuration.nix, and nixos-rebuild switch.

    1. extraUsers

      extraUsers have been renamed to users. See related commits.

    2. boot.initrd.luks.devices = [ { name = "root"; device = "/dev/nvme0n1p2"; preLVM = true; } ];

      This will still work on 20.03 but will show a warning as name = "root"; is deprecated, and luksroot should be used instead (see boot.initrd.luks.devices NixOS option) .

      boot.initd.luks.devices = {
        luksroot = {
          device = "/nev/sda2";
          preLVM = true;
        };
      };
      
    3. # cryptsetup luksFormat $LVM_PARTITION

      Got a warning here but it seems to be safe to ignore.

      WARNING: Locking directory /run/cryptsetup is missing!
      
    4. Networking

      This didn't work out of the box, therefore worth looking at the Arch linux wpa_supplicant docs.

      wpa_cli also wouldn't work, and needed to make sure that I had the right SSID so this link is also helpful to list available wifi networks.

    5. Note that from here on in we’ll be in root prompts the whole time. The NixOS install environment helpfully drops you in a shell with root logged in.

      On 20.03 install drops users to a non-privileged terminal so sudo su has to be entered to become root. (Otherwise the first steps in "Networking" will fail immediately.)

      Saving this here for posterity: https://stackoverflow.com/questions/55191125/cant-seem-to-get-sudo-working-under-nixos

  5. May 2020
    1. In OTP 22 we introduced the new experimental socket API. The idea behind this API is to have a stable intermediary API that can be used to create features that are not part of the higher-level gen_* APIs. We have now come one step further in our plan to replace the inet driver by making it possible to use the gen_tcp API with socket as an optional back-end. To make it easy to test with existing code using gen_tcp a new option {inet_backend, socket | inet} can be used to select the socket implementation instead of the default inet implementation.

      Q1: So inet and socket are competing socket implementations then?

      Q2: inets is higher level abstraction layer on top of inet? (Just as HTTP is higher level than transport protocols.)

      Q3 (corollary of Q1 and Q2): inets could be then rewritten to use socket instead? (And used just like gen_tcp with the inet_backend option?)

  6. Apr 2020
    1. hypermedia

      Hypertext is text which contains links to other texts. The term was coined by Ted Nelson around 1965 (see History ).

      HyperMedia is a term used for hypertext which is not constrained to be text: it can include graphics, video and sound , for example. Apparently Ted Nelson was the first to use this term too. https://www.w3.org/WhatIs.html

      Most Web navigation is done by clicking text-based links that open new pages in a Web browser. These links, which are often blue and underlined, are referred to as hypertext, since they allow the user to jump from page to page. Hypermedia is an extension of hypertext that allows images, movies, and Flash animations to be linked to other content.

      The most common type of hypermedia is an image link. Photos or graphics on the Web are often linked to other pages. For example, clicking a small "thumbnail" image may open a larger version of the picture in a new window. Clicking a promotional graphic may direct you to an advertiser's website. Flash animations and videos can also be turned into hyperlinks by embedding one or more links that appear during playback. https://techterms.com/definition/hypermedia

      See also hypermedia tags in hypothes.is

    1. If we refer to the CAP theorem, Mnesia sits on the CP side, rather than the AP side, meaning that it won't do eventual consistency, will react rather badly to netsplits in some cases, but will give you strong consistency guarantees if you expect the network to be reliable (and you sometimes shouldn't).

      We start out with the TL;DR treatise: The mnesia database is not CP, nor AP. And it cannot be CA, because CA doesn’t make any meaningful sense. In short, it is broken with respect to the CAP theorem. https://medium.com/@jlouis666/mnesia-and-cap-d2673a92850

    1. nix path-info shows information about store paths, replacing nix-store -q. A useful feature is the option --closure-size (-S). For example, the following command show the closure sizes of every path in the current NixOS system closure, sorted by size: nix path-info -rS /run/current-system | sort -nk2

      The Nixpkgs pull request template has a checkbox "Determined the impact on package closure size (by running nix path-info -S before and after)" but there is only 4 instances of path-info in the Nix manual (and none in the Nixpkgs manual).

      nix --help says

      path-info        query information about store paths
      

      so the command works at the bottom but what switches are available for example? From the examples, -r and -S is valid but where are they documented?

      nix path-info -rS $(readlink -f $(which vim))

    1. Applicative order versus normal order According to the description of evaluation given in 1.1.3, the interpreter first evaluates the operator and operands and then applies the resulting procedure to the resulting arguments. This is not the only way to perform evaluation. An alternative evaluation model would not evaluate the operands until their values were needed. Instead it would first substitute operand expressions for parameters until it obtained an expression involving only primitive operators, and would then perform the evaluation.

      Applicative-order and normal-order evaluation sound like synonyms to eager/strict versus _lazy_evaluation strategies respectively, but there are differences:

      The bottom line seems to be that

      • strict/eager = normal order
      • lazy ~= applicative BUT all terms are evaluated at most once
    1. recursion equations

      Does this refer to recurrence relations?

      Not much found for recursion equations, and those seem to suggest the two terms are interchangeable. However: Recurrence vs Recursive

      See wikipedia on recurrence relation also.

    1. Thus, programs must be written for people to read, and only incidentally for machines to execute.
    1. Each breakthrough in hardware technology leads to more massive programming enterprises, new organizational principles, and an enrichment of abstract models. Every reader should ask himself periodically “Toward what end, toward what end?”—but do not ask it too often lest you pass up the fun of programming for the constipation of bittersweet philosophy.
    2. The source of the exhilaration associated with computer programming is the continual unfolding within the mind and on the computer of mechanisms expressed as programs and the explosion of perception they generate. If art interprets our dreams, the computer executes them in the guise of programs!
    1. Origin servers SHOULD NOT fold multiple Set-Cookie header fields into a single header field. The usual mechanism for folding HTTP headers fields (i.e., as defined in [RFC2616]) might change the semantics of the Set-Cookie header field because the %x2C (",") character is used by Set-Cookie in a way that conflicts with such folding.

      "Fold" should be replaced with "combine" to make this paragraph consistent with the HTTP/1 specs (RFC 2616, RFC 7230).

      https://www.rfc-editor.org/errata/eid6093 https://stackoverflow.com/questions/3241326/

    1. api-version A query string parameter, indicating the API version for the IMDS endpoint. Please use API version 2018-02-01 or greater.

      Couldn't find where the exhaustive list of API versions are listed, but found this on the Azure Instance Metadata Service (aka IMDS) page:

      2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11, 2019-04-30, 2019-06-01, 2019-06-04, 2019-08-01, 2019-08-15

      Also:

      The version 2019-11-01 is currently getting deployed and may not be available in all regions.

  7. Mar 2020
    1. Voltage is the pressure from an electrical circuit's power source that pushes charged electrons (current) through a conducting loop, enabling them to do work such as illuminating a light.

      This is by far the best explanation I found.

  8. Nov 2019
    1. name = "vim-with-plugins";

      How does one find what vim packages are available? (That nix vim-derivations/attributes, such as vimHugeX)

    2. { packageOverrides = pkgs: rec { foo = pkgs.foo.override { ... }; }; }

      Why is rec needed here, and not in the example under 2.6.1?

      Based on what I saw with other examples, rec is usually included when a_package.override is used inside packageOverrides. But why?

    1. 3. Deployment as Memory Management

      The entire chapter 3 is worth reading. Great resource on what a package (or more broadly, a component) is in regards to Nix.

      Specifically "3.1 What is a component?"

    1. packages

      There is no officially prescribed reading order of the Nix manuals, but it's safe to say that one should start this, the Nix manual. Then it would be prudent to briefly describe what a package is in the context of Nix and/or (at east) link to the definition.

      I like how Dolstra's thesis has an entire section on the topic (that is, on the more general concept of components).

    2. You can have multiple versions or variants of a package installed at the same time.

      It is clear now that there can be multiple versions of the same package in the store, but how does one call them (e.g., if is an executable application)? Simply by using the full Nix store path (and create and manage one's own symlinks, with stow or manually)??

    1. haskell-overridez is a tool and library of nix functions that simplify the use of overrides while developing haskell projects with nixpkgs.

  9. Oct 2019
    1. fixed-point

      "fixed-point", "fix point" seems to be most important concept in Nix, because overrides, overridePackages, overlays are built using it.

    2. Overlays
    3. buildEnv
    4. override

      First mention of the override attribute, so where is it coming from?

    5. stdenv.lib.licenses

      Find out where stdenv.lib functions are documented.

    6. builtins.elem

      builtins.elem x xs

      Return true if a value equal to x occurs in the list xs, and false otherwise.

    7. builtins.parseDrvName

      builtins.parseDrvName s

      Split the string s into a package name and version. The package name is everything up to but not including the first dash followed by a digit, and the version is everything following that dash. The result is returned in a set { name, version }. Thus, builtins.parseDrvName "nix-0.12pre12876" returns { name = "nix"; version = "0.12pre12876"; }.

    8. This option is a function which accepts a package as a parameter, and returns a boolean. The following example configuration accepts a package and always returns false: { allowUnfreePredicate = (pkg: false); }

      What is a package in this context? That is, the callback's pkg parameter. Is it a derivation?

      If I understood it correctly, whenever referencing other packages as inputs, those are actually derivations, that are just attribute sets.