diff options
| -rw-r--r-- | custom/dotfiles.nix | 22 | ||||
| -rw-r--r-- | vali.nix | 18 |
2 files changed, 24 insertions, 16 deletions
diff --git a/custom/dotfiles.nix b/custom/dotfiles.nix new file mode 100644 index 00000000..e45fc2d0 --- /dev/null +++ b/custom/dotfiles.nix | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | { fetchgit | ||
| 2 | , lib | ||
| 3 | , findutils | ||
| 4 | }: | ||
| 5 | |||
| 6 | let | ||
| 7 | dotfiles = fetchgit (rec { | ||
| 8 | name = "dotfiles-${rev}"; | ||
| 9 | url = git://git.yggdrasil.li/dotfiles; | ||
| 10 | rev = "377401ceefea6772915071267625cd02c066f86e"; | ||
| 11 | sha256 = "258e15ff69afaa663541b1691e1385d43b74d086891e4a0009d3507ab6cfbbe8"; | ||
| 12 | }); | ||
| 13 | setupUser = name : { | ||
| 14 | inherit name; | ||
| 15 | value = '' | ||
| 16 | cd ${dotfiles} | ||
| 17 | ${findutils}/bin/find . -type d -print0 | ${findutils}/bin/xargs -0 -I '{}' -- mkdir -p "/home/${name}/{}" | ||
| 18 | ${findutils}/bin/find . -type f -print0 | ${findutils}/bin/xargs -0 -I '{}' -- ln -s -f "${dotfiles}/{}" "/home/${name}/{}" | ||
| 19 | ''; | ||
| 20 | }; | ||
| 21 | in | ||
| 22 | names : lib.listToAttrs (builtins.map setupUser names); | ||
| @@ -74,20 +74,6 @@ rec { | |||
| 74 | }; | 74 | }; |
| 75 | 75 | ||
| 76 | system.activationScripts = let | 76 | system.activationScripts = let |
| 77 | dotfiles = pkgs.fetchgit (rec { | 77 | setupUsers = pkgs.callPackage custom/dotfiles.nix {}; |
| 78 | name = "dotfiles-${rev}"; | 78 | in setupUsers [ "/home/gkleen" ]; |
| 79 | url = git://git.yggdrasil.li/dotfiles; | ||
| 80 | rev = "377401ceefea6772915071267625cd02c066f86e"; | ||
| 81 | sha256 = "258e15ff69afaa663541b1691e1385d43b74d086891e4a0009d3507ab6cfbbe8"; | ||
| 82 | }); | ||
| 83 | setupUsers = names : pkgs.lib.listToAttrs (builtins.map setupUser names); | ||
| 84 | setupUser = name : { | ||
| 85 | inherit name; | ||
| 86 | value = '' | ||
| 87 | cd ${dotfiles} | ||
| 88 | ${pkgs.findutils}/bin/find . -type d -print0 | ${pkgs.findutils}/bin/xargs -0 -I '{}' -- mkdir -p "/home/${name}/{}" | ||
| 89 | ${pkgs.findutils}/bin/find . -type f -print0 | ${pkgs.findutils}/bin/xargs -0 -I '{}' -- ln -s -f "${dotfiles}/{}" "/home/${name}/{}" | ||
| 90 | ''; | ||
| 91 | }; | ||
| 92 | in setupUsers [ "gkleen" ]; | ||
| 93 | } | 79 | } |
