summaryrefslogtreecommitdiff
path: root/custom/dotfiles.nix
blob: a19ebe9c22401b73c18505b3c47ca29fdc564c76 (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 = "e54479a4eed08fbaff2983841771f687a8c6db4f";
    sha256 = "da6c687464ad874838014072e4af3878ec30b0e7beb948672b1bd80035e1c0b1";
  });
  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)