summaryrefslogtreecommitdiff
path: root/custom/dotfiles.nix
blob: 43b9006c50713a0882ca06e3e5ff46cc2c2ca470 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{ fetchgit
, lib
, findutils
}:

let
  dotfiles = fetchgit (rec {
    name = "dotfiles-${rev}";
    url = git://git.yggdrasil.li/dotfiles;
    rev = "7be34a8395dd7174e2dfb6b8b544a3ded6ffe66e";
    sha256 = "6865e8013394068ab17c8699061f233434bfae525b75810f98fbf5c48e9d2d5d";
  });
  setupUser = name : {
    inherit name;
    value = ''
      cd ${dotfiles}
      ${findutils}/bin/find . -type d -print0 | ${findutils}/bin/xargs -0 -I '{}' -- mkdir -p "${name}/{}"
      ${findutils}/bin/find . -type f -print0 | ${findutils}/bin/xargs -0 -I '{}' -- ln -s -f "${dotfiles}/{}" "${name}/{}"
    '';
  };
in
  names : lib.listToAttrs (builtins.map setupUser names)