From 4445bddfb210a29eced70c5225b11d682b0e7e9f Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 3 Jul 2015 21:30:14 +0200 Subject: seperated dotfiles --- custom/dotfiles.nix | 22 ++++++++++++++++++++++ vali.nix | 18 ++---------------- 2 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 custom/dotfiles.nix 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 @@ +{ fetchgit +, lib +, findutils +}: + +let + dotfiles = fetchgit (rec { + name = "dotfiles-${rev}"; + url = git://git.yggdrasil.li/dotfiles; + rev = "377401ceefea6772915071267625cd02c066f86e"; + sha256 = "258e15ff69afaa663541b1691e1385d43b74d086891e4a0009d3507ab6cfbbe8"; + }); + setupUser = name : { + inherit name; + value = '' + cd ${dotfiles} + ${findutils}/bin/find . -type d -print0 | ${findutils}/bin/xargs -0 -I '{}' -- mkdir -p "/home/${name}/{}" + ${findutils}/bin/find . -type f -print0 | ${findutils}/bin/xargs -0 -I '{}' -- ln -s -f "${dotfiles}/{}" "/home/${name}/{}" + ''; + }; +in + names : lib.listToAttrs (builtins.map setupUser names); diff --git a/vali.nix b/vali.nix index 0d866949..659980f8 100644 --- a/vali.nix +++ b/vali.nix @@ -74,20 +74,6 @@ rec { }; system.activationScripts = let - dotfiles = pkgs.fetchgit (rec { - name = "dotfiles-${rev}"; - 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" ]; + setupUsers = pkgs.callPackage custom/dotfiles.nix {}; + in setupUsers [ "/home/gkleen" ]; } -- cgit v1.2.3