summaryrefslogtreecommitdiffstats
path: root/tv/3modules/per-user.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2015-11-06 21:29:49 +0100
committertv <tv@krebsco.de>2015-11-06 21:29:49 +0100
commita37227c0e9aa7140d586f35cba313bc6d9623273 (patch)
treea7aec3a5df65f6bd562b69ce7bcc051217df1e32 /tv/3modules/per-user.nix
parent4d4955ad403775e9a8477c3f1163abb1f9e96d02 (diff)
tv modules: add per-user
Diffstat (limited to 'tv/3modules/per-user.nix')
-rw-r--r--tv/3modules/per-user.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/tv/3modules/per-user.nix b/tv/3modules/per-user.nix
new file mode 100644
index 0000000..8d21a01
--- /dev/null
+++ b/tv/3modules/per-user.nix
@@ -0,0 +1,35 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.tv.per-user;
+
+ out = {
+ options.tv.per-user = api;
+ config = imp;
+ };
+
+ api = mkOption {
+ type = with types; attrsOf (submodule {
+ options = {
+ packages = mkOption {
+ type = listOf path;
+ default = [];
+ };
+ };
+ });
+ default = {};
+ };
+
+ imp = {
+ environment = {
+ etc = flip mapAttrs' cfg (name: { packages, ... }: {
+ name = "per-user/${name}";
+ value.source = pkgs.symlinkJoin "per-user.${name}" packages;
+ });
+ profiles = ["/etc/per-user/$LOGNAME"];
+ };
+ };
+
+in out