diff options
author | tv <tv@shackspace.de> | 2015-07-09 00:41:48 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-07-09 00:41:48 +0200 |
commit | 60226cc42d9ddc4025ed8e42a9e67032f747380e (patch) | |
tree | 5068b029e3e4e9a9605e0b6f4b49b951578a3f0e /modules | |
parent | 8e56049eabf870bc297e866684c2b105638bb09a (diff) |
tv.users: init
Diffstat (limited to 'modules')
-rw-r--r-- | modules/tv/users/default.nix | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/modules/tv/users/default.nix b/modules/tv/users/default.nix new file mode 100644 index 000000000..719f57d70 --- /dev/null +++ b/modules/tv/users/default.nix @@ -0,0 +1,67 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.tv.users; + + opts = { + enable = mkOption { + default = true; + type = types.bool; + description = '' + If set to false, TODO... + ''; + }; + + packages = mkOption { + default = []; + #example = literalExample "[ pkgs.firefox pkgs.thunderbird ]"; + type = with types; listOf path; + description = '' + TODO this description is for environment.systemPackages + The set of packages that appear in + /run/current-system/sw. These packages are + automatically available to all users, and are + automatically updated every time you rebuild the system + configuration. (The latter is the main difference with + installing them in the default profile, + <filename>/nix/var/nix/profiles/default</filename>. + ''; + }; + }; +in + +{ + options.tv.users = mkOption { + default = {}; + type = with types; attrsOf optionSet; + options = [ opts ]; + description = '' + TODO + ''; + }; + + config = { + system.activationScripts."tv.users" = + let + bindir = name: packages: + pkgs.symlinkJoin "${name}-bindir" (map (path: path + "/" + "bin") packages); + in + '' + mkdir -m 0755 -p /run/tv.users + # TODO delete old + # TODO detect collisions + # TODO don't link .xxx-wrapped + ${concatStrings (mapAttrsToList (name: { packages, ... }: '' + mkdir -m 0755 -p /run/tv.users/${name} + ln -snf ${bindir name packages} /run/tv.users/${name}/bin + '') cfg)} + ''; + environment.shellInit = '' + # XXX lower precedence than ~/bin + PATH=/run/tv.users/$LOGNAME/bin:$PATH + export PATH + ''; + }; +} |