From b54f00c6954a0b44abb52289332c748f95d796d3 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 6 Nov 2015 21:29:49 +0100 Subject: tv modules: add per-user --- tv/3modules/default.nix | 1 + tv/3modules/per-user.nix | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tv/3modules/per-user.nix diff --git a/tv/3modules/default.nix b/tv/3modules/default.nix index bb10d8261..3a75d6e43 100644 --- a/tv/3modules/default.nix +++ b/tv/3modules/default.nix @@ -5,5 +5,6 @@ _: ./consul.nix ./ejabberd.nix ./iptables.nix + ./per-user.nix ]; } diff --git a/tv/3modules/per-user.nix b/tv/3modules/per-user.nix new file mode 100644 index 000000000..8d21a01d9 --- /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 -- cgit v1.2.3