Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
users.hh File Reference
#include "types.hh"
#include <sys/types.h>

Go to the source code of this file.

Functions

std::string nix::getUserName ()
 
Path nix::getHomeOf (uid_t userId)
 
Path nix::getHome ()
 
Path nix::getCacheDir ()
 
Path nix::getConfigDir ()
 
std::vector< Pathnix::getConfigDirs ()
 
Path nix::getDataDir ()
 
Path nix::getStateDir ()
 
Path nix::createNixStateDir ()
 
std::string nix::expandTilde (std::string_view path)
 
bool nix::isRootUser ()
 

Function Documentation

◆ createNixStateDir()

Path nix::createNixStateDir ( )

Create the Nix state directory and return the path to it.

◆ expandTilde()

std::string nix::expandTilde ( std::string_view path)

Perform tilde expansion on a path, replacing tilde with the user's home directory.

◆ getCacheDir()

Path nix::getCacheDir ( )
Returns
$NIX_CACHE_HOME or $XDG_CACHE_HOME/nix or $HOME/.cache/nix.

◆ getConfigDir()

Path nix::getConfigDir ( )
Returns
$NIX_CONFIG_HOME or $XDG_CONFIG_HOME/nix or $HOME/.config/nix.

◆ getConfigDirs()

std::vector< Path > nix::getConfigDirs ( )
Returns
the directories to search for user configuration files

◆ getDataDir()

Path nix::getDataDir ( )
Returns
$NIX_DATA_HOME or $XDG_DATA_HOME/nix or $HOME/.local/share/nix.

◆ getHome()

Path nix::getHome ( )
Returns
$HOME or the user's home directory from /etc/passwd.

◆ getHomeOf()

Path nix::getHomeOf ( uid_t userId)
Returns
the given user's home directory from /etc/passwd.

◆ getStateDir()

Path nix::getStateDir ( )
Returns
$NIX_STATE_HOME or $XDG_STATE_HOME/nix or $HOME/.local/state/nix.

◆ isRootUser()

bool nix::isRootUser ( )

Is the current user UID 0 on Unix?

Currently always false on Windows, but that may change.