- Apr 2024
-
html.spec.whatwg.org html.spec.whatwg.org
-
An example of the latter would be something like keeping track of the precise coordinate from which a popup div was made to animate, so that if the user goes back, it can be made to animate to the same location. Or alternatively, it could be used to keep a pointer into a cache of data that would be fetched from the server based on the information in the URL, so that when going back and forward, the information doesn't have to be fetched again.
"7.4.1.1 Session history entries" doesn't mention whether focus is saved, only scroll has dedicated "attributes" in a history entry, but what this paragraph seems to allude to is that focus can be saved too (and indeed it can).
(See
pushState
.)
-
-
fsharpforfunandprofit.com fsharpforfunandprofit.com
-
let map oneTrackFunction twoTrackInput = match twoTrackInput with | Success s -> Success (oneTrackFunction s) | Failure f -> Failure f And here it is in use with canonicalizeEmail: let usecase = validate1 >=> validate2 >=> validate3 >> map canonicalizeEmail // normal composition Note that normal composition is now used because map canonicalizeEmail is a fully two-track function and can be connected to the output of the validate3 switch directly. In other words, for one-track functions, >=> switch is exactly the same as >> map. Your choice.
QUESTION
map
can be defined usingbind
andswitch
,let map f = bind (switch f)
but how to do this with
>=>
?...ANSWER
Found a solution, but this is quite stupid:
let map' f result = match result with // The value of `o` is irrelevant, it is only needed // because `>=>` returns a function, but we need // a value and both operands of the input `f` are // provided by the closures | Ok o -> ((fun _ -> result) >=> (switch f)) o | Error e -> Error e
NOTE<br /> Call them as:
map ((+) 2) ((Ok 27) : Result<int,string>);; map' ((+) 2) ((Ok 27) : Result<int,string>);;
-
- Mar 2024
-
giraffe.wiki giraffe.wiki
-
The main differences are: Additionally to HttpHandler functions there is a new type called Endpoint The router is a flat list of Endpoint functions The GET, POST, route, etc. functions map a conventional HttpHandler to an Endpoint function (when the Giraffe.EndpointRouting module has been opened) The final Endpoint list has to be passed into ASP.NET Core's EndpointMiddleware instead of using the GiraffeMiddleware
Q: How does
HttpHandler
composition work then?I guess that all the composition should be done inside the
HttpHandler
passed to theEndPointRouting
functions.edit: It does state below that
The
choose
handler is replaced by composing anEndpoint list
. -
Please be aware that such a routex can create a conflict and unexpected behaviour if you have a similar matching routef (see routef): let webApp = choose [ routex "/foo(/*)" >=> text "Bar" routef "/foo/%s/%s/%s" (fun (s1, s2, s3) -> text (sprintf "%s%s%s" s1 s2 s3)) // If none of the routes matched then return a 404 RequestErrors.NOT_FOUND "Not Found" ] In the above scenario it is not clear which one of the two http handlers a user want to be invoked when a request is made to https://example.org/foo///.
BUG: This will never match
foo///
:routef "/foo/%s/%s/%s" (fun (s1, s2, s3) -> text (sprintf "%s%s%s" s1 s2 s3))
In fact, if theroutex
pipeline is removed, theroutef
one will be skipped as it does not matchfoo///
. Perhaps it did in past versions?SUGGESTION: If the
routef
pipeline is replaced with a real conflicting pipeline, such asroute "/foo >=> text "Foo"
then there the order of the pipelines will decide. Even the Giraffe docs say this aboutchoose
:The
choose
combinator function iterates through a list of HttpHandler functions and invokes each individual handler until the first HttpHandler returns a positive result:The phrasing is a bit misleading, because it is absolutely clear which of the two handlers will be invoked.
-
- Apr 2023
-
github.com github.com
-
The Answer to the Original Issue
This is the pinning solution.
-
If channels were to be removed, it would be more clearer to everybody including new users, what the real use and power of nix is, and all documentation would go straight to pinning. Then only after understanding this, can people write higher level abstract tools to provide an auto-updating "channel" like interface to the underlying pinning concept.
great channels vs pinning summary
-
One effect of this is that you get reproducibility. Note that this is not binary reproducibility, since it's still possible for the compilation of code to give different resulting binaries. But it is reproducibility within the context of Nix universe.
-
No pinning isn't about which channels you get. Pinning pins to a content addressed commit hash of nixpkgs or any nixpkgs even your own fork. Channels is orthogonal and probably a mistake and should be removed.
Wonder what the consensus on channels nowadays?
-
What's "pinning"? Is this ever explained to a new user? Where? (Yes, I understand what it is now, but new users probably will not, meaning it doesn't exist to them.) Your packages never get bug-fix updates Your packages never get security updates Broken package expressions never get fixed. If you need to update one package, you must update them all. This can be seen as either consistency, or limitation. It depends on the use case.
Again, the entire comment is great.
-
The main thing I want to accomplish is to distinguish between the versions of packages, and the versions of derivations.
-
What I want is to let a channel have several derivations for a package, each with its own version. This is current behavior. I then want my derivation to depend on a specific package name and version. Since versions are currently put into some package names, this is current behavior, though it would be cleaner to just use separate names. I then want my derivation to pattern match a range of versions. This is not current behavior. The current channel will provide a package with the greatest version number matched by the range provided that it has defined.
Another good one.
-
To summarize what I have read here (correct me if I am wrong) @mayhewluke described some real drawbacks of how derivations are currently implemented: Derivations cannot use a specific version of a package. Derivations are limited to a very small subset of real versions for dependencies.
This entire comment is gold
-
You always have the option of adding missing versions of certain packages to your local database by means of an override as described in http://nixos.org/nixpkgs/manual/#how-to-create-nix-builds-for-your-own-private-haskell-packages. You can register aeson-0.8.1.1 in your copy of Nixpkgs without needing to change the Nixpkgs git repository at all.
what
-
So what happens if I have to fix a bug in an old project that was using 0.8.1.1? In that particular case, Nix won't help you and you are better off using a cabal-install sandbox or a stack build.
Is this still the case?
-
To be certain, you can just copy those by nix-copy-closure. Note that version numbers of direct dependencies don't contain all the information at all.
-
We keep multiple versions in nixpkgs only when there's a good reason to. Nix is able to handle any number of versions/configurations, but on the other hand it's much more convenient when all (or most) use just a single one. It leads to better sharing of the effort in many respects: simplified maintenance, testing, sharing of the binaries, etc. It's what most distros do. (Only gentoo diverges from the big ones I know, and they pay a price for it.) When we do create more variants, we just name them (attribute paths), e.g. gcc48 and gcc49 or ffmpeg and ffmpeg-full.
mull this over
-
- Aug 2021
-
gist.github.com gist.github.com
-
matrix/table populated? (It seems like that part is manual.)
test
-
- May 2021
-
toraritte.github.io toraritte.github.io
-
The command nix-shell will build the dependencies of the specified derivation, but not the derivation itself. It will then start an interactive shell in which all environment variables defined by the derivation path have been set to their corresponding values, and the script $stdenv/setup has been sourced. This is useful for reproducing the environment of a derivation for development.
QUESTION: What exactly does
nix-shell
execute from the Nix expression (i.e.,shell.nix
,default.nix
, etc.)?ANSWER: Based on my current understanding, the answer is everything. It calls
$stdenv/setup
(see annotation below) to set up the most basic environment variables (TODO: expand on this), and "injects" the most common tools (e.g.,gcc
,sed
) into it.It also defines the phases (TODO: verify this) and builder functions, such as
genericBuilder
. For example, the default builder is just two lines:source $stdenv/setup genericBuild
TODO:
pkgs/stdenv/generic/builder.sh
is a mystery though.QUESTION: Once dropping into
nix-shell
, how do I know what phases to execute by looking at adefault.nix
? (E.g.,[..]freeswitch/default.nix
)ANSWER: As far as I can tell, one can override the phases in their Nix build expression (to build the derivation, see at the bottom), but they won't get executed as only the
$stdenv/setup
(see above) will get sourced, and no builders are called that, in return, invoke the phases (again, see above).So if one is using
nix-shell
to create/hack on a package, the person has to manually invoke the builder or phases (TODO: still fuzzy on this subject)
to set up an environment, then one doesn't even have to worry about builders/phases because we just use
nix-shell
to clear the environment and to inject tools that we need for a given task
QUESTION: When dropping into
nix-shell
, is this Nix expression (i.e.,freeswitch/default.nix
) executed? Or just parts of it?ANSWER: As stated above, all of the input Nix expression is evaluated, but no builders and build phases are called; although, nothing prevents one to override the phases, in case they are creating/hacking on a package.
QUESTION:
The command
nix-shell
will build the dependencies of the specified derivation, but not the derivation itself.What is the "derivation" here exactly? I know that it is a build expression, but does that mean the
default.nix
(or other Nix expression)nix-shell
is invoked with?<sup>This statement also seems like a contradiction with how `nix-shell` works (i.e., if one issues `nix-shell -p curl`, then `curl` will be available in that sub-shell), but `-p` acts like a shortcut to as if `curl` had been listed in `buildInputs` so this is not the case.</sup>
ANSWER: I have the feeling my confusion comes from the fact that the term "derivation" is used ambiguously in the manuals, sometimes to mean multiple things (see list below).
TODO: Substantiate this claim, and make sure that it not coming from my misunderstanding certain topics.
Nix build expression (such as
default.nix
) whose output is going to become the store derivation itself (see last item at the bottom about the Nix manual's glossary definition)store derivation.
Had multiple cracks at unambiguously define what a derivation is, and here's a list of these:
What is the purpose of nix-instantiate? What is a store-derivation? (probably the best try yet)
What is a Nix expression in regard to Nix package management? (feels sloppier, but commenter mentions
ATerm
, adding the possibility of making it very specific)Closure vs derivation in the Nix package manager (very short, and will have to be re-written, but adds closures to the mix)
There is now a glossary definition of a derivation in the Nix manual; see this annotation why I find it problematic
QUESTION: What is the difference between
nix-shell -p
andnix-shell
invoked with a Nix expression ofmkShell
(or other that achieves the similar effect)?QUESTION:
nix-shell
does not create a sub-shell, so what does it do? (clarification: sonix-shell
indeed does it; I confused it withnix shell
)
-
- Feb 2021
-
toraritte.github.io toraritte.github.io
-
A Nix expression describes everything that goes into a package build action (a “derivation”)
Come up with an ultimate definition for what a "derivation" is.
So round up all the places where it is mentioned across Nix* manuals, and check out these:
https://stackoverflow.com/questions/58243554/what-is-a-nix-expression-in-regard-to-nix-package-management (this also needs to be edited)
https://nixos.org/manual/nix/unstable/expressions/derivations.html
https://github.com/justinwoo/nix-shorts/blob/master/posts/your-first-derivation.md
look for more online
From Nix Pills section 6.1. The
derivation
function (see annotation):A derivation from a Nix language view point is simply a set, with some attributes. Therefore you can pass the derivation around with variables like anything else.
So there is clearly an ambiguity between what derivations are perceived to be and what is stated in the Eelco Dolstra's PhD thesis. Or maybe I'm having issues with reading comprehension again...
-
For each output declared in outputs, the corresponding environment variable is set to point to the intended path in the Nix store for that output. Each output path is a concatenation of the cryptographic hash of all build inputs, the name attribute and the output name. (The output name is omitted if it’s out.)
QUESTION: So when I see
$out
in a builder script, it refers to the default output path because theoutput
attribute in the Nix expression has never been explicitly set, right? -
A derivation causes that derivation to be built prior to the present derivation; its default output path is put in the environment variable.
That is, if an input attribute is a reference to a derivation in the Nix store, then
- that derivation is built first (after a binary substitute is not found, I presume), and
- the path to the built package (for a better word) is handed to the shell build script.
-
derivationA description of a build action. The result of a derivation is a store object. Derivations are typically specified in Nix expressions using the derivation primitive. These are translated into low-level store derivations (implicitly by nix-env and nix-build, or explicitly by nix-instantiate).
Organically related to the annotation regarding my
nix-shell
confusion.The dissection of this definition to show why I find it lacking:
A description of a build action.
The first (couple) time(s) I read the manuals, this description popped up in many places, and I identified it with Nix expression every time, thinking that a derivation is a synonym for Nix expression.
Maybe it is, because it clearly tries to disambiguate between store derivations and derivation in the last sentence.
The result of a derivation is a store object.
Is this store object the same as a store derivation?
Derivations are typically specified in Nix expressions using the `derivation primitive. These are translated into low-level store derivations (implicitly by nix-env and nix-build, or explicitly by nix-instantiate).
QUESTION: So, the part of the Nix build expression (such as
default.nix
) where thederivation
primitive is called (explicitly or implicitly, as inmkDerivation
) is the derivation, that will be ultimately be translated into store derivations?ANSWER: Start at section 15.4 Derivation.
QUESTION: Also, why is typically used here? Can one define derivations outside of Nix expressions?
ANSWER(?): One could I guess, because store derivations are ATerms (see annotation at the top), and the Nix expression language is just a tool to translate parameterized build actions into concrete terms to build a software package. The store derivations could be achieved using different means; e.g., the way Guix uses Guile scheme to get the same result))
I believe, that originally, derivation was simply a synonym to store derivation. Maybe it still is, and I'm just having difficulties with reading comprehension but I think the following would be less misleading (to me and apart from re-writing the very first sentence):
Derivations are typically the result of Nix expressions calling the
derivation primitive explicitly, or implicitly using
mkDerivation`. These are translated into low-level store derivations (implicitly by nix-env and nix-build, or explicitly by nix-instantiate). -
$stdenv/setup
QUESTION: Does this refer to
pkgs/stdenv/generic/setup.sh
? According to 6.5 Phases in the Nixpkgs manual?ANSWER: I'm pretty sure it does. It sets up the environment (not sure how yet; I see the env vars, but not the basic commands - sed, awk, etc. - that are listed below) and defines a bunch of functions (such as
genericBuilder
) but it doesn't call these functions! -
The function mkDerivation in the Nixpkgs standard environment is a wrapper around derivation that adds a default value for system and always uses Bash as the builder, to which the supplied builder is passed as a command-line argument. See the Nixpkgs manual for details.
"Documented" in the Nixpkgs manual under 6.1 Using
stdenv
.Used the double-quotes above because I don't consider it well documted. Will give it a try too; worst case scenario is that I'll fail as well.
-
C.12. Release 1.6 (2013-09-10)In addition to the usual bug fixes, this release has several new features:The command nix-build --run-env has been renamed to nix-shell.
-
See annotations with the
build-phases
tag.
Why are the build phases not enumerated in the Nix manual? If the instructions on how to create a derivation (and thus, a package) then why not go all in instead of spreading out information in different manuals, making the subject harder to grasp?...
(By the way, it is documented in the Nixpkgs manual under 6.5 Phases; not sure why it is not called build phases when every page refers to them like that.)
-
Chapter 14. A Simple Nix Expression
This such a stupid move to go through a derivation example before introducing the language.
-
Add the package to the file pkgs/top-level/all-packages.nix. The Nix expression written in the first step is a function; it requires other packages in order to build it. In this step you put it all together, i.e., you call the function with the right arguments to build the actual package.
In addition to this rant, step 3. should be more generic, instead of tying it to Nixpkgs; at least, either show how to build your own Nix expression repo, or don't add this step, but it is not at all necessary to write a derivation. There is a Nixpkgs manual for a reason.
-
$ nix-env -i firefox --substituters ssh://alice@avalon This works similar to the binary cache substituter that Nix usually uses, only using SSH instead of HTTP
So a substitute is a built binary for a given derivation, and a substituter is a server (or binary cache) that serves pre-built binaries, right?
Update: in the next line it says that "it will fall back to using the binary cache substituter", so I guess that answers it.
-
substitute
this is another key topic. Also:
- substitute vs. substituter => this (I think)
See annotations with the
substitute
tag -
When you ask Nix to install a package, it will first try to get it in pre-compiled form from a binary cache. By default, Nix will use the binary cache https://cache.nixos.org; it contains binaries for most packages in Nixpkgs. Only if no binary is available in the binary cache, Nix will build the package from source. So if nix-env -i subversion results in Nix building stuff from source, then either the package is not built for your platform by the Nixpkgs build servers, or your version of Nixpkgs is too old or too new.
binary caches tie in with substitutes somehow; get to the bottom of it. See annotations with the
substitute
tag.Maybe this?
-
closure
Another gem: who knows what a "closure" is.
[This highlight] (a couple lines below) implicitly explains it though:
The command nix-copy-closure copies a Nix store path along with all its dependencies to or from another machine via the SSH protocol. It doesn’t copy store paths that are already present on the target machine.
or this, also just a couple lines below:
the closure of a store path (that is, the path and all its dependencies)
-
the closure of a store path (that is, the path and all its dependencies)
-
The command nix-copy-closure copies a Nix store path along with all its dependencies to or from another machine via the SSH protocol. It doesn’t copy store paths that are already present on the target machine. For example, the following command copies Firefox with all its dependencies:
-
subscribes you to a channel that always contains that latest version of the Nix Packages collection.
That is a misleading statement. The latest version is where the
master
branch points, isn't it?So a channel points to a Nixpkgs commit (on a branch named after the channel) where all packages inside are deemed stable, and all packages are built to have available binary substitutes by a (hydra) build farm.
-
A Nix channel is just a URL that points to a place that contains a set of Nix expressions and a manifest.
-
garbage collector roots
Definitely avoid this, when a term is used but only introduced formally way later. (There is also a reference to "garbage collector roots" almost at the beginning as well.)
-
$ nix-env --switch-profile /nix/var/nix/profiles/my-profile $ nix-env --switch-profile /nix/var/nix/profiles/default These commands switch to the my-profile and default profile, respectively. If the profile doesn’t exist, it will be created automatically.
learn more about profiles; creating new profiles was new info
-
Chapter 10. ProfilesProfiles and user environments are Nix’s mechanism for implementing the ability to allow different users to have different configurations, and to do atomic upgrades and rollbacks.
-
user environment
Explain the shit out of this one with tons of examples.
-
In Nix, different users can have different “views” on the set of installed applications. That is, there might be lots of applications present on the system (possibly in many different versions), but users can have a specific selection of those active — where “active” just means that it appears in a directory in the user’s PATH. Such a view on the set of installed applications is called a user environment, which is just a directory tree consisting of symlinks to the files of the active applications.
-
nix-env -qas
... and it takes AGES to complete
-
4.3.1. Change the Nix store path prefix
There is a lot of place in this manual (and probably in the others as well) where the prefix is referred to (usually with italics, such as "prefix/store"), so in the book
this should be linked to this section (or the one in the book), and
establish a clear and well-communicated notation to convey this
-
At the same time, it is not possible for one user to inject a Trojan horse into a package that might be used by another user.
Why?
Answer is below in the manual: https://hyp.is/qRSFdnCJEeueY8NWtMIeHw/toraritte.github.io/saves/Nix-Package-Manager-Guide-Version-2.3.10.html
-
Chapter 6. SecurityNix has two basic security models. First, it can be used in “single-user mode”, which is similar to what most other package management tools do: there is a single user (typically root) who performs all package management operations. All other users can then use the installed packages, but they cannot perform package management operations themselves.Alternatively, you can configure Nix in “multi-user mode”. In this model, all users can perform package management operations — for instance, every user can install software without requiring root privileges. Nix ensures that this is secure. For instance, it’s not possible for one user to overwrite a package used by another user with a Trojan horse.
Would have been nice to link these to the install chapter where single- and multi-user modes were mentioned.
How would this look in a topic-based documentation? I would think that his chapter would be listed in the pre-requisites, and it could be used to buld different reading paths (or assemblies in DocBook, I believe) such as
practical
,depth-first
(if there are people like me who want to understand everything first), etc. -
reentrancy
-
You can uninstall Nix simply by running: $ rm -rf /nix
Yeah, I there are several tickets and posts about how this is not entirely true.
- https://github.com/NixOS/nix/issues/1623
- https://github.com/NixOS/nix/issues/1402
- https://github.com/NixOS/nix/issues/458
- https://stackoverflow.com/questions/51929461/how-to-uninstall-nix
- https://stackoverflow.com/questions/443699/how-do-you-uninstall-in-nix
- https://apple.stackexchange.com/questions/170000/how-to-completely-remove-nix-package-manager
-
$ mkdir /nix $ chown alice /nix
Traditionally, when a command should be invoked with
sudo
, it is either included in the example, or the shell indicator is#
instead of$
. -
To explicitly select a single-user installation on your system:
It should be noted in this section also that since nix 2.1.0, single user install is the default.
-
nix-shell '<nixpkgs>' -A pan
What is happening here exactly?
nix-shell
's syntax synopsis always bugged because it looks like thisSYNOPSIS nix-shell [--arg name value] [--argstr name value] [{--attr | -A} attrPath] [--command cmd] [--run cmd] [--exclude regexp] [--pure] [--keep name] {{--packages | -p} packages... | [path]}
and the canonical example is
nix-shell '<nixpkgs>' -A pan
; what tripped me up is thatpath
is usually the first in examples, and I thought that the position of arguments are strict. As it turns out,nix-shell -A pan '<nixpkgs>
is just as valid.Side note<br> Apparently there is no standard for man pages. See 1, 2.
'<nixpkgs>'
path is the one specified in theNIX_PATH
environment variable, and-A pan
looks up thepan
attribute inpkgs/top-level/all-packages.nix
in the Nixpkgs repo. -
since packages aren’t overwritten, the old versions are still there after an upgrade. This means that you can roll back to the old version:
Wouldn't hurt to tell folks that this is a convenience layer, and one could also just use the old package from the
/nix/store
, even though that path would be long and obscure; one could use symlinks of course.Or, onc could just use
nix-shell -p
that specifies a specific version (that's already in the store), but, of course, it's not that simple...
-
-
toraritte.github.io toraritte.github.io
-
A derivation from a Nix language view point is simply a set, with some attributes. Therefore you can pass the derivation around with variables like anything else.
-
the single repository technique. The natural implementation in Nix is to create a top-level Nix expression, and one expression for each package. The top-level expression imports and combines all expressions in a giant attribute set with name -> package pairs. But isn't that heavy? It isn't, because Nix is a lazy language, it evaluates only what's needed! And that's why nixpkgs is able to maintain such a big software repository in a giant attribute set.
This is the gist of how Nixpkgs works (and how it is organized).
-
17.3. Fixed point
QUESTION: What is a fixed-point of a function?
ANSWER: See this video) at least, and the Fixed-point (mathematics)) wikipedia article:
In mathematics, a fixed point (sometimes shortened to fixpoint, also known as an invariant point) of a function is an element of the function's domain that is mapped to itself by the function. That is to say, c is a fixed point of the function
f
iff(c) = c
. This meansf(f(...f(c)...)) = f n(c) = c
an important terminating consideration when recursively computing f. A set of fixed points is sometimes called a fixed set.
For example, if f is defined on the real numbers by
f(x)=x^{2}-3x+4,}
, then 2 is a fixed point off
, becausef(2) = 2
.There is also the wiki article fixed-point combinator that actually plays a role here, but read through the articles in this order.
Then dissect the Stackoverflow thread What is a Y combinator?, and pay attention to the comments! For example:
According to Mike Vanier's description, your definition for Y is actually not a combinator because it's recursive. Under "Eliminating (most) explicit recursion (lazy version)" he has the lazy scheme equivalent of your C# code but explains in point 2: "It is not a combinator, because the Y in the body of the definition is a free variable which is only bound once the definition is complete..." I think the cool thing about Y-combinators is that they produce recursion by evaluating the fixed-point of a function. In this way, they don't need explicit recursion. – GrantJ Jul 18 '11 at 0:02
(wut?)
Other resources in no particular order:
- google search for "fixpoint evaluation fixed point combinator explained"
- Cornell's CS 6110 S17 Lecture 5
- google search for "fixed-point of a function"
- Fixed-point theorem (wikipedia)
- How can I find the fixed points of a function? (math stackexchange)
- The Y Combinator (Slight Return) (see the "Fixpoint of functions" section)
- Clear, intuitive derivation of the fixed-point combinator (Y combinator)? (computer science stackexchange)
- Fixed-Point Combinators (stackoverflow)
- Fixed-point combinator (HandWiki)
QUESTION: How the hell did they come up with the idea of using this with Nix and package management? (..and who? I remember a video saved somewhere, but maybe that was about overlays)
QUESTION: ... and how does it work in this context?
ANSWER: Well, not an answer yet, but this may be something in the right direction:
http://blog.tpleyer.de/posts/2020-01-29-Nix-overlay-evaluation-example.html
-
there's no ldconfig cache either. So where does bash find libc?
QUESTION: What is
ldconfig
cache?QUESTION: What is
libc
and why does Bash need it? -
Derivations/packages are stored in the Nix store as follows: /nix/store/hash-name, where the hash uniquely identifies the derivation (this isn't quite true, it's a little more complex), and the name is the name of the derivation.
QUESTION: So the Nix store houses derivations and not the built packages?
QUESTION: Are the hashes in the Nix store not unique?
-
In Nix there is the notion of a derivation rather than a package. The difference can be subtle at the beginning, so I will often use the words interchangeably.
Doesn't really say anything but thought it important to highlight this first mention of derivations in the Nix Pills.
-
From an administrator's point of view: you can use containers. The typical solution nowadays is to create a container per service, especially when different versions are needed. That somewhat solves the problem, but at a different level and with other drawbacks. For example, needing orchestration tools, setting up a shared cache of packages, and new machines to monitor rather than simple services.
This is a very good pointer; I guess it refers to systemd services when it mentions "simple services".
-
-
toraritte.github.io toraritte.github.io
-
Specifying a name and a src is the absolute minimum Nix requires.
Didn't they mean what
mkDerivation
requires?I have been jumping around in this manual, so not sure about what arguments does
derivation
require. -
For convenience, you can also use pname and version attributes and mkDerivation will automatically set name to "${pname}-${version}" by default.
The error messages are not helpful when one messes up the input attribute set of
mkDerivation
(i.e., eithername
, orpname
andversion
attributes have to be present); see Nixpkgs issue #113520. -
6.1. Using stdenv
-
fetchpatch works very similarly to fetchurl with the same arguments expected. It expects patch files as a source and and performs normalization on them before computing the checksum. For example it will remove comments or other unstable parts that are sometimes added by version control systems and can change over time.
-
19.3. Submitting security fixes Security fixes are submitted in the same way as other changes and thus the same guidelines apply. If the security fix comes in the form of a patch and a CVE is available, then the name of the patch should be the CVE identifier, so e.g. CVE-2019-13636.patch in the case of a patch that is included in the Nixpkgs tree. If a patch is fetched the name needs to be set as well, e.g.: (fetchpatch { name = "CVE-2019-11068.patch"; url = "https://gitlab.gnome.org/GNOME/libxslt/commit/e03553605b45c88f0b4b2980adfbbb8f6fca2fd6.patch"; sha256 = "0pkpb4837km15zgg6h57bncp66d5lwrlvkr73h0lanywq7zrwhj8"; }) If a security fix applies to both master and a stable release then, similar to regular changes, they are preferably delivered via master first and cherry-picked to the release branch. Critical security fixes may by-pass the staging branches and be delivered directly to release branches such as master and release-*.
-
18.6. Patches Patches available online should be retrieved using fetchpatch. patches = [ (fetchpatch { name = "fix-check-for-using-shared-freetype-lib.patch"; url = "http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=8f5d285"; sha256 = "1f0k043rng7f0rfl9hhb89qzvvksqmkrikmm38p61yfx51l325xr"; }) ];
... and from Chapter 11:
fetchpatch
works very similarly tofetchurl
with the same arguments expected. It expects patch files as a source and and performs normalization on them before computing the checksum. For example it will remove comments or other unstable parts that are sometimes added by version control systems and can change over time.... and also adding highlight of 19.3. Submitting security fixes
because these are the only places I've seen
fetchpatch
mentioned.From the wild in
freeswitch/default.nix
in Nixpkgs:stdenv.mkDerivation rec { pname = "freeswitch"; version = "1.10.5"; src = fetchFromGitHub { owner = "signalwire"; repo = pname; rev = "v${version}"; sha256 = "18dhyb19k28dcm1i8mhqvvgm2phsrmrwyjmfn79glk8pdlalvcha"; }; patches = [ # https://github.com/signalwire/freeswitch/pull/812 fix mod_spandsp, mod_gsmopen build, drop when updating from 1.10.5 (fetchpatch { url = "https://github.com/signalwire/freeswitch/commit/51fba83ed3ed2d9753d8e6b13e13001aca50b493.patch"; sha256 = "0h2bmifsyyasxjka3pczbmqym1chvz91fmb589njrdbwpkjyvqh3"; }) ]; postPatch = '' patchShebangs libs/libvpx/build/make/rtcd.pl substituteInPlace libs/libvpx/build/make/configure.sh \ --replace AS=\''${AS} AS=yasm # Disable advertisement banners for f in src/include/cc.h libs/esl/src/include/cc.h; do { echo 'const char *cc = "";' echo 'const char *cc_s = "";' } > $f done '';
-
6.5. Phases
Not sure why this isn't called build phases... See also.
-
-
nix-tutorial.gitlabpages.inria.fr nix-tutorial.gitlabpages.inria.fr
-
nix-channel --list #<output> nixpkgs https://nixos.org/channels/nixpkgs-unstable The command returns a name for each channel (e.g., nixpkgs) and an URL. Note When running nix-env with the parameter -A, one can select the channel to get the package from. Such a command looks like nix-env -iA channelname.packagename.
Instead of
#<output>
it should have saidchannel-name
instead at the topnix-channel
example to keep it consistent. -
However, using channels is not fully reproducible, as a channel may evolve to incorporate updates.
TODO: Find other sources about this topic. I remember this mentioned already (and it makes) sense, but need to learn more.
TODO: What is a better alternative? An own repo? Flakes? Can cachix help?
It says right below that pinning can help but keep looking.
When package reproducibility become a major concern, as it is the case in this tutorial, it is preferable to refer to a pinned version of the nixpkgs repository instead — i.e, a specific commit of the repository or an immutable archived tarball. The ability to pin the version of nixpkgs is powerful, it will ensure that a package is always constructed from the same Nix source. As we go deeper in the tutorial we avoid using channels in favor of pinned environments.
-
However, it makes the “Making the package available to the user” more complex. Nix heavily relies on environment variables to make this possible
And symlinks
-
-
nixos.wiki nixos.wiki
-
example: get an environment which is used to build irssi (also see nix-shell) $ nix-build $NIXPKGS --run-env -A irssi example: get a persistent environment which is used to build irssi $ nix-build $NIXPKGS --run-env -A irssi --add-root
nix-build <path> --run-env
has been superseded bynix-shell
. From Nix manual section C.12. Release 1.6 (2013-09-10):The command
nix-build --run-env
has been renamed tonix-shell
. -
git clone --depth=1 https://github.com/nixos/nixpkgs
i should remember this to only get last commit, which basically means to only care about the data, and discard commit history.
-
-
nix-tutorial.gitlabpages.inria.fr nix-tutorial.gitlabpages.inria.fr
-
Even if this is possible, we chose not to use Nix to store the experiment input and output data in this tutorial.
How?
-
-
nixos.org nixos.org
-
NIX_PATHA colon-separated list of directories used to look up Nix expressions enclosed in angle brackets (i.e., <path>). For instance, the value
It would be helpful to
- formally describe the formats for NIXPATH, and
- note the allowed angle bracket syntax accordingly
<path>
will work with the prefixless format, but not with the prefixed one, and it may be helpful to spell this out explicitly.0 [14:16:19] nix repl Welcome to Nix version 2.3.10. Type :? for help. nix-repl> :l <nixpkgs/doc> Added 40 variables. nix-repl> :l <doc> error: file 'doc' was not found in the Nix search path (add it using $NIX_PATH or -I)
I always saw a NIXPATH used with the prefix syntax so far:
$ echo $NIX_PATH nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root
but
NIX_PATH
documentation shows that the prefixless format is also valid.$ export NIX_PATH=/home/toraritte:/nix/var/nix/profiles/per-user/root/channels/nixos $ printenv NIX_PATH /home/toraritte:/nix/var/nix/profiles/per-user/root/channels/nixos $ nix repl Welcome to Nix version 2.3.10. Type :? for help. nix-repl> :l <nixpkgs> Added 12439 variables.
Tags
Annotators
URL
-
- Dec 2020
-
tools.ietf.org tools.ietf.org
-
Several commands (RSET, DATA, QUIT) are specified as not permitting parameters.
That is, they don't accept options, only data arguments. E.g.,
DATA
's argument is the RFC 822 message format with headers and message body. -
The model for this is that distinct buffers are provided to hold the types of data objects; that is, there is a reverse-path buffer, a forward-path buffer, and a mail data buffer.
!
-
2.3.1. Mail Objects SMTP transports a mail object. A mail object contains an envelope and content. The SMTP envelope is sent as a series of SMTP protocol units (described in Section 3). It consists of an originator address (to Klensin Standards Track [Page 11] RFC 5321 SMTP October 2008 which error reports should be directed), one or more recipient addresses, and optional protocol extension material
The SMTP envelope is sent as a series of SMTP protocol units (described in Section 3). It consists of
- an originator address (to which error reports should be directed),
MAIL FROM
that refers to the originator (a.k.a., reverse path, backward-pointing address) of the request- one or more recipient addresses,
Multiple
RCPT TO
for each "to:" rfc822 message header in the mail data (see annotation)- and optional protocol extension material.
DATA
(see below)
(See also
envelope-vs-mail
tags.) -
The third step in the procedure is the DATA command (or some alternative specified in a service extension). DATA <CRLF>
Third part of the envelope:
DATA
. -
When the RFC 822 format ([28], [4]) is being used, the mail data include the header fields such as those named Date, Subject, To, Cc, and From.
This just answered my question regarding the quote from "Postfix: The Definitive Guide":
ENVELOPE ADDRESSES AND MESSAGE HEADERS A common source of confusion for email users is the fact that the To: address in email message headers has nothing to do with where a message is actually delivered. The envelope address controls message delivery. In practice, when you compose a message and provide your MUA with a To: address, your MUA uses that same address as the envelope destination address, but this is not required nor is it always the case. From the MTA’s point of view, message headers are part of the content of an email message. The delivery of a message is determined by the addresses specified during the SMTP conversation. These addresses are the envelope addresses , and they are the only thing that determine where messages go. See Section 2.2.8 later in the chapter for an explanation of the SMTP protocol.
Mailing lists and spam are common examples of when the envelope destination address differs from the To: address of the message headers.
Also an answer to this question.
-
An SMTP-capable host SHOULD support both the alias and the list models of address expansion for multiple delivery. When a message is delivered or forwarded to each address of an expanded list form, the return address in the envelope ("MAIL FROM:") MUST be changed to be the address of a person or other entity who administers the list. However, in this case, the message header section (RFC 5322 [4]) MUST be left unchanged; in particular, the "From" field of the header section is unaffected.
Another section that serves well to understand the difference between email data and SMTP envelope.
-
To expand an alias, the recipient mailer simply replaces the pseudo- mailbox address in the envelope with each of the expanded addresses in turn; the rest of the envelope and the message body are left unchanged. The message is then delivered or forwarded to each expanded address.
This annotation explains what this paragraph means and dispels my confusion regarding how 3mails with multiple recipients will get processed (also, SMTP envelope vs mail data).
MS Outlook's "distribution list" is the same as an rfc5321 alias.
-
The return (backward-pointing) address in the envelope is changed so that all error messages generated by the final deliveries will be returned to a list administrator, not to the message originator, who generally has no control over the contents of the list and will typically find error messages annoying.
- This the only difference between an SMTP alias and list; expanding recipients to RCPT commands is the same.
- Another great example to highlight the difference between SMTP envelope and mail data: the envelope's
MAIL FROM
(see annotation) is different from to the mail data's rfc822From:
.
-
If the Klensin Standards Track [Page 19] RFC 5321 SMTP October 2008 recipient is known not to be a deliverable address, the SMTP server returns a 550 reply, typically with a string such as "no such user - " and the mailbox name (other circumstances and reply codes are possible).
Will the entire transaction be canceled? "Transaction" in the name of this a section implies yes, but what if all the recipients are valid?
See replies below but the answer is no; an
RCPT
command is specified for each recipient in the mail data, theseRCPT
commands will be evaluated in sequence,, and any SMTP (error) notifications will be sent to the address in theMAIL FROM
command (which is not necessarily the same as the mail data'sFrom:
header). -
There exist mailing lists that perform additional, sometimes extensive, modifications to a message and its envelope. Such mailing lists need to be viewed as full MUAs, which accept a delivery and post a new message.
I guess Mailman would qualify (e.g.,
Reply-to
header munging) -
the reverse-path (originator) address specification command (MAIL)
Sometimes "reverse path" or "originator" address is also referred to "backward-pointing" address (and those instances also refer to the
MAIL
command mostly). -
The second step in the procedure is the RCPT command. This step of the procedure can be repeated any number of times.
This step of the procedure can be repeated any number of times. !
So the section
3.9.1. Alias
To expand an alias, the recipient mailer simply replaces the pseudo-mailbox address in the envelope with each of the expanded addresses in turn; the rest of the envelope and the message body are left unchanged. The message is then delivered or forwarded to each expanded address.
means that for each "to:" rfc822 message header in the mail data (i.e., SMTP envelope's DATA) a RCPT TO command will be added.
-
An important mail facility is a mechanism for multi-destination delivery of a single message, by transforming (or "expanding" or "exploding") a pseudo-mailbox address into a list of destination mailbox addresses.
So this section describes how distribution list addresses or mailing list addresses are expanded into individual email addresses of the members of those lists, and not how emails are delivered to multiple addresses when more than one recipient is specified in a MUA.
-
2yz
-
However, in practice, some servers do not perform recipient verification until after the message text is received. These servers SHOULD treat a failure for one or more recipients as a "subsequent failure" and return a mail message as discussed in Section 6 and, in particular, in Section 6.1. Using a "550 mailbox not found" (or equivalent) reply code after the data are accepted makes it difficult or impossible for the client to determine which recipients failed.
Seems relevant for the question above.
-
If the verb is initially accepted and the 354 reply issued, the DATA command should fail only if the mail transaction was incomplete (for example, no recipients),
How could this specific scenario be even possible? It just said in the previous paragraph that
If there was no MAIL, or no RCPT, command, or all such commands were rejected, the server MAY return a "command out of sequence" (503) or "no valid recipients" (554) reply in response to the DATA command.
-
5yz
This was unexpected; why wasn't the canonical format (i.e., 5xx) used instead?
-
Since it has been a common source of errors, it is worth noting that spaces are not permitted on either side of the colon following FROM in the MAIL command or TO in the RCPT command. The syntax is exactly as given above.
!
-
Similarly, servers MAY decline to accept mail that is destined for other hosts or systems.
For a personal mail server, this sounds like a reasonable advice to follow.
-
An SMTP session is initiated when a client opens a connection to a server and the server responds with an opening message.
Is SMTP stateless or stateful? See thread above.
-
However, exploiting the case sensitivity of mailbox local-parts impedes interoperability and is discouraged.
What does this mean? Then what is the point of preserving the case if one can't act on it?
-
Verbs and argument values (e.g., "TO:" or "to:" in the RCPT command and extension name keywords) are not case sensitive, with the sole exception in this specification of a mailbox local-part (SMTP Extensions may explicitly specify case-sensitive elements). That is, a command verb, an argument value other than a mailbox local-part, and free form text MAY be encoded in upper case, lower case, or any mixture of upper and lower case with no impact on its meaning. The local-part of a mailbox MUST BE treated as case sensitive.
The local-part of a mailbox MUST BE treated as case sensitive.
Meaning that email addresses are case sensitive (the part before @, that is).
-
The terms "message content" and "mail data" are used interchangeably in this document to describe the material transmitted after the DATA command is accepted and before the end of data indication is transmitted.
The terms "message content" and "mail are used interchangeably
-
RFC 3463 [25], specifies further structuring of the reply strings, including the use of supplemental and more specific completion codes (see also RFC 5248 [26]).
To-do: look at the mentioned RFCs.
-
SMTP sessions are stateful
SMTP is stateless but SMTP sessions (just as HTTP/HTTPS sessions) are stateful.
-
CNAME RR
RR - resource record
-
The means by which an SMTP client, once it has determined a target domain, determines the identity of an SMTP server to which a copy of a message is to be transferred, and then performs that transfer, is covered by this document. To effect a mail transfer to an SMTP server, an SMTP client establishes a two-way transmission channel to that SMTP server. An SMTP client determines the address of an appropriate host running an SMTP server by resolving a destination domain name to either an intermediate Mail eXchanger host or a final target host.
What does "SMTP client" refer to in this context? A MUA?
-
However, RFC 821 specifies some features that were not in significant use in the Internet by the mid-1990s and (in appendices) some additional transport models. Those sections are omitted here in the interest of clarity and brevity; readers needing them should refer to RFC 821.
Important?
-
-
tools.ietf.org tools.ietf.org
-
CNAME A <domain-name> which specifies the canonical or primary name for the owner. The owner name is an alias.
The second sentence ruins understanding this definition for me. Does this mean that CNAME is basically an alias, but it is the highest priority one (hence the designation "primary")?
-
- Nov 2020
-
hydra.nixos.org hydra.nixos.org
-
performs fully automated deployment. This is a good thing because it ensures that deployments are reproducible.It performs provisioning.
What is the difference between provisioning and deployment?
-
missing virtual machines
Typo? Missing -> spinning
-
- Oct 2020
-
erlang.org erlang.org
-
HTTP CLIENT SERVICE START/STOP An HTTP client can be configured to start when starting the Inets application or started dynamically in runtime by calling the Inets application API inets:start(httpc, ServiceConfig) or inets:start(httpc, ServiceConfig, How), see inets(3). The configuration options are as follows: {profile, profile()} Name of the profile, see DATA TYPES. This option is mandatory. {data_dir, path()} Directory where the profile can save persistent data. If omitted, all cookies are treated as session cookies. The client can be stopped using inets:stop(httpc, Pid) or inets:stop(httpc, Profile).
inets:start()
will automatically start thehttpc
service also! -
profile() = atom()
This should be
profile() = default | atom()
because thehttpc
service is automatically started with the default profile (calleddefault
) wheninets
is started.See also How to get more information about error when starting Inets httpd?
Tags
Annotators
URL
-
-
erlang.org erlang.org
-
The HTTP client default profile is started when the Inets application is started and is then available to all processes on that Erlang node.
Tags
Annotators
URL
-
-
docs.microsoft.com docs.microsoft.com
-
To request tokens for Azure Storage
That is, to request token if the app is not running in the Azure cloud with a managed identity:
Acquire a token from Azure AD for authorizing requests from a client application
Request an access token in Azure Active Directory B2C (and the other chapters in the Authorization protocols section)
-
- Aug 2020
-
toraritte.github.io toraritte.github.io
-
Original post is here.
This explanation should be combined with 24 Days of GHC Extensions: Rank N Types (see related hypothes.is note).
-
-
ocharles.org.uk ocharles.org.uk
-
Commonly the above definition is called the identity function. But in fact we should think of it as a whole family of functions. We should really say that id is an identity function for all types a. In other words, for every type T you might come up with, there is an identity function called id, which is of type T -> T. This is the type-checker’s view anyway, and by turning on the RankNTypes extension we can be explicit about that in our code: {-# LANGUAGE RankNTypes #-} id :: forall a. a -> a id x = x
This is such a nice description of
forall
. It should be combined withforall
is the type-level "lambda" (also saved it here). -
Now it is much clearer that id is really a family of infinitely many functions. It is fair to say that it is an abstract function (as opposed to a concrete one), because its type abstracts over the type variable a. The common and proper mathematical wording is that the type is universally quantified (or often just quantified) over a.
This was very neatly put, and
forall
above is also spot on. -
It also adds safety through a property called parametricity. If we pretend that there are no infinite loops or exceptions (it’s okay to do that, so we will do it throughout this article), then the function is actually fully determined by its type. In other words, if we see the type a -> a, we know that the corresponding value must be the identity function.
If this would be the first time I came across parametricity, I wouldn't understand what it means.
https://en.wikipedia.org/wiki/Parametricity
In programming language theory, parametricity is an abstract uniformity property enjoyed by parametrically polymorphic functions, which captures the intuition that all instances of a polymorphic function act the same way.
That is, a function with the type signature
a -> a
has only one implementation: it can only return its input. In a similar fashion,a -> b -> a
will only return the first argument and ignore the second. And so on. -
In other words you cannot choose the definition of a value based on its type (for now).
What does this mean?
-
-
github.com github.com
-
and so rows cannot exist as a value.
From Turning a map of data constructors into a row type (purescript discourse):
rows don’t have corresponding values, they only exist at the type level. If you do only purely want a row and not something like a Variant result you could return a proxy though.
-
-
book.purescript.org book.purescript.org
-
Quantified Types
My main issue with this book is that the difficulty is exponentially increasing, and by "keeping it simple" (i.e., trying to use simple terms) it is even harder to do a proper research.
For example:
1. The name of this chapter
This chapter should have been called Explicitly quantified type or Explicit universal quantification as it is too general as is, and doing a search to get to know more when someone has no formal/previous functional programming background, makes very hard.
Most importantly though, even if Haskell not mentioned, the word "explicit" would have been important.
It is also more about generic parameters than about quantification itself, and
forall
is kind of introduced but it is totally misleading.2.
forall
The post “forall” is the type-level “lambda” (saved) is the best, most succinct explanation of
forall
that I ever found. Unfortunately not before going down the rabbit hole.. (See links below.) One still needs to know about- typeclasses
- generic parameters
- constraints
- what pragmas are but after that, it is straightforward.
(Jordan's Reference section on
forall
also doesn't help much.)forall
is also mandatory in PureScript (which is also not mentioned when introducing it), and I believe a comparison (the way the above post did) with Haskell is important, but at the right time. At least Jordan's Reference tries to put it off until later, but still before explaining concepts required to understand it.3. The "rabbit hole" links
These are all good resources, but not for uninitiated mortals, and at a lower level (such as where I am now) they raise more questions than answers.
Explicit
forall
(r/purescript reddit)](Started here initially, but the single sentence there prompted a search for scoped type variables and rank-n types (or Rank N types).)
-
-
github.com github.com
-
# Build a developer-level executable file spago bundle-app --main Module.Path.To.Main --to dist/index.js node dist/index.js # Build a production-level Node-backend file via Parcel spago bundle-app --main Module.Path.To.Main --to dist/bundle-output.js parcel build dist/bundle-output.js --target "node" -o app.js
These are the
spago
equivalents forpulp browserify
I guess. -
spago build --watch --clear-screen
Is this the same as
pscid
?
-
-
nixos.org nixos.org
-
builtins.attrValues set
TODO: Is this the same as
lib.attrsets.attrValues
in nixpkgs? -
builtins.elem x xsReturn true if a value equal to x occurs in the list xs, and false otherwise.
equalElem
oreqElem
would have been more fortunate. In this form I would believe that it does whatbuiltins.elemAt
does. -
baseNameOf sReturn the base name of the string s, that is, everything following the final slash in the string. This is similar to the GNU basename command.
works both on strings and paths
-
String Concatenation string1 + string2 leftString concatenation.
-
-
nixos.org nixos.org
-
5.1.2.6. lib.attrsets.attrValuesattrValues :: AttrSet -> [Any]
TODO Is this an alias to
builtins.attrValues
? -
type Option type, providing type-checking and value merging.
This is vague to the point of being useless, given the Nix expression language is untyped.
A snippet from
freeswitch.nix
:configTemplate = mkOption { type = types.path; # omitted }; configDir = mkOption { type = with types; attrsOf path; # omitted };
Where does
types
come from?What is the difference between the path types? (I guess, the second one is attribute set consisting only of paths.)
-
TODO: document
lib.mkIf
Found a description in the NixOS manual:
The special function mkIf causes the evaluation of the conditional to be “pushed down” into the individual definitions, as if you had written:
config = { environment.systemPackages = if config.services.httpd.enable then [ ... ] else []; ... };
-
TODO: document
lib.mkDefault
Not mentioned in any of the manuals (i.e., nix, nixpkgs, NixOS), only the NixOS options page has 1 mention:
Some promising search result (in the order of relevance):
- https://releases.nixos.org/nix-dev/2015-June/017549.html
- https://releases.nixos.org/nix-dev/2015-June/017549.html
From source:
mkOverride = priority: content: { _type = "override"; inherit priority content; }; mkDefault = mkOverride 1000; # used in config sections of non-user modules to set a default
It seems that all the
mkOverride
calls set up a priority for certain actions. -
5.1.7. NixOS / nixpkgs option handling
What is an
option
?From the link below to the source, it's just an attribute set with all the function parameters (see below) plus a
_type
attribute name to allow for type level operations (because Nix is untyped).mkOption = { # Default value used when no definition is given in the configuration. default ? null, # Textual representation of the default, for the manual. defaultText ? null, # Example value used in the manual. example ? null, # String describing the option. description ? null, # Related packages used in the manual (see `genRelatedPackages` in ../nixos/lib/make-options-doc/default.nix). relatedPackages ? null, # Option type, providing type-checking and value merging. type ? null, # Function that converts the option value to something else. apply ? null, # Whether the option is for NixOS developers only. internal ? null, # Whether the option shows up in the manual. visible ? null, # Whether the option can be set only once readOnly ? null, # Deprecated, used by types.optionSet. options ? null } @ attrs: attrs // { _type = "option"; };
How does it fit in a big scheme of things?
?
-
5.1.2.25. lib.attrsets.recursiveUpdateUntil
If there is
recursiveUpdateUntil
(i.e.,mergeUntil
) thenmergeWith
would also be welcome. -
5.1.2.26. lib.attrsets.recursiveUpdaterecursiveUpdate :: AttrSet -> AttrSet -> AttrSet
Would be nice to have an alias called
merge
. -
String -> Any -> { name = String; value = Any }
Fix: add semicolon after last
Any
. (same above in the main type signature) -
mapAttrsToList :: (String -> Any -> Any) -> AttrSet -> Any Located at lib/attrsets.nix:233 in <nixpkgs>. Call fn for each attribute in the given set and return the result in a list.
So the type signature
(String -> Any -> Any) -> AttrSet -> Any ^^^
should be
(String -> Any -> Any) -> AttrSet -> List ^^^^
instead, right?
-
5.1.2.11. lib.attrsets.collectcollect :: (Any -> Bool) -> AttrSet -> [Any]
See comment above.
-
5.1.2.7. lib.attrsets.catAttrscatAttrs :: String -> [AttrSet] -> [Any] Located at lib/attrsets.nix:113 in <nixpkgs>. Collect each attribute named `attr' from the list of attribute sets, sets.
Then why not call it
collectVals
?... (Following the distinctive naming convention betweenlib.attrsets.attrVals
andlib.attrsets.attrValues
.)Especially because there is
lib.attrsets.collect
:catAttrs :: String -> [AttrSet] -> [Any] collect :: (Any -> Bool) -> AttrSet -> [Any]
(Call it
filterVals
? There arefilterAttrs*
functions but those return an attribute set, so no collision.) -
Attribute-Set
This should read "Attribute Set Functions". Nowhere else is attribute sets spelled as "attribute-set".
edit: Alright, "attribute-set" is used in total of 4 times, whereas "attribute set" is used 112 times.
Tags
Annotators
URL
-
-
-
> (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
-
- Jul 2020
-
erlang.org erlang.org
-
The keys will be copied to the heap for the process calling get/0, but the values will not.
What does this mean?
-
-
adoptingerlang.org adoptingerlang.org
-
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, therelx
example from therebar.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 inrebar.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.
-
-
adoptingerlang.org adoptingerlang.org
-
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 isrest_for_one
orone_for_all
and a sibling's death causes thetemporary
process to be terminated). - A
transient
child process is restarted only if it terminates abnormally, that is, with another exit reason thannormal
,shutdown
, or{shutdown,Term}
. https://erlang.org/doc/man/supervisor.html
- A
-
-
adoptingerlang.org adoptingerlang.org
-
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.
Or use the Nix package manager's
nix-shell
.
Tags
Annotators
URL
-
-
www.sos.ca.gov www.sos.ca.gov
-
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."
-
- Jun 2020
-
nixos.org nixos.org
-
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 isfetchGit
), but there is also nosha256
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-L215We are again back to trying things out on hearsay.
In the
home-manager
NixOS wiki it also shows aref
argument tofetchGit
but it is not documented anywhere. Yay. Anyway, it works without it too.
-
-
nixos.wiki nixos.wiki
-
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).
-
-
www.mpscholten.de www.mpscholten.de
-
with import <nixpkgs> {};
It is kind of an anti-pattern using the angle bracket notation and the linked post also makes a suggestion:
{ pkgs ? import (fetchTarball https://github.com/NixOS/nixpkgs/archive/3590f02e7d5760e52072c1a729ee2250b5560746.tar.gz) {}; }: # ...
-
with import <nixpkgs> {};
It is kind of an anti-pattern using the angle bracket notation and the linked post also makes a suggestion:
{ pkgs ? import (fetchTarball https://github.com/NixOS/nixpkgs/archive/3590f02e7d5760e52072c1a729ee2250b5560746.tar.gz) {}; }: # ...
-
with import <nixpkgs> {};
It is kind of an anti-pattern using the angle bracket notation and the linked post also makes a suggestion:
{ pkgs ? import (fetchTarball https://github.com/NixOS/nixpkgs/archive/3590f02e7d5760e52072c1a729ee2250b5560746.tar.gz) {}; }: # ...
-
-
nixos.wiki nixos.wiki
-
Basic Install environment.systemPackages = with pkgs; [ vim ]; or environment.systemPackages = with pkgs; [ vim_configurable ];
What is the difference between the
vim
andvim_configurable
packages?I believe the source for the latter is here.
Tags
Annotators
URL
-
-
-
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)
-
-
docs.microsoft.com docs.microsoft.comaz disk1
-
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.
-
-
releases.nixos.org releases.nixos.org
-
Install the latest version of NixOps. $ nix-env -i nixops
... or list it in
environment.systemPackages
in/etc/nixos/configuration.nix
, andnixos-rebuild switch
.
-
-
binarin.ru binarin.ru
-
One way (are there others?) to pin Nixpkgs, and ditch channels.
-
-
qfpl.io qfpl.io
-
extraUsers
extraUsers
have been renamed tousers
. See related commits. -
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, andluksroot
should be used instead (seeboot.initrd.luks.devices
NixOS option) .boot.initd.luks.devices = { luksroot = { device = "/nev/sda2"; preLVM = true; }; };
-
# cryptsetup luksFormat $LVM_PARTITION
Got a warning here but it seems to be safe to ignore.
WARNING: Locking directory /run/cryptsetup is missing!
-
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. -
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
Tags
Annotators
URL
-
- May 2020
-
blog.erlang.org blog.erlang.org
-
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
andsocket
are competing socket implementations then?Q2:
inets
is higher level abstraction layer on top ofinet
? (Just as HTTP is higher level than transport protocols.)Q3 (corollary of Q1 and Q2):
inets
could be then rewritten to usesocket
instead? (And used just likegen_tcp
with theinet_backend
option?)
Tags
Annotators
URL
-
- Apr 2020
-
docs.microsoft.com docs.microsoft.com
-
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
-
-
learnyousomeerlang.com learnyousomeerlang.com
-
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
Tags
Annotators
URL
-
-
nixos.org nixos.org
-
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 ofpath-info
in the Nix manual (and none in the Nixpkgs manual).nix --help
sayspath-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))
-
-
sarabander.github.io sarabander.github.io
-
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:
- Eager evaluation/applicative order and lazy evaluation/normal order (Stackoverflow)
- Normal, Applicative, and Lazy evaluation
The bottom line seems to be that
- strict/eager = normal order
- lazy ~= applicative BUT all terms are evaluated at most once
Tags
Annotators
URL
-
-
sarabander.github.io sarabander.github.io
-
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.
Tags
Annotators
URL
-
-
sarabander.github.io sarabander.github.io
-
Thus, programs must be written for people to read, and only incidentally for machines to execute.
Tags
Annotators
URL
-
-
sarabander.github.io sarabander.github.io
-
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.
-
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!
Tags
Annotators
URL
-
-
tools.ietf.org tools.ietf.org
-
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/
Tags
Annotators
URL
-
-
docs.microsoft.com docs.microsoft.com
-
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.
-
-
erlang.org erlang.org
-
Content-Length
Not mentioned anywhere (not even in the
inets
User's Guide), butContent-Length
is calculated automatically if it is not provided.
Tags
Annotators
URL
-
- Mar 2020
-
www.fluke.com www.fluke.com
-
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.
-
- Nov 2019
-
nixos.org nixos.org
-
name = "vim-with-plugins";
How does one find what vim packages are available? (That nix vim-derivations/attributes, such as
vimHugeX
) -
{ 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 whena_package.override
is used insidepackageOverrides
. But why?
Tags
Annotators
URL
-
-
discourse.nixos.org discourse.nixos.org
-
Nix ecosystem introduction ("Talk at my company")
-
-
discourse.nixos.org discourse.nixos.org
-
Declarative package management for normal users
-
-
stackoverflow.com stackoverflow.com
-
What is the relationship between Disnix and NixOps?
-
-
news.ycombinator.com news.ycombinator.com
-
any real reason you should use zeromq over rabbitmq?
Tags
Annotators
URL
-
-
www.tweag.io www.tweag.io
-
NIX + BAZEL = FULLY REPRODUCIBLE, INCREMENTAL BUILDS
Tags
Annotators
URL
-
-
www.membraneframework.org www.membraneframework.org
-
Membrane Framework - Reliable & scalable multimedia streaming
-
-
chriswarbo.net chriswarbo.net
-
Web Hosting with IPFS and Nix
-
-
iohk.io iohk.io
-
How we use Nix at IOHK?
-
-
softwareengineering.stackexchange.com softwareengineering.stackexchange.com
-
What technical details should a programmer of a web application consider before making the site public?
-
-
localhost:8080 localhost:8080
-
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?"
-
-
nixos.org nixos.org
-
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).
-
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)??
-
-
github.com github.com
-
haskell-overridez is a tool and library of nix functions that simplify the use of overrides while developing haskell projects with nixpkgs.
Tags
Annotators
URL
-
-
github.com github.comjyp/styx1
-
A nix-based Haskell project manager
-
- Oct 2019
-
localhost:8080 localhost:8080
-
Eelco Dolstra's seminal paper
-
-
nixos.org nixos.org
-
fixed-point
"fixed-point", "fix point" seems to be most important concept in Nix, because
override
s,overridePackages
, overlays are built using it.- Nix Pill - Chapter 17. Nixpkgs Overriding Packages (the first place I saw this concept properly described)
- Nixpkgs issue - Add pkgs.overrideWithScope#44196 (best high level summary of Nixpkgs ever read)
- How to Fake Dynamic Binding in Nix
- Comment by zimbatm on NixOS Discourse
- nixpkgs/lib/fixed-points.nix
-
Overlays
- [Nix-dev] Introducing Nixpkgs Overlays
- Video - Initial announcement of overlays by Nicolas B. Pierron (nbp)
- Overlays implementation by Nicolas B. Pierron (nbp)
- https://nixos.wiki/wiki/Overlays
- Gabriel439/haskell-nix issue #58
- NixOS: The DOs and DON’Ts of nixpkgs overlays
- Nix overlays and override pattern Stackoverflow thread
Should
packageOverrides
be deprecated in favor of Overlays?- Nixpkgs issue - Deprecate packageOverrides? #43266
- Nixpkgs pull request - [WIP] Deprecate packageOverrides #43560
-
buildEnv
Where is
buildEnv
documented?- How buildEnv builtin function works? Stackoverflow thread
- mkShell vs. buildEnv?
- NixOS Wiki, Documentation Gaps, section What's the relationship between nix-env and buildEnv
- How to copy a nix-env profile using nix-copy-closure?
- https://news.ycombinator.com/item?id=11803558
-
override
First mention of the
override
attribute, so where is it coming from? -
stdenv.lib.licenses
Find out where
stdenv.lib
functions are documented. -
builtins.elem
builtins.elem x xs
Return true if a value equal to x occurs in the list xs, and false otherwise.
-
builtins.parseDrvName
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"; }.
-
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.
-