Modular, context-aware and aspect-oriented dendritic Nix configurations. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/ den.oeiuwq.com
configurations den dendritic nix aspect oriented
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(core): Add host fixed-point in user schema. (#284)

authored by

Victor Borja and committed by
GitHub
f2fd0622 ea654224

+31 -21
+21 -18
nix/types.nix
··· 38 38 users = lib.mkOption { 39 39 description = "user accounts"; 40 40 default = { }; 41 - type = lib.types.attrsOf userType; 41 + type = lib.types.attrsOf (userType config); 42 42 }; 43 43 instantiate = lib.mkOption { 44 44 description = '' ··· 104 104 } 105 105 ); 106 106 107 - userType = lib.types.submodule ( 108 - { name, config, ... }: 109 - { 110 - freeformType = lib.types.attrsOf lib.types.anything; 111 - imports = [ den.schema.user ]; 112 - config._module.args.user = config; 113 - options = { 114 - name = strOpt "user configuration name" name; 115 - userName = strOpt "user account name" config.name; 116 - classes = lib.mkOption { 117 - type = lib.types.listOf lib.types.str; 118 - description = "home management nix classes"; 119 - default = [ "user" ]; 107 + userType = 108 + host: 109 + lib.types.submodule ( 110 + { name, config, ... }: 111 + { 112 + freeformType = lib.types.attrsOf lib.types.anything; 113 + imports = [ den.schema.user ]; 114 + config._module.args.host = host; 115 + config._module.args.user = config; 116 + options = { 117 + name = strOpt "user configuration name" name; 118 + userName = strOpt "user account name" config.name; 119 + classes = lib.mkOption { 120 + type = lib.types.listOf lib.types.str; 121 + description = "home management nix classes"; 122 + default = [ "user" ]; 123 + }; 124 + aspect = strOpt "main aspect name" config.name; 120 125 }; 121 - aspect = strOpt "main aspect name" config.name; 122 - }; 123 - } 124 - ); 126 + } 127 + ); 125 128 126 129 strOpt = 127 130 description: default:
+10 -3
templates/ci/modules/features/schema-base-modules.nix
··· 23 23 { den, lib, ... }: 24 24 { 25 25 den.schema.user = 26 - { user, ... }: 26 + { user, host, ... }: 27 27 { 28 28 options.main-group = lib.mkOption { default = user.name; }; 29 + options.description = lib.mkOption { default = "${user.name}@${host.name}"; }; 29 30 }; 30 31 31 32 den.hosts.x86_64-linux.igloo.users.tux = { }; 32 33 33 - expr = den.hosts.x86_64-linux.igloo.users.tux.main-group; 34 - expected = "tux"; 34 + expr = [ 35 + den.hosts.x86_64-linux.igloo.users.tux.main-group 36 + den.hosts.x86_64-linux.igloo.users.tux.description 37 + ]; 38 + expected = [ 39 + "tux" 40 + "tux@igloo" 41 + ]; 35 42 } 36 43 ); 37 44