Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Links the bookmark file into the users local surfraw configuration.
- #If the file already exists, force overwrite only if symlinked files hash
- #matches the already existing file.
- home.activation.linkSurfrawBookmarkFile = let
- placeholderBookmarkFile = pkgs.buildPackages.writeText
- "surfraw-placeholder-bookmarks" ''
- # This is a readonly, example bookmark file generated by home-manager.
- # If you want your own bookmarks here, use the 'linkBookmarkFile'
- # option of the surfraw module. This example file will then be replaced
- # by a link to your specified bookmark file.
- #
- # Bookmark Format
- # ---------------
- #
- # Everything after a # is treated as comment until the end of line.
- # Bookmarks are given in following form.
- # <name><whitespace><url> #And possible some tags as a comment
- # ntk http://www.ntk.net/
- '';
- source = if cfg.linkBookmarkFile == null
- then placeholderBookmarkFile else toString cfg.linkBookmarkFile;
- target = "${config.xdg.configHome}/surfraw/bookmarks";
- hashOf = file: builtins.hashFile "sha256" file;
- isSourceAlsoTarget = hashOf source == hashOf target;
- isTargetPlaceholder = hashOf target == hashOf placeholderBookmarkFile;
- in lib.hm.dag.entryAfter ["writeBoundary"]
- (if !(pathExists target) || isTargetPlaceholder || isSourceAlsoTarget
- then "$DRY_RUN_CMD ln -s -f $VERBOSE_ARG ${source} ${target}"
- else "$DRY_RUN_CMD ln -s $VERBOSE_ARG ${source} ${target}");
Advertisement
Add Comment
Please, Sign In to add comment