1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-30 03:23:16 +02:00

* Strip off the `.nix' suffix from the attribute name for files in

~/.nix-defexpr,  otherwise the attribute cannot be selected with the
  `-A' option.  Useful if you want to stick a Nix expression directly
  in ~/.nix-defexpr.
This commit is contained in:
Eelco Dolstra 2008-08-25 13:31:57 +00:00
parent cc826dc03e
commit b428adc267
5 changed files with 27 additions and 6 deletions

View file

@ -2,6 +2,7 @@
#include "store-api.hh"
#include "aterm.hh"
#include "globals.hh"
#include "util.hh"
#include "derivations-ast.hh"
#include "derivations-ast.cc"
@ -163,9 +164,7 @@ ATerm unparseDerivation(const Derivation & drv)
bool isDerivation(const string & fileName)
{
return
fileName.size() >= drvExtension.size() &&
string(fileName, fileName.size() - drvExtension.size()) == drvExtension;
return hasSuffix(fileName, drvExtension);
}