From 7393d245d61eac3f0c4f9f79865f8c9e8aea4839 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 12 Nov 2017 10:47:36 +0100 Subject: per-user module: create profiles only when needed Refs https://github.com/NixOS/nixpkgs/pull/25712 --- krebs/3modules/per-user.nix | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/krebs/3modules/per-user.nix b/krebs/3modules/per-user.nix index 9080e3b44..a7a07a8e6 100644 --- a/krebs/3modules/per-user.nix +++ b/krebs/3modules/per-user.nix @@ -15,16 +15,19 @@ in { }; config = { environment = { - etc = flip mapAttrs' cfg (name: { packages, ... }: { - name = "per-user/${name}"; - value.source = pkgs.buildEnv { - name = "per-user.${name}"; - paths = packages; - pathsToLink = [ - "/bin" - ]; - }; - }); + etc = + mapAttrs' + (name: per-user: { + name = "per-user/${name}"; + value.source = pkgs.buildEnv { + name = "per-user.${name}"; + paths = per-user.packages; + pathsToLink = [ + "/bin" + ]; + }; + }) + (filterAttrs (_: per-user: per-user.packages != []) cfg); profiles = ["/etc/per-user/$LOGNAME"]; }; }; -- cgit v1.2.3