Skip to content
Snippets Groups Projects
  1. Sep 05, 2014
  2. Aug 28, 2014
  3. Aug 21, 2014
    • Eelco Dolstra's avatar
      Fix tests · 3f800605
      Eelco Dolstra authored
      So all these years I was totally deluded about the meaning of "set
      -e". You might think that it causes statements like "false && true" or
      "! true" to fail, but it doesn't...
      3f800605
  4. Aug 20, 2014
  5. Aug 13, 2014
  6. Jul 30, 2014
  7. Jul 24, 2014
  8. Jul 16, 2014
    • Eelco Dolstra's avatar
      Handle case collisions on case-insensitive systems · 276a40b3
      Eelco Dolstra authored
      When running NixOps under Mac OS X, we need to be able to import store
      paths built on Linux into the local Nix store. However, HFS+ is
      usually case-insensitive, so if there are directories with file names
      that differ only in case, then importing will fail.
      
      The solution is to add a suffix ("~nix~case~hack~<integer>") to
      colliding files. For instance, if we have a directory containing
      xt_CONNMARK.h and xt_connmark.h, then the latter will be renamed to
      "xt_connmark.h~nix~case~hack~1". If a store path is dumped as a NAR,
      the suffixes are removed. Thus, importing and exporting via a
      case-insensitive Nix store is round-tripping. So when NixOps calls
      nix-copy-closure to copy the path to a Linux machine, you get the
      original file names back.
      
      Closes #119.
      276a40b3
  9. Jul 14, 2014
  10. Jul 11, 2014
  11. Jul 09, 2014
  12. Jul 04, 2014
  13. Jun 10, 2014
  14. May 29, 2014
  15. May 26, 2014
    • Eelco Dolstra's avatar
      Make the Nix search path declarative · 62a6eeb1
      Eelco Dolstra authored
      Nix search path lookups like <nixpkgs> are now desugared to ‘findFile
      nixPath <nixpkgs>’, where ‘findFile’ is a new primop. Thus you can
      override the search path simply by saying
      
        let
          nixPath = [ { prefix = "nixpkgs"; path = "/my-nixpkgs"; } ];
        in ... <nixpkgs> ...
      
      In conjunction with ‘scopedImport’ (commit
      c273c15c), the Nix search path can be
      propagated across imports, e.g.
      
        let
      
          overrides = {
            nixPath = [ ... ] ++ builtins.nixPath;
            import = fn: scopedImport overrides fn;
            scopedImport = attrs: fn: scopedImport (overrides // attrs) fn;
            builtins = builtins // overrides;
          };
      
        in scopedImport overrides ./nixos
      62a6eeb1
    • Eelco Dolstra's avatar
      Ensure that -I flags get included in nixPath · 39d72640
      Eelco Dolstra authored
      Also fixes #261.
      39d72640
    • Eelco Dolstra's avatar
      Add constant ‘nixPath’ · a8edf185
      Eelco Dolstra authored
      It contains the Nix expression search path as a list of { prefix, path
      } sets, e.g.
      
        [ { path = "/nix/var/nix/profiles/per-user/root/channels/nixos"; prefix = ""; }
          { path = "/etc/nixos/configuration.nix"; prefix = "nixos-config"; }
          { path = "/home/eelco/Dev/nix/inst/share/nix/corepkgs"; prefix = "nix"; }
        ]
      a8edf185
    • Eelco Dolstra's avatar
      Add primop ‘scopedImport’ · c273c15c
      Eelco Dolstra authored
      ‘scopedImport’ works like ‘import’, except that it takes a set of
      attributes to be added to the lexical scope of the expression,
      essentially extending or overriding the builtin variables.  For
      instance, the expression
      
        scopedImport { x = 1; } ./foo.nix
      
      where foo.nix contains ‘x’, will evaluate to 1.
      
      This has a few applications:
      
      * It allows getting rid of function argument specifications in package
        expressions. For instance, a package expression like:
      
          { stdenv, fetchurl, libfoo }:
      
          stdenv.mkDerivation { ... buildInputs = [ libfoo ]; }
      
        can now we written as just
      
          stdenv.mkDerivation { ... buildInputs = [ libfoo ]; }
      
        and imported in all-packages.nix as:
      
          bar = scopedImport pkgs ./bar.nix;
      
        So whereas we once had dependencies listed in three places
        (buildInputs, the function, and the call site), they now only need
        to appear in one place.
      
      * It allows overriding builtin functions. For instance, to trace all
        calls to ‘map’:
      
        let
          overrides = {
            map = f: xs: builtins.trace "map called!" (map f xs);
      
            # Ensure that our override gets propagated by calls to
            # import/scopedImport.
            import = fn: scopedImport overrides fn;
      
            scopedImport = attrs: fn: scopedImport (overrides // attrs) fn;
      
            # Also update ‘builtins’.
            builtins = builtins // overrides;
          };
        in scopedImport overrides ./bla.nix
      
      * Similarly, it allows extending the set of builtin functions. For
        instance, during Nixpkgs/NixOS evaluation, the Nixpkgs library
        functions could be added to the default scope.
      
      There is a downside: calls to scopedImport are not memoized, unlike
      import. So importing a file multiple times leads to multiple parsings
      / evaluations. It would be possible to construct the AST only once,
      but that would require careful handling of variables/environments.
      c273c15c
  16. May 22, 2014
  17. May 02, 2014
  18. Apr 15, 2014
  19. Mar 10, 2014
  20. Feb 26, 2014
  21. Feb 19, 2014
  22. Feb 17, 2014
Loading