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

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

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

      What is the difference between the vim and vim_configurable packages?

      I believe the source for the latter is here.

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

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

      boot.initd.luks.devices = {
        luksroot = {
          device = "/nev/sda2";
          preLVM = true;
        };
      };
      
  2. Apr 2020
    1. nix path-info shows information about store paths, replacing nix-store -q. A useful feature is the option --closure-size (-S). For example, the following command show the closure sizes of every path in the current NixOS system closure, sorted by size: nix path-info -rS /run/current-system | sort -nk2

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

      nix --help says

      path-info        query information about store paths
      

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

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

  3. Mar 2020
  4. Feb 2020
    1. 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.
    2. 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.
    1. 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.
  5. Nov 2019
    1. { packageOverrides = pkgs: rec { foo = pkgs.foo.override { ... }; }; }

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

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

    1. 3. Deployment as Memory Management

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

      Specifically "3.1 What is a component?"

    1. packages

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

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

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

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

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

  6. Oct 2019
    1. fixed-point

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

    2. Overlays
    3. buildEnv
    4. stdenv.lib.licenses

      Find out where stdenv.lib functions are documented.

    5. builtins.elem

      builtins.elem x xs

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

    6. builtins.parseDrvName

      builtins.parseDrvName s

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

    7. 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.

  7. Jul 2019
  8. Jun 2019
  9. Dec 2018
  10. Nov 2018
  11. Oct 2018
  12. Sep 2018
  13. Jul 2018
  14. Jun 2018
  15. Dec 2017