forked from lix-project/lix
* Refactoring: move the user environment stuff into its own module.
This commit is contained in:
parent
5c31995bb8
commit
b7ff69eb7c
|
@ -1,6 +1,7 @@
|
||||||
bin_PROGRAMS = nix-env
|
bin_PROGRAMS = nix-env
|
||||||
|
|
||||||
nix_env_SOURCES = nix-env.cc profiles.cc profiles.hh help.txt
|
nix_env_SOURCES = nix-env.cc profiles.cc user-env.cc profiles.hh help.txt
|
||||||
|
|
||||||
nix_env_LDADD = ../libmain/libmain.la ../libexpr/libexpr.la \
|
nix_env_LDADD = ../libmain/libmain.la ../libexpr/libexpr.la \
|
||||||
../libstore/libstore.la ../libutil/libutil.la \
|
../libstore/libstore.la ../libutil/libutil.la \
|
||||||
../boost/format/libformat.la ${aterm_lib} @ADDITIONAL_NETWORK_LIBS@
|
../boost/format/libformat.la ${aterm_lib} @ADDITIONAL_NETWORK_LIBS@
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "common-opts.hh"
|
#include "common-opts.hh"
|
||||||
#include "xml-writer.hh"
|
#include "xml-writer.hh"
|
||||||
#include "store-api.hh"
|
#include "store-api.hh"
|
||||||
|
#include "user-env.hh"
|
||||||
#include "util.hh"
|
#include "util.hh"
|
||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
@ -192,25 +193,6 @@ static Path getDefNixExprPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static DrvInfos queryInstalled(EvalState & state, const Path & userEnv)
|
|
||||||
{
|
|
||||||
Path path = userEnv + "/manifest";
|
|
||||||
|
|
||||||
if (!pathExists(path))
|
|
||||||
return DrvInfos(); /* not an error, assume nothing installed */
|
|
||||||
|
|
||||||
throw Error("not implemented");
|
|
||||||
#if 0
|
|
||||||
Expr e = ATreadFromNamedFile(path.c_str());
|
|
||||||
if (!e) throw Error(format("cannot read Nix expression from `%1%'") % path);
|
|
||||||
|
|
||||||
DrvInfos elems;
|
|
||||||
// !!! getDerivations(state, e, "", ATermMap(1), elems);
|
|
||||||
return elems;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Ensure exclusive access to a profile. Any command that modifies
|
/* Ensure exclusive access to a profile. Any command that modifies
|
||||||
the profile first acquires this lock. */
|
the profile first acquires this lock. */
|
||||||
static void lockProfile(PathLocks & lock, const Path & profile)
|
static void lockProfile(PathLocks & lock, const Path & profile)
|
||||||
|
|
28
src/nix-env/user-env.cc
Normal file
28
src/nix-env/user-env.cc
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#include "util.hh"
|
||||||
|
#include "get-drvs.hh"
|
||||||
|
|
||||||
|
|
||||||
|
namespace nix {
|
||||||
|
|
||||||
|
|
||||||
|
DrvInfos queryInstalled(EvalState & state, const Path & userEnv)
|
||||||
|
{
|
||||||
|
Path path = userEnv + "/manifest";
|
||||||
|
|
||||||
|
if (!pathExists(path))
|
||||||
|
return DrvInfos(); /* not an error, assume nothing installed */
|
||||||
|
|
||||||
|
throw Error("not implemented");
|
||||||
|
#if 0
|
||||||
|
Expr e = ATreadFromNamedFile(path.c_str());
|
||||||
|
if (!e) throw Error(format("cannot read Nix expression from `%1%'") % path);
|
||||||
|
|
||||||
|
DrvInfos elems;
|
||||||
|
// !!! getDerivations(state, e, "", ATermMap(1), elems);
|
||||||
|
return elems;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
16
src/nix-env/user-env.hh
Normal file
16
src/nix-env/user-env.hh
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#ifndef __USER_ENV_H
|
||||||
|
#define __USER_ENV_H
|
||||||
|
|
||||||
|
#include "get-drvs.hh"
|
||||||
|
|
||||||
|
namespace nix {
|
||||||
|
|
||||||
|
DrvInfos queryInstalled(EvalState & state, const Path & userEnv);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !__USER_ENV_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue