Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

home-manager: refactor & improve inconsistencies #209

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
512 changes: 285 additions & 227 deletions home-manager.nix

Large diffs are not rendered by default.

42 changes: 39 additions & 3 deletions lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,50 @@ let
list;
in
result.duplicates;

getHomeDirCfg = { pkgs, homeDirectory, storage }: dir:
let
dirCfg.storage = storage;

dirCfg.mountDir =
if dirCfg.storage.removePrefixDirectory then
dirListToPath (builtins.tail (splitPath [ dir ]))
else
dir;


dirCfg.mountPoint = concatPaths [ homeDirectory dirCfg.mountDir ];
dirCfg.targetDir = concatPaths [ dirCfg.storage.persistentStoragePath dir ];

dirCfg.escaped.mountPoint = lib.escapeShellArg dirCfg.mountPoint;
dirCfg.escaped.targetDir = lib.escapeShellArg dirCfg.targetDir;

dirCfg.sanitized.targetDir = sanitizeName dirCfg.targetDir;
dirCfg.sanitized.mountPoint = sanitizeName dirCfg.mountPoint;
dirCfg.sanitized.mountDir = sanitizeName dirCfg.mountDir;

dirCfg.unitName = "bindMount--${dirCfg.sanitized.mountDir}";

dirCfg.runBindfsArgs =
let
bindfsOptions =
lib.lists.optional (!dirCfg.storage.allowOther) "no-allow-other"
++ lib.lists.optional (lib.versionAtLeast pkgs.bindfs.version "1.14.9") "fsname=${dirCfg.targetDir}"
;
in
lib.lists.optionals (bindfsOptions != [ ]) [ "-o" (concatStringsSep "," bindfsOptions) ]
;
in
dirCfg;
in
{
inherit
splitPath
dirListToPath
concatPaths
dirListToPath
duplicates
getHomeDirCfg
parentsOf
sanitizeName
duplicates
splitPath
;
}
43 changes: 0 additions & 43 deletions mount-file.bash

This file was deleted.

Loading