- Sep 2020
-
github.com github.com
Tags
Annotators
URL
-
- Aug 2020
-
nixos.org nixos.org
-
builtins.attrValues set
TODO: Is this the same as
lib.attrsets.attrValues
in nixpkgs? -
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
-
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
-
- Jun 2020
-
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
-
-
qfpl.io qfpl.io
-
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; }; };
Tags
Annotators
URL
-
- Apr 2020
-
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))
-
-
-
PHP built-in server with sqlite enabled
Docker based PHP development environment
Tags
Annotators
URL
-
- Mar 2020
- Feb 2020
-
-
Nix is a purely functional package manager. This means that it treats packages like values in purely functional programming languages such as Haskell — they are built by functions that don’t have side-effects, and they never change after they have been built.
-
-
Nix helps you make sure that package dependency specifications are complete. In general, when you’re making a package for a package management system like RPM, you have to specify for each package what its dependencies are, but there are no guarantees that this specification is complete. If you forget a dependency, then the component will build and work correctly on your machine if you have the dependency installed, but not on the end user's machine if it's not there.
-
-
builtwithnix.org builtwithnix.org
-
Never compile the same project twice Nix allows to easily share build results across machines. If the CI has built the project, developers or servers can download the build results instead of re-building the same thing.
Tags
Annotators
URL
-
-
discourse.drone.io discourse.drone.ioDrone1
Tags
Annotators
URL
-
-
www.slideshare.net www.slideshare.net
- Nov 2019
-
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?
-
-
www.tweag.io www.tweag.io
-
NIX + BAZEL = FULLY REPRODUCIBLE, INCREMENTAL BUILDS
Tags
Annotators
URL
-
-
chriswarbo.net chriswarbo.net
-
Web Hosting with IPFS and Nix
-
-
iohk.io iohk.io
-
How we use Nix at IOHK?
-
-
nixos.org nixos.org
-
{ 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
-
-
nixos.org nixos.org
-
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?"
Tags
Annotators
URL
-
-
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
-
nixos.org nixos.org
-
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
-
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.
-
-
www.thedailybeast.com www.thedailybeast.com
-
Christopher Wylie, the Cambridge Analytica whistleblower, claims that Sophie Schmidt, the daughter of former Google CEO Eric Schmidt, successfully campaigned for The Guardian to scrub her name from one of their bombshell data-abuse stories.
-
- Jul 2019
-
niklasblog.com niklasblog.com
- Jun 2019
- Dec 2018
-
discourse.nixos.org discourse.nixos.org
-
lethalman.blogspot.com lethalman.blogspot.com
-
garbas.si garbas.si
Tags
Annotators
URL
-
- Nov 2018
-
tutorials.ubuntu.com tutorials.ubuntu.com
-
-
kukuruku.co kukuruku.co
- Oct 2018
-
askubuntu.com askubuntu.com
-
nixos.org nixos.org
-
- Sep 2018
-
chriswarbo.net chriswarbo.net
-
www.haskellforall.com www.haskellforall.com
- Jul 2018
-
nixos.org nixos.org
- Jun 2018
-
cachix.org cachix.org
-
-
www.domenkozar.com www.domenkozar.com
-
github.com github.com
Tags
Annotators
URL
-
-
blog.liw.fi blog.liw.fi
-
-
github.com github.com
-
github.com github.com
Tags
Annotators
URL
-
-
discourse.nixos.org discourse.nixos.org
Tags
Annotators
URL
-
-
nixos.wiki nixos.wiki
-
-
www.slideshare.net www.slideshare.net
-
github.com github.com
Tags
Annotators
URL
-
-
blog.matejc.com blog.matejc.com
Tags
Annotators
URL
-
- Dec 2017
-
ebzzry.io ebzzry.io
Tags
Annotators
URL
-