summaryrefslogtreecommitdiffstats
path: root/krebs/3modules/per-user.nix
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/3modules/per-user.nix')
-rw-r--r--krebs/3modules/per-user.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/krebs/3modules/per-user.nix b/krebs/3modules/per-user.nix
new file mode 100644
index 00000000..ee213ded
--- /dev/null
+++ b/krebs/3modules/per-user.nix
@@ -0,0 +1,35 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.krebs.per-user;
+
+ out = {
+ options.krebs.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