From 7a24d878e5299a1afddce22fb722a11eb6d16179 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 3 Jul 2015 21:25:42 +0200 Subject: First attempt at dotfiles --- vali.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/vali.nix b/vali.nix index b23912b1..f96e156f 100644 --- a/vali.nix +++ b/vali.nix @@ -4,7 +4,7 @@ { config, pkgs, ... }: -{ +rec { imports = [ # Include the results of the hardware scan. ./vali-hw.nix @@ -72,4 +72,22 @@ inherit (template) shell; openssh.authorizedKeys.keyFiles = template.openssh.authorizedKeys.keyFiles; }; + + system.activationScripts = let + dotfiles = fetchgit { + inherit name; + url = git://git.yggdrasil.li/dotfiles; + rev = "377401ceefea6772915071267625cd02c066f86e"; + sha256 = "258e15ff69afaa663541b1691e1385d43b74d086891e4a0009d3507ab6cfbbe8"; + }; + setupUsers = names : pkgs.lib.listToAttrs (builtins.map setupUser names); + setupUser = name : { + inherit name; + value = '' + cd ${dotfiles} + ${pkgs.findutils}/bin/find . -type d -print0 | ${pkgs.findutils}/bin/xargs -0 -I '{}' -- mkdir -p "/home/${name}/{}" + ${pkgs.findutils}/bin/find . -type f -print0 | ${pkgs.findutils}/bin/xargs -0 -I '{}' -- ln -s -f "${dotfiles}/{}" "/home/${name}/{}" + ''; + }; + in setupUsers [ "gkleen" ]; } -- cgit v1.2.3