Merge pull request #58 from centromere/home-with-pure-eval
Add support for pure evaluation mode
This commit is contained in:
commit
f840a659d5
2 changed files with 8 additions and 5 deletions
|
|
@ -204,15 +204,17 @@ rec {
|
||||||
# Finding git config
|
# Finding git config
|
||||||
#
|
#
|
||||||
|
|
||||||
|
home = if lib.inPureEvalMode or false then _: /nonexistent else import ./home.nix;
|
||||||
|
|
||||||
maybeXdgGitConfigFile =
|
maybeXdgGitConfigFile =
|
||||||
for
|
for
|
||||||
(guardNonEmptyString (builtins.getEnv "XDG_CONFIG_HOME"))
|
(guardNonEmptyString (builtins.getEnv "XDG_CONFIG_HOME"))
|
||||||
(xdgConfigHome:
|
(xdgConfigHome:
|
||||||
guardFile (/. + xdgConfigHome + "/git/config")
|
guardFile (/. + xdgConfigHome + "/git/config")
|
||||||
);
|
);
|
||||||
maybeGlobalConfig = take 1 (guardFile ~/.gitconfig
|
maybeGlobalConfig = take 1 (guardFile (home /.gitconfig)
|
||||||
++ maybeXdgGitConfigFile
|
++ maybeXdgGitConfigFile
|
||||||
++ guardFile ~/.config/git/config);
|
++ guardFile (home /.config/git/config));
|
||||||
|
|
||||||
globalConfigItems = for maybeGlobalConfig (globalConfigFile:
|
globalConfigItems = for maybeGlobalConfig (globalConfigFile:
|
||||||
parse-ini.parseIniFile globalConfigFile
|
parse-ini.parseIniFile globalConfigFile
|
||||||
|
|
@ -224,7 +226,7 @@ rec {
|
||||||
for
|
for
|
||||||
(guard (toLower section == "core" && toLower key == "excludesfile"))
|
(guard (toLower section == "core" && toLower key == "excludesfile"))
|
||||||
(_:
|
(_:
|
||||||
resolveFile (~/.) value
|
resolveFile (home /.) value
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -236,7 +238,7 @@ rec {
|
||||||
maybeGlobalIgnoresFile = take 1
|
maybeGlobalIgnoresFile = take 1
|
||||||
( globalConfiguredExcludesFile
|
( globalConfiguredExcludesFile
|
||||||
++ xdgExcludesFile
|
++ xdgExcludesFile
|
||||||
++ guardFile ~/.config/git/ignore);
|
++ guardFile (home /.config/git/ignore));
|
||||||
|
|
||||||
/* Given baseDir, which generalizes the idea of working directory,
|
/* Given baseDir, which generalizes the idea of working directory,
|
||||||
resolve a file path relative to that directory.
|
resolve a file path relative to that directory.
|
||||||
|
|
@ -247,7 +249,7 @@ rec {
|
||||||
*/
|
*/
|
||||||
resolveFile = baseDir: path: take 1
|
resolveFile = baseDir: path: take 1
|
||||||
( if hasPrefix "/" path then guardFile (/. + path) else
|
( if hasPrefix "/" path then guardFile (/. + path) else
|
||||||
(if hasPrefix "~" path then guardFile (~/. + removePrefix "~" path) else [])
|
(if hasPrefix "~" path then guardFile (home /. + removePrefix "~" path) else [])
|
||||||
++ guardFile (baseDir + "/" + path)
|
++ guardFile (baseDir + "/" + path)
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
|
|
|
||||||
1
home.nix
Normal file
1
home.nix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
path: ~/. + path
|
||||||
Loading…
Add table
Add a link
Reference in a new issue