diff --git a/lib/attrsets.nix b/lib/attrsets.nix index 01d51779c80..7c93d8698de 100644 --- a/lib/attrsets.nix +++ b/lib/attrsets.nix @@ -29,9 +29,8 @@ rec { ["x" "y"] applied with some value v returns `x.y = v;' */ setAttrByPath = attrPath: value: if attrPath == [] then value - else listToAttrs [( - nameValuePair (head attrPath) (setAttrByPath (tail attrPath) value) - )]; + else listToAttrs + [ { name = head attrPath; value = setAttrByPath (tail attrPath) value; } ]; getAttrFromPath = attrPath: set: @@ -133,7 +132,7 @@ rec { => { x = "x-foo"; y = "y-bar"; } */ mapAttrs = f: set: - listToAttrs (map (attr: nameValuePair attr (f attr (getAttr attr set))) (attrNames set)); + listToAttrs (map (attr: { name = attr; value = f attr (getAttr attr set); }) (attrNames set)); /* Like `mapAttrs', but allows the name of each attribute to be @@ -240,7 +239,7 @@ rec { # names, hopefully this does not affect the system because the maximal # laziness avoid computing twice the same expression and listToAttrs does # not care about duplicated attribute names. - zipAttrsWith = f: sets: zipWithNames (concatMap attrNames sets) f sets; + zipAttrsWith = f: sets: zipAttrsWithNames (concatMap attrNames sets) f sets; zipAttrs = zipAttrsWith (name: values: values); diff --git a/lib/default.nix b/lib/default.nix index 033269e6b60..fc92e04503b 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -8,7 +8,6 @@ let sources = import ./sources.nix; modules = import ./modules.nix; options = import ./options.nix; - properties = import ./properties.nix; types = import ./types.nix; meta = import ./meta.nix; debug = import ./debug.nix; @@ -21,13 +20,13 @@ let in { inherit trivial lists strings stringsWithDeps attrsets sources options - properties modules types meta debug maintainers licenses platforms systems; + modules types meta debug maintainers licenses platforms systems; # Pull in some builtins not included elsewhere. inherit (builtins) pathExists readFile; } # !!! don't include everything at top-level; perhaps only the most # commonly used functions. // trivial // lists // strings // stringsWithDeps // attrsets // sources - // properties // options // types // meta // debug // misc // modules + // options // types // meta // debug // misc // modules // systems // customisation diff --git a/lib/lists.nix b/lib/lists.nix index 262a529b2b6..d0b09539bf6 100644 --- a/lib/lists.nix +++ b/lib/lists.nix @@ -118,6 +118,11 @@ in rec { all = pred: fold (x: y: if pred x then y else false) true; + # Count how many times function `pred' returns true for the elements + # of `list'. + count = pred: fold (x: c: if pred x then inc c else c) 0; + + # Return a singleton list or an empty list, depending on a boolean # value. Useful when building lists with optional elements # (e.g. `++ optional (system == "i686-linux") flashplayer'). @@ -165,10 +170,11 @@ in rec { zipLists = zipListsWith (fst: snd: { inherit fst snd; }); - - # Reverse the order of the elements of a list. + + # Reverse the order of the elements of a list. FIXME: O(n^2)! reverseList = fold (e: acc: acc ++ [ e ]) []; + # Sort a list based on a comparator function which compares two # elements and returns true if the first argument is strictly below # the second argument. The returned list is sorted in an increasing diff --git a/lib/modules.nix b/lib/modules.nix index f914947e784..071809daa58 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -1,379 +1,312 @@ -# NixOS module handling. - -let lib = import ./default.nix; in - -with { inherit (builtins) head; }; -with import ./trivial.nix; with import ./lists.nix; -with import ./misc.nix; +with import ./trivial.nix; with import ./attrsets.nix; with import ./options.nix; -with import ./properties.nix; +with import ./debug.nix; +with import ./types.nix; rec { - # Unfortunately this can also be a string. - isPath = x: !( - builtins.isFunction x - || builtins.isAttrs x - || builtins.isInt x - || builtins.isBool x - || builtins.isList x - ); - - - importIfPath = path: - if isPath path then - import path - else - path; - - - applyIfFunction = f: arg: - if builtins.isFunction f then - f arg - else - f; - - - isModule = m: - (m ? config && isAttrs m.config && ! isOption m.config) - || (m ? options && isAttrs m.options && ! isOption m.options); - - - # Convert module to a set which has imports / options and config - # attributes. - unifyModuleSyntax = m: + /* Evaluate a set of modules. The result is a set of two + attributes: ‘options’: the nested set of all option declarations, + and ‘config’: the nested set of all option values. */ + evalModules = { modules, prefix ? [], args ? {}, check ? true }: let - delayedModule = delayProperties m; - - getImports = - toList (rmProperties (delayedModule.require or [])); - getImportedPaths = filter isPath getImports; - getImportedSets = filter (x: !isPath x) getImports; - - getConfig = - removeAttrs delayedModule ["require" "key" "imports"]; + args' = args // result; + closed = closeModules modules args'; + # Note: the list of modules is reversed to maintain backward + # compatibility with the old module system. Not sure if this is + # the most sensible policy. + options = mergeModules prefix (reverseList closed); + # Traverse options and extract the option values into the final + # config set. At the same time, check whether all option + # definitions have matching declarations. + config = yieldConfig prefix options; + yieldConfig = prefix: set: + let res = removeAttrs (mapAttrs (n: v: + if isOption v then v.value + else yieldConfig (prefix ++ [n]) v) set) ["_definedNames"]; + in + if check && set ? _definedNames then + fold (m: res: + fold (name: res: + if hasAttr name set then res else throw "The option `${showOption (prefix ++ [name])}' defined in `${m.file}' does not exist.") + res m.names) + res set._definedNames + else + res; + result = { inherit options config; }; + in result; + /* Close a set of modules under the ‘imports’ relation. */ + closeModules = modules: args: + let + toClosureList = file: parentKey: imap (n: x: + if isAttrs x || builtins.isFunction x then + unifyModuleSyntax file "${parentKey}:anon-${toString n}" (applyIfFunction x args) + else + unifyModuleSyntax (toString x) (toString x) (applyIfFunction (import x) args)); in - if isModule m then - { key = ""; } // m + builtins.genericClosure { + startSet = toClosureList unknownModule "" modules; + operator = m: toClosureList m.file m.key m.imports; + }; + + /* Massage a module into canonical form, that is, a set consisting + of ‘options’, ‘config’ and ‘imports’ attributes. */ + unifyModuleSyntax = file: key: m: + if m ? config || m ? options then + let badAttrs = removeAttrs m ["imports" "options" "config" "key" "_file"]; in + if badAttrs != {} then + throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'." else - { key = ""; - imports = (m.imports or []) ++ getImportedPaths; - config = getConfig; - } // ( - if getImportedSets != [] then - assert length getImportedSets == 1; - { options = head getImportedSets; } + { file = m._file or file; + key = toString m.key or key; + imports = m.imports or []; + options = m.options or {}; + config = m.config or {}; + } + else + { file = m._file or file; + key = toString m.key or key; + imports = m.require or [] ++ m.imports or []; + options = {}; + config = removeAttrs m ["key" "_file" "require" "imports"]; + }; + + applyIfFunction = f: arg: if builtins.isFunction f then f arg else f; + + /* Merge a list of modules. This will recurse over the option + declarations in all modules, combining them into a single set. + At the same time, for each option declaration, it will merge the + corresponding option definitions in all machines, returning them + in the ‘value’ attribute of each option. */ + mergeModules = prefix: modules: + mergeModules' prefix modules + (concatMap (m: map (config: { inherit (m) file; inherit config; }) (pushDownProperties m.config)) modules); + + mergeModules' = prefix: options: configs: + listToAttrs (map (name: { + # We're descending into attribute ‘name’. + inherit name; + value = + let + loc = prefix ++ [name]; + # Get all submodules that declare ‘name’. + decls = concatLists (map (m: + if hasAttr name m.options + then [ { inherit (m) file; options = getAttr name m.options; } ] + else [] + ) options); + # Get all submodules that define ‘name’. + defns = concatLists (map (m: + if hasAttr name m.config + then map (config: { inherit (m) file; inherit config; }) + (pushDownProperties (getAttr name m.config)) + else [] + ) configs); + nrOptions = count (m: isOption m.options) decls; + # Process mkMerge and mkIf properties. + defns' = concatMap (m: + if hasAttr name m.config + then map (m': { inherit (m) file; value = m'; }) (dischargeProperties (getAttr name m.config)) + else [] + ) configs; + in + if nrOptions == length decls then + let opt = fixupOptionType loc (mergeOptionDecls loc decls); + in evalOptionValue loc opt defns' + else if nrOptions != 0 then + let + firstOption = findFirst (m: isOption m.options) "" decls; + firstNonOption = findFirst (m: !isOption m.options) "" decls; + in + throw "The option `${showOption loc}' in `${firstOption.file}' is a prefix of options in `${firstNonOption.file}'." else - {} - ); + mergeModules' loc decls defns; + }) (concatMap (m: attrNames m.options) options)) + // { _definedNames = map (m: { inherit (m) file; names = attrNames m.config; }) configs; }; + /* Merge multiple option declarations into a single declaration. In + general, there should be only one declaration of each option. + The exception is the ‘options’ attribute, which specifies + sub-options. These can be specified multiple times to allow one + module to add sub-options to an option declared somewhere else + (e.g. multiple modules define sub-options for ‘fileSystems’). */ + mergeOptionDecls = loc: opts: + fold (opt: res: + if opt.options ? default && res ? default || + opt.options ? example && res ? example || + opt.options ? description && res ? description || + opt.options ? apply && res ? apply || + opt.options ? type && res ? type + then + throw "The option `${showOption loc}' in `${opt.file}' is already declared in ${showFiles res.declarations}." + else + opt.options // res // + { declarations = [opt.file] ++ res.declarations; + options = if opt.options ? options then [(toList opt.options.options ++ res.options)] else []; + } + ) { inherit loc; declarations = []; options = []; } opts; - unifyOptionModule = {key ? ""}: name: index: m: (args: + /* Merge all the definitions of an option to produce the final + config value. */ + evalOptionValue = loc: opt: defs: let - module = lib.applyIfFunction m args; - key_ = rec { - file = key; - option = name; - number = index; - outPath = key; - }; - in if lib.isModule module then - { key = key_; } // module - else - { key = key_; options = module; } - ); - - - moduleClosure = initModules: args: - let - moduleImport = origin: index: m: - let m' = applyIfFunction (importIfPath m) args; - in (unifyModuleSyntax m') // { - # used by generic closure to avoid duplicated imports. - key = - if isPath m then m - else m'.key or (newModuleName origin index); - }; - - getImports = m: m.imports or []; - - newModuleName = origin: index: - "${origin.key}:"; - - topLevel = { - key = ""; + # Process mkOverride properties, adding in the default + # value specified in the option declaration (if any). + defsFinal = filterOverrides + ((if opt ? default then [{ file = head opt.declarations; value = mkOptionDefault opt.default; }] else []) ++ defs); + files = map (def: def.file) defsFinal; + # Type-check the remaining definitions, and merge them if + # possible. + merged = + if defsFinal == [] then + throw "The option `${showOption loc}' is used but not defined." + else + fold (def: res: + if opt.type.check def.value then res + else throw "The option value `${showOption loc}' in `${def.file}' is not a ${opt.type.name}.") + (opt.type.merge loc defsFinal) defsFinal; + # Finally, apply the ‘apply’ function to the merged + # value. This allows options to yield a value computed + # from the definitions. + value = (opt.apply or id) merged; + in opt // + { value = addErrorContext "while evaluating the option `${showOption loc}':" value; + definitions = map (def: def.value) defsFinal; + isDefined = defsFinal != []; + inherit files; }; - in - (lazyGenericClosure { - startSet = imap (moduleImport topLevel) initModules; - operator = m: imap (moduleImport m) (getImports m); - }); + /* Given a config set, expand mkMerge properties, and push down the + mkIf properties into the children. The result is a list of + config sets that do not have properties at top-level. For + example, + mkMerge [ { boot = set1; } (mkIf cond { boot = set2; services = set3; }) ] - moduleApply = funs: module: - lib.mapAttrs (name: value: - if builtins.hasAttr name funs then - let fun = lib.getAttr name funs; in - fun value + is transformed into + + [ { boot = set1; } { boot = mkIf cond set2; services mkIf cond set3; } ]. + + This transform is the critical step that allows mkIf conditions + to refer to the full configuration without creating an infinite + recursion. + */ + pushDownProperties = cfg: + if cfg._type or "" == "merge" then + concatMap pushDownProperties cfg.contents + else if cfg._type or "" == "if" then + map (mapAttrs (n: v: mkIf cfg.condition v)) (pushDownProperties cfg.content) + else if cfg._type or "" == "override" then + map (mapAttrs (n: v: mkOverride cfg.priority v)) (pushDownProperties cfg.content) + else + [ cfg ]; + + /* Given a config value, expand mkMerge properties, and discharge + any mkIf conditions. That is, this is the place where mkIf + conditions are actually evaluated. The result is a list of + config values. For example, ‘mkIf false x’ yields ‘[]’, + ‘mkIf true x’ yields ‘[x]’, and + + mkMerge [ 1 (mkIf true 2) (mkIf true (mkIf false 3)) ] + + yields ‘[ 1 2 ]’. + */ + dischargeProperties = def: + if def._type or "" == "merge" then + concatMap dischargeProperties def.contents + else if def._type or "" == "if" then + if def.condition then + dischargeProperties def.content else - value - ) module; - - - # Handle mkMerge function left behind after a delay property. - moduleFlattenMerge = module: - if module ? config && - isProperty module.config && - isMerge module.config.property - then - (map (cfg: { key = module.key; config = cfg; }) module.config.content) - ++ [ (module // { config = {}; }) ] + [ ] else - [ module ]; + [ def ]; + /* Given a list of config values, process the mkOverride properties, + that is, return the values that have the highest (that is, + numerically lowest) priority, and strip the mkOverride + properties. For example, - # Handle mkMerge attributes which are left behind by previous delay - # properties and convert them into a list of modules. Delay properties - # inside the config attribute of a module and create a second module if a - # mkMerge attribute was left behind. - # - # Module -> [ Module ] - delayModule = module: - map (moduleApply { config = delayProperties; }) (moduleFlattenMerge module); + [ { file = "/1"; value = mkOverride 10 "a"; } + { file = "/2"; value = mkOverride 20 "b"; } + { file = "/3"; value = "z"; } + { file = "/4"; value = mkOverride 10 "d"; } + ] + yields - evalDefinitions = opt: values: - if opt.type.delayOnGlobalEval or false then - map (delayPropertiesWithIter opt.type.iter opt.name) - (evalLocalProperties values) - else - evalProperties values; + [ { file = "/1"; value = "a"; } + { file = "/4"; value = "d"; } + ] - - selectModule = name: m: - { inherit (m) key; - } // ( - if m ? options && builtins.hasAttr name m.options then - { options = lib.getAttr name m.options; } - else {} - ) // ( - if m ? config && builtins.hasAttr name m.config then - { config = lib.getAttr name m.config; } - else {} - ); - - filterModules = name: modules: - filter (m: m ? config || m ? options) ( - map (selectModule name) modules - ); - - - modulesNames = modules: - lib.concatMap (m: [] - ++ optionals (m ? options) (lib.attrNames m.options) - ++ optionals (m ? config) (lib.attrNames m.config) - ) modules; - - - moduleZip = funs: modules: - lib.mapAttrs (name: fun: - fun (catAttrs name modules) - ) funs; - - - moduleMerge = path: modules_: + Note that "z" has the default priority 100. + */ + filterOverrides = defs: let - addName = name: - if path == "" then name else path + "." + name; + defaultPrio = 100; + getPrio = def: if def.value._type or "" == "override" then def.value.priority else defaultPrio; + min = x: y: if builtins.lessThan x y then x else y; + highestPrio = fold (def: prio: min (getPrio def) prio) 9999 defs; + strip = def: if def.value._type or "" == "override" then def // { value = def.value.content; } else def; + in concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs; - modules = concatLists (map delayModule modules_); - - modulesOf = name: filterModules name modules; - declarationsOf = name: filter (m: m ? options) (modulesOf name); - definitionsOf = name: filter (m: m ? config ) (modulesOf name); - - recurseInto = name: - moduleMerge (addName name) (modulesOf name); - - recurseForOption = name: modules: args: - moduleMerge name ( - moduleClosure modules args - ); - - errorSource = modules: - "The error may come from the following files:\n" + ( - lib.concatStringsSep "\n" ( - map (m: - if m ? key then toString m.key else "" - ) modules - ) - ); - - eol = "\n"; - - allNames = modulesNames modules; - - getResults = m: - let fetchResult = s: mapAttrs (n: v: v.result) s; in { - options = fetchResult m.options; - config = fetchResult m.config; - }; - - endRecursion = { options = {}; config = {}; }; - - in if modules == [] then endRecursion else - getResults (fix (crossResults: moduleZip { - options = lib.zipWithNames allNames (name: values: rec { - config = lib.getAttr name crossResults.config; - - declarations = declarationsOf name; - declarationSources = - map (m: { - source = m.key; - }) declarations; - - hasOptions = values != []; - isOption = any lib.isOption values; - - decls = # add location to sub-module options. - map (m: - mapSubOptions - (unifyOptionModule {inherit (m) key;} name) - m.options - ) declarations; - - decl = - lib.addErrorContext "${eol - }while enhancing option `${addName name}':${eol - }${errorSource declarations}${eol - }" ( - addOptionMakeUp - { name = addName name; recurseInto = recurseForOption; } - (mergeOptionDecls decls) - ); - - value = decl // (with config; { - inherit (config) isNotDefined; - isDefined = ! isNotDefined; - declarations = declarationSources; - definitions = definitionSources; - config = strictResult; - }); - - recurse = (recurseInto name).options; - - result = - if isOption then value - else if !hasOptions then {} - else if all isAttrs values then recurse - else - throw "${eol - }Unexpected type where option declarations are expected.${eol - }${errorSource declarations}${eol - }"; - - }); - - config = lib.zipWithNames allNames (name: values_: rec { - option = lib.getAttr name crossResults.options; - - definitions = definitionsOf name; - definitionSources = - map (m: { - source = m.key; - value = m.config; - }) definitions; - - values = values_ ++ - optionals (option.isOption && option.decl ? extraConfigs) - option.decl.extraConfigs; - - defs = evalDefinitions option.decl values; - - isNotDefined = defs == []; - - value = - lib.addErrorContext "${eol - }while evaluating the option `${addName name}':${eol - }${errorSource (modulesOf name)}${eol - }" ( - let opt = option.decl; in - opt.apply ( - if isNotDefined then - opt.default or (throw "Option `${addName name}' not defined and does not have a default value.") - else opt.merge defs - ) - ); - - strictResult = builtins.tryEval (builtins.toXML value); - - recurse = (recurseInto name).config; - - configIsAnOption = v: isOption (rmProperties v); - errConfigIsAnOption = - let badModules = filter (m: configIsAnOption m.config) definitions; in - "${eol - }Option ${addName name} is defined in the configuration section.${eol - }${errorSource badModules}${eol - }"; - - errDefinedWithoutDeclaration = - let badModules = definitions; in - "${eol - }Option '${addName name}' defined without option declaration.${eol - }${errorSource badModules}${eol - }"; - - result = - if option.isOption then value - else if !option.hasOptions then throw errDefinedWithoutDeclaration - else if any configIsAnOption values then throw errConfigIsAnOption - else if all isAttrs values then recurse - # plain value during the traversal - else throw errDefinedWithoutDeclaration; - - }); - } modules)); - - - fixMergeModules = initModules: {...}@args: - lib.fix (result: - # This trick avoids an infinite loop because names of attribute - # are know and it is not required to evaluate the result of - # moduleMerge to know which attributes are present as arguments. - let module = { inherit (result) options config; }; in - moduleMerge "" ( - moduleClosure initModules (module // args) - ) - ); - - - # Visit all definitions to raise errors related to undeclared options. - checkModule = path: {config, options, ...}@m: + /* Hack for backward compatibility: convert options of type + optionSet to configOf. FIXME: remove eventually. */ + fixupOptionType = loc: opt: let - eol = "\n"; - addName = name: - if path == "" then name else path + "." + name; - in - if lib.isOption options then - if options ? options then - options.type.fold - (cfg: res: res && checkModule (options.type.docPath path) cfg._args) - true config - else - true - else if isAttrs options && lib.attrNames m.options != [] then - all (name: - lib.addErrorContext "${eol - }while checking the attribute `${addName name}':${eol - }" (checkModule (addName name) (selectModule name m)) - ) (lib.attrNames m.config) - else - builtins.trace "try to evaluate config ${lib.showVal config}." - false; + options' = opt.options or + (throw "Option `${showOption loc'}' has type optionSet but has no option attribute."); + coerce = x: + if builtins.isFunction x then x + else { config, ... }: { options = x; }; + options = map coerce (flatten options'); + f = tp: + if tp.name == "option set" then types.submodule options + else if tp.name == "attribute set of option sets" then types.attrsOf (types.submodule options) + else if tp.name == "list or attribute set of option sets" then types.loaOf (types.submodule options) + else if tp.name == "list of option sets" then types.listOf (types.submodule options) + else if tp.name == "null or option set" then types.nullOr (types.submodule options) + else tp; + in opt // { type = f (opt.type or types.unspecified); }; + + + /* Properties. */ + + mkIf = condition: content: + { _type = "if"; + inherit condition content; + }; + + mkAssert = assertion: message: content: + mkIf + (if assertion then true else throw "\nFailed assertion: ${message}") + content; + + mkMerge = contents: + { _type = "merge"; + inherit contents; + }; + + mkOverride = priority: content: + { _type = "override"; + inherit priority content; + }; + + mkOptionDefault = mkOverride 1001; # priority of option defaults + mkDefault = mkOverride 1000; # used in config sections of non-user modules to set a default + mkForce = mkOverride 50; + mkVMOverride = mkOverride 10; # used by ‘nixos-rebuild build-vm’ + + mkFixStrictness = id; # obsolete, no-op + + # FIXME: Add mkOrder back in. It's not currently used anywhere in + # NixOS, but it should be useful. + + + /* Compatibility. */ + fixMergeModules = modules: args: evalModules { inherit modules args; check = false; }; } diff --git a/lib/options.nix b/lib/options.nix index b6a88008bb7..63798c4faa3 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -2,28 +2,27 @@ let lib = import ./default.nix; in -with { inherit (builtins) head length; }; with import ./trivial.nix; with import ./lists.nix; with import ./misc.nix; with import ./attrsets.nix; -with import ./properties.nix; +with import ./strings.nix; rec { isOption = lib.isType "option"; - mkOption = attrs: attrs // { - _type = "option"; - # name (this is the name of the attributem it is automatically generated by the traversal) - # default (value used when no definition exists) - # example (documentation) - # description (documentation) - # type (option type, provide a default merge function and ensure type correctness) - # merge (function used to merge definitions into one definition: [ /type/ ] -> /type/) - # apply (convert the option value to ease the manipulation of the option result) - # options (set of sub-options declarations & definitions) - # extraConfigs (list of possible configurations) - }; + mkOption = + { default ? null # Default value used when no definition is given in the configuration. + , defaultText ? null # Textual representation of the default, for in the manual. + , example ? null # Example value used in the manual. + , description ? null # String describing the option. + , type ? null # Option type, providing type-checking and value merging. + , apply ? null # Function that converts the option value to something else. + , internal ? null # Whether the option is for NixOS developers only. + , visible ? null # Whether the option shows up in the manual. + , options ? null # Obsolete, used by types.optionSet. + } @ attrs: + attrs // { _type = "option"; }; mkEnableOption = name: mkOption { default = false; @@ -32,261 +31,65 @@ rec { type = lib.types.bool; }; - mapSubOptions = f: opt: - if opt ? options then - opt // { - options = imap f (toList opt.options); - } - else - opt; - - # Make the option declaration more user-friendly by adding default - # settings and some verifications based on the declaration content (like - # type correctness). - addOptionMakeUp = {name, recurseInto}: decl: - let - init = { - inherit name; - merge = mergeDefaultOption; - apply = lib.id; - }; - - functionsFromType = opt: - opt // (builtins.intersectAttrs { merge = 1; check = 1; } (decl.type or {})); - - addDeclaration = opt: opt // decl; - - ensureMergeInputType = opt: - if opt ? check then - opt // { - merge = list: - if all opt.check list then - opt.merge list - else - throw "A value of the option `${name}' has a bad type."; - } - else opt; - - checkDefault = opt: - if opt ? check && opt ? default then - opt // { - default = - if opt.check opt.default then - opt.default - else - throw "The default value of the option `${name}' has a bad type."; - } - else opt; - - handleOptionSets = opt: - if opt ? type && opt.type.hasOptions then - let - # Evaluate sub-modules. - subModuleMerge = path: vals: - lib.fix (args: - let - result = recurseInto path (opt.options ++ imap (index: v: args: { - key = rec { - #!!! Would be nice if we had the file the val was from - option = path; - number = index; - outPath = "option ${option} config number ${toString number}"; - }; - } // (lib.applyIfFunction v args)) (toList vals)) args; - name = lib.removePrefix (opt.name + ".") path; - extraArgs = opt.extraArgs or {}; - individualExtraArgs = opt.individualExtraArgs or {}; - in { - inherit (result) config options; - inherit name; - } // - (opt.extraArgs or {}) // - (if hasAttr name individualExtraArgs then getAttr name individualExtraArgs else {}) - ); - - # Add _options in sub-modules to make it viewable from other - # modules. - subModuleMergeConfig = path: vals: - let result = subModuleMerge path vals; in - { _args = result; } // result.config; - - in - opt // { - merge = list: - opt.type.iter - subModuleMergeConfig - opt.name - (opt.merge list); - options = - let path = opt.type.docPath opt.name; in - (subModuleMerge path []).options; - } - else - opt; - in - foldl (opt: f: f opt) init [ - # default settings - functionsFromType - - # user settings - addDeclaration - - # override settings - ensureMergeInputType - checkDefault - handleOptionSets - ]; - - # Merge a list of options containning different field. This is useful to - # separate the merge & apply fields from the interface. - mergeOptionDecls = opts: - if opts == [] then {} - else if length opts == 1 then - let opt = head opts; in - if opt ? options then - opt // { options = toList opt.options; } - else - opt - else - fold (opt1: opt2: - lib.addErrorContext "opt1 = ${lib.showVal opt1}\nopt2 = ${lib.showVal opt2}" ( - # You cannot merge if two options have the same field. - assert opt1 ? default -> ! opt2 ? default; - assert opt1 ? example -> ! opt2 ? example; - assert opt1 ? description -> ! opt2 ? description; - assert opt1 ? merge -> ! opt2 ? merge; - assert opt1 ? apply -> ! opt2 ? apply; - assert opt1 ? type -> ! opt2 ? type; - opt1 // opt2 - // optionalAttrs (opt1 ? options || opt2 ? options) { - options = - (toList (opt1.options or [])) - ++ (toList (opt2.options or [])); - } - // optionalAttrs (opt1 ? extraConfigs || opt2 ? extraConfigs) { - extraConfigs = opt1.extraConfigs or [] ++ opt2.extraConfigs or []; - } - // optionalAttrs (opt1 ? extraArgs || opt2 ? extraArgs) { - extraArgs = opt1.extraArgs or {} // opt2.extraArgs or {}; - } - // optionalAttrs (opt1 ? individualExtraArgs || opt2 ? individualExtraArgs) { - individualExtraArgs = zipAttrsWith (name: values: - if length values == 1 then head values else (head values // (head (tail values))) - ) [ (opt1.individualExtraArgs or {}) (opt2.individualExtraArgs or {}) ]; - } - )) {} opts; - - - # !!! This function will be removed because this can be done with the - # multiple option declarations. - addDefaultOptionValues = defs: opts: opts // - builtins.listToAttrs (map (defName: - { name = defName; - value = - let - defValue = builtins.getAttr defName defs; - optValue = builtins.getAttr defName opts; - in - if isOption defValue - then - # `defValue' is an option. - if hasAttr defName opts - then builtins.getAttr defName opts - else defValue.default - else - # `defValue' is an attribute set containing options. - # So recurse. - if hasAttr defName opts && isAttrs optValue - then addDefaultOptionValues defValue optValue - else addDefaultOptionValues defValue {}; - } - ) (attrNames defs)); - - mergeDefaultOption = list: + mergeDefaultOption = loc: defs: + let list = getValues defs; in if length list == 1 then head list - else if all builtins.isFunction list then x: mergeDefaultOption (map (f: f x) list) + else if all builtins.isFunction list then x: mergeDefaultOption loc (map (f: f x) list) else if all isList list then concatLists list else if all isAttrs list then fold lib.mergeAttrs {} list else if all builtins.isBool list then fold lib.or false list else if all builtins.isString list then lib.concatStrings list - else if all builtins.isInt list && all (x: x == head list) list - then head list - else throw "Cannot merge values."; + else if all builtins.isInt list && all (x: x == head list) list then head list + else throw "Cannot merge definitions of `${showOption loc}' given in ${showFiles (getFiles defs)}."; - mergeTypedOption = typeName: predicate: merge: list: - if all predicate list then merge list - else throw "Expect a ${typeName}."; + /* Obsolete, will remove soon. Specify an option type or apply + function instead. */ + mergeTypedOption = typeName: predicate: merge: loc: list: + let list' = map (x: x.value) list; in + if all predicate list then merge list' + else throw "Expected a ${typeName}."; mergeEnableOption = mergeTypedOption "boolean" (x: true == x || false == x) (fold lib.or false); mergeListOption = mergeTypedOption "list" isList concatLists; - mergeStringOption = mergeTypedOption "string" - (x: if builtins ? isString then builtins.isString x else x + "") - lib.concatStrings; + mergeStringOption = mergeTypedOption "string" builtins.isString lib.concatStrings; - mergeOneOption = list: - if list == [] then abort "This case should never happen." - else if length list != 1 then throw "Multiple definitions. Only one is allowed for this option." - else head list; + mergeOneOption = loc: defs: + if defs == [] then abort "This case should never happen." + else if length defs != 1 then + throw "The unique option `${showOption loc}' is defined multiple times, in ${showFiles (getFiles defs)}." + else (head defs).value; - - fixableMergeFun = merge: f: config: - merge ( - # generate the list of option sets. - f config - ); - - fixableMergeModules = merge: initModules: {...}@args: config: - fixableMergeFun merge (config: - lib.moduleClosure initModules (args // { inherit config; }) - ) config; - - - fixableDefinitionsOf = initModules: {...}@args: - fixableMergeModules (modules: (lib.moduleMerge "" modules).config) initModules args; - - fixableDeclarationsOf = initModules: {...}@args: - fixableMergeModules (modules: (lib.moduleMerge "" modules).options) initModules args; - - definitionsOf = initModules: {...}@args: - (lib.fix (module: - fixableMergeModules (lib.moduleMerge "") initModules args module.config - )).config; - - declarationsOf = initModules: {...}@args: - (lib.fix (module: - fixableMergeModules (lib.moduleMerge "") initModules args module.config - )).options; + getValues = map (x: x.value); + getFiles = map (x: x.file); # Generate documentation template from the list of option declaration like # the set generated with filterOptionSets. - optionAttrSetToDocList = attrs: - let options = collect isOption attrs; in - fold (opt: rest: - let - docOption = { - inherit (opt) name; - description = opt.description or (throw "Option ${opt.name}: No description."); - declarations = map (x: toString x.source) opt.declarations; - #definitions = map (x: toString x.source) opt.definitions; - internal = opt.internal or false; - visible = opt.visible or true; - } - // optionalAttrs (opt ? example) { example = scrubOptionValue opt.example; } - // optionalAttrs (opt ? default) { default = scrubOptionValue opt.default; } - // optionalAttrs (opt ? defaultText) { default = opt.defaultText; }; + optionAttrSetToDocList = optionAttrSetToDocList' []; - subOptions = - if opt ? options then - optionAttrSetToDocList opt.options - else - []; - in - [ docOption ] ++ subOptions ++ rest - ) [] options; + optionAttrSetToDocList' = prefix: options: + fold (opt: rest: + let + docOption = rec { + name = showOption opt.loc; + description = opt.description or (throw "Option `${name}' has no description."); + declarations = filter (x: x != unknownModule) opt.declarations; + internal = opt.internal or false; + visible = opt.visible or true; + } + // optionalAttrs (opt ? example) { example = scrubOptionValue opt.example; } + // optionalAttrs (opt ? default) { default = scrubOptionValue opt.default; } + // optionalAttrs (opt ? defaultText) { default = opt.defaultText; }; + + subOptions = + let ss = opt.type.getSubOptions opt.loc; + in if ss != {} then optionAttrSetToDocList' opt.loc ss else []; + in + # FIXME: expensive, O(n^2) + [ docOption ] ++ subOptions ++ rest) [] (collect isOption options); /* This function recursively removes all derivation attributes from @@ -295,7 +98,8 @@ rec { representation of derivations is very large (on the order of megabytes) and is not actually used by the manual generator. */ scrubOptionValue = x: - if isDerivation x then { type = "derivation"; drvPath = x.name; outPath = x.name; name = x.name; } + if isDerivation x then + { type = "derivation"; drvPath = x.name; outPath = x.name; name = x.name; } else if isList x then map scrubOptionValue x else if isAttrs x then mapAttrs (n: v: scrubOptionValue v) (removeAttrs x ["_args"]) else x; @@ -308,4 +112,9 @@ rec { literalExample = text: { _type = "literalExample"; inherit text; }; + /* Helper functions. */ + showOption = concatStringsSep "."; + showFiles = files: concatStringsSep " and " (map (f: "`${f}'") files); + unknownModule = ""; + } diff --git a/lib/properties.nix b/lib/properties.nix deleted file mode 100644 index 22aa8d891d8..00000000000 --- a/lib/properties.nix +++ /dev/null @@ -1,464 +0,0 @@ -# Nixpkgs/NixOS properties. Generalize the problem of delayable (not yet -# evaluable) properties like mkIf. - -let lib = import ./default.nix; in - -with { inherit (builtins) head tail; }; -with import ./trivial.nix; -with import ./lists.nix; -with import ./misc.nix; -with import ./attrsets.nix; - -rec { - - inherit (lib) isType; - - # Tell that nothing is defined. When properties are evaluated, this type - # is used to remove an entry. Thus if your property evaluation semantic - # implies that you have to mute the content of an attribute, then your - # property should produce this value. - isNotdef = isType "notdef"; - mkNotdef = {_type = "notdef";}; - - # General property type, it has a property attribute and a content - # attribute. The property attribute refers to an attribute set which - # contains a _type attribute and a list of functions which are used to - # evaluate this property. The content attribute is used to stack properties - # on top of each other. - # - # The optional functions which may be contained in the property attribute - # are: - # - onDelay: run on a copied property. - # - onGlobalDelay: run on all copied properties. - # - onEval: run on an evaluated property. - # - onGlobalEval: run on a list of property stack on top of their values. - isProperty = isType "property"; - mkProperty = p@{property, content, ...}: p // { - _type = "property"; - }; - - # Go through the stack of properties and apply the function `op' on all - # property and call the function `nul' on the final value which is not a - # property. The stack is traversed in reversed order. The `op' function - # should expect a property with a content which have been modified. - # - # Warning: The `op' function expects only one argument in order to avoid - # calls to mkProperties as the argument is already a valid property which - # contains the result of the folding inside the content attribute. - foldProperty = op: nul: attrs: - if isProperty attrs then - op (attrs // { - content = foldProperty op nul attrs.content; - }) - else - nul attrs; - - # Simple function which can be used as the `op' argument of the - # foldProperty function. Properties that you don't want to handle can be - # ignored with the `id' function. `isSearched' is a function which should - # check the type of a property and return a boolean value. `thenFun' and - # `elseFun' are functions which behave as the `op' argument of the - # foldProperty function. - foldFilter = isSearched: thenFun: elseFun: attrs: - if isSearched attrs.property then - thenFun attrs - else - elseFun attrs; - - - # Move properties from the current attribute set to the attribute - # contained in this attribute set. This trigger property handlers called - # `onDelay' and `onGlobalDelay'. - delayPropertiesWithIter = iter: path: attrs: - let cleanAttrs = rmProperties attrs; in - if isProperty attrs then - iter (a: v: - lib.addErrorContext "while moving properties on the attribute `${a}':" ( - triggerPropertiesGlobalDelay a ( - triggerPropertiesDelay a ( - copyProperties attrs v - )))) path cleanAttrs - else - attrs; - - delayProperties = # implicit attrs argument. - let - # mapAttrs except that it also recurse into potential mkMerge - # functions. This may cause a strictness issue because looking the - # type of a string implies evaluating it. - iter = fun: path: value: - lib.mapAttrs (attr: val: - if isProperty val && isMerge val.property then - val // { content = map (fun attr) val.content; } - else - fun attr val - ) value; - in - delayPropertiesWithIter iter ""; - - # Call onDelay functions. - triggerPropertiesDelay = name: attrs: - let - callOnDelay = p@{property, ...}: - if property ? onDelay then - property.onDelay name p - else - p; - in - foldProperty callOnDelay id attrs; - - # Call onGlobalDelay functions. - triggerPropertiesGlobalDelay = name: attrs: - let - globalDelayFuns = uniqListExt { - getter = property: property._type; - inputList = foldProperty (p@{property, content, ...}: - if property ? onGlobalDelay then - [ property ] ++ content - else - content - ) (a: []) attrs; - }; - - callOnGlobalDelay = property: content: - property.onGlobalDelay name content; - in - fold callOnGlobalDelay attrs globalDelayFuns; - - # Expect a list of values which may have properties and return the same - # list of values where all properties have been evaluated and where all - # ignored values are removed. This trigger property handlers called - # `onEval' and `onGlobalEval'. - evalProperties = valList: - if valList != [] then - filter (x: !isNotdef x) ( - triggerPropertiesGlobalEval ( - evalLocalProperties valList - ) - ) - else - valList; - - evalLocalProperties = valList: - filter (x: !isNotdef x) ( - map triggerPropertiesEval valList - ); - - # Call onEval function - triggerPropertiesEval = val: - foldProperty (p@{property, ...}: - if property ? onEval then - property.onEval p - else - p - ) id val; - - # Call onGlobalEval function - triggerPropertiesGlobalEval = valList: - let - globalEvalFuns = uniqListExt { - getter = property: property._type; - inputList = - fold (attrs: list: - foldProperty (p@{property, content, ...}: - if property ? onGlobalEval then - [ property ] ++ content - else - content - ) (a: list) attrs - ) [] valList; - }; - - callOnGlobalEval = property: valList: property.onGlobalEval valList; - in - fold callOnGlobalEval valList globalEvalFuns; - - # Remove all properties on top of a value and return the value. - rmProperties = - foldProperty (p@{content, ...}: content) id; - - # Copy properties defined on a value on another value. - copyProperties = attrs: newAttrs: - foldProperty id (x: newAttrs) attrs; - - /* Merge. */ - - # Create "merge" statement which is skipped by the delayProperty function - # and interpreted by the underlying system using properties (modules). - - # Create a "Merge" property which only contains a condition. - isMerge = isType "merge"; - mkMerge = content: mkProperty { - property = { - _type = "merge"; - onDelay = name: val: throw "mkMerge is not the first of the list of properties."; - onEval = val: throw "mkMerge is not allowed on option definitions."; - }; - inherit content; - }; - - /* If. ThenElse. Always. */ - - # create "if" statement that can be delayed on sets until a "then-else" or - # "always" set is reached. When an always set is reached the condition - # is ignore. - - # Create a "If" property which only contains a condition. - isIf = isType "if"; - mkIf = condition: content: mkProperty { - property = { - _type = "if"; - onGlobalDelay = onIfGlobalDelay; - onEval = onIfEval; - inherit condition; - }; - inherit content; - }; - - mkAssert = assertion: message: content: - mkIf - (if assertion then true else throw "\nFailed assertion: ${message}") - content; - - # Evaluate the "If" statements when either "ThenElse" or "Always" - # statement is encountered. Otherwise it removes multiple If statements and - # replaces them by one "If" statement where the condition is the list of all - # conditions joined with a "and" operation. - onIfGlobalDelay = name: content: - let - # extract if statements and non-if statements and repectively put them - # in the attribute list and attrs. - ifProps = - foldProperty - (foldFilter (p: isIf p) - # then, push the condition inside the list list - (p@{property, content, ...}: - { inherit (content) attrs; - list = [property] ++ content.list; - } - ) - # otherwise, add the propertie. - (p@{property, content, ...}: - { inherit (content) list; - attrs = p // { content = content.attrs; }; - } - ) - ) - (attrs: { list = []; inherit attrs; }) - content; - - # compute the list of if statements. - evalIf = content: condition: list: - if list == [] then - mkIf condition content - else - let p = head list; in - evalIf content (condition && p.condition) (tail list); - in - evalIf ifProps.attrs true ifProps.list; - - # Evaluate the condition of the "If" statement to either get the value or - # to ignore the value. - onIfEval = p@{property, content, ...}: - if property.condition then - content - else - mkNotdef; - - /* mkOverride */ - - # Create an "Override" statement which allow the user to define - # priorities between values. The default priority is 100. The lowest - # priorities are kept. The template argument must reproduce the same - # attribute set hierarchy to override leaves of the hierarchy. - isOverride = isType "override"; - mkOverrideTemplate = priority: template: content: mkProperty { - property = { - _type = "override"; - onDelay = onOverrideDelay; - onGlobalEval = onOverrideGlobalEval; - inherit priority template; - }; - inherit content; - }; - - # Like mkOverrideTemplate, but without the template argument. - mkOverride = priority: content: mkOverrideTemplate priority {} content; - - # Sugar to override the default value of the option by making a new - # default value based on the configuration. - mkDefaultValue = mkOverride 1000; - mkDefault = mkOverride 1000; - mkForce = mkOverride 50; - mkStrict = mkOverride 0; - - # Make the template traversal in function of the property traversal. If - # the template define a non-empty attribute set, then the property is - # copied only on all mentionned attributes inside the template. - # Otherwise, the property is kept on all sub-attribute definitions. - onOverrideDelay = name: p@{property, content, ...}: - let inherit (property) template; in - if isAttrs template && template != {} then - if hasAttr name template then - p // { - property = p.property // { - template = builtins.getAttr name template; - }; - } - # Do not override the attribute \name\ - else - content - # Override values defined inside the attribute \name\. - else - p; - - # Keep values having lowest priority numbers only throwing away those having - # a higher priority assigned. - onOverrideGlobalEval = valList: - let - defaultPrio = 100; - - inherit (builtins) lessThan; - - getPrioVal = - foldProperty - (foldFilter isOverride - (p@{property, content, ...}: - if content ? priority && lessThan content.priority property.priority then - content - else - content // { - inherit (property) priority; - } - ) - (p@{property, content, ...}: - content // { - value = p // { content = content.value; }; - } - ) - ) (value: { inherit value; }); - - addDefaultPrio = x: - if x ? priority then x - else x // { priority = defaultPrio; }; - - prioValList = map (x: addDefaultPrio (getPrioVal x)) valList; - - higherPrio = - if prioValList == [] then - defaultPrio - else - fold (x: min: - if lessThan x.priority min then - x.priority - else - min - ) (head prioValList).priority (tail prioValList); - in - map (x: - if x.priority == higherPrio then - x.value - else - mkNotdef - ) prioValList; - - /* mkOrder */ - - # Order definitions based on there index value. This property is useful - # when the result of the merge function depends on the order on the - # initial list. (e.g. concatStrings) Definitions are ordered based on - # their rank. The lowest ranked definition would be the first to element - # of the list used by the merge function. And the highest ranked - # definition would be the last. Definitions which does not have any rank - # value have the default rank of 100. - isOrder = isType "order"; - mkOrder = rank: content: mkProperty { - property = { - _type = "order"; - onGlobalEval = onOrderGlobalEval; - inherit rank; - }; - inherit content; - }; - - mkHeader = mkOrder 10; - mkFooter = mkOrder 1000; - - # Fetch the rank of each definition (add the default rank is none) and - # sort them based on their ranking. - onOrderGlobalEval = valList: - let - defaultRank = 100; - - inherit (builtins) lessThan; - - getRankVal = - foldProperty - (foldFilter isOrder - (p@{property, content, ...}: - if content ? rank then - content - else - content // { - inherit (property) rank; - } - ) - (p@{property, content, ...}: - content // { - value = p // { content = content.value; }; - } - ) - ) (value: { inherit value; }); - - addDefaultRank = x: - if x ? rank then x - else x // { rank = defaultRank; }; - - rankValList = map (x: addDefaultRank (getRankVal x)) valList; - - cmp = x: y: - builtins.lessThan x.rank y.rank; - in - map (x: x.value) (sort cmp rankValList); - - /* mkFixStrictness */ - - # This is a hack used to restore laziness on some option definitions. - # Some option definitions are evaluated when they are not used. This - # error is caused by the strictness of type checking builtins. Builtins - # like 'isAttrs' are too strict because they have to evaluate their - # arguments to check if the type is correct. This evaluation, cause the - # strictness of properties. - # - # Properties can be stacked on top of each other. The stackability of - # properties on top of the option definition is nice for user manipulation - # but require to check if the content of the property is not another - # property. Such testing implies to verify if this is an attribute set - # and if it possess the type 'property'. (see isProperty & typeOf/isType) - # - # To avoid strict evaluation of option definitions, 'mkFixStrictness' is - # introduced. This property protects an option definition by replacing - # the base of the stack of properties by 'mkNotDef', when this property is - # evaluated it returns the original definition. - # - # This property is useful over any elements which depends on options which - # are raising errors when they get evaluated without the proper settings. - # - # Plain list and attribute set are lazy structures, which means that the - # container gets evaluated but not the content. Thus, using this property - # on top of plain list or attribute set is pointless. - # - # This is a Hack, you should avoid it! - - # This property has a long name because you should avoid it. - isFixStrictness = attrs: (typeOf attrs) == "fix-strictness"; - mkFixStrictness = value: - mkProperty { - property = { - _type = "fix-strictness"; - onEval = p: value; - }; - content = mkNotdef; - }; - -} diff --git a/lib/systems.nix b/lib/systems.nix index 1ef869fb012..afa2002c6e4 100644 --- a/lib/systems.nix +++ b/lib/systems.nix @@ -22,7 +22,7 @@ rec { }; - isCpuType = x: typeOf x == "cpu-type" + isCpuType = x: isType "cpu-type" x && elem x.bits [8 16 32 64 128] && (builtins.lessThan 8 x.bits -> isSignificantByte x.significantByte); @@ -69,7 +69,7 @@ rec { }; - isSystem = x: typeOf x == "system" + isSystem = x: isType "system" x && isCpuType x.cpu && isArchitecture x.arch && isKernel x.kernel; diff --git a/lib/types.nix b/lib/types.nix index 156d72ac5e7..09b29a762e1 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -1,17 +1,15 @@ # Definitions related to run-time type checking. Used in particular # to type-check NixOS configurations. -let lib = import ./default.nix; in - with import ./lists.nix; with import ./attrsets.nix; with import ./options.nix; with import ./trivial.nix; +with import ./strings.nix; rec { isType = type: x: (x._type or "") == type; - hasType = x: isAttrs x && x ? _type; typeOf = x: x._type or ""; setType = typeName: value: value // { @@ -19,208 +17,194 @@ rec { }; - # name (name of the type) - # check (check the config value. Before returning false it should trace the bad value eg using traceValIfNot) - # merge (default merge function) - # iter (iterate on all elements contained in this type) - # fold (fold all elements contained in this type) - # hasOptions (boolean: whatever this option contains an option set) - # delayOnGlobalEval (boolean: should properties go through the evaluation of this option) - # docPath (path concatenated to the option name contained in the option set) isOptionType = isType "option-type"; mkOptionType = - { name - , check ? (x: true) - , merge ? mergeDefaultOption - # Handle complex structure types. - , iter ? (f: path: v: f path v) - , fold ? (op: nul: v: op v nul) - , docPath ? lib.id - # If the type can contains option sets. - , hasOptions ? false - , delayOnGlobalEval ? false + { # Human-readable representation of the type. + name + , # Function applied to each definition that should return true if + # its type-correct, false otherwise. + check ? (x: true) + , # Merge a list of definitions together into a single value. + # This function is called with two arguments: the location of + # the option in the configuration as a list of strings + # (e.g. ["boot" "loader "grub" "enable"]), and a list of + # definition values and locations (e.g. [ { file = "/foo.nix"; + # value = 1; } { file = "/bar.nix"; value = 2 } ]). + merge ? mergeDefaultOption + , # Return a flat list of sub-options. Used to generate + # documentation. + getSubOptions ? prefix: {} }: - { _type = "option-type"; - inherit name check merge iter fold docPath hasOptions delayOnGlobalEval; + inherit name check merge getSubOptions; }; types = rec { + unspecified = mkOptionType { + name = "unspecified"; + }; + bool = mkOptionType { name = "boolean"; - check = lib.traceValIfNot builtins.isBool; - merge = fold lib.or false; + check = builtins.isBool; + merge = loc: fold (x: y: x.value || y) false; }; int = mkOptionType { name = "integer"; - check = lib.traceValIfNot builtins.isInt; + check = builtins.isInt; + merge = mergeOneOption; }; - string = mkOptionType { + str = mkOptionType { name = "string"; - check = lib.traceValIfNot builtins.isString; - merge = lib.concatStrings; + check = builtins.isString; + merge = mergeOneOption; }; - # Like ‘string’, but add newlines between every value. Useful for - # configuration file contents. - lines = mkOptionType { + # Merge multiple definitions by concatenating them (with the given + # separator between the values). + separatedString = sep: mkOptionType { name = "string"; - check = lib.traceValIfNot builtins.isString; - merge = lib.concatStringsSep "\n"; + check = builtins.isString; + merge = loc: defs: concatStringsSep sep (getValues defs); }; - envVar = mkOptionType { - name = "environment variable"; - inherit (string) check; - merge = lib.concatStringsSep ":"; - }; + lines = separatedString "\n"; + commas = separatedString ","; + envVar = separatedString ":"; + + # Deprecated; should not be used because it quietly concatenates + # strings, which is usually not what you want. + string = separatedString ""; attrs = mkOptionType { name = "attribute set"; - check = lib.traceValIfNot isAttrs; - merge = fold lib.mergeAttrs {}; + check = isAttrs; + merge = loc: fold (def: mergeAttrs def.value) {}; }; # derivation is a reserved keyword. package = mkOptionType { name = "derivation"; - check = lib.traceValIfNot isDerivation; + check = isDerivation; + merge = mergeOneOption; }; path = mkOptionType { name = "path"; # Hacky: there is no ‘isPath’ primop. - check = lib.traceValIfNot (x: builtins.unsafeDiscardStringContext (builtins.substring 0 1 (toString x)) == "/"); + check = x: builtins.unsafeDiscardStringContext (builtins.substring 0 1 (toString x)) == "/"; + merge = mergeOneOption; }; # drop this in the future: - list = builtins.trace "types.list is deprecated, use types.listOf instead" types.listOf; + list = builtins.trace "`types.list' is deprecated; use `types.listOf' instead" types.listOf; - listOf = elemType: mkOptionType { + listOf = elemType: mkOptionType { name = "list of ${elemType.name}s"; - check = value: lib.traceValIfNot isList value && all elemType.check value; - merge = concatLists; - iter = f: path: list: map (elemType.iter f (path + ".*")) list; - fold = op: nul: list: lib.fold (e: l: elemType.fold op l e) nul list; - docPath = path: elemType.docPath (path + ".*"); - inherit (elemType) hasOptions; - - # You cannot define multiple configurations of one entity, therefore - # no reason justify to delay properties inside list elements. - delayOnGlobalEval = false; + check = value: isList value && all elemType.check value; + merge = loc: defs: + concatLists (imap (n: def: imap (m: def': + elemType.merge (loc ++ ["[${toString n}-${toString m}]"]) + [{ inherit (def) file; value = def'; }]) def.value) defs); + getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]); }; attrsOf = elemType: mkOptionType { name = "attribute set of ${elemType.name}s"; - check = x: lib.traceValIfNot isAttrs x - && all elemType.check (lib.attrValues x); - merge = lib.zipAttrsWith (name: elemType.merge); - iter = f: path: set: lib.mapAttrs (name: elemType.iter f (path + "." + name)) set; - fold = op: nul: set: fold (e: l: elemType.fold op l e) nul (lib.attrValues set); - docPath = path: elemType.docPath (path + "."); - inherit (elemType) hasOptions delayOnGlobalEval; + check = x: isAttrs x && all elemType.check (attrValues x); + merge = loc: defs: + zipAttrsWith (name: elemType.merge (loc ++ [name])) + # Push down position info. + (map (def: listToAttrs (mapAttrsToList (n: def': + { name = n; value = { inherit (def) file; value = def'; }; }) def.value)) defs); + getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); }; # List or attribute set of ... loaOf = elemType: let convertIfList = defIdx: def: - if isList def then - listToAttrs ( - flip imap def (elemIdx: elem: - nameValuePair "unnamed-${toString defIdx}.${toString elemIdx}" elem)) + if isList def.value then + { inherit (def) file; + value = listToAttrs ( + imap (elemIdx: elem: + { name = "unnamed-${toString defIdx}.${toString elemIdx}"; + value = elem; + }) def.value); + } else def; listOnly = listOf elemType; attrOnly = attrsOf elemType; - in mkOptionType { name = "list or attribute set of ${elemType.name}s"; check = x: if isList x then listOnly.check x else if isAttrs x then attrOnly.check x - else lib.traceValIfNot (x: false) x; - ## The merge function returns an attribute set - merge = defs: - attrOnly.merge (imap convertIfList defs); - iter = f: path: def: - if isList def then listOnly.iter f path def - else if isAttrs def then attrOnly.iter f path def - else throw "Unexpected value"; - fold = op: nul: def: - if isList def then listOnly.fold op nul def - else if isAttrs def then attrOnly.fold op nul def - else throw "Unexpected value"; - - docPath = path: elemType.docPath (path + "."); - inherit (elemType) hasOptions delayOnGlobalEval; - } - ; + else false; + merge = loc: defs: attrOnly.merge loc (imap convertIfList defs); + getSubOptions = prefix: elemType.getSubOptions (prefix ++ [""]); + }; uniq = elemType: mkOptionType { - inherit (elemType) name check iter fold docPath hasOptions; - merge = list: - if length list == 1 then - head list - else - throw "Multiple definitions of ${elemType.name}. Only one is allowed for this option."; - }; - - none = elemType: mkOptionType { - inherit (elemType) name check iter fold docPath hasOptions; - merge = list: - throw "No definitions are allowed for this option."; + inherit (elemType) name check; + merge = mergeOneOption; + getSubOptions = elemType.getSubOptions; }; nullOr = elemType: mkOptionType { - inherit (elemType) name merge docPath hasOptions; + name = "null or ${elemType.name}"; check = x: builtins.isNull x || elemType.check x; - iter = f: path: v: if v == null then v else elemType.iter f path v; - fold = op: nul: v: if v == null then nul else elemType.fold op nul v; + merge = loc: defs: + let nrNulls = count (def: isNull def.value) defs; in + if nrNulls == length defs then null + else if nrNulls != 0 then + throw "The option `${showOption loc}' is defined both null and not null, in ${showFiles (getFiles defs)}." + else elemType.merge loc defs; + getSubOptions = elemType.getSubOptions; }; functionTo = elemType: mkOptionType { name = "function that evaluates to a(n) ${elemType.name}"; - check = lib.traceValIfNot builtins.isFunction; - merge = fns: - args: elemType.merge (map (fn: fn args) fns); - # These are guesses, I don't fully understand iter, fold, delayOnGlobalEval - iter = f: path: v: - args: elemType.iter f path (v args); - fold = op: nul: v: - args: elemType.fold op nul (v args); - inherit (elemType) delayOnGlobalEval; - hasOptions = false; + check = builtins.isFunction; + merge = loc: defs: + fnArgs: elemType.merge loc (map (fn: { inherit (fn) file; value = fn.value fnArgs; }) defs); + getSubOptions = elemType.getSubOptions; }; - # usually used with listOf, attrsOf, loaOf like this: - # users = mkOption { - # type = loaOf optionSet; - # - # # you can omit the list if there is one element only - # options = [ { - # name = mkOption { - # description = "name of the user" - # ... - # }; - # # more options here - # } { more options } ]; - # } - # TODO: !!! document passing options as an argument to optionSet, - # deprecate the current approach. + submodule = opts: + let + opts' = toList opts; + inherit (import ./modules.nix) evalModules; + in + mkOptionType rec { + name = "submodule"; + check = x: isAttrs x || builtins.isFunction x; + merge = loc: defs: + let + coerce = def: if builtins.isFunction def then def else { config = def; }; + modules = opts' ++ map (def: { _file = def.file; imports = [(coerce def.value)]; }) defs; + in (evalModules { inherit modules; args.name = last loc; prefix = loc; }).config; + getSubOptions = prefix: (evalModules + { modules = opts'; inherit prefix; + # FIXME: hack to get shit to evaluate. + args = { name = ""; }; }).options; + }; + + # Obsolete alternative to configOf. It takes its option + # declarations from the ‘options’ attribute of containing option + # declaration. optionSet = mkOptionType { - name = "option set"; - # merge is done in "options.nix > addOptionMakeUp > handleOptionSets" - merge = lib.id; - check = x: isAttrs x || builtins.isFunction x; - hasOptions = true; - delayOnGlobalEval = true; + name = /* builtins.trace "types.optionSet is deprecated; use types.submodule instead" */ "option set"; }; + # Augment the given type with an additional type check function. + addCheck = elemType: check: elemType // { check = x: elemType.check x && check x; }; + }; } diff --git a/nixos/default.nix b/nixos/default.nix index 88f82a82482..5d69b79e13a 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -9,7 +9,7 @@ let modules = [ configuration ]; }; - inherit (eval) config pkgs; + inherit (eval) pkgs; # This is for `nixos-rebuild build-vm'. vmConfig = (import ./lib/eval-config.nix { @@ -30,9 +30,9 @@ let in { - inherit eval config; + inherit (eval) config options; - system = config.system.build.toplevel; + system = eval.config.system.build.toplevel; vm = vmConfig.system.build.vm; diff --git a/nixos/doc/manual/configuration.xml b/nixos/doc/manual/configuration.xml index b0b1da71184..9bca53ae904 100644 --- a/nixos/doc/manual/configuration.xml +++ b/nixos/doc/manual/configuration.xml @@ -7,7 +7,7 @@ This chapter describes how to configure various aspects of a NixOS machine through the configuration file /etc/nixos/configuration.nix. As described in -, changes to that file only take +, changes to this file only take effect after you run nixos-rebuild. @@ -15,7 +15,703 @@ effect after you run nixos-rebuild.
Configuration syntax -TODO +
The basics + +The NixOS configuration file +/etc/nixos/configuration.nix is actually a +Nix expression, which is the Nix package +manager’s purely functional language for describing how to build +packages and configurations. This means you have all the expressive +power of that language at your disposal, including the ability to +abstract over common patterns, which is very useful when managing +complex systems. The syntax and semantics of the Nix language are +fully described in the Nix +manual, but here we give a short overview of the most important +constructs useful in NixOS configuration files. + +The NixOS configuration file generally looks like this: + + +{ config, pkgs, ... }: + +{ option definitions +} + + +The first line ({ config, pkgs, ... }:) denotes +that this is actually a function that takes at least the two arguments + config and pkgs. (These are +explained later.) The function returns a set of +option definitions ({ ... }). These definitions have the +form name = +value, where +name is the name of an option and +value is its value. For example, + + +{ config, pkgs, ... }: + +{ services.httpd.enable = true; + services.httpd.adminAddr = "alice@example.org"; + services.httpd.documentRoot = "/webroot"; +} + + +defines a configuration with three option definitions that together +enable the Apache HTTP Server with /webroot as +the document root. + +Sets can be nested, and in fact dots in option names are +shorthand for defining a set containing another set. For instance, + defines a set named +services that contains a set named +httpd, which in turn contains an option definition +named enable with value true. +This means that the example above can also be written as: + + +{ config, pkgs, ... }: + +{ services = { + httpd = { + enable = true; + adminAddr = "alice@example.org"; + documentRoot = "/webroot"; + }; + }; +} + + +which may be more convenient if you have lots of option definitions +that share the same prefix (such as +services.httpd). + +NixOS checks your option definitions for correctness. For +instance, if you try to define an option that doesn’t exist (that is, +doesn’t have a corresponding option declaration), +nixos-rebuild will give an error like: + +The option `services.httpd.enabl' defined in `/etc/nixos/configuration.nix' does not exist. + +Likewise, values in option definitions must have a correct type. For +instance, must be a Boolean +(true or false). Trying to give +it a value of another type, such as a string, will cause an error: + +The option value `services.httpd.enable' in `/etc/nixos/configuration.nix' is not a boolean. + + + + +Options have various types of values. The most important are: + + + + Strings + + Strings are enclosed in double quotes, e.g. + + +networking.hostName = "dexter"; + + + Special characters can be escaped by prefixing them with a + backslash (e.g. \"). + + Multi-line strings can be enclosed in double + single quotes, e.g. + + +networking.extraHosts = + '' + 127.0.0.2 other-localhost + 10.0.0.1 server + ''; + + + The main difference is that preceding whitespace is + automatically stripped from each line, and that characters like + " and \ are not special + (making it more convenient for including things like shell + code). + + + + + Booleans + + These can be true or + false, e.g. + + +networking.firewall.enable = true; +networking.firewall.allowPing = false; + + + + + + + Integers + + For example, + + +boot.kernel.sysctl."net.ipv4.tcp_keepalive_time" = 60; + + + (Note that here the attribute name + net.ipv4.tcp_keepalive_time is enclosed in + quotes to prevent it from being interpreted as a set named + net containing a set named + ipv4, and so on. This is because it’s not a + NixOS option but the literal name of a Linux kernel + setting.) + + + + + Sets + + Sets were introduced above. They are name/value pairs + enclosed in braces, as in the option definition + + +fileSystems."/boot" = + { device = "/dev/sda1"; + fsType = "ext4"; + options = "rw,data=ordered,relatime"; + }; + + + + + + + Lists + + The important thing to note about lists is that list + elements are separated by whitespace, like this: + + +boot.kernelModules = [ "fuse" "kvm-intel" "coretemp" ]; + + + List elements can be any other type, e.g. sets: + + +swapDevices = [ { device = "/dev/disk/by-label/swap"; } ]; + + + + + + + Packages + + Usually, the packages you need are already part of the Nix + Packages collection, which is a set that can be accessed through + the function argument pkgs. Typical uses: + + +environment.systemPackages = + [ pkgs.thunderbird + pkgs.emacs + ]; + +postgresql.package = pkgs.postgresql90; + + + The latter option definition changes the default PostgreSQL + package used by NixOS’s PostgreSQL service to 9.0. For more + information on packages, including how to add new ones, see + . + + + + + + + +
+ + +
Abstractions + +If you find yourself repeating yourself over and over, it’s time +to abstract. Take, for instance, this Apache HTTP Server configuration: + + +{ + services.httpd.virtualHosts = + [ { hostName = "example.org"; + documentRoot = "/webroot"; + adminAddr = "alice@example.org"; + enableUserDir = true; + } + { hostName = "example.org"; + documentRoot = "/webroot"; + adminAddr = "alice@example.org"; + enableUserDir = true; + enableSSL = true; + sslServerCert = "/root/ssl-example-org.crt"; + sslServerKey = "/root/ssl-example-org.key"; + } + ]; +} + + +It defines two virtual hosts with nearly identical configuration; the +only difference is that the second one has SSL enabled. To prevent +this duplication, we can use a let: + + +let + exampleOrgCommon = + { hostName = "example.org"; + documentRoot = "/webroot"; + adminAddr = "alice@example.org"; + enableUserDir = true; + }; +in +{ + services.httpd.virtualHosts = + [ exampleOrgCommon + (exampleOrgCommon // { + enableSSL = true; + sslServerCert = "/root/ssl-example-org.crt"; + sslServerKey = "/root/ssl-example-org.key"; + }) + ]; +} + + +The let exampleOrgCommon = +... defines a variable named +exampleOrgCommon. The // +operator merges two attribute sets, so the configuration of the second +virtual host is the set exampleOrgCommon extended +with the SSL options. + +You can write a let wherever an expression is +allowed. Thus, you also could have written: + + +{ + services.httpd.virtualHosts = + let exampleOrgCommon = ...; in + [ exampleOrgCommon + (exampleOrgCommon // { ... }) + ]; +} + + +but not { let exampleOrgCommon = +...; in ...; +} since attributes (as opposed to attribute values) are not +expressions. + +Functions provide another method of +abstraction. For instance, suppose that we want to generate lots of +different virtual hosts, all with identical configuration except for +the host name. This can be done as follows: + + +{ + services.httpd.virtualHosts = + let + makeVirtualHost = name: + { hostName = name; + documentRoot = "/webroot"; + adminAddr = "alice@example.org"; + }; + in + [ (makeVirtualHost "example.org") + (makeVirtualHost "example.com") + (makeVirtualHost "example.gov") + (makeVirtualHost "example.nl") + ]; +} + + +Here, makeVirtualHost is a function that takes a +single argument name and returns the configuration +for a virtual host. That function is then called for several names to +produce the list of virtual host configurations. + +We can further improve on this by using the function +map, which applies another function to every +element in a list: + + +{ + services.httpd.virtualHosts = + let + makeVirtualHost = ...; + in map makeVirtualHost + [ "example.org" "example.com" "example.gov" "example.nl" ]; +} + + +(The function map is called a +higher-order function because it takes another +function as an argument.) + +What if you need more than one argument, for instance, if we +want to use a different documentRoot for each +virtual host? Then we can make makeVirtualHost a +function that takes a set as its argument, like this: + + +{ + services.httpd.virtualHosts = + let + makeVirtualHost = { name, root }: + { hostName = name; + documentRoot = root; + adminAddr = "alice@example.org"; + }; + in map makeVirtualHost + [ { name = "example.org"; root = "/sites/example.org"; } + { name = "example.com"; root = "/sites/example.com"; } + { name = "example.gov"; root = "/sites/example.gov"; } + { name = "example.nl"; root = "/sites/example.nl"; } + ]; +} + + +But in this case (where every root is a subdirectory of +/sites named after the virtual host), it would +have been shorter to define makeVirtualHost as + +makeVirtualHost = name: + { hostName = name; + documentRoot = "/sites/${name}"; + adminAddr = "alice@example.org"; + }; + + +Here, the construct +${...} allows the result +of an expression to be spliced into a string. + +
+ + +
Modularity + +The NixOS configuration mechanism is modular. If your +configuration.nix becomes too big, you can split +it into multiple files. Likewise, if you have multiple NixOS +configurations (e.g. for different computers) with some commonality, +you can move the common configuration into a shared file. + +Modules have exactly the same syntax as +configuration.nix. In fact, +configuration.nix is itself a module. You can +use other modules by including them from +configuration.nix, e.g.: + + +{ config, pkgs, ... }: + +{ imports = [ ./vpn.nix ./kde.nix ]; + services.httpd.enable = true; + environment.systemPackages = [ pkgs.emacs ]; + ... +} + + +Here, we include two modules from the same directory, +vpn.nix and kde.nix. The +latter might look like this: + + +{ config, pkgs, ... }: + +{ services.xserver.enable = true; + services.xserver.displayManager.kdm.enable = true; + services.xserver.desktopManager.kde4.enable = true; + environment.systemPackages = [ pkgs.kde4.kscreensaver ]; +} + + +Note that both configuration.nix and +kde.nix define the option +. When multiple modules +define an option, NixOS will try to merge the +definitions. In the case of +, that’s easy: the lists of +packages can simply be concatenated. For other types of options, a +merge may not be possible: for instance, if two modules define +, +nixos-rebuild will give an error: + + +The unique option `services.httpd.adminAddr' is defined multiple times, in `/etc/nixos/httpd.nix' and `/etc/nixos/configuration.nix'. + + +When that happens, it’s possible to force one definition take +precedence over the others: + + +services.httpd.adminAddr = pkgs.lib.mkForce "bob@example.org"; + + + + +When using multiple modules, you may need to access +configuration values defined in other modules. This is what the +config function argument is for: it contains the +complete, merged system configuration. That is, +config is the result of combining the +configurations returned by every moduleIf you’re +wondering how it’s possible that the (indirect) +result of a function is passed as an +input to that same function: that’s because Nix +is a “lazy” language — it only computes values when they are needed. +This works as long as no individual configuration value depends on +itself.. For example, here is a module that adds +some packages to only if + is set to +true somewhere else: + + +{ config, pkgs, ... }: + +{ environment.systemPackages = + if config.services.xserver.enable then + [ pkgs.firefox + pkgs.thunderbird + ] + else + [ ]; +} + + + + +With multiple modules, it may not be obvious what the final +value of a configuration option is. The command + allows you to find out: + + +$ nixos-option services.xserver.enable +true + +$ nixos-option boot.kernelModules +[ "tun" "ipv6" "loop" ... ] + + +Interactive exploration of the configuration is possible using +nix-repl, +a read-eval-print loop for Nix expressions. It’s not installed by +default; run nix-env -i nix-repl to get it. A +typical use: + + +$ nix-repl '<nixos>' + +nix-repl> config.networking.hostName +"mandark" + +nix-repl> map (x: x.hostName) config.services.httpd.virtualHosts +[ "example.org" "example.gov" ] + + + + +
+ + +
Syntax summary + +Below is a summary of the most important syntactic constructs in +the Nix expression language. It’s not complete. In particular, there +are many other built-in functions. See the Nix +manual for the rest. + + + + + + + + Example + Description + + + + + + Basic values + + + "Hello world" + A string + + + "${pkgs.bash}/bin/sh" + A string containing an expression (expands to "/nix/store/hash-bash-version/bin/sh") + + + true, false + Booleans + + + 123 + An integer + + + ./foo.png + A path (relative to the containing Nix expression) + + + + Compound values + + + { x = 1; y = 2; } + An set with attributes names x and y + + + { foo.bar = 1; } + A nested set, equivalent to { foo = { bar = 1; }; } + + + rec { x = "bla"; y = x + "bar"; } + A recursive set, equivalent to { x = "foo"; y = "foobar"; } + + + [ "foo" "bar" ] + A list with two elements + + + + Operators + + + "foo" + "bar" + String concatenation + + + 1 + 2 + Integer addition + + + "foo" == "f" + "oo" + Equality test (evaluates to true) + + + "foo" != "bar" + Inequality test (evaluates to true) + + + !true + Boolean negation + + + { x = 1; y = 2; }.x + Attribute selection (evaluates to 1) + + + { x = 1; y = 2; }.z or 3 + Attribute selection with default (evaluates to 3) + + + { x = 1; y = 2; } // { z = 3; } + Merge two sets (attributes in the right-hand set taking precedence) + + + + Control structures + + + if 1 + 1 == 2 then "yes!" else "no!" + Conditional expression + + + assert 1 + 1 == 2; "yes!" + Assertion check (evaluates to "yes!") + + + let x = "foo"; y = "bar"; in x + y + Variable definition + + + with pkgs.lib; head [ 1 2 3 ] + Add all attributes from the given set to the scope + (evaluates to 1) + + + + Functions (lambdas) + + + x: x + 1 + A function that expects an integer and returns it increased by 1 + + + (x: x + 1) 100 + A function call (evaluates to 101) + + + let inc = x: x + 1; in inc (inc (inc 100)) + A function bound to a variable and subsequently called by name (evaluates to 103) + + + { x, y }: x + y + A function that expects a set with required attributes + x and y and concatenates + them + + + { x, y ? "bar" }: x + y + A function that expects a set with required attribute + x and optional y, using + "bar" as default value for + y + + + { x, y, ... }: x + y + A function that expects a set with required attributes + x and y and ignores any + other attributes + + + { x, y } @ args: x + y + A function that expects a set with required attributes + x and y, and binds the + whole set to args + + + + Built-in functions + + + import ./foo.nix + Load and return Nix expression in given file + + + map (x: x + x) [ 1 2 3 ] + Apply a function to every element of a list (evaluates to [ 2 4 6 ]) + + + + + + + +
+
@@ -170,7 +866,7 @@ recursion.) -
Adding custom packages +
Adding custom packages It’s possible that a package you need is not available in NixOS. In that case, you can do two things. First, you can clone the Nixpkgs @@ -316,7 +1012,7 @@ manpage or the Nix manual. -
User management +
User management NixOS supports both declarative and imperative styles of user management. In the declarative style, users are specified in diff --git a/nixos/doc/manual/development.xml b/nixos/doc/manual/development.xml index 775143cc835..6bbccac6e5c 100644 --- a/nixos/doc/manual/development.xml +++ b/nixos/doc/manual/development.xml @@ -3,7 +3,7 @@ Development -This chapter has some random notes on hacking on +This chapter describes how you can modify and extend NixOS. @@ -11,7 +11,7 @@ NixOS.
-Hacking on NixOS +Getting the sources By default, NixOS’s nixos-rebuild command uses the NixOS and Nixpkgs sources provided by the @@ -34,37 +34,40 @@ $ git clone git://github.com/NixOS/nixpkgs.git This will check out the latest NixOS sources to -/my/sources/nixpkgs/nixos and -the Nixpkgs sources to +/my/sources/nixpkgs/nixos +and the Nixpkgs sources to /my/sources/nixpkgs. -If you want to rebuild your system using your (modified) sources, you -need to tell nixos-rebuild about them using the - flag: +(The NixOS source tree lives in a subdirectory of the Nixpkgs +repository.) If you want to rebuild your system using your (modified) +sources, you need to tell nixos-rebuild about them +using the flag: -$ nixos-rebuild switch -I /my/sources/nixpkgs +$ nixos-rebuild switch -I nixpkgs=/my/sources/nixpkgs -nixos-rebuild affects only the system profile. -To install packages to your user profile from expressions in -/my/sources, use -nix-env -f /my/sources/nixpkgs, -or change the default by replacing the symlink in +If you want nix-env to use the expressions in +/my/sources, use nix-env -f +/my/sources/nixpkgs, or change +the default by adding a symlink in ~/.nix-defexpr: -$ rm -f ~/.nix-defexpr/channels $ ln -s /my/sources/nixpkgs ~/.nix-defexpr/nixpkgs - +You may want to delete the symlink +~/.nix-defexpr/channels_root to prevent root’s +NixOS channel from clashing with your own tree. +
@@ -73,190 +76,132 @@ in nixos/ as packages.
-Extending NixOS +Writing NixOS modules -NixOS is based on a modular system for declarative configuration. - This system combines multiple modules to produce one - configuration. One of the module which compose your computer - configuration is /etc/nixos/configuration.nix. Other - modules are available under NixOS modules - directory +NixOS has a modular system for declarative configuration. This +system combines multiple modules to produce the +full system configuration. One of the modules that constitute the +configuration is /etc/nixos/configuration.nix. +Most of the others live in the nixos/modules +subdirectory of the Nixpkgs tree. -A module is a file which handles one specific part of the - configuration. This part of the configuration could correspond to - hardware, a service, network settings, or preferences. A module - configuration does not have to handle everything from scratch, it can base - its configuration on other configurations provided by other modules. Thus - a module can define options to setup its - configuration, and it can also declare options to be - fed by other modules. +Each NixOS module is a file that handles one logical aspect of +the configuration, such as a specific kind of hardware, a service, or +network settings. A module configuration does not have to handle +everything from scratch; it can use the functionality provided by +other modules for its implementation. Thus a module can +declare options that can be used by other +modules, and conversely can define options +provided by other modules in its own implementation. For example, the +module pam.nix +declares the option that allows +other modules (e.g. sshd.nix) +to define PAM services; and it defines the option + (declared by etc.nix) +to cause files to be created in +/etc/pam.d. - +In , we saw the following structure +of NixOS modules: -A module is a file which contains a Nix - expression. This expression should be either an expression which gets - evaluated into an attribute set or a function which returns an attribute - set. + +{ config, pkgs, ... }: -When the expression is a function, it should expect only one argument - which is an attribute set containing an attribute - named config and another attribute - named pkgs. The config attribute - contains the result of the merge of all modules. This attribute is - evaluated lazily, such as any Nix expression. For more details on how - options are merged, see the details in . - The pkgs attribute - contains nixpkgs attribute set of packages. This - attribute is necessary for declaring options. +{ option definitions +} + -Usual module content +This is actually an abbreviated form of module +that only defines options, but does not declare any. The structure of +full NixOS modules is shown in . + +Structure of NixOS modules { config, pkgs, ... }: { imports = - [ + [ paths of other modules ]; options = { - + option declarations }; config = { - + option definitions }; } - Illustrates - a module skeleton. +The meaning of each part is as follows. - This line makes the current Nix expression a function. This - line can be omitted if there is no reference to pkgs - and config inside the module. + This line makes the current Nix expression a function. The + variable pkgs contains Nixpkgs, while + config contains the full system configuration. + This line can be omitted if there is no reference to + pkgs and config inside the + module. - This list is used to enumerate path to other modules which are - declaring options used by the current module. In NixOS, default modules - are listed in the file modules/module-list.nix. - The default modules don't need to be added in the import list. + This list enumerates the paths to other NixOS modules that + should be included in the evaluation of the system configuration. + A default set of modules is defined in the file + modules/module-list.nix. These don't need to + be added in the import list. - This attribute set contains an attribute set of option - declaration. + The attribute options is a nested set of + option declarations (described below). - This attribute set contains an attribute set of option - definitions. If the module does not have any imported - modules or any option declarations, then this attribute set can be used - in place of its parent attribute set. This is a common case for simple - modules such - as /etc/nixos/configuration.nix. + The attribute config is a nested set of + option definitions (also described + below). - + shows a module that handles +the regular update of the “locate” database, an index of all files in +the file system. This module declares two options that can be defined +by other modules (typically the user’s +configuration.nix): + (whether the database should +be updated) and (when the +update should be done). It implements its functionality by defining +two options declared by other modules: + (the set of all systemd services) +and (the list of +commands to be executed periodically by cron). -A module defines a configuration which would be - interpreted by other modules. To define a configuration, a module needs - to provide option definitions. An option definition is a simple - attribute assignment. - -Option definitions are made in a declarative manner. Without - properties, options will always be defined with the same value. To - introduce more flexibility in the system, option definitions are guarded - by properties. - -Properties are means to introduce conditional values inside option - definitions. This conditional values can be distinguished in two - categories. The condition which are local to the current configuration - and conditions which are dependent on others configurations. Local - properties are mkIf - and mkAssert. Global properties - are mkOverride, mkDefault - and mkOrder. - -mkIf is used to remove the option definitions which - are below it if the condition is evaluated to - false. mkAssert expects the condition to be evaluated - to true otherwise it raises an error message. - -mkOverride is used to mask previous definitions if - the current value has a lower mask number. The mask value is 100 (default) - for any option definition which does not use this property. - Thus, mkDefault is just a short-cut with a higher mask - (1000) than the default mask value. This means that a module can set an - option definition as a preference, and still let another module defining - it with a different value without using any property. - -mkOrder is used to sort definitions based on the - rank number. The rank number will sort all options definitions before - giving the sorted list of option definition to the merge function defined - in the option declaration. A lower rank will move the definition to the - beginning and a higher rank will move the option toward the end. The - default rank is 100. - - - -A module may declare options which are used by - other module to change the configuration provided by the current module. - Changes to the option definitions are made with properties which are using - values extracted from the result of the merge of all modules - (the config argument). - -The config argument reproduce the same hierarchy of - all options declared in all modules. For each option, the result of the - option is available, it is either the default value or the merge of all - definitions of the option. - -Options are declared with the - function pkgs.lib.mkOption. This function expects an - attribute set which at least provides a description. A default value, an - example, a type, a merge function and a post-process function can be - added. - -Types are used to provide a merge strategy for options and to ensure - the type of each option definitions. They are defined - in pkgs.lib.types. - -The merge function expects a list of option definitions and merge - them to obtain one result of the same type. - -The post-process function (named apply) takes the - result of the merge or of the default value, and produce an output which - could have a different type than the type expected by the option. - - - -Locate Module Example +NixOS module for the “locate” service { config, pkgs, ... }: with pkgs.lib; -let - cfg = config.services.locate; - locatedb = "/var/cache/locatedb"; - logfile = "/var/log/updatedb"; - cmd =''root updatedb --localuser=nobody --output=${locatedb} > ${logfile}''; -in +let locatedb = "/var/cache/locatedb"; in { - imports = [ /path/to/nixpkgs/nixos/modules/services/scheduling/cron.nix ]; - options = { + services.locate = { + enable = mkOption { + type = types.bool; default = false; - example = true; - type = with types; bool; description = '' If enabled, NixOS will periodically update the database of files used by the locate command. @@ -264,35 +209,370 @@ in }; period = mkOption { + type = types.str; default = "15 02 * * *"; - type = with types; uniq string; description = '' This option defines (in the format used by cron) when the - locate database is updated. - The default is to update at 02:15 (at night) every day. + locate database is updated. The default is to update at + 02:15 at night every day. ''; }; + }; + }; - config = mkIf cfg.enable { - services.cron = { - enable = true; - systemCronJobs = "${cfg.period} root ${cmd}"; - }; + config = { + + systemd.services.update-locatedb = + { description = "Update Locate Database"; + path = [ pkgs.su ]; + script = + '' + mkdir -m 0755 -p $(dirname ${locatedb}) + exec updatedb --localuser=nobody --output=${locatedb} --prunepaths='/tmp /var/tmp /media /run' + ''; + }; + + services.cron.systemCronJobs = optional config.services.locate.enable + "${config.services.locate.period} root ${config.systemd.package}/bin/systemctl start update-locatedb.service"; + }; } - illustrates a module which handles - the regular update of the database which index all files on the file - system. This modules has option definitions to rely on the cron service - to run the command at predefined dates. In addition, this modules - provides option declarations to enable the indexing and to use different - period of time to run the indexing. Properties are used to prevent - ambiguous definitions of option (enable locate service and disable cron - services) and to ensure that no options would be defined if the locate - service is not enabled. +
Option declarations + +An option declaration specifies the name, type and description +of a NixOS configuration option. It is illegal to define an option +that hasn’t been declared in any module. A option declaration +generally looks like this: + + +options = { + name = mkOption { + type = type specification; + default = default value; + example = example value; + description = "Description for use in the NixOS manual."; + }; +}; + + + + +The function mkOption accepts the following arguments. + + + + + type + + The type of the option (see below). It may be omitted, + but that’s not advisable since it may lead to errors that are + hard to diagnose. + + + + + default + + The default value used if no value is defined by any + module. A default is not required; in that case, if the option + value is ever used, an error will be thrown. + + + + + example + + An example value that will be shown in the NixOS manual. + + + + + description + + A textual description of the option, in DocBook format, + that will be included in the NixOS manual. + + + + + + + +Here is a non-exhaustive list of option types: + + + + + types.bool + + A Boolean. + + + + + types.int + + An integer. + + + + + types.str + + A string. + + + + + types.lines + + A string. If there are multiple definitions, they are + concatenated, with newline characters in between. + + + + + types.path + + A path, defined as anything that, when coerced to a + string, starts with a slash. This includes derivations. + + + + + types.listOf t + + A list of elements of type t + (e.g., types.listOf types.str is a list of + strings). Multiple definitions are concatenated together. + + + + + types.attrsOf t + + A set of elements of type t + (e.g., types.attrsOf types.int is a set of + name/value pairs, the values being integers). + + + + + types.nullOr t + + Either the value null or something of + type t. + + + + + +You can also create new types using the function +mkOptionType. See +lib/types.nix in Nixpkgs for details. + +
+ + +
Option definitions + +Option definitions are generally straight-forward bindings of values to option names, like + + +config = { + services.httpd.enable = true; +}; + + +However, sometimes you need to wrap an option definition or set of +option definitions in a property to achieve +certain effects: + +Delaying conditionals + +If a set of option definitions is conditional on the value of +another option, you may need to use mkIf. +Consider, for instance: + + +config = if config.services.httpd.enable then { + environment.systemPackages = [ ... ]; + ... +} else {}; + + +This definition will cause Nix to fail with an “infinite recursion” +error. Why? Because the value of + depends on the value +being constructed here. After all, you could also write the clearly +circular and contradictory: + +config = if config.services.httpd.enable then { + services.httpd.enable = false; +} else { + services.httpd.enable = true; +}; + + +The solution is to write: + + +config = mkIf config.services.httpd.enable { + environment.systemPackages = [ ... ]; + ... +}; + + +The special function mkIf causes the evaluation of +the conditional to be “pushed down” into the individual definitions, +as if you had written: + + +config = { + environment.systemPackages = if config.services.httpd.enable then [ ... ] else []; + ... +}; + + + + + + +Setting priorities + +A module can override the definitions of an option in other +modules by setting a priority. All option +definitions that do not have the lowest priority value are discarded. +By default, option definitions have priority 1000. You can specify an +explicit priority by using mkOverride, e.g. + + +services.openssh.enable = mkOverride 10 false; + + +This definition causes all other definitions with priorities above 10 +to be discarded. The function mkForce is +equal to mkOverride 50. + + + +Merging configurations + +In conjunction with mkIf, it is sometimes +useful for a module to return multiple sets of option definitions, to +be merged together as if they were declared in separate modules. This +can be done using mkMerge: + + +config = mkMerge + [ # Unconditional stuff. + { environment.systemPackages = [ ... ]; + } + # Conditional stuff. + (mkIf config.services.bla.enable { + environment.systemPackages = [ ... ]; + }) + ]; + + + + + + +
+ + +
Important options + +NixOS has many options, but some are of particular importance to +module writers. + + + + + + + This set defines files in /etc. A + typical use is: + +environment.etc."os-release".text = + '' + NAME=NixOS + ... + ''; + + which causes a file named /etc/os-release + to be created with the given contents. + + + + + + + A set of shell script fragments that must be executed + whenever the configuration is activated (i.e., at boot time, or + after running nixos-rebuild switch). For instance, + +system.activationScripts.media = + '' + mkdir -m 0755 -p /media + ''; + + causes the directory /media to be created. + Activation scripts must be idempotent. They should not start + background processes such as daemons; use + for that. + + + + + + + This is the set of systemd services. Example: + +systemd.services.dhcpcd = + { description = "DHCP Client"; + wantedBy = [ "multi-user.target" ]; + after = [ "systemd-udev-settle.service" ]; + path = [ dhcpcd pkgs.nettools pkgs.openresolv ]; + serviceConfig = + { Type = "forking"; + PIDFile = "/run/dhcpcd.pid"; + ExecStart = "${dhcpcd}/sbin/dhcpcd --config ${dhcpcdConf}"; + Restart = "always"; + }; + }; + + which creates the systemd unit + dhcpcd.service. The option + determined which other units pull this + one in; multi-user.target is the default + target of the system, so dhcpcd.service will + always be started. The option + provides the main + command for the service; it’s also possible to provide pre-start + actions, stop scripts, and so on. + + + + + + + + If your service requires special UIDs or GIDs, you can + define them with these options. See for details. + + + + + +
+
@@ -303,50 +583,79 @@ in Building specific parts of NixOS - +With the command nix-build, you can build +specific parts of your NixOS configuration. This is done as follows: -$ nix-build /path/to/nixpkgs/nixos -A attr +$ cd /path/to/nixpkgs/nixos +$ nix-build -A config.option -where attr is an attribute in -/path/to/nixpkgs/nixos/default.nix. Attributes of interest include: +where option is a NixOS option with type +“derivation” (i.e. something that can be built). Attributes of +interest include: - config - The computer configuration generated from - the NIXOS_CONFIG environment variable (default - is /etc/nixos/configuration.nix) with the NixOS - default set of modules. + system.build.toplevel + + The top-level option that builds the entire NixOS system. + Everything else in your configuration is indirectly pulled in by + this option. This is what nixos-rebuild + builds and what /run/current-system points + to afterwards. + + A shortcut to build this is: + + +$ nix-build -A system + + - system - The derivation which build your computer system. It is - built by the command nixos-rebuild - build + system.build.manual.manual + The NixOS manual. - vm - The derivation which build your computer system inside a - virtual machine. It is built by the command nixos-rebuild - build-vm + system.build.etc + A tree of symlinks that form the static parts of + /etc. + + + system.build.initialRamdisk + system.build.kernel + + The initial ramdisk and kernel of the system. This allows + a quick way to test whether the kernel and the initial ramdisk + boot correctly, by using QEMU’s and + options: + + +$ nix-build -A config.system.build.initialRamdisk -o initrd +$ nix-build -A config.system.build.kernel -o kernel +$ qemu-system-x86_64 -kernel ./kernel/bzImage -initrd ./initrd/initrd -hda /dev/null + + + + + + + + system.build.nixos-rebuild + system.build.nixos-install + system.build.nixos-generate-config + + These build the corresponding NixOS commands. + + + - -Most parts of NixOS can be built through the config -attribute set. This attribute set allows you to have a view of the merged -option definitions and all its derivations. Important derivations are store -inside the option and can be listed with the -command nix-instantiate --xml --eval-only /path/to/nixpkgs/nixos -A -config.system.build - -
@@ -367,8 +676,7 @@ you have to set NIXOS_CONFIG before running nix-build to build the ISO. -$ export NIXOS_CONFIG=/path/to/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix -$ nix-build /path/to/nixpkgs/nixos -A config.system.build.isoImage +$ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal.nix @@ -383,23 +691,6 @@ $ mount -o loop -t iso9660 ./result/iso/cd.iso /mnt/iso
- - -
- -Testing/building the NixOS Manual - -A quick way to see if your documentation improvements -or option descriptions look good: - - -$ nix-build -A config.system.build.manual - - - -
- -
@@ -412,8 +703,7 @@ tedious, so here is a quick way to see if the installer works properly: -$ export NIXOS_CONFIG=/path/to/nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix -$ nix-build /path/to/nixpkgs/nixos -A config.system.build.nixos-install +$ nix-build -A config.system.build.nixos-install $ dd if=/dev/zero of=diskimage seek=2G count=0 bs=1 $ yes | mke2fs -j diskimage $ mount -o loop diskimage /mnt @@ -427,91 +717,61 @@ $ ./result/bin/nixos-install -
+
Whole-system testing using virtual machines -Testing the <literal>initrd</literal> +Complete NixOS GNU/Linux systems can be tested in virtual +machines (VMs). This makes it possible to test a system upgrade or +configuration change before rebooting into it, using the +nixos-rebuild build-vm or nixos-rebuild +build-vm-with-bootloader command. -A quick way to test whether the kernel and the initial ramdisk -boot correctly is to use QEMU’s and - options: - - -$ nix-build /path/to/nixpkgs/nixos -A config.system.build.initialRamdisk -o initrd -$ nix-build /path/to/nixpkgs/nixos -A config.system.build.kernel -o kernel -$ qemu-system-x86_64 -kernel ./kernel/bzImage -initrd ./initrd/initrd -hda /dev/null - - - - -
- -
- - Whole-system testing using virtual machines - - - Complete NixOS GNU/Linux systems can be tested in virtual machines - (VMs). This makes it possible to test a system upgrade or - configuration change before rebooting into it, using the - nixos-rebuild build-vm or - nixos-rebuild build-vm-with-bootloader command. - - - - - - The tests/ directory in the NixOS source tree - contains several whole-system unit tests. - These tests can be runNixOS tests can be run both from - NixOS and from a non-NixOS GNU/Linux distribution, provided the - Nix package manager is installed. from the NixOS - source tree as follows: + +The tests/ directory in the NixOS source +tree contains several whole-system unit tests. +These tests can be runNixOS tests can be run both from +NixOS and from a non-NixOS GNU/Linux distribution, provided the Nix +package manager is installed. from the NixOS source +tree as follows: $ nix-build tests/ -A nfs.test - This performs an automated test of the NFS client and server - functionality in the Linux kernel, including file locking - semantics (e.g., whether locks are maintained across server - crashes). It will first build or download all the dependencies of - the test (e.g., all packages needed to run a NixOS VM). The test - is defined in - tests/nfs.nix. If the test succeeds, - nix-build will place a symlink - ./result in the current directory pointing at - the location in the Nix store of the test results (e.g., - screenshots, test reports, and so on). In particular, a - pretty-printed log of the test is written to - log.html, which can be viewed using a web - browser like this: +This performs an automated test of the NFS client and server +functionality in the Linux kernel, including file locking semantics +(e.g., whether locks are maintained across server crashes). It will +first build or download all the dependencies of the test (e.g., all +packages needed to run a NixOS VM). The test is defined in +tests/nfs.nix. If the test succeeds, +nix-build will place a symlink +./result in the current directory pointing at the +location in the Nix store of the test results (e.g., screenshots, test +reports, and so on). In particular, a pretty-printed log of the test +is written to log.html, which can be viewed using +a web browser like this: $ firefox result/log.html - + - - It is also possible to run the test environment interactively, - allowing you to experiment with the VMs. For example: +It is also possible to run the test environment interactively, +allowing you to experiment with the VMs. For example: $ nix-build tests/ -A nfs.driver $ ./result/bin/nixos-run-vms - The script nixos-run-vms starts the three - virtual machines defined in the NFS test using QEMU/KVM. The root - file system of the VMs is created on the fly and kept across VM - restarts in - ./hostname.qcow2. - +The script nixos-run-vms starts the three virtual +machines defined in the NFS test using QEMU/KVM. The root file system +of the VMs is created on the fly and kept across VM restarts in +./hostname.qcow2. - - Finally, the test itself can be run interactively. This is - particularly useful when developing or debugging a test: +Finally, the test itself can be run interactively. This is +particularly useful when developing or debugging a test: $ nix-build tests/ -A nfs.driver @@ -520,8 +780,7 @@ starting VDE switch for network 1 > - Perl statements can now be typed in to start or manipulate the - VMs: +Perl statements can now be typed in to start or manipulate the VMs: > startAll; @@ -534,65 +793,61 @@ starting VDE switch for network 1 > $client2->succeed("flock -n -s /data/lock true"); - The function testScript executes the entire - test script and drops you back into the test driver command line - upon its completion. This allows you to inspect the state of the - VMs after the test (e.g. to debug the test script). - +The function testScript executes the entire test +script and drops you back into the test driver command line upon its +completion. This allows you to inspect the state of the VMs after the +test (e.g. to debug the test script). - - This and other tests are continuously run on the Hydra - instance at nixos.org, which allows - developers to be notified of any regressions introduced by a NixOS - or Nixpkgs change. - +This and other tests are continuously run on the Hydra +instance at nixos.org, which allows +developers to be notified of any regressions introduced by a NixOS or +Nixpkgs change. - - The actual Nix programming interface to VM testing is in NixOS, - under - lib/testing.nix. This file defines a - function which takes an attribute set containing a - nixpkgs attribute (the path to a Nixpkgs - checkout), and a system attribute (the system - type). It returns an attribute set containing several utility - functions, among which the main entry point is - makeTest. - +The actual Nix programming interface to VM testing is in NixOS, +under +lib/testing.nix. This file defines a +function which takes an attribute set containing a +nixpkgs attribute (the path to a Nixpkgs checkout), +and a system attribute (the system type). It +returns an attribute set containing several utility functions, among +which the main entry point is makeTest. + - - The makeTest function takes a function similar to - that found in - tests/nfs.nix (discussed above). It - returns an attribute set containing (among others): +The makeTest function takes a function +similar to that found in +tests/nfs.nix (discussed above). It +returns an attribute set containing (among others): - + - - test - A derivation containing the test log as an HTML file, - as seen above, suitable for presentation in the Hydra continuous - build system. - + + test + A derivation containing the test log as an HTML + file, as seen above, suitable for presentation in the Hydra + continuous build system. + - - report - A derivation containing a code coverage report, with - meta-data suitable for Hydra. - + + report + A derivation containing a code coverage report, with + meta-data suitable for Hydra. + - - driver - A derivation containing scripts to run the VM test or - interact with the VM network interactively, as seen above. - - + + driver + A derivation containing scripts to run the VM test or + interact with the VM network interactively, as seen above. + + - - + + +
+ diff --git a/nixos/doc/manual/installation.xml b/nixos/doc/manual/installation.xml index d274cfc6908..88ef589dd06 100644 --- a/nixos/doc/manual/installation.xml +++ b/nixos/doc/manual/installation.xml @@ -18,6 +18,33 @@ details, see the NixOS Wiki. +As an alternative to installing NixOS yourself, you can get a +running NixOS system through several other means: + + + + Using virtual appliances in Open Virtualization Format (OVF) + that can be imported into VirtualBox. These are available from + the NixOS + homepage. + + + Using AMIs for Amazon’s EC2. To find one for your region + and instance type, please refer to the list + of most recent AMIs. + + + Using NixOps, the NixOS-based cloud deployment tool, which + allows you to provision VirtualBox and EC2 NixOS instances from + declarative specifications. Check out the NixOps + homepage for details. + + + + +
@@ -62,9 +89,14 @@ Wiki. For initialising Ext4 partitions: mkfs.ext4. It is recommended that you assign a unique symbolic label to the file system using the option - . This will - make the file system configuration independent from device - changes. + , since this + makes the file system configuration independent from device + changes. For example: + + +$ mkfs.ext4 -L nixos /dev/sda1 + + For creating swap partitions: mkswap. Again it’s recommended to assign a @@ -97,6 +129,12 @@ $ mount /dev/disk/by-label/nixos /mnt + If your machine has a limited amount of memory, you + may want to activate swap devices now (swapon + device). The installer (or + rather, the build actions that it may spawn) may need quite a bit of + RAM, depending on your configuration. + You now need to create a file @@ -161,28 +199,16 @@ $ nano /mnt/etc/nixos/configuration.nix - If your machine has a limited amount of memory, you - may want to activate swap devices now (swapon - device). The installer (or - rather, the build actions that it may spawn) may need quite a bit of - RAM, depending on your configuration. - - - Do the installation: $ nixos-install - Cross fingers. + Cross fingers. If this fails due to a temporary problem (such as + a network issue while downloading binaries from the NixOS binary + cache), you can just re-run nixos-install. + Otherwise, fix your configuration.nix and + then re-run nixos-install. If everything went well: @@ -194,7 +220,7 @@ $ reboot You should now be able to boot into the installed NixOS. - The Grub boot menu shows a list of available + The GRUB boot menu shows a list of available configurations (initially just one). Every time you change the NixOS configuration (see ), a new item appears in the menu. @@ -229,26 +255,28 @@ $ nix-env -i w3m - shows a typical sequence -of commands for installing NixOS on an empty hard drive (here -/dev/sda). shows a -corresponding configuration Nix expression. +To summarise, shows a +typical sequence of commands for installing NixOS on an empty hard +drive (here /dev/sda). shows a corresponding configuration Nix expression. Commands for installing NixOS on <filename>/dev/sda</filename> -$ fdisk /dev/sda (or whatever device you want to install on) -$ mkfs.ext4 -L nixos /dev/sda1 (idem) -$ mkswap -L swap /dev/sda2 (idem) -$ mount LABEL=nixos /mnt -$ nixos-generate-config +$ fdisk /dev/sda # (or whatever device you want to install on) +$ mkfs.ext4 -L nixos /dev/sda1 +$ mkswap -L swap /dev/sda2 +$ swapon /dev/sda2 +$ mount /dev/disk/by-label/nixos /mnt +$ nixos-generate-config --root /mnt $ nano /mnt/etc/nixos/configuration.nix -(in particular, set the fileSystems and swapDevices options) $ nixos-install $ reboot NixOS configuration +{ config, pkgs, ... }: + { imports = [ # Include the results of the hardware scan. @@ -257,14 +285,12 @@ $ reboot boot.loader.grub.device = "/dev/sda"; - # Note: setting fileSystems and swapDevices is generally not - # necessary, since nixos-generate-config has set them automatically - # in hardware-configuration.nix. - fileSystems."/".device = "/dev/disk/by-label/nixos"; - - swapDevices = - [ { device = "/dev/disk/by-label/swap"; } ]; + # Note: setting fileSystems is generally not + # necessary, since nixos-generate-config figures them out + # automatically in hardware-configuration.nix. + #fileSystems."/".device = "/dev/disk/by-label/nixos"; + # Enable the OpenSSH server. services.sshd.enable = true; } @@ -290,6 +316,10 @@ to build the new configuration, make it the default configuration for booting, and try to realise the configuration in the running system (e.g., by restarting system services). +These commands must be executed as root, so you should +either run them from a root shell or by prefixing them with +sudo -i. + You can also do @@ -309,6 +339,18 @@ to build the configuration and make it the boot default, but not switch to it now (so it will only take effect after the next reboot). +You can make your configuration show up in a different submenu +of the GRUB 2 boot screen by giving it a different profile +name, e.g. + + +$ nixos-rebuild switch -p test + +which causes the new configuration (and previous ones created using +-p test) to show up in the GRUB submenu “NixOS - +Profile 'test'”. This can be useful to separate test configurations +from “stable” configurations. + Finally, you can do @@ -319,7 +361,7 @@ whether everything compiles cleanly. If you have a machine that supports hardware virtualisation, you can also test the new configuration in a sandbox by building and -running a virtual machine that contains the +running a QEMU virtual machine that contains the desired configuration. Just do @@ -334,7 +376,6 @@ available.
-
@@ -342,28 +383,86 @@ available. Upgrading NixOS The best way to keep your NixOS installation up to date is to -use the nixos-unstable channel. (A channel is a +use one of the NixOS channels. A channel is a Nix mechanism for distributing Nix expressions and associated -binaries.) The NixOS channel is updated automatically from NixOS’s -Git repository after running certain tests and building most -packages. +binaries. The NixOS channels are updated automatically from NixOS’s +Git repository after certain tests have passed and all packages have +been built. These channels are: -NixOS automatically subscribes you to the NixOS channel. If for -some reason this is not the case, just do + + + Stable channels, such as nixos-13.10. + These only get conservative bug fixes and package upgrades. For + instance, a channel update may cause the Linux kernel on your + system to be upgraded from 3.4.66 to 3.4.67 (a minor bug fix), but + not from 3.4.x to + 3.11.x (a major change that has the + potential to break things). Stable channels are generally + maintained until the next stable branch is created. + + + The unstable channel, nixos-unstable. + This corresponds to NixOS’s main development branch, and may thus + see radical changes between channel updates. It’s not recommended + for production systems. + + + +To see what channels are available, go to . (Note that the URIs of the +various channels redirect to a directory that contains the channel’s +latest version and includes ISO images and VirtualBox +appliances.) + +When you first install NixOS, you’re automatically subscribed to +the NixOS channel that corresponds to your installation source. For +instance, if you installed from a 13.10 ISO, you will be subscribed to +the nixos-13.10 channel. To see which NixOS +channel you’re subscribed to, run the following as root: -$ nix-channel --add http://nixos.org/channels/nixos-unstable +$ nix-channel --list | grep nixos +nixos https://nixos.org/channels/nixos-unstable -You can then upgrade NixOS to the latest version in the channel by -running +To switch to a different NixOS channel, do -$ nix-channel --update nixos +$ nix-channel --add http://nixos.org/channels/channel-name nixos -and running the nixos-rebuild command as described -in . +(Be sure to include the nixos parameter at the +end.) For instance, to use the NixOS 13.10 stable channel: + + +$ nix-channel --add http://nixos.org/channels/nixos-13.10 nixos + + +But it you want to live on the bleeding edge: + + +$ nix-channel --add http://nixos.org/channels/nixos-unstable nixos + + + + +You can then upgrade NixOS to the latest version in your chosen +channel by running + + +$ nixos-rebuild switch --upgrade + + +which is equivalent to the more verbose nix-channel --update +nixos; nixos-rebuild switch. + +It is generally safe to switch back and forth between +channels. The only exception is that a newer NixOS may also have a +newer Nix version, which may involve an upgrade of Nix’s database +schema. This cannot be undone easily, so in that case you will not be +able to go back to your original channel.
diff --git a/nixos/doc/manual/options-to-docbook.xsl b/nixos/doc/manual/options-to-docbook.xsl index 73c905fbca1..6d11ad7a6c4 100644 --- a/nixos/doc/manual/options-to-docbook.xsl +++ b/nixos/doc/manual/options-to-docbook.xsl @@ -36,23 +36,15 @@ select="attr[@name = 'description']/string/@value" /> - - Default: - - - - - - - - - none - - - + + + Default: + + + + - Example: @@ -61,9 +53,7 @@ - - - + @@ -94,9 +84,34 @@ + + + + +'' +'' + + + + + + + + + + null + + + - - "" + + + '''' + + + "" + + @@ -142,14 +157,7 @@ - - - (download of ) - - - (build of ) - - + (build of ) diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix index cd543c958ff..5e1ce69158f 100644 --- a/nixos/lib/eval-config.nix +++ b/nixos/lib/eval-config.nix @@ -7,23 +7,20 @@ , baseModules ? import ../modules/module-list.nix , extraArgs ? {} , modules +, check ? true }: let extraArgs_ = extraArgs; pkgs_ = pkgs; system_ = system; in rec { - # These are the NixOS modules that constitute the system configuration. - configComponents = modules ++ baseModules; - # Merge the option definitions in all modules, forming the full - # system configuration. It's not checked for undeclared options. - systemModule = - pkgs.lib.fixMergeModules configComponents extraArgs; - - optionDefinitions = systemModule.config; - optionDeclarations = systemModule.options; - inherit (systemModule) options; + # system configuration. + inherit (pkgs.lib.evalModules { + modules = modules ++ baseModules; + args = extraArgs; + check = check && options.environment.checkConfigurationOptions.value; + }) config options; # These are the extra arguments passed to every module. In # particular, Nixpkgs is passed through the "pkgs" argument. @@ -56,16 +53,12 @@ rec { # define nixpkgs.config, so it's pointless to evaluate them. baseModules = [ ../modules/misc/nixpkgs.nix ]; pkgs = import ./nixpkgs.nix { system = system_; config = {}; }; - }).optionDefinitions.nixpkgs; + check = false; + }).config.nixpkgs; in { inherit system; inherit (nixpkgsOptions) config; }); - # Optionally check wether all config values have corresponding - # option declarations. - config = - assert optionDefinitions.environment.checkConfigurationOptions -> pkgs.lib.checkModule "" systemModule; - systemModule.config; } diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix index 6e0fdaf4b74..987bb1088c0 100644 --- a/nixos/modules/config/fonts/fontconfig.nix +++ b/nixos/modules/config/fonts/fontconfig.nix @@ -9,6 +9,7 @@ with pkgs.lib; fonts = { enableFontConfig = mkOption { # !!! should be enableFontconfig + type = types.bool; default = true; description = '' If enabled, a Fontconfig configuration file will be built diff --git a/nixos/modules/config/gnu.nix b/nixos/modules/config/gnu.nix index 1a69083a206..6f5d2950463 100644 --- a/nixos/modules/config/gnu.nix +++ b/nixos/modules/config/gnu.nix @@ -5,6 +5,7 @@ with pkgs.lib; { options = { gnu = mkOption { + type = types.bool; default = false; description = '' When enabled, GNU software is chosen by default whenever a there is diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix index c3e39717258..56d541cb9b3 100644 --- a/nixos/modules/config/i18n.nix +++ b/nixos/modules/config/i18n.nix @@ -18,16 +18,18 @@ in i18n = { defaultLocale = mkOption { + type = types.str; default = "en_US.UTF-8"; example = "nl_NL.UTF-8"; - description = " + description = '' The default locale. It determines the language for program messages, the format for dates and times, sort order, and so on. It also determines the character set, such as UTF-8. - "; + ''; }; supportedLocales = mkOption { + type = types.listOf types.str; default = ["all"]; example = ["en_US.UTF-8/UTF-8" "nl_NL.UTF-8/UTF-8" "nl_NL/ISO-8859-1"]; description = '' @@ -40,22 +42,23 @@ in }; consoleFont = mkOption { + type = types.str; default = "lat9w-16"; example = "LatArCyrHeb-16"; - description = " + description = '' The font used for the virtual consoles. Leave empty to use whatever the setfont program considers the default font. - "; + ''; }; consoleKeyMap = mkOption { + type = types.str; default = "us"; example = "fr"; - description = " + description = '' The keyboard mapping table for the virtual consoles. - "; - type = types.uniq types.string; + ''; }; }; diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix index f1bdfd01b24..9ac68b42819 100644 --- a/nixos/modules/config/networking.nix +++ b/nixos/modules/config/networking.nix @@ -15,6 +15,7 @@ in options = { networking.extraHosts = pkgs.lib.mkOption { + type = types.lines; default = ""; example = "192.168.0.1 lanlocalhost"; description = '' @@ -23,6 +24,7 @@ in }; networking.dnsSingleRequest = pkgs.lib.mkOption { + type = types.bool; default = false; description = '' Recent versions of glibc will issue both ipv4 (A) and ipv6 (AAAA) diff --git a/nixos/modules/config/no-x-libs.nix b/nixos/modules/config/no-x-libs.nix index 77890b49c67..ec7bf3fea7b 100644 --- a/nixos/modules/config/no-x-libs.nix +++ b/nixos/modules/config/no-x-libs.nix @@ -1,10 +1,12 @@ { config, pkgs, ... }: +with pkgs.lib; + { options = { - environment.noXlibs = pkgs.lib.mkOption { + environment.noXlibs = mkOption { + type = types.bool; default = false; - example = true; description = '' Switch off the options in the default configuration that require X libraries. Currently this includes: ssh X11 forwarding, dbus, fonts.enableCoreFonts, @@ -13,7 +15,7 @@ }; }; - config = pkgs.lib.mkIf config.environment.noXlibs { + config = mkIf config.environment.noXlibs { programs.ssh.setXAuthLocation = false; fonts = { enableCoreFonts = false; diff --git a/nixos/modules/config/nsswitch.nix b/nixos/modules/config/nsswitch.nix index ad62b5597be..2e2125d44f7 100644 --- a/nixos/modules/config/nsswitch.nix +++ b/nixos/modules/config/nsswitch.nix @@ -16,6 +16,7 @@ in # NSS modules. Hacky! system.nssModules = mkOption { + type = types.listOf types.path; internal = true; default = []; description = '' @@ -23,7 +24,6 @@ in several DNS resolution methods to be specified via /etc/nsswitch.conf. ''; - merge = mergeListOption; apply = list: { inherit list; diff --git a/nixos/modules/config/power-management.nix b/nixos/modules/config/power-management.nix index fec2c886818..7299136235e 100644 --- a/nixos/modules/config/power-management.nix +++ b/nixos/modules/config/power-management.nix @@ -17,6 +17,7 @@ in powerManagement = { enable = mkOption { + type = types.bool; default = true; description = '' @@ -26,11 +27,13 @@ in }; resumeCommands = mkOption { + type = types.lines; default = ""; description = "Commands executed after the system resumes from suspend-to-RAM."; }; powerUpCommands = mkOption { + type = types.lines; default = ""; example = "${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"; description = @@ -42,6 +45,7 @@ in }; powerDownCommands = mkOption { + type = types.lines; default = ""; example = "${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"; description = diff --git a/nixos/modules/config/pulseaudio.nix b/nixos/modules/config/pulseaudio.nix index 26060f5b2d1..7a6cc542273 100644 --- a/nixos/modules/config/pulseaudio.nix +++ b/nixos/modules/config/pulseaudio.nix @@ -46,6 +46,7 @@ in { hardware.pulseaudio = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the PulseAudio sound server. @@ -72,12 +73,13 @@ in { The path to the configuration the PulseAudio server should use. By default, the "default.pa" configuration from the PulseAudio distribution is used. - ''; + ''; }; - + package = mkOption { + type = types.path; default = pulseaudio; - example = "pulseaudio.override { jackaudioSupport = true; }"; + example = literalExample "pulseaudio.override { jackaudioSupport = true; }"; description = '' The PulseAudio derivation to use. This can be used to enable features (such as JACK support) that are not enabled in the @@ -125,9 +127,9 @@ in { description = "PulseAudio system service user"; home = pulseRuntimePath; }; - + users.extraGroups.pulse.gid = gid; - + systemd.services.pulseaudio = { description = "PulseAudio system-wide server"; wantedBy = [ "sound.target" ]; diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix index 4f7447f435b..e3fbdd7aaec 100644 --- a/nixos/modules/config/shells-environment.nix +++ b/nixos/modules/config/shells-environment.nix @@ -25,12 +25,17 @@ in ''; type = types.attrsOf (mkOptionType { name = "a string or a list of strings"; - merge = xs: - let xs' = evalProperties xs; in - if isList (head xs') then concatLists xs' - else if builtins.lessThan 1 (length xs') then abort "variable in ‘environment.variables’ has multiple values" - else if !builtins.isString (head xs') then abort "variable in ‘environment.variables’ does not have a string value" - else head xs'; + merge = loc: defs: + let + defs' = filterOverrides defs; + res = (head defs').value; + in + if isList res then concatLists (getValues defs') + else if builtins.lessThan 1 (length defs') then + throw "The option `${showOption loc}' is defined multiple times, in ${showFiles (getFiles defs)}." + else if !builtins.isString res then + throw "The option `${showOption loc}' does not have a string value, in ${showFiles (getFiles defs)}." + else res; }); apply = mapAttrs (n: v: if isList v then concatStringsSep ":" v else v); }; diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix index 7d4654ae287..65d7722abfa 100644 --- a/nixos/modules/config/swap.nix +++ b/nixos/modules/config/swap.nix @@ -34,13 +34,13 @@ with utils; device = mkOption { example = "/dev/sda3"; - type = types.uniq types.string; + type = types.str; description = "Path of the device."; }; label = mkOption { example = "swap"; - type = types.uniq types.string; + type = types.str; description = '' Label of the device. Can be used instead of device. ''; @@ -72,11 +72,8 @@ with utils; }; config = { - device = - if options.label.isDefined then - "/dev/disk/by-label/${config.label}" - else - mkNotdef; + device = mkIf options.label.isDefined + "/dev/disk/by-label/${config.label}"; }; }; diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix index 6b52fd38fde..31441bad615 100644 --- a/nixos/modules/config/sysctl.nix +++ b/nixos/modules/config/sysctl.nix @@ -7,7 +7,7 @@ let sysctlOption = mkOptionType { name = "sysctl option value"; check = x: builtins.isBool x || builtins.isString x || builtins.isInt x; - merge = xs: last xs; # FIXME: hacky way to allow overriding in configuration.nix. + merge = args: defs: (last defs).value; # FIXME: hacky way to allow overriding in configuration.nix. }; in diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix index 0610ad54da3..2f61947c3bc 100644 --- a/nixos/modules/config/system-path.nix +++ b/nixos/modules/config/system-path.nix @@ -14,7 +14,7 @@ let ''; requiredPackages = - [ config.environment.nix + [ config.nix.package pkgs.acl pkgs.attr pkgs.bashInteractive # bash with ncurses support @@ -60,6 +60,7 @@ in environment = { systemPackages = mkOption { + type = types.listOf types.path; default = []; example = "[ pkgs.icecat3 pkgs.thunderbird ]"; description = '' @@ -74,6 +75,7 @@ in }; pathsToLink = mkOption { + type = types.listOf types.str; # Note: We need `/lib' to be among `pathsToLink' for NSS modules # to work. default = []; @@ -122,7 +124,7 @@ in postBuild = '' if [ -x $out/bin/update-mime-database -a -w $out/share/mime/packages ]; then - $out/bin/update-mime-database -V $out/share/mime + XDG_DATA_DIRS=$out/share $out/bin/update-mime-database -V $out/share/mime > /dev/null fi if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then diff --git a/nixos/modules/config/timezone.nix b/nixos/modules/config/timezone.nix index e185584846a..07a76d9ad1f 100644 --- a/nixos/modules/config/timezone.nix +++ b/nixos/modules/config/timezone.nix @@ -9,7 +9,7 @@ with pkgs.lib; timeZone = mkOption { default = "CET"; - type = with types; uniq string; + type = types.str; example = "America/New_York"; description = "The time zone used when displaying times and dates."; }; diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix index 5f32dc350df..fb8b0229c1d 100644 --- a/nixos/modules/config/users-groups.nix +++ b/nixos/modules/config/users-groups.nix @@ -12,14 +12,19 @@ let options = { name = mkOption { - type = with types; uniq string; + type = types.str; description = "The name of the user account. If undefined, the name of the attribute set will be used."; }; description = mkOption { - type = with types; uniq string; + type = types.str; default = ""; - description = "A short description of the user account."; + example = "Alice Q. User"; + description = '' + A short description of the user account, typically the + user's full name. This is actually the “GECOS” or “comment” + field in /etc/passwd. + ''; }; uid = mkOption { @@ -29,25 +34,25 @@ let }; group = mkOption { - type = with types; uniq string; + type = types.str; default = "nogroup"; description = "The user's primary group."; }; extraGroups = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = []; description = "The user's auxiliary groups."; }; home = mkOption { - type = with types; uniq string; + type = types.str; default = "/var/empty"; description = "The user's home directory."; }; shell = mkOption { - type = with types; uniq string; + type = types.str; default = "/run/current-system/sw/sbin/nologin"; description = "The path to the user's shell."; }; @@ -65,9 +70,15 @@ let }; password = mkOption { - type = with types; uniq (nullOr string); + type = with types; uniq (nullOr str); default = null; - description = "The user's password. If undefined, no password is set for the user. Warning: do not set confidential information here because this data would be readable by all. This option should only be used for public account such as guest."; + description = '' + The user's password. If undefined, no password is set for + the user. Warning: do not set confidential information here + because it is world-readable in the Nix store. This option + should only be used for public accounts such as + guest. + ''; }; isSystemUser = mkOption { @@ -79,11 +90,11 @@ let createUser = mkOption { type = types.bool; default = true; - description = " + description = '' Indicates if the user should be created automatically as a local user. Set this to false if the user for instance is an LDAP user. NixOS will then not modify any of the basic properties for the user account. - "; + ''; }; isAlias = mkOption { @@ -107,7 +118,7 @@ let options = { name = mkOption { - type = with types; uniq string; + type = types.str; description = "The name of the group. If undefined, the name of the attribute set will be used."; }; @@ -149,13 +160,12 @@ in example = { alice = { uid = 1234; - description = "Alice"; + description = "Alice Q. User"; home = "/home/alice"; createHome = true; group = "users"; extraGroups = ["wheel"]; shell = "/bin/sh"; - password = "foobar"; }; }; description = '' diff --git a/nixos/modules/hardware/all-firmware.nix b/nixos/modules/hardware/all-firmware.nix index 16b6a862593..027dd827b4d 100644 --- a/nixos/modules/hardware/all-firmware.nix +++ b/nixos/modules/hardware/all-firmware.nix @@ -1,4 +1,6 @@ -{pkgs, config, ...}: +{ config, pkgs, ... }: + +with pkgs.lib; { @@ -6,9 +8,9 @@ options = { - hardware.enableAllFirmware = pkgs.lib.mkOption { + hardware.enableAllFirmware = mkOption { default = false; - type = pkgs.lib.types.bool; + type = types.bool; description = '' Turn on this option if you want to enable all the firmware shipped with Debian/Ubuntu. ''; @@ -19,7 +21,7 @@ ###### implementation - config = pkgs.lib.mkIf config.hardware.enableAllFirmware { + config = mkIf config.hardware.enableAllFirmware { hardware.firmware = [ "${pkgs.firmwareLinuxNonfree}/lib/firmware" ]; }; diff --git a/nixos/modules/hardware/pcmcia.nix b/nixos/modules/hardware/pcmcia.nix index 0dba59734ca..20684656750 100644 --- a/nixos/modules/hardware/pcmcia.nix +++ b/nixos/modules/hardware/pcmcia.nix @@ -18,16 +18,16 @@ in hardware.pcmcia = { enable = mkOption { + type = types.bool; default = false; - merge = mergeEnableOption; description = '' Enable this option to support PCMCIA card. ''; }; firmware = mkOption { + type = types.listOf types.path; default = []; - merge = mergeListOption; description = '' List of firmware used to handle specific PCMCIA card. ''; @@ -36,7 +36,7 @@ in config = mkOption { default = null; description = '' - Path to the configuration file which map the memory, irq + Path to the configuration file which maps the memory, IRQs and ports used by the PCMCIA hardware. ''; }; diff --git a/nixos/modules/installer/cd-dvd/channel.nix b/nixos/modules/installer/cd-dvd/channel.nix index c6e0f1577bb..bcf3dbb3f73 100644 --- a/nixos/modules/installer/cd-dvd/channel.nix +++ b/nixos/modules/installer/cd-dvd/channel.nix @@ -33,7 +33,7 @@ in if ! [ -e /var/lib/nixos/did-channel-init ]; then echo "unpacking the NixOS/Nixpkgs sources..." mkdir -p /nix/var/nix/profiles/per-user/root - ${config.environment.nix}/bin/nix-env -p /nix/var/nix/profiles/per-user/root/channels \ + ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/per-user/root/channels \ -i ${channelSources} --quiet --option use-substitutes false mkdir -m 0700 -p /root/.nix-defexpr ln -s /nix/var/nix/profiles/per-user/root/channels /root/.nix-defexpr/channels diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index de9728d677c..b803a3f188b 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -298,12 +298,12 @@ in '' # After booting, register the contents of the Nix store on the # CD in the Nix database in the tmpfs. - ${config.environment.nix}/bin/nix-store --load-db < /nix/store/nix-path-registration + ${config.nix.package}/bin/nix-store --load-db < /nix/store/nix-path-registration # nixos-rebuild also requires a "system" profile and an # /etc/NIXOS tag. touch /etc/NIXOS - ${config.environment.nix}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system + ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system ''; # Add vfat support to the initrd to enable people to copy the diff --git a/nixos/modules/installer/cd-dvd/live-dvd.nix b/nixos/modules/installer/cd-dvd/live-dvd.nix deleted file mode 100644 index e57be6d442e..00000000000 --- a/nixos/modules/installer/cd-dvd/live-dvd.nix +++ /dev/null @@ -1,78 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ ./installation-cd-base.nix ]; - - # Build the build-time dependencies of this configuration on the DVD - # to speed up installation. - isoImage.storeContents = [ config.system.build.toplevel.drvPath ]; - - # Include lots of packages. - environment.systemPackages = - [ pkgs.utillinuxCurses - pkgs.upstartJobControl - pkgs.iproute - pkgs.bc - pkgs.fuse - pkgs.zsh - pkgs.sqlite - pkgs.gnupg - pkgs.manpages - pkgs.pinentry - pkgs.screen - pkgs.patch - pkgs.which - pkgs.diffutils - pkgs.file - pkgs.irssi - pkgs.mcabber - pkgs.mutt - pkgs.emacs - pkgs.vimHugeX - pkgs.bvi - pkgs.ddrescue - pkgs.cdrkit - pkgs.btrfsProgs - pkgs.xfsprogs - pkgs.jfsutils - pkgs.jfsrec - pkgs.ntfs3g - pkgs.subversion16 - pkgs.monotone - pkgs.git - pkgs.darcs - pkgs.mercurial - pkgs.bazaar - pkgs.cvs - pkgs.pciutils - pkgs.hddtemp - pkgs.sdparm - pkgs.hdparm - pkgs.usbutils - pkgs.openssh - pkgs.lftp - pkgs.w3m - pkgs.openssl - pkgs.ncat - pkgs.lynx - pkgs.wget - pkgs.elinks - pkgs.socat - pkgs.squid - pkgs.unrar - pkgs.zip - pkgs.unzip - pkgs.lzma - pkgs.cabextract - pkgs.cpio - pkgs.lsof - pkgs.ltrace - pkgs.perl - pkgs.python - pkgs.ruby - pkgs.guile - pkgs.clisp - pkgs.tcl - ]; - -} diff --git a/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix b/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix index 85356118ce6..13ed95d4ceb 100644 --- a/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix +++ b/nixos/modules/installer/cd-dvd/system-tarball-fuloong2f.nix @@ -152,7 +152,7 @@ in # default root password is empty. services.openssh.enable = true; - jobs.openssh.startOn = pkgs.lib.mkOverrideTemplate 50 {} ""; + jobs.openssh.startOn = pkgs.lib.mkOverride 50 ""; boot.loader.grub.enable = false; boot.loader.generationsDir.enable = false; diff --git a/nixos/modules/installer/cd-dvd/system-tarball-pc.nix b/nixos/modules/installer/cd-dvd/system-tarball-pc.nix index 7619f074b74..fcb96f7a24f 100644 --- a/nixos/modules/installer/cd-dvd/system-tarball-pc.nix +++ b/nixos/modules/installer/cd-dvd/system-tarball-pc.nix @@ -109,7 +109,7 @@ in # not be started by default on the installation CD because the # default root password is empty. services.openssh.enable = true; - jobs.openssh.startOn = pkgs.lib.mkOverrideTemplate 50 {} ""; + jobs.openssh.startOn = pkgs.lib.mkOverride 50 ""; # To be able to use the systemTarball to catch troubles. boot.crashDump = { diff --git a/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix b/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix index 20fe4de2cd8..7f253d595dc 100644 --- a/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix +++ b/nixos/modules/installer/cd-dvd/system-tarball-sheevaplug.nix @@ -165,7 +165,7 @@ in # not be started by default on the installation CD because the # default root password is empty. services.openssh.enable = true; - jobs.openssh.startOn = pkgs.lib.mkOverrideTemplate 50 {} ""; + jobs.openssh.startOn = pkgs.lib.mkOverride 50 ""; # cpufrequtils fails to build on non-pc powerManagement.enable = false; diff --git a/nixos/modules/installer/cd-dvd/system-tarball.nix b/nixos/modules/installer/cd-dvd/system-tarball.nix index 6bf8eebdac5..8d678fba71f 100644 --- a/nixos/modules/installer/cd-dvd/system-tarball.nix +++ b/nixos/modules/installer/cd-dvd/system-tarball.nix @@ -77,14 +77,14 @@ in # After booting, register the contents of the Nix store on the # CD in the Nix database in the tmpfs. if [ -f /nix-path-registration ]; then - ${config.environment.nix}/bin/nix-store --load-db < /nix-path-registration && + ${config.nix.package}/bin/nix-store --load-db < /nix-path-registration && rm /nix-path-registration fi # nixos-rebuild also requires a "system" profile and an # /etc/NIXOS tag. touch /etc/NIXOS - ${config.environment.nix}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system + ${config.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system ''; }; diff --git a/nixos/modules/installer/tools/nixos-option.sh b/nixos/modules/installer/tools/nixos-option.sh index 69dd513f95c..60cee2519da 100644 --- a/nixos/modules/installer/tools/nixos-option.sh +++ b/nixos/modules/installer/tools/nixos-option.sh @@ -1,5 +1,7 @@ #! @shell@ -e +# FIXME: rewrite this in a more suitable language. + usage () { exec man nixos-option exit 1 @@ -90,24 +92,25 @@ evalNix(){ } evalAttr(){ - local prefix=$1 - local suffix=$2 - local strict=$3 + local prefix="$1" + local strict="$2" + local suffix="$3" echo "(import {}).$prefix${option:+.$option}${suffix:+.$suffix}" | evalNix ${strict:+--strict} } evalOpt(){ - evalAttr "eval.options" "$@" + evalAttr "options" "" "$@" } evalCfg(){ - evalAttr "config" "$@" + local strict="$1" + evalAttr "config" "$strict" } findSources(){ local suffix=$1 - echo "builtins.map (f: f.source) (import {}).eval.options${option:+.$option}.$suffix" | + echo "(import {}).options${option:+.$option}.$suffix" | evalNix --strict } @@ -143,7 +146,7 @@ let nixos = import {}; nixpkgs = import {}; sources = builtins.map (f: f.source); - opt = reach nixos.eval.options; + opt = reach nixos.options; cfg = reach nixos.config; in @@ -186,7 +189,7 @@ EOF fi if test "$(evalOpt "_type" 2> /dev/null)" = '"option"'; then - $value && evalCfg; + $value && evalCfg 1 if $desc; then $value && echo; @@ -212,14 +215,14 @@ if test "$(evalOpt "_type" 2> /dev/null)" = '"option"'; then nixMap printPath "$(findSources "declarations")" echo "" echo "Defined by:" - nixMap printPath "$(findSources "definitions")" + nixMap printPath "$(findSources "files")" echo "" fi else # echo 1>&2 "Warning: This value is not an option." - result=$(evalCfg) + result=$(evalCfg "") if names=$(attrNames "$result" 2> /dev/null); then echo 1>&2 "This attribute set contains:" escapeQuotes () { eval echo "$1"; } diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh index d655210c90e..5c89394abce 100644 --- a/nixos/modules/installer/tools/nixos-rebuild.sh +++ b/nixos/modules/installer/tools/nixos-rebuild.sh @@ -109,7 +109,7 @@ fi # more conservative. if [ "$action" != dry-run -a -n "$buildNix" ]; then echo "building Nix..." >&2 - if ! nix-build '' -A config.environment.nix -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then + if ! nix-build '' -A config.nix.package -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then if ! nix-build '' -A nixFallback -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then nix-build '' -A nixUnstable -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null fi @@ -121,7 +121,7 @@ fi # Update the version suffix if we're building from Git (so that # nixos-version shows something useful). if nixpkgs=$(nix-instantiate --find-file nixpkgs "${extraBuildFlags[@]}"); then - suffix=$(@shell@ $nixpkgs/nixos/modules/installer/tools/get-version-suffix "${extraBuildFlags[@]}") + suffix=$(@shell@ $nixpkgs/nixos/modules/installer/tools/get-version-suffix "${extraBuildFlags[@]}" || true) if [ -n "$suffix" ]; then echo -n "$suffix" > "$nixpkgs/.version-suffix" || true fi diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index 074c77b5146..652bfa917df 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -22,10 +22,10 @@ let src = ./nixos-install.sh; inherit (pkgs) perl pathsFromGraph; - nix = config.environment.nix; + nix = config.nix.package; nixClosure = pkgs.runCommand "closure" - { exportReferencesGraph = ["refs" config.environment.nix]; } + { exportReferencesGraph = ["refs" config.nix.package]; } "cp refs $out"; }; @@ -52,6 +52,7 @@ let inherit (config.system) nixosVersion nixosCodeName; }; + /* nixos-gui = pkgs.xulrunnerWrapper { launcher = "nixos-gui"; application = pkgs.stdenv.mkDerivation { @@ -71,10 +72,12 @@ let }; }; }; + */ in { + /* options = { installer.enableGraphicalTools = pkgs.lib.mkOption { @@ -87,6 +90,7 @@ in }; }; + */ config = { environment.systemPackages = @@ -96,10 +100,10 @@ in nixos-generate-config nixos-option nixos-version - ] ++ pkgs.lib.optional cfg.enableGraphicalTools nixos-gui; + ]; system.build = { - inherit nixos-install nixos-generate-config nixos-option; + inherit nixos-install nixos-generate-config nixos-option nixos-rebuild; }; }; } diff --git a/nixos/modules/misc/assertions.nix b/nixos/modules/misc/assertions.nix index 229f8f27860..5fb88308b77 100644 --- a/nixos/modules/misc/assertions.nix +++ b/nixos/modules/misc/assertions.nix @@ -15,10 +15,10 @@ in options = { assertions = mkOption { + type = types.listOf types.unspecified; internal = true; default = []; example = [ { assertion = false; message = "you can't enable this for that reason"; } ]; - merge = pkgs.lib.mergeListOption; description = '' This option allows modules to express conditions that must hold for the evaluation of the system configuration to diff --git a/nixos/modules/misc/check-config.nix b/nixos/modules/misc/check-config.nix index 28f36ad9ae5..f759c88d3a1 100644 --- a/nixos/modules/misc/check-config.nix +++ b/nixos/modules/misc/check-config.nix @@ -1,10 +1,12 @@ -{pkgs, ...}: +{ pkgs, ... }: + +with pkgs.lib; { options = { - environment.checkConfigurationOptions = pkgs.lib.mkOption { + environment.checkConfigurationOptions = mkOption { + type = types.bool; default = true; - example = false; description = '' Whether to check the validity of the entire configuration. ''; diff --git a/nixos/modules/misc/crashdump.nix b/nixos/modules/misc/crashdump.nix index 6e6bc9dec0f..6e71baa9a43 100644 --- a/nixos/modules/misc/crashdump.nix +++ b/nixos/modules/misc/crashdump.nix @@ -14,8 +14,8 @@ in boot = { crashDump = { enable = mkOption { + type = types.bool; default = false; - example = true; description = '' If enabled, NixOS will set up a kernel that will boot on crash, and leave the user to a stage1 debug1devices @@ -35,6 +35,7 @@ in ''; }; kernelParams = mkOption { + type = types.listOf types.str; default = [ "debug1devices" ]; description = '' Parameters that will be passed to the kernel kexec-ed on crash. diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index adaa2b0d9ae..e3edc9dda6b 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -7,12 +7,14 @@ options = { ids.uids = pkgs.lib.mkOption { + internal = true; description = '' The user IDs used in NixOS. ''; }; ids.gids = pkgs.lib.mkOption { + internal = true; description = '' The group IDs used in NixOS. ''; @@ -102,6 +104,8 @@ tcpcryptd = 93; # tcpcryptd uses a hard-coded uid. We patch it in Nixpkgs to match this choice. zope2 = 94; firebird = 95; + redis = 96; + haproxy = 97; # When adding a uid, make sure it doesn't match an existing gid. @@ -188,6 +192,7 @@ quassel = 89; amule = 90; minidlna = 91; + haproxy = 92; # When adding a gid, make sure it doesn't match an existing uid. diff --git a/nixos/modules/misc/locate.nix b/nixos/modules/misc/locate.nix index 02b1ed7b63d..b6408be5844 100644 --- a/nixos/modules/misc/locate.nix +++ b/nixos/modules/misc/locate.nix @@ -17,8 +17,8 @@ in services.locate = { enable = mkOption { + type = types.bool; default = false; - example = true; description = '' If enabled, NixOS will periodically update the database of files used by the locate command. @@ -26,11 +26,12 @@ in }; period = mkOption { + type = types.str; default = "15 02 * * *"; description = '' This option defines (in the format used by cron) when the locate database is updated. - The default is to update at 02:15 (at night) every day. + The default is to update at 02:15 at night every day. ''; }; diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index 9eba728c339..7433fab168e 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -26,7 +26,7 @@ let configType = mkOptionType { name = "nixpkgs config"; check = traceValIfNot isConfig; - merge = fold mergeConfig {}; + merge = args: fold (def: mergeConfig def.value) {}; }; in @@ -59,7 +59,7 @@ in }; nixpkgs.system = mkOption { - default = pkgs.stdenv.system; + type = types.str; description = '' Specifies the Nix platform type for which NixOS should be built. If unset, it defaults to the platform type of your host system @@ -70,4 +70,8 @@ in }; }; + + config = { + nixpkgs.system = mkDefault pkgs.stdenv.system; + }; } diff --git a/nixos/modules/misc/passthru.nix b/nixos/modules/misc/passthru.nix index f68adc5e843..b65f20d62f2 100644 --- a/nixos/modules/misc/passthru.nix +++ b/nixos/modules/misc/passthru.nix @@ -6,6 +6,7 @@ { options = { passthru = pkgs.lib.mkOption { + visible = false; description = '' This attribute set will be exported as a system attribute. You can put whatever you want here. diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix index 5ab24686152..2fa95563e9a 100644 --- a/nixos/modules/misc/version.nix +++ b/nixos/modules/misc/version.nix @@ -8,31 +8,31 @@ with pkgs.lib; system.nixosVersion = mkOption { internal = true; - type = types.uniq types.string; + type = types.str; description = "NixOS version."; }; system.nixosVersionSuffix = mkOption { internal = true; - type = types.uniq types.string; + type = types.str; description = "NixOS version suffix."; }; system.nixosRevision = mkOption { internal = true; - type = types.uniq types.string; + type = types.str; description = "NixOS Git revision hash."; }; system.nixosCodeName = mkOption { internal = true; - type = types.uniq types.string; + type = types.str; description = "NixOS release code name."; }; system.defaultChannel = mkOption { internal = true; - type = types.uniq types.string; + type = types.str; default = https://nixos.org/channels/nixos-unstable; description = "Default NixOS channel to which the root user is subscribed."; }; @@ -58,18 +58,15 @@ with pkgs.lib; # Generate /etc/os-release. See # http://0pointer.de/public/systemd-man/os-release.html for the # format. - environment.etc = singleton - { source = pkgs.writeText "os-release" - '' - NAME=NixOS - ID=nixos - VERSION="${config.system.nixosVersion} (${config.system.nixosCodeName})" - VERSION_ID="${config.system.nixosVersion}" - PRETTY_NAME="NixOS ${config.system.nixosVersion} (${config.system.nixosCodeName})" - HOME_URL="http://nixos.org/" - ''; - target = "os-release"; - }; + environment.etc."os-release".text = + '' + NAME=NixOS + ID=nixos + VERSION="${config.system.nixosVersion} (${config.system.nixosCodeName})" + VERSION_ID="${config.system.nixosVersion}" + PRETTY_NAME="NixOS ${config.system.nixosVersion} (${config.system.nixosCodeName})" + HOME_URL="http://nixos.org/" + ''; }; diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 62e5b8e49c2..8b76e1f21cb 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -150,12 +150,12 @@ ./services/networking/cntlm.nix ./services/networking/chrony.nix ./services/networking/ddclient.nix - #./services/networking/dhclient.nix ./services/networking/dhcpcd.nix ./services/networking/dhcpd.nix ./services/networking/dnsmasq.nix ./services/networking/ejabberd.nix ./services/networking/firewall.nix + ./services/networking/haproxy.nix ./services/networking/tcpcrypt.nix ./services/networking/flashpolicyd.nix ./services/networking/freenet.nix @@ -276,7 +276,7 @@ ./tasks/scsi-link-power-management.nix ./tasks/swraid.nix ./virtualisation/libvirtd.nix - ./virtualisation/nova.nix + #./virtualisation/nova.nix ./virtualisation/virtualbox-guest.nix ./virtualisation/xen-dom0.nix ] diff --git a/nixos/modules/profiles/clone-config.nix b/nixos/modules/profiles/clone-config.nix index d7190020e7e..04ee76d8d3e 100644 --- a/nixos/modules/profiles/clone-config.nix +++ b/nixos/modules/profiles/clone-config.nix @@ -16,7 +16,8 @@ let # cannot serialized attribute set given in the list of modules (that's why # you should use files). moduleFiles = - filter isPath modules; + # FIXME: use typeOf (Nix 1.6.1). + filter (x: !isAttrs x && !builtins.isFunction x) modules; # Partition module files because between NixOS and non-NixOS files. NixOS # files may change if the repository is updated. diff --git a/nixos/modules/programs/shadow.nix b/nixos/modules/programs/shadow.nix index 36c915f755f..9e46ab8b298 100644 --- a/nixos/modules/programs/shadow.nix +++ b/nixos/modules/programs/shadow.nix @@ -48,7 +48,7 @@ in Rather, it should be the path of a symlink that points to the actual shell in the Nix store. ''; - type = types.uniq types.path; + type = types.path; }; }; diff --git a/nixos/modules/programs/ssh.nix b/nixos/modules/programs/ssh.nix index 64bf2508316..a66679dff90 100644 --- a/nixos/modules/programs/ssh.nix +++ b/nixos/modules/programs/ssh.nix @@ -16,6 +16,7 @@ in programs.ssh = { forwardX11 = mkOption { + type = types.bool; default = false; description = '' Whether to request X11 forwarding on outgoing connections by default. @@ -29,18 +30,21 @@ in }; setXAuthLocation = mkOption { + type = types.bool; default = true; description = '' Whether to set the path to xauth for X11-forwarded connections. - Pulls in X11 dependency. + This causes a dependency on X11 packages. ''; }; extraConfig = mkOption { + type = types.lines; default = ""; description = '' Extra configuration text appended to ssh_config. - See the ssh_config(5) man page for help. + See ssh_config5 + for help. ''; }; }; diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 1d19fe6da76..ae3c9faeea6 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -32,7 +32,6 @@ let zipAttrsWith (n: v: if tail v != [] then if n == "_type" then (head v) - else if n == "extraConfigs" then concatLists v else if n == "warnings" then concatLists v else if n == "description" || n == "apply" then abort "Cannot rename an option to multiple options." @@ -55,12 +54,7 @@ let inherit visible; }); } - { options = setTo (mkOption { - extraConfigs = - let externalDefs = (fromOf options).definitions; in - if externalDefs == [] then [] - else map (def: def.value) (define externalDefs); - }); + { config = setTo (mkIf (fromOf options).isDefined (define (mkMerge (fromOf options).definitions))); } ]; @@ -75,10 +69,9 @@ let in zipModules ([] -# usage example: -# ++ alias [ "services" "xserver" "slim" "theme" ] [ "services" "xserver" "displayManager" "slim" "theme" ] -++ obsolete [ "environment" "extraPackages" ] [ "environment" "systemPackages" ] +++ obsolete [ "environment" "x11Packages" ] [ "environment" "systemPackages" ] ++ obsolete [ "environment" "enableBashCompletion" ] [ "programs" "bash" "enableCompletion" ] +++ obsolete [ "environment" "nix" ] [ "nix" "package" ] ++ obsolete [ "security" "extraSetuidPrograms" ] [ "security" "setuidPrograms" ] ++ obsolete [ "networking" "enableWLAN" ] [ "networking" "wireless" "enable" ] @@ -98,6 +91,7 @@ in zipModules ([] ++ obsolete [ "boot" "grubSplashImage" ] [ "boot" "loader" "grub" "splashImage" ] ++ obsolete [ "boot" "initrd" "extraKernelModules" ] [ "boot" "initrd" "kernelModules" ] +++ obsolete [ "boot" "extraKernelParams" ] [ "boot" "kernelParams" ] # OpenSSH ++ obsolete [ "services" "sshd" "ports" ] [ "services" "openssh" "ports" ] diff --git a/nixos/modules/security/apparmor.nix b/nixos/modules/security/apparmor.nix index d4aa0598dd3..b9f15159002 100644 --- a/nixos/modules/security/apparmor.nix +++ b/nixos/modules/security/apparmor.nix @@ -15,6 +15,7 @@ with pkgs.lib; security.apparmor = { enable = mkOption { + type = types.bool; default = false; description = '' Enable AppArmor application security system. Enable only if @@ -23,8 +24,8 @@ with pkgs.lib; }; profiles = mkOption { + type = types.listOf types.path; default = []; - merge = mergeListOption; description = '' List of file names of AppArmor profiles. ''; diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix index 1081b41299d..93d12d292e4 100644 --- a/nixos/modules/security/pam.nix +++ b/nixos/modules/security/pam.nix @@ -13,7 +13,7 @@ let name = mkOption { example = "sshd"; - type = types.uniq types.string; + type = types.str; description = "Name of the PAM service."; }; @@ -133,7 +133,7 @@ let }; text = mkOption { - type = types.nullOr types.string; + type = types.nullOr types.lines; description = "Contents of the PAM service file."; }; diff --git a/nixos/modules/security/pam_usb.nix b/nixos/modules/security/pam_usb.nix index 2bd3069ddb1..4cc99995fbc 100644 --- a/nixos/modules/security/pam_usb.nix +++ b/nixos/modules/security/pam_usb.nix @@ -17,6 +17,7 @@ in security.pam.usb = { enable = mkOption { + type = types.bool; default = false; description = '' Enable USB login for all login systems that support it. For diff --git a/nixos/modules/security/polkit.nix b/nixos/modules/security/polkit.nix index 8b04f4043bc..cafa9f82d5e 100644 --- a/nixos/modules/security/polkit.nix +++ b/nixos/modules/security/polkit.nix @@ -13,11 +13,13 @@ in options = { security.polkit.enable = mkOption { + type = types.bool; default = true; description = "Whether to enable PolKit."; }; security.polkit.permissions = mkOption { + type = types.lines; default = ""; example = '' @@ -49,6 +51,7 @@ in }; security.polkit.adminIdentities = mkOption { + type = types.str; default = "unix-user:0;unix-group:wheel"; example = ""; description = diff --git a/nixos/modules/security/rngd.nix b/nixos/modules/security/rngd.nix index dd251fe69d3..720ac02f2e8 100644 --- a/nixos/modules/security/rngd.nix +++ b/nixos/modules/security/rngd.nix @@ -5,6 +5,7 @@ with pkgs.lib; { options = { security.rngd.enable = mkOption { + type = types.bool; default = true; description = '' Whether to enable the rng daemon, which adds entropy from diff --git a/nixos/modules/security/rtkit.nix b/nixos/modules/security/rtkit.nix index e47e7baa2b8..164ad9b3aa7 100644 --- a/nixos/modules/security/rtkit.nix +++ b/nixos/modules/security/rtkit.nix @@ -10,6 +10,7 @@ with pkgs.lib; options = { security.rtkit.enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the RealtimeKit system service, which hands diff --git a/nixos/modules/security/setuid-wrappers.nix b/nixos/modules/security/setuid-wrappers.nix index e75679e5ff6..62df85816e5 100644 --- a/nixos/modules/security/setuid-wrappers.nix +++ b/nixos/modules/security/setuid-wrappers.nix @@ -25,7 +25,9 @@ in options = { security.setuidPrograms = mkOption { + type = types.listOf types.str; default = []; + example = ["passwd"]; description = '' The Nix store cannot contain setuid/setgid programs directly. For this reason, NixOS can automatically generate wrapper @@ -36,6 +38,7 @@ in }; security.setuidOwners = mkOption { + type = types.listOf types.attrs; default = []; example = [ { program = "sendmail"; @@ -53,6 +56,8 @@ in }; security.wrapperDir = mkOption { + internal = true; + type = types.path; default = "/var/setuid-wrappers"; description = '' This option defines the path to the setuid wrappers. It diff --git a/nixos/modules/security/sudo.nix b/nixos/modules/security/sudo.nix index 77251780198..215a8ecd601 100644 --- a/nixos/modules/security/sudo.nix +++ b/nixos/modules/security/sudo.nix @@ -17,6 +17,7 @@ in options = { security.sudo.enable = mkOption { + type = types.bool; default = true; description = '' @@ -26,6 +27,7 @@ in }; security.sudo.wheelNeedsPassword = mkOption { + type = types.bool; default = true; description = '' @@ -35,6 +37,7 @@ in }; security.sudo.configFile = mkOption { + type = types.lines; # Note: if syntax errors are detected in this file, the NixOS # configuration will fail to build. description = diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix index 6c53ef46ab9..d021b8bd3ba 100644 --- a/nixos/modules/services/audio/alsa.nix +++ b/nixos/modules/services/audio/alsa.nix @@ -20,14 +20,15 @@ in sound = { enable = mkOption { + type = types.bool; default = true; description = '' Whether to enable ALSA sound. ''; - merge = mergeEnableOption; }; enableOSSEmulation = mkOption { + type = types.bool; default = true; description = '' Whether to enable ALSA OSS emulation (with certain cards sound mixing may not work!). diff --git a/nixos/modules/services/audio/fuppes.nix b/nixos/modules/services/audio/fuppes.nix index 9c8849e525b..3eb0732bae2 100644 --- a/nixos/modules/services/audio/fuppes.nix +++ b/nixos/modules/services/audio/fuppes.nix @@ -21,7 +21,7 @@ with pkgs.lib; name = mkOption { example = "Media Center"; - type = with types; uniq string; + type = types.str; description = '' Enables Fuppes (UPnP A/V Media Server). Can be used to watch photos, video and listen to music from a phone/tv connected to the @@ -41,7 +41,7 @@ with pkgs.lib; file = mkOption { default = "/var/log/fuppes.log"; - type = with types; uniq string; + type = types.str; description = '' File which will contains the log produced by the daemon. ''; @@ -50,7 +50,7 @@ with pkgs.lib; config = mkOption { example = "/etc/fuppes/fuppes.cfg"; - type = with types; uniq string; + type = types.str; description = '' Mutable configuration file which can be edited with the web interface. Due to possible modification, double quote the full @@ -69,7 +69,7 @@ with pkgs.lib; database = mkOption { default = "/var/lib/fuppes/fuppes.db"; - type = with types; uniq string; + type = types.str; description = '' Database file which index all shared files. ''; @@ -88,7 +88,7 @@ with pkgs.lib; user = mkOption { default = "root"; # The default is not secure. example = "fuppes"; - type = with types; uniq string; + type = types.str; description = '' Name of the user which own the configuration files and under which the fuppes daemon will be executed. diff --git a/nixos/modules/services/databases/4store-endpoint.nix b/nixos/modules/services/databases/4store-endpoint.nix index 7b03b4d8f1d..7872ea2dc6a 100644 --- a/nixos/modules/services/databases/4store-endpoint.nix +++ b/nixos/modules/services/databases/4store-endpoint.nix @@ -24,12 +24,12 @@ with pkgs.lib; }; listenAddress = mkOption { - default = null; + default = null; description = "IP address to listen on."; }; port = mkOption { - default = 8080; + default = 8080; description = "port to listen on."; }; @@ -45,9 +45,12 @@ with pkgs.lib; ###### implementation - config = mkIf cfg.enable ( - mkAssert (cfg.enable -> cfg.database != "") - "Must specify database name" { + config = mkIf cfg.enable { + + assertions = singleton + { assertion = cfg.enable -> cfg.database != ""; + message = "Must specify 4Store database name"; + }; users.extraUsers = singleton { name = endpointUser; @@ -63,10 +66,10 @@ with pkgs.lib; startOn = "filesystem"; exec = '' - ${run} '${pkgs.rdf4store}/bin/4s-httpd -D ${cfg.options} ${if cfg.listenAddress!=null then "-H ${cfg.listenAddress}" else "" } -p ${toString cfg.port} ${cfg.database}' + ${run} '${pkgs.rdf4store}/bin/4s-httpd -D ${cfg.options} ${if cfg.listenAddress!=null then "-H ${cfg.listenAddress}" else "" } -p ${toString cfg.port} ${cfg.database}' ''; }; - }); + }; } diff --git a/nixos/modules/services/databases/4store.nix b/nixos/modules/services/databases/4store.nix index 14990e92ea3..412d14b050c 100644 --- a/nixos/modules/services/databases/4store.nix +++ b/nixos/modules/services/databases/4store.nix @@ -36,9 +36,12 @@ with pkgs.lib; ###### implementation - config = mkIf cfg.enable ( - mkAssert (cfg.enable -> cfg.database != "") - "Must specify database name" { + config = mkIf cfg.enable { + + assertions = singleton + { assertion = cfg.enable -> cfg.database != ""; + message = "Must specify 4Store database name."; + }; users.extraUsers = singleton { name = fourStoreUser; @@ -56,16 +59,16 @@ with pkgs.lib; preStart = '' mkdir -p ${stateDir}/ chown ${fourStoreUser} ${stateDir} - if ! test -e "${stateDir}/${cfg.database}"; then - ${run} -c '${pkgs.rdf4store}/bin/4s-backend-setup ${cfg.database}' + if ! test -e "${stateDir}/${cfg.database}"; then + ${run} -c '${pkgs.rdf4store}/bin/4s-backend-setup ${cfg.database}' fi ''; exec = '' - ${run} -c '${pkgs.rdf4store}/bin/4s-backend -D ${cfg.options} ${cfg.database}' + ${run} -c '${pkgs.rdf4store}/bin/4s-backend -D ${cfg.options} ${cfg.database}' ''; }; - }); + }; } diff --git a/nixos/modules/services/databases/postgresql.nix b/nixos/modules/services/databases/postgresql.nix index 1c43dad1d50..73447e3cf0d 100644 --- a/nixos/modules/services/databases/postgresql.nix +++ b/nixos/modules/services/databases/postgresql.nix @@ -46,6 +46,7 @@ in services.postgresql = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to run PostgreSQL. @@ -53,6 +54,7 @@ in }; package = mkOption { + type = types.path; example = literalExample "pkgs.postgresql92"; description = '' PostgreSQL package to use. @@ -60,6 +62,7 @@ in }; port = mkOption { + type = types.int; default = "5432"; description = '' Port for PostgreSQL. @@ -67,6 +70,7 @@ in }; dataDir = mkOption { + type = types.path; default = "/var/db/postgresql"; description = '' Data directory for PostgreSQL. @@ -74,6 +78,7 @@ in }; authentication = mkOption { + type = types.lines; default = ""; description = '' Defines how users authenticate themselves to the server. @@ -81,6 +86,7 @@ in }; identMap = mkOption { + type = types.lines; default = ""; description = '' Defines the mapping from system users to database users. @@ -88,14 +94,15 @@ in }; initialScript = mkOption { - default = null; type = types.nullOr types.path; + default = null; description = '' A file containing SQL statements to execute on first startup. ''; }; enableTCPIP = mkOption { + type = types.bool; default = false; description = '' Whether to run PostgreSQL with -i flag to enable TCP/IP connections. @@ -103,8 +110,9 @@ in }; extraPlugins = mkOption { + type = types.listOf types.path; default = []; - example = "pkgs.postgis"; # of course don't use a string here! + example = literalExample "pkgs.postgis"; description = '' When this list contains elements a new store path is created. PostgreSQL and the elments are symlinked into it. Then pg_config, @@ -118,15 +126,16 @@ in }; extraConfig = mkOption { + type = types.lines; default = ""; description = "Additional text to be appended to postgresql.conf."; }; recoveryConfig = mkOption { + type = types.nullOr types.lines; default = null; - type = types.nullOr types.string; description = '' - Values to put into recovery.conf file. + Contents of the recovery.conf file. ''; }; }; diff --git a/nixos/modules/services/databases/redis.nix b/nixos/modules/services/databases/redis.nix index 5bc58c73bd6..ea6399ba4f4 100644 --- a/nixos/modules/services/databases/redis.nix +++ b/nixos/modules/services/databases/redis.nix @@ -14,6 +14,7 @@ let ${condOption "unixsocket" cfg.unixSocket} loglevel ${cfg.logLevel} logfile ${cfg.logfile} + syslog-enabled ${redisBool cfg.syslog} databases ${toString cfg.databases} ${concatMapStrings (d: "save ${toString (builtins.elemAt d 0)} ${toString (builtins.elemAt d 1)}\n") cfg.save} dbfilename ${cfg.dbFilename} @@ -82,12 +83,18 @@ in }; logfile = mkOption { - default = "stdout"; + default = "/dev/null"; description = "Specify the log file name. Also 'stdout' can be used to force Redis to log on the standard output."; example = "/var/log/redis.log"; type = with types; string; }; + syslog = mkOption { + default = true; + description = "Enable logging to the system logger."; + type = with types; bool; + }; + databases = mkOption { default = 16; description = "Set the number of databases."; @@ -177,8 +184,9 @@ in config = mkIf config.services.redis.enable { - users.extraUsers = singleton + users.extraUsers.redis = { name = cfg.user; + uid = config.ids.uids.redis; description = "Redis database user"; }; diff --git a/nixos/modules/services/games/ghost-one.nix b/nixos/modules/services/games/ghost-one.nix index 815118be1c6..92c9112eeb6 100644 --- a/nixos/modules/services/games/ghost-one.nix +++ b/nixos/modules/services/games/ghost-one.nix @@ -21,7 +21,8 @@ in language = mkOption { default = "English"; - check = lang: elem lang [ "English" "Spanish" "Russian" "Serbian" "Turkish" ]; + type = types.addCheck types.str + (lang: elem lang [ "English" "Spanish" "Russian" "Serbian" "Turkish" ]); description = "The language of bot messages: English, Spanish, Russian, Serbian or Turkish."; }; diff --git a/nixos/modules/services/hardware/acpid.nix b/nixos/modules/services/hardware/acpid.nix index 6a595f8306b..adba6394dcf 100644 --- a/nixos/modules/services/hardware/acpid.nix +++ b/nixos/modules/services/hardware/acpid.nix @@ -66,21 +66,25 @@ in services.acpid = { enable = mkOption { + type = types.bool; default = false; description = "Whether to enable the ACPI daemon."; }; powerEventCommands = mkOption { + type = types.lines; default = ""; description = "Shell commands to execute on a button/power.* event."; }; lidEventCommands = mkOption { + type = types.lines; default = ""; description = "Shell commands to execute on a button/lid.* event."; }; acEventCommands = mkOption { + type = types.lines; default = ""; description = "Shell commands to execute on an ac_adapter.* event."; }; diff --git a/nixos/modules/services/hardware/bluetooth.nix b/nixos/modules/services/hardware/bluetooth.nix index 6bc0ad0bf77..b0714a3ce80 100644 --- a/nixos/modules/services/hardware/bluetooth.nix +++ b/nixos/modules/services/hardware/bluetooth.nix @@ -9,6 +9,7 @@ with pkgs.lib; options = { hardware.bluetooth.enable = mkOption { + type = types.bool; default = false; description = "Whether to enable support for Bluetooth."; }; diff --git a/nixos/modules/services/hardware/sane.nix b/nixos/modules/services/hardware/sane.nix index 905445f22c1..5979feb8240 100644 --- a/nixos/modules/services/hardware/sane.nix +++ b/nixos/modules/services/hardware/sane.nix @@ -2,6 +2,12 @@ with pkgs.lib; +let + + pkg = if config.hardware.sane.snapshot then pkgs.saneBackendsGit else pkgs.saneBackends; + +in + { ###### interface @@ -9,11 +15,13 @@ with pkgs.lib; options = { hardware.sane.enable = mkOption { + type = types.bool; default = false; description = "Enable support for SANE scanners."; }; hardware.sane.snapshot = mkOption { + type = types.bool; default = false; description = "Use a development snapshot of SANE scanner drivers."; }; @@ -23,18 +31,13 @@ with pkgs.lib; ###### implementation - config = let pkg = if config.hardware.sane.snapshot - then pkgs.saneBackendsGit - else pkgs.saneBackends; - in mkIf config.hardware.sane.enable { - environment.systemPackages = [ pkg ]; - services.udev.packages = [ pkg ]; - - users.extraGroups = singleton { - name = "scanner"; - gid = config.ids.gids.scanner; - }; + config = mkIf config.hardware.sane.enable { - }; + environment.systemPackages = [ pkg ]; + services.udev.packages = [ pkg ]; + + users.extraGroups."scanner".gid = config.ids.gids.scanner; + + }; } diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix index 37dba8ce71d..516569c0280 100644 --- a/nixos/modules/services/hardware/udev.nix +++ b/nixos/modules/services/hardware/udev.nix @@ -114,6 +114,7 @@ in options = { boot.hardwareScan = mkOption { + type = types.bool; default = true; description = '' Whether to try to load kernel modules for all detected hardware. @@ -126,8 +127,8 @@ in services.udev = { packages = mkOption { + type = types.listOf types.path; default = []; - merge = mergeListOption; description = '' List of packages containing udev rules. All files found in @@ -138,8 +139,8 @@ in }; path = mkOption { + type = types.listOf types.path; default = []; - merge = mergeListOption; description = '' Packages added to the PATH environment variable when executing programs from Udev rules. @@ -162,9 +163,9 @@ in }; hardware.firmware = mkOption { + type = types.listOf types.path; default = []; example = [ "/root/my-firmware" ]; - merge = mergeListOption; description = '' List of directories containing firmware files. Such files will be loaded automatically if the kernel asks for them diff --git a/nixos/modules/services/hardware/udisks.nix b/nixos/modules/services/hardware/udisks.nix index 1ba17c589d2..531ee192573 100644 --- a/nixos/modules/services/hardware/udisks.nix +++ b/nixos/modules/services/hardware/udisks.nix @@ -13,6 +13,7 @@ with pkgs.lib; services.udisks = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable Udisks, a DBus service that allows diff --git a/nixos/modules/services/hardware/udisks2.nix b/nixos/modules/services/hardware/udisks2.nix index eae4172ccb3..178ec379ff1 100644 --- a/nixos/modules/services/hardware/udisks2.nix +++ b/nixos/modules/services/hardware/udisks2.nix @@ -13,6 +13,7 @@ with pkgs.lib; services.udisks2 = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable Udisks, a DBus service that allows diff --git a/nixos/modules/services/hardware/upower.nix b/nixos/modules/services/hardware/upower.nix index 5d1658adb75..4a9b13d4aa0 100644 --- a/nixos/modules/services/hardware/upower.nix +++ b/nixos/modules/services/hardware/upower.nix @@ -13,6 +13,7 @@ with pkgs.lib; services.upower = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable Upower, a DBus service that provides power diff --git a/nixos/modules/services/logging/logcheck.nix b/nixos/modules/services/logging/logcheck.nix index 23f21b6a754..2a6a6516f48 100644 --- a/nixos/modules/services/logging/logcheck.nix +++ b/nixos/modules/services/logging/logcheck.nix @@ -52,7 +52,7 @@ let levelOption = mkOption { default = "server"; - type = types.uniq types.string; + type = types.str; description = '' Set the logcheck level. Either "workstation", "server", or "paranoid". ''; @@ -63,7 +63,7 @@ let regex = mkOption { default = ""; - type = types.uniq types.string; + type = types.str; description = '' Regex specifying which log lines to ignore. ''; @@ -73,7 +73,7 @@ let ignoreCronOptions = { user = mkOption { default = "root"; - type = types.uniq types.string; + type = types.str; description = '' User that runs the cronjob. ''; @@ -81,7 +81,7 @@ let cmdline = mkOption { default = ""; - type = types.uniq types.string; + type = types.str; description = '' Command line for the cron job. Will be turned into a regex for the logcheck ignore rule. ''; @@ -89,7 +89,7 @@ let timeArgs = mkOption { default = null; - type = types.nullOr (types.uniq types.string); + type = types.nullOr (types.str); example = "02 06 * * *"; description = '' "min hr dom mon dow" crontab time args, to auto-create a cronjob too. @@ -112,7 +112,7 @@ in user = mkOption { default = "logcheck"; - type = types.uniq types.string; + type = types.str; description = '' Username for the logcheck user. ''; @@ -121,7 +121,7 @@ in timeOfDay = mkOption { default = "*"; example = "6"; - type = types.uniq types.string; + type = types.str; description = '' Time of day to run logcheck. A logcheck will be scheduled at xx:02 each day. Leave default (*) to run every hour. Of course when nothing special was logged, @@ -132,7 +132,7 @@ in mailTo = mkOption { default = "root"; example = "you@domain.com"; - type = types.uniq types.string; + type = types.str; description = '' Email address to send reports to. ''; @@ -140,7 +140,7 @@ in level = mkOption { default = "server"; - type = types.uniq types.string; + type = types.str; description = '' Set the logcheck level. Either "workstation", "server", or "paranoid". ''; diff --git a/nixos/modules/services/logging/logstash.nix b/nixos/modules/services/logging/logstash.nix index 2f0eea50526..79bdf4f7bbc 100644 --- a/nixos/modules/services/logging/logstash.nix +++ b/nixos/modules/services/logging/logstash.nix @@ -99,7 +99,7 @@ in mkHash functions, which take a string representation of a float and an attrset, respectively. ''; - merge = mergeConfigs; + apply = mergeConfigs; }; filterConfig = mkOption { @@ -109,7 +109,7 @@ in representing a logstash configuration's filter section. See inputConfig description for details. ''; - merge = mergeConfigs; + apply = mergeConfigs; }; outputConfig = mkOption { @@ -119,7 +119,7 @@ in representing a logstash configuration's output section. See inputConfig description for details. ''; - merge = mergeConfigs; + apply = mergeConfigs; }; }; }; diff --git a/nixos/modules/services/logging/syslogd.nix b/nixos/modules/services/logging/syslogd.nix index 24cd5c1567e..36a0ace927a 100644 --- a/nixos/modules/services/logging/syslogd.nix +++ b/nixos/modules/services/logging/syslogd.nix @@ -46,7 +46,7 @@ in }; tty = mkOption { - type = types.uniq types.string; + type = types.str; default = "tty10"; description = '' The tty device on which syslogd will print important log @@ -55,7 +55,7 @@ in }; defaultConfig = mkOption { - type = types.string; + type = types.lines; default = defaultConf; description = '' The default syslog.conf file configures a @@ -73,7 +73,7 @@ in }; extraConfig = mkOption { - type = types.string; + type = types.lines; default = ""; example = "news.* -/var/log/news"; description = '' diff --git a/nixos/modules/services/mail/freepops.nix b/nixos/modules/services/mail/freepops.nix index 8f6e9382607..79f211ad86e 100644 --- a/nixos/modules/services/mail/freepops.nix +++ b/nixos/modules/services/mail/freepops.nix @@ -35,7 +35,7 @@ in bind = mkOption { default = "0.0.0.0"; - type = with types; uniq string; + type = types.str; description = '' Bind over an IPv4 address instead of any. ''; @@ -44,7 +44,7 @@ in logFile = mkOption { default = "/var/log/freepopsd"; example = "syslog"; - type = with types; uniq string; + type = types.str; description = '' Filename of the log file or syslog to rely on the logging daemon. ''; @@ -53,7 +53,7 @@ in suid = { user = mkOption { default = "nobody"; - type = with types; uniq string; + type = types.str; description = '' User name under which freepopsd will be after binding the port. ''; @@ -61,7 +61,7 @@ in group = mkOption { default = "nogroup"; - type = with types; uniq string; + type = types.str; description = '' Group under which freepopsd will be after binding the port. ''; diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index ff0bdf65ced..1707828d0db 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -6,7 +6,7 @@ let cfg = config.nix; - inherit (config.environment) nix; + nix = cfg.package; makeNixBuildUser = nr: { name = "nixbld${toString nr}"; @@ -55,19 +55,20 @@ in options = { - environment.nix = mkOption { - default = pkgs.nix; - merge = mergeOneOption; - description = '' - This option specifies the Nix package instance to use throughout the system. - ''; - }; - nix = { + package = mkOption { + type = types.path; + default = pkgs.nix; + description = '' + This option specifies the Nix package instance to use throughout the system. + ''; + }; + maxJobs = mkOption { + type = types.int; default = 1; - example = 2; + example = 64; description = " This option defines the maximum number of jobs that Nix will try to build in parallel. The default is 1. You should generally @@ -77,8 +78,8 @@ in }; useChroot = mkOption { + type = types.bool; default = false; - example = true; description = " If set, Nix will perform builds in a chroot-environment that it will set up automatically for each build. This prevents @@ -88,6 +89,7 @@ in }; chrootDirs = mkOption { + type = types.listOf types.str; default = []; example = [ "/dev" "/proc" ]; description = @@ -98,15 +100,17 @@ in }; extraOptions = mkOption { + type = types.lines; default = ""; - example = " + example = '' gc-keep-outputs = true gc-keep-derivations = true - "; + ''; description = "Additional text appended to nix.conf."; }; distributedBuilds = mkOption { + type = types.bool; default = false; description = '' Whether to distribute builds to the machines listed in @@ -115,22 +119,25 @@ in }; daemonNiceLevel = mkOption { + type = types.int; default = 0; - description = " + description = '' Nix daemon process priority. This priority propagates to build processes. 0 is the default Unix process priority, 20 is the lowest. - "; + ''; }; daemonIONiceLevel = mkOption { + type = types.int; default = 0; - description = " + description = '' Nix daemon process I/O priority. This priority propagates to build processes. 0 is the default Unix process I/O priority, 7 is the lowest. - "; + ''; }; buildMachines = mkOption { + type = types.listOf types.attrs; default = []; example = [ { hostName = "voila.labs.cs.uu.nl"; @@ -160,7 +167,7 @@ in user name to be used for the SSH connection (sshUser), the Nix system type (system, e.g., - \"i686-linux\"), the maximum number of + "i686-linux"), the maximum number of jobs to be run in parallel on that machine (maxJobs), the path to the SSH private key to be used to connect (sshKey), a @@ -176,24 +183,26 @@ in }; proxy = mkOption { + type = types.str; default = ""; - description = " + description = '' This option specifies the proxy to use for fetchurl. The real effect is just exporting http_proxy, https_proxy and ftp_proxy with that value. - "; + ''; example = "http://127.0.0.1:3128"; }; # Environment variables for running Nix. envVars = mkOption { + type = types.attrs; internal = true; default = {}; - type = types.attrs; description = "Environment variables used by Nix."; }; nrBuildUsers = mkOption { + type = types.int; default = 10; description = '' Number of nixbld user accounts created to @@ -204,6 +213,7 @@ in }; readOnlyStore = mkOption { + type = types.bool; default = true; description = '' If set, NixOS will enforce the immutability of the Nix store @@ -214,8 +224,8 @@ in }; binaryCaches = mkOption { + type = types.listOf types.str; default = [ http://cache.nixos.org/ ]; - type = types.listOf types.string; description = '' List of binary cache URLs used to obtain pre-built binaries of Nix packages. @@ -223,9 +233,9 @@ in }; trustedBinaryCaches = mkOption { + type = types.listOf types.str; default = [ ]; example = [ http://hydra.nixos.org/ ]; - type = types.listOf types.string; description = '' List of binary cache URLs that non-root users can use (in addition to those specified using @@ -302,7 +312,7 @@ in } // optionalAttrs cfg.distributedBuilds { - NIX_BUILD_HOOK = "${config.environment.nix}/libexec/nix/build-remote.pl"; + NIX_BUILD_HOOK = "${nix}/libexec/nix/build-remote.pl"; NIX_REMOTE_SYSTEMS = "/etc/nix/machines"; NIX_CURRENT_LOAD = "/run/nix/current-load"; } diff --git a/nixos/modules/services/misc/nix-gc.nix b/nixos/modules/services/misc/nix-gc.nix index ad6889ce142..fa20e0956f5 100644 --- a/nixos/modules/services/misc/nix-gc.nix +++ b/nixos/modules/services/misc/nix-gc.nix @@ -22,7 +22,7 @@ in dates = mkOption { default = "03:15"; - type = types.uniq types.string; + type = types.str; description = '' Specification (in the format described by systemd.time @@ -34,7 +34,7 @@ in options = mkOption { default = ""; example = "--max-freed $((64 * 1024**3))"; - type = types.uniq types.string; + type = types.str; description = '' Options given to nix-collect-garbage when the garbage collector is run automatically. @@ -52,7 +52,7 @@ in systemd.services.nix-gc = { description = "Nix Garbage Collector"; - script = "exec ${config.environment.nix}/bin/nix-collect-garbage ${cfg.options}"; + script = "exec ${config.nix.package}/bin/nix-collect-garbage ${cfg.options}"; startAt = optionalString cfg.automatic cfg.dates; }; diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix index a593d05ee62..885b8fa2d0c 100644 --- a/nixos/modules/services/misc/nixos-manual.nix +++ b/nixos/modules/services/misc/nixos-manual.nix @@ -16,13 +16,15 @@ let system.nixosRevision = config.system.nixosRevision; }; + eval = evalModules { + modules = [ versionModule ] ++ baseModules; + args = (removeAttrs extraArgs ["config" "options"]) // { modules = [ ]; }; + }; + manual = import ../../../doc/manual { inherit pkgs; revision = config.system.nixosRevision; - options = (fixMergeModules ([ versionModule ] ++ baseModules) - (removeAttrs extraArgs ["config" "options"]) // { - modules = [ ]; - }).options; + options = eval.options; }; entry = "${manual.manual}/share/doc/nixos/manual.html"; @@ -51,14 +53,15 @@ in options = { services.nixosManual.enable = mkOption { - default = true; type = types.bool; + default = true; description = '' Whether to build the NixOS manual pages. ''; }; services.nixosManual.showManual = mkOption { + type = types.bool; default = false; description = '' Whether to show the NixOS manual on one of the virtual @@ -74,6 +77,7 @@ in }; services.nixosManual.browser = mkOption { + type = types.path; default = "${pkgs.w3m}/bin/w3m"; description = '' Browser used to show the manual. diff --git a/nixos/modules/services/misc/rogue.nix b/nixos/modules/services/misc/rogue.nix index 94fa8850750..de25cc0fb98 100644 --- a/nixos/modules/services/misc/rogue.nix +++ b/nixos/modules/services/misc/rogue.nix @@ -17,6 +17,7 @@ in options = { services.rogue.enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the Rogue game on one of the virtual @@ -25,6 +26,7 @@ in }; services.rogue.tty = mkOption { + type = types.str; default = "tty9"; description = '' Virtual console on which to run Rogue. diff --git a/nixos/modules/services/misc/synergy.nix b/nixos/modules/services/misc/synergy.nix index 91c0acb0bc2..63e7c7667e5 100644 --- a/nixos/modules/services/misc/synergy.nix +++ b/nixos/modules/services/misc/synergy.nix @@ -22,58 +22,56 @@ in enable = mkOption { default = false; description = " - Whether to enable the synergy client (receive keyboard and mouse events from a synergy server) + Whether to enable the Synergy client (receive keyboard and mouse events from a Synergy server). "; }; screenName = mkOption { default = ""; - description = " - use screen-name instead the hostname to identify + description = '' + Use the given name instead of the hostname to identify ourselves to the server. - "; + ''; }; serverAddress = mkOption { - description = " + description = '' The server address is of the form: [hostname][:port]. The hostname must be the address or hostname of the server. The port overrides the default port, 24800. - "; + ''; }; autoStart = mkOption { default = true; type = types.bool; - description = "Whether synergy-client should be started automatically."; + description = "Whether the Synergy client should be started automatically."; }; }; server = { enable = mkOption { default = false; - description = " - Whether to enable the synergy server (send keyboard and mouse events) - "; + description = '' + Whether to enable the Synergy server (send keyboard and mouse events). + ''; }; configFile = mkOption { default = "/etc/synergy-server.conf"; - description = " - The synergy server configuration file. open upstart-jobs/synergy.nix to see an example - "; + description = "The Synergy server configuration file."; }; screenName = mkOption { default = ""; - description = " - use screen-name instead the hostname to identify + description = '' + Use the given name instead of the hostname to identify this screen in the configuration. - "; + ''; }; address = mkOption { default = ""; - description = "listen for clients on the given address"; + description = "Address on which to listen for clients."; }; autoStart = mkOption { default = true; type = types.bool; - description = "Whether synergy-server should be started automatically."; + description = "Whether the Synergy server should be started automatically."; }; }; }; diff --git a/nixos/modules/services/monitoring/dd-agent.nix b/nixos/modules/services/monitoring/dd-agent.nix index ef658523c1f..f99114ac9ad 100644 --- a/nixos/modules/services/monitoring/dd-agent.nix +++ b/nixos/modules/services/monitoring/dd-agent.nix @@ -26,7 +26,7 @@ in { example = "ae0aa6a8f08efa988ba0a17578f009ab"; - type = types.uniq types.string; + type = types.str; }; hostname = mkOption { diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix index 7fa3ab22b00..08e6ef662cc 100644 --- a/nixos/modules/services/monitoring/graphite.nix +++ b/nixos/modules/services/monitoring/graphite.nix @@ -8,7 +8,7 @@ let dataDir = "/var/db/graphite"; carbonOpts = name: with config.ids; '' - --nodaemon --syslog --prefix=${name} \ + --nodaemon --syslog --prefix=${name} --pidfile /var/run/${name}.pid \ --uid ${toString uids.graphite} --gid ${toString uids.graphite} ${name} ''; carbonEnv = { @@ -32,13 +32,13 @@ in { host = mkOption { description = "Graphite web frontend listen address"; default = "127.0.0.1"; - types = type.uniq types.string; + type = types.str; }; port = mkOption { description = "Graphite web frontend port"; default = "8080"; - types = type.uniq types.string; + type = types.str; }; }; @@ -52,8 +52,11 @@ in { PICKLE_RECEIVER_INTERFACE = 127.0.0.1 LINE_RECEIVER_INTERFACE = 127.0.0.1 CACHE_QUERY_INTERFACE = 127.0.0.1 + # Do not log every update + LOG_UPDATES = False + LOG_CACHE_HITS = False ''; - type = types.uniq types.string; + type = types.str; }; enableCache = mkOption { diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix index de07dc0dbaa..512e639721e 100644 --- a/nixos/modules/services/monitoring/smartd.nix +++ b/nixos/modules/services/monitoring/smartd.nix @@ -12,16 +12,15 @@ let device = mkOption { example = "/dev/sda"; - type = types.string; + type = types.str; description = "Location of the device."; }; options = mkOption { default = ""; example = "-d sat"; - type = types.string; - merge = pkgs.lib.concatStringsSep " "; - description = "Options that determine how smartd monitors the device"; + type = types.separatedString " "; + description = "Options that determine how smartd monitors the device."; }; }; diff --git a/nixos/modules/services/monitoring/statsd.nix b/nixos/modules/services/monitoring/statsd.nix index 120c8860d57..979debefdd9 100644 --- a/nixos/modules/services/monitoring/statsd.nix +++ b/nixos/modules/services/monitoring/statsd.nix @@ -36,7 +36,7 @@ in host = mkOption { description = "Address that statsd listens on over UDP"; default = "127.0.0.1"; - type = types.uniq types.string; + type = types.str; }; port = mkOption { @@ -48,7 +48,7 @@ in mgmt_address = mkOption { description = "Address to run managment TCP interface on"; default = "127.0.0.1"; - type = types.uniq types.string; + type = types.str; }; mgmt_port = mkOption { @@ -65,7 +65,7 @@ in graphiteHost = mkOption { description = "Hostname or IP of Graphite server"; default = "127.0.0.1"; - type = types.uniq types.string; + type = types.str; }; graphitePort = mkOption { @@ -77,7 +77,7 @@ in extraConfig = mkOption { default = ""; description = "Extra configuration options for statsd"; - type = types.uniq types.string; + type = types.str; }; }; diff --git a/nixos/modules/services/monitoring/ups.nix b/nixos/modules/services/monitoring/ups.nix index a7b72e53f0a..c00f4bad935 100644 --- a/nixos/modules/services/monitoring/ups.nix +++ b/nixos/modules/services/monitoring/ups.nix @@ -15,7 +15,7 @@ let # This can be infered from the UPS model by looking at # /nix/store/nut/share/driver.list driver = mkOption { - type = types.uniq types.string; + type = types.str; description = '' Specify the program to run to talk to this UPS. apcsmart, bestups, and sec are some examples. @@ -23,7 +23,7 @@ let }; port = mkOption { - type = types.uniq types.string; + type = types.str; description = '' The serial port to which your UPS is connected. /dev/ttyS0 is usually the first port on Linux boxes, for example. @@ -115,7 +115,7 @@ in # This option is not used yet. mode = mkOption { default = "standalone"; - type = types.uniq types.string; + type = types.str; description = '' The MODE determines which part of the NUT is to be started, and which configuration files must be modified. @@ -142,7 +142,7 @@ in schedulerRules = mkOption { example = "/etc/nixos/upssched.conf"; - type = types.uniq types.string; + type = types.str; description = '' File which contains the rules to handle UPS events. ''; diff --git a/nixos/modules/services/networking/avahi-daemon.nix b/nixos/modules/services/networking/avahi-daemon.nix index 3603d677837..effd1a62bd9 100644 --- a/nixos/modules/services/networking/avahi-daemon.nix +++ b/nixos/modules/services/networking/avahi-daemon.nix @@ -50,7 +50,7 @@ in }; hostName = mkOption { - type = types.uniq types.string; + type = types.str; description = ''Host name advertised on the LAN.''; }; diff --git a/nixos/modules/services/networking/bitlbee.nix b/nixos/modules/services/networking/bitlbee.nix index 82e875f5aae..fe37e8ea012 100644 --- a/nixos/modules/services/networking/bitlbee.nix +++ b/nixos/modules/services/networking/bitlbee.nix @@ -64,7 +64,7 @@ in authMode = mkOption { default = "Open"; - check = authModeCheck; + type = types.addCheck types.str authModeCheck; description = '' The following authentication modes are available: Open -- Accept connections from anyone, use NickServ for user authentication. diff --git a/nixos/modules/services/networking/cntlm.nix b/nixos/modules/services/networking/cntlm.nix index bfe7209b991..96396878afc 100644 --- a/nixos/modules/services/networking/cntlm.nix +++ b/nixos/modules/services/networking/cntlm.nix @@ -39,7 +39,7 @@ in }; netbios_hostname = mkOption { - type = types.uniq types.string; + type = types.str; description = '' The hostname of your machine. ''; diff --git a/nixos/modules/services/networking/dhclient.nix b/nixos/modules/services/networking/dhclient.nix deleted file mode 100644 index 1e343443899..00000000000 --- a/nixos/modules/services/networking/dhclient.nix +++ /dev/null @@ -1,111 +0,0 @@ -{ config, pkgs, ... }: - -with pkgs.lib; - -let - - inherit (pkgs) nettools dhcp lib; - - # Don't start dhclient on explicitly configured interfaces or on - # interfaces that are part of a bridge. - ignoredInterfaces = - map (i: i.name) (lib.filter (i: i ? ipAddress && i.ipAddress != "" ) config.networking.interfaces) - ++ concatLists (attrValues (mapAttrs (n: v: v.interfaces) config.networking.bridges)); - - stateDir = "/var/lib/dhcp"; # Don't use /var/state/dhcp; not FHS-compliant. - - dhclientExitHooks = pkgs.writeText "dhclient-exit-hooks" - '' - #echo "$reason" >> /tmp/dhcp-exit - #echo "$exit_status" >> /tmp/dhcp-exit - - if test "$reason" = BOUND -o "$reason" = REBOOT; then - # Restart ntpd. (The "ip-up" event below will trigger the - # restart.) We need to restart it to make sure that it will - # actually do something: if ntpd cannot resolve the server - # hostnames in its config file, then it will never do - # anything ever again ("couldn't resolve ..., giving up on - # it"), so we silently lose time synchronisation. - ${config.system.build.upstart}/sbin/initctl stop ntpd - - ${config.system.build.upstart}/sbin/initctl emit -n ip-up - fi - - if test "$reason" = EXPIRE -o "$reason" = RELEASE; then - ${config.system.build.upstart}/sbin/initctl emit -n ip-down - fi - ''; - -in - -{ - - ###### implementation - - config = mkIf config.networking.useDHCP { - - # dhclient barfs if /proc/net/if_inet6 doesn't exist. - boot.kernelModules = [ "ipv6" ]; - - jobs.dhclient = - { startOn = "started network-interfaces"; - stopOn = "stopping network-interfaces"; - - path = [ dhcp ]; - - script = - '' - # Determine the interface on which to start dhclient. - interfaces= - - for i in $(cd /sys/class/net && ls -d *); do - # Only run dhclient on interfaces of type ARPHRD_ETHER - # (1), i.e. Ethernet. Ignore peth* devices; on Xen, - # they're renamed physical Ethernet cards used for - # bridging. Likewise for vif* and tap* (Xen) and - # virbr* and vnet* (libvirt). - if [ "$(cat /sys/class/net/$i/type)" = 1 ]; then - if ! for j in ${toString ignoredInterfaces}; do echo $j; done | grep -F -x -q "$i" && - ! echo "$i" | grep -x -q "peth.*\|vif.*\|tap.*\|virbr.*\|vnet.*"; - then - echo "Running dhclient on $i" - interfaces="$interfaces $i" - fi - fi - done - - if test -z "$interfaces"; then - echo 'No interfaces on which to start dhclient!' - exit 1 - fi - - mkdir -m 755 -p ${stateDir} - - exec dhclient -d $interfaces -e "PATH=$PATH" -lf ${stateDir}/dhclient.leases -sf ${dhcp}/sbin/dhclient-script - ''; - }; - - environment.systemPackages = [dhcp]; - - environment.etc = - [ # Dhclient hooks for emitting ip-up/ip-down events. - { source = dhclientExitHooks; - target = "dhclient-exit-hooks"; - } - ]; - - powerManagement.resumeCommands = - '' - ${config.system.build.upstart}/sbin/restart dhclient - ''; - - networking.interfaceMonitor.commands = - '' - if [ "$status" = up ]; then - ${config.system.build.upstart}/sbin/restart dhclient - fi - ''; - - }; - -} diff --git a/nixos/modules/services/networking/dhcpcd.nix b/nixos/modules/services/networking/dhcpcd.nix index 48803511a5e..07b5606eaca 100644 --- a/nixos/modules/services/networking/dhcpcd.nix +++ b/nixos/modules/services/networking/dhcpcd.nix @@ -6,7 +6,7 @@ let inherit (pkgs) dhcpcd; - # Don't start dhclient on explicitly configured interfaces or on + # Don't start dhcpcd on explicitly configured interfaces or on # interfaces that are part of a bridge. ignoredInterfaces = map (i: i.name) (filter (i: i.ipAddress != null) (attrValues config.networking.interfaces)) diff --git a/nixos/modules/services/networking/dhcpd.nix b/nixos/modules/services/networking/dhcpd.nix index 43e0843cb97..5b2058e4e12 100644 --- a/nixos/modules/services/networking/dhcpd.nix +++ b/nixos/modules/services/networking/dhcpd.nix @@ -15,7 +15,7 @@ let authoritative; ddns-update-style ad-hoc; log-facility local1; # see dhcpd.nix - + ${cfg.extraConfig} ${pkgs.lib.concatMapStrings @@ -30,13 +30,13 @@ let ''; in - + { ###### interface options = { - + services.dhcpd = { enable = mkOption { @@ -48,16 +48,16 @@ in extraConfig = mkOption { default = ""; - example = " + example = '' option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; option routers 192.168.1.5; option domain-name-servers 130.161.158.4, 130.161.33.17, 130.161.180.1; - option domain-name \"example.org\"; + option domain-name "example.org"; subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.100 192.168.1.200; } - "; + ''; description = " Extra text to be appended to the DHCP server configuration file. Currently, you almost certainly need to specify @@ -100,9 +100,9 @@ in }; }; - + }; - + ###### implementation @@ -127,5 +127,5 @@ in }; }; - + } diff --git a/nixos/modules/services/networking/firewall.nix b/nixos/modules/services/networking/firewall.nix index b24ac2d7032..3c0c51e6ec8 100644 --- a/nixos/modules/services/networking/firewall.nix +++ b/nixos/modules/services/networking/firewall.nix @@ -53,6 +53,7 @@ in options = { networking.firewall.enable = mkOption { + type = types.bool; default = false; description = '' @@ -64,6 +65,7 @@ in }; networking.firewall.logRefusedConnections = mkOption { + type = types.bool; default = true; description = '' @@ -72,6 +74,7 @@ in }; networking.firewall.logRefusedPackets = mkOption { + type = types.bool; default = false; description = '' @@ -82,6 +85,7 @@ in }; networking.firewall.logRefusedUnicastsOnly = mkOption { + type = types.bool; default = true; description = '' @@ -93,6 +97,7 @@ in }; networking.firewall.rejectPackets = mkOption { + type = types.bool; default = false; description = '' @@ -193,6 +198,7 @@ in }; networking.firewall.extraCommands = mkOption { + type = types.lines; default = ""; example = "iptables -A INPUT -p icmp -j ACCEPT"; description = @@ -209,11 +215,8 @@ in ###### implementation - # !!! Maybe if `enable' is false, the firewall should still be built - # but not started by default. However, currently nixos-rebuild - # doesn't deal with such Upstart jobs properly (it starts them if - # they are changed, regardless of whether the start condition - # holds). + # FIXME: Maybe if `enable' is false, the firewall should still be + # built but not started by default? config = mkIf cfg.enable { networking.firewall.trustedInterfaces = [ "lo" ]; diff --git a/nixos/modules/services/networking/gogoclient.nix b/nixos/modules/services/networking/gogoclient.nix index 07c35e3cb3d..3b92eb8b06b 100644 --- a/nixos/modules/services/networking/gogoclient.nix +++ b/nixos/modules/services/networking/gogoclient.nix @@ -15,38 +15,35 @@ in default = false; type = types.bool; description = '' - Enable the gogoclient ipv6 tunnel. + Enable the gogoCLIENT IPv6 tunnel. ''; }; autorun = mkOption { default = true; - description = " - Switch to false to create upstart-job and configuration, - but not run it automatically - "; + description = '' + Whether to automatically start the tunnel. + ''; }; username = mkOption { default = ""; - description = " + description = '' Your Gateway6 login name, if any. - "; + ''; }; password = mkOption { default = ""; type = types.string; - description = " - Path to a file (as a string), containing your gogonet password, if any. - "; + description = '' + Path to a file (as a string), containing your gogoNET password, if any. + ''; }; server = mkOption { default = "anonymous.freenet6.net"; example = "broker.freenet6.net"; - description = " - Used Gateway6 server. - "; + description = "The Gateway6 server to be used."; }; }; }; diff --git a/nixos/modules/services/networking/haproxy.nix b/nixos/modules/services/networking/haproxy.nix new file mode 100644 index 00000000000..c8345a528a7 --- /dev/null +++ b/nixos/modules/services/networking/haproxy.nix @@ -0,0 +1,87 @@ +{ config, pkgs, ...}: +let + cfg = config.services.haproxy; + haproxyCfg = pkgs.writeText "haproxy.conf" cfg.config; +in +with pkgs.lib; +{ + options = { + services.haproxy = { + + enable = mkOption { + default = false; + description = " + Enable the HAProxy. + "; + }; + + config = mkOption { + default = + '' + global + log 127.0.0.1 local6 + maxconn 24000 + daemon + nbproc 1 + + defaults + mode http + option httpclose + + # Remove requests from the queue if people press stop button + option abortonclose + + # Try to connect this many times on failure + retries 3 + + # If a client is bound to a particular backend but it goes down, + # send them to a different one + option redispatch + + monitor-uri /haproxy-ping + + timeout connect 7s + timeout queue 300s + timeout client 300s + timeout server 300s + + # Enable status page at this URL, on the port HAProxy is bound to + stats enable + stats uri /haproxy-status + stats refresh 5s + stats realm Haproxy statistics + ''; + description = " + Default configuration. + "; + }; + + }; + + }; + + config = mkIf cfg.enable { + + systemd.services.haproxy = { + description = "HAProxy"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "forking"; + PIDFile = "/var/run/haproxy.pid"; + ExecStartPre = "${pkgs.haproxy}/sbin/haproxy -c -q -f ${haproxyCfg}"; + ExecStart = "${pkgs.haproxy}/sbin/haproxy -D -f ${haproxyCfg} -p /var/run/haproxy.pid"; + ExecReload = "-${pkgs.bash}/bin/bash -c \"exec ${pkgs.haproxy}/sbin/haproxy -D -f ${haproxyCfg} -p /var/run/haproxy.pid -sf $MAINPID\""; + }; + }; + + environment.systemPackages = [ pkgs.haproxy ]; + + users.extraUsers.haproxy = { + group = "haproxy"; + uid = config.ids.uids.haproxy; + }; + + users.extraGroups.haproxy.gid = config.ids.uids.haproxy; + }; +} diff --git a/nixos/modules/services/networking/ifplugd.nix b/nixos/modules/services/networking/ifplugd.nix index df50e9807a9..4e939d60354 100644 --- a/nixos/modules/services/networking/ifplugd.nix +++ b/nixos/modules/services/networking/ifplugd.nix @@ -9,10 +9,7 @@ let cfg = config.networking.interfaceMonitor; # The ifplugd action script, which is called whenever the link - # status changes (i.e., a cable is plugged in or unplugged). We do - # nothing when a cable is unplugged. When a cable is plugged in, we - # restart dhclient, which will hopefully give us a new IP address - # if appropriate. + # status changes (i.e., a cable is plugged in or unplugged). plugScript = pkgs.writeScript "ifplugd.action" '' #! ${pkgs.stdenv.shell} @@ -30,17 +27,19 @@ in options = { networking.interfaceMonitor.enable = mkOption { + type = types.bool; default = false; description = '' If true, monitor Ethernet interfaces for cables being plugged in or unplugged. When this occurs, the - dhclient service is restarted to - automatically obtain a new IP address. This is useful for - roaming users (laptops). + commands specified in + are + executed. ''; }; networking.interfaceMonitor.beep = mkOption { + type = types.bool; default = false; description = '' If true, beep when an Ethernet cable is @@ -49,6 +48,7 @@ in }; networking.interfaceMonitor.commands = mkOption { + type = types.lines; default = ""; description = '' Shell commands to be executed when the link status of an diff --git a/nixos/modules/services/networking/iodined.nix b/nixos/modules/services/networking/iodined.nix index 1b3473ee0ee..cd150fe63fd 100644 --- a/nixos/modules/services/networking/iodined.nix +++ b/nixos/modules/services/networking/iodined.nix @@ -32,21 +32,21 @@ in }; ip = mkOption { - type = types.uniq types.string; + type = types.str; default = ""; description = "Assigned ip address or ip range"; example = "172.16.10.1/24"; }; domain = mkOption { - type = types.uniq types.string; + type = types.str; default = ""; description = "Domain or subdomain of which nameservers point to us"; example = "tunnel.mydomain.com"; }; extraConfig = mkOption { - type = types.uniq types.string; + type = types.str; default = ""; description = "Additional command line parameters"; example = "-P mysecurepassword -l 192.168.1.10 -p 23"; diff --git a/nixos/modules/services/networking/minidlna.nix b/nixos/modules/services/networking/minidlna.nix index ea5bc8514f1..e31d77f13fe 100644 --- a/nixos/modules/services/networking/minidlna.nix +++ b/nixos/modules/services/networking/minidlna.nix @@ -32,7 +32,7 @@ in services.minidlna.mediaDirs = mkOption { type = types.listOf types.string; default = []; - examples = [ "/data/media" "V,/home/alice/video" ]; + example = [ "/data/media" "V,/home/alice/video" ]; description = '' Directories to be scanned for media files. The prefixes diff --git a/nixos/modules/services/networking/nat.nix b/nixos/modules/services/networking/nat.nix index 9d62a764f06..ce28f018828 100644 --- a/nixos/modules/services/networking/nat.nix +++ b/nixos/modules/services/networking/nat.nix @@ -19,6 +19,7 @@ in options = { networking.nat.enable = mkOption { + type = types.bool; default = false; description = '' @@ -27,6 +28,7 @@ in }; networking.nat.internalIPs = mkOption { + type = types.listOf types.str; example = [ "192.168.1.0/24" ] ; description = '' @@ -34,12 +36,10 @@ in coming from these networks and destined for the external interface will be rewritten. ''; - # Backward compatibility: this used to be a single range instead - # of a list. - apply = x: if isList x then x else [x]; }; networking.nat.externalInterface = mkOption { + type = types.str; example = "eth1"; description = '' @@ -48,7 +48,8 @@ in }; networking.nat.externalIP = mkOption { - default = ""; + type = types.nullOr types.str; + default = null; example = "203.0.113.123"; description = '' @@ -86,7 +87,7 @@ in '' iptables -t nat -A POSTROUTING \ -s ${network} -o ${cfg.externalInterface} \ - ${if cfg.externalIP == "" + ${if cfg.externalIP == null then "-j MASQUERADE" else "-j SNAT --to-source ${cfg.externalIP}"} '' diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix index 1d5682f5f3f..ad6f9858aaf 100644 --- a/nixos/modules/services/networking/networkmanager.nix +++ b/nixos/modules/services/networking/networkmanager.nix @@ -64,8 +64,8 @@ in { networking.networkmanager = { enable = mkOption { + type = types.bool; default = false; - merge = mergeEnableOption; description = '' Whether to use NetworkManager to obtain an IP address and other configuration for all network interfaces that are not manually @@ -76,11 +76,11 @@ in { }; packages = mkOption { + type = types.listOf types.path; default = [ ]; description = '' Extra packages that provide NetworkManager plugins. ''; - merge = mergeListOption; apply = list: [ networkmanager modemmanager wpa_supplicant ] ++ list; }; diff --git a/nixos/modules/services/networking/openfire.nix b/nixos/modules/services/networking/openfire.nix index d5c18c0675c..b2efb5e9c12 100644 --- a/nixos/modules/services/networking/openfire.nix +++ b/nixos/modules/services/networking/openfire.nix @@ -40,10 +40,12 @@ in ###### implementation - config = mkIf config.services.openfire.enable ( - mkAssert (!(config.services.openfire.usePostgreSQL -> config.services.postgresql.enable)) " - openfire assertion failed - " { + config = mkIf config.services.openfire.enable { + + assertions = singleton + { assertion = !(config.services.openfire.usePostgreSQL -> config.services.postgresql.enable); + message = "OpenFire assertion failed."; + }; jobs.openfire = { description = "OpenFire XMPP server"; @@ -65,6 +67,6 @@ in ''; # */ }; - }); + }; } diff --git a/nixos/modules/services/networking/openvpn.nix b/nixos/modules/services/networking/openvpn.nix index 1e862591406..292d45f4347 100644 --- a/nixos/modules/services/networking/openvpn.nix +++ b/nixos/modules/services/networking/openvpn.nix @@ -75,53 +75,53 @@ in services.openvpn.servers = mkOption { default = {}; - example = { + example = literalExample '' + { + server = { + config = ''' + # Simplest server configuration: http://openvpn.net/index.php/documentation/miscellaneous/static-key-mini-howto.html. + # server : + dev tun + ifconfig 10.8.0.1 10.8.0.2 + secret /root/static.key + '''; + up = "ip route add ..."; + down = "ip route del ..."; + }; - server = { - config = '' - # Simplest server configuration: http://openvpn.net/index.php/documentation/miscellaneous/static-key-mini-howto.html. - # server : - dev tun - ifconfig 10.8.0.1 10.8.0.2 - secret /root/static.key - ''; - up = "ip route add ..."; - down = "ip route del ..."; - }; - - client = { - config = '' - client - remote vpn.example.org - dev tun - proto tcp-client - port 8080 - ca /root/.vpn/ca.crt - cert /root/.vpn/alice.crt - key /root/.vpn/alice.key - ''; - up = "echo nameserver $nameserver | ${pkgs.openresolv}/sbin/resolvconf -m 0 -a $dev"; - down = "${pkgs.openresolv}/sbin/resolvconf -d $dev"; - }; - - }; + client = { + config = ''' + client + remote vpn.example.org + dev tun + proto tcp-client + port 8080 + ca /root/.vpn/ca.crt + cert /root/.vpn/alice.crt + key /root/.vpn/alice.key + '''; + up = "echo nameserver $nameserver | ''${pkgs.openresolv}/sbin/resolvconf -m 0 -a $dev"; + down = "''${pkgs.openresolv}/sbin/resolvconf -d $dev"; + }; + } + ''; description = '' - Each attribute of this option defines an Upstart job to run an - OpenVPN instance. These can be OpenVPN servers or clients. - The name of each Upstart job is - openvpn-name, + Each attribute of this option defines a systemd service that + runs an OpenVPN instance. These can be OpenVPN servers or + clients. The name of each systemd service is + openvpn-name.service, where name is the corresponding attribute name. ''; type = types.attrsOf types.optionSet; - options = { + options = { config = mkOption { - type = types.string; - description = '' + type = types.lines; + description = '' Configuration of this OpenVPN instance. See openvpn8 for details. @@ -130,7 +130,7 @@ in up = mkOption { default = ""; - type = types.string; + type = types.lines; description = '' Shell commands executed when the instance is starting. ''; @@ -138,7 +138,7 @@ in down = mkOption { default = ""; - type = types.string; + type = types.lines; description = '' Shell commands executed when the instance is shutting down. ''; diff --git a/nixos/modules/services/networking/rpcbind.nix b/nixos/modules/services/networking/rpcbind.nix index 00c958c5a4a..c966f85e260 100644 --- a/nixos/modules/services/networking/rpcbind.nix +++ b/nixos/modules/services/networking/rpcbind.nix @@ -40,6 +40,7 @@ in services.rpcbind = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable `rpcbind', an ONC RPC directory service diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix index f5670ccdcbf..7a2335847e3 100644 --- a/nixos/modules/services/networking/ssh/sshd.nix +++ b/nixos/modules/services/networking/ssh/sshd.nix @@ -27,7 +27,7 @@ let openssh.authorizedKeys = { keys = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = []; description = '' A list of verbatim OpenSSH public keys that should be added to the @@ -39,6 +39,7 @@ let }; keyFiles = mkOption { + type = types.listOf types.unspecified; default = []; description = '' A list of files each containing one OpenSSH public key that should be @@ -77,6 +78,7 @@ in services.openssh = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the OpenSSH secure shell daemon, which @@ -85,6 +87,7 @@ in }; forwardX11 = mkOption { + type = types.bool; default = cfgc.setXAuthLocation; description = '' Whether to allow X11 connections to be forwarded. @@ -92,6 +95,7 @@ in }; allowSFTP = mkOption { + type = types.bool; default = true; description = '' Whether to enable the SFTP subsystem in the SSH daemon. This @@ -102,7 +106,7 @@ in permitRootLogin = mkOption { default = "without-password"; - check = permitRootLoginCheck; + type = types.addCheck types.str permitRootLoginCheck; description = '' Whether the root user can login using ssh. Valid values are yes, without-password, @@ -112,6 +116,7 @@ in }; gatewayPorts = mkOption { + type = types.str; default = "no"; description = '' Specifies whether remote hosts are allowed to connect to @@ -122,6 +127,7 @@ in }; ports = mkOption { + type = types.listOf types.int; default = [22]; description = '' Specifies on which ports the SSH daemon listens. @@ -129,6 +135,7 @@ in }; passwordAuthentication = mkOption { + type = types.bool; default = true; description = '' Specifies whether password authentication is allowed. @@ -136,6 +143,7 @@ in }; challengeResponseAuthentication = mkOption { + type = types.bool; default = true; description = '' Specifies whether challenge/response authentication is allowed. @@ -143,6 +151,7 @@ in }; hostKeys = mkOption { + type = types.listOf types.attrs; default = [ { path = "/etc/ssh/ssh_host_dsa_key"; type = "dsa"; @@ -163,11 +172,13 @@ in }; authorizedKeysFiles = mkOption { + type = types.listOf types.unspecified; default = []; description = "Files from with authorized keys are read."; }; extraConfig = mkOption { + type = types.lines; default = ""; description = "Verbatim contents of sshd_config."; }; @@ -202,7 +213,7 @@ in The path to the public key file for the host. The public key file is read at build time and saved in the Nix store. You can fetch a public key file from a running SSH server - with the ssh-keyscan command. + with the ssh-keyscan command. ''; }; }; diff --git a/nixos/modules/services/networking/vsftpd.nix b/nixos/modules/services/networking/vsftpd.nix index d9f1e96b1d2..0a6355e6ff1 100644 --- a/nixos/modules/services/networking/vsftpd.nix +++ b/nixos/modules/services/networking/vsftpd.nix @@ -75,7 +75,7 @@ let { cfgText = if cfg.rsaCertFile == null then "" else '' - sslEnable=YES + ssl_enable=YES rsa_cert_file=${cfg.rsaCertFile} ''; diff --git a/nixos/modules/services/networking/wpa_supplicant.nix b/nixos/modules/services/networking/wpa_supplicant.nix index dca398dd8be..5e5f81ed5a0 100644 --- a/nixos/modules/services/networking/wpa_supplicant.nix +++ b/nixos/modules/services/networking/wpa_supplicant.nix @@ -26,6 +26,7 @@ in networking.wireless = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to start wpa_supplicant to scan for @@ -40,6 +41,7 @@ in }; interfaces = mkOption { + type = types.listOf types.string; default = []; example = [ "wlan0" "wlan1" ]; description = '' @@ -51,12 +53,14 @@ in }; driver = mkOption { + type = types.str; default = "nl80211,wext"; description = "Force a specific wpa_supplicant driver."; }; userControlled = { enable = mkOption { + type = types.bool; default = false; description = '' Allow normal users to control wpa_supplicant through wpa_gui or wpa_cli. @@ -70,9 +74,9 @@ in }; group = mkOption { + type = types.str; default = "wheel"; example = "network"; - type = types.string; description = "Members of this group can control wpa_supplicant."; }; }; diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix index 1c3dc9d90b1..951cef3eac0 100644 --- a/nixos/modules/services/printing/cupsd.nix +++ b/nixos/modules/services/printing/cupsd.nix @@ -49,6 +49,7 @@ in services.printing = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable printing support through the CUPS daemon. @@ -56,6 +57,8 @@ in }; bindirCmds = mkOption { + type = types.lines; + internal = true; default = ""; description = '' Additional commands executed while creating the directory @@ -64,6 +67,7 @@ in }; cupsdConf = mkOption { + type = types.lines; default = ""; example = '' @@ -77,13 +81,16 @@ in }; drivers = mkOption { - example = [ pkgs.splix ]; + type = types.listOf types.path; + example = literalExample "[ pkgs.splix ]"; description = '' - CUPS drivers (CUPS, gs and samba are added unconditionally). + CUPS drivers to use. Drivers provided by CUPS, Ghostscript + and Samba are added unconditionally. ''; }; tempDir = mkOption { + type = types.path; default = "/tmp"; example = "/tmp/cups"; description = '' diff --git a/nixos/modules/services/scheduling/atd.nix b/nixos/modules/services/scheduling/atd.nix index 8c96252668e..c516c5889f1 100644 --- a/nixos/modules/services/scheduling/atd.nix +++ b/nixos/modules/services/scheduling/atd.nix @@ -17,18 +17,21 @@ in options = { services.atd.enable = mkOption { + type = types.bool; default = false; description = '' - Whether to enable the `at' daemon, a command scheduler. + Whether to enable the at daemon, a command scheduler. ''; }; services.atd.allowEveryone = mkOption { + type = types.bool; default = false; description = '' - Whether to make /var/spool/at{jobs,spool} writeable - by everyone (and sticky). This is normally not needed since - the `at' commands are setuid/setgid `atd'. + Whether to make /var/spool/at{jobs,spool} + writeable by everyone (and sticky). This is normally not + needed since the at commands are + setuid/setgid atd. ''; }; diff --git a/nixos/modules/services/scheduling/cron.nix b/nixos/modules/services/scheduling/cron.nix index e14f03fb1e8..44ed1ba5a07 100644 --- a/nixos/modules/services/scheduling/cron.nix +++ b/nixos/modules/services/scheduling/cron.nix @@ -11,7 +11,9 @@ let '' SHELL=${pkgs.bash}/bin/bash PATH=${config.system.path}/bin:${config.system.path}/sbin - MAILTO="${config.services.cron.mailto}" + ${optionalString (config.services.cron.mailto != null) '' + MAILTO="${config.services.cron.mailto}" + ''} NIX_CONF_DIR=/etc/nix ${pkgs.lib.concatStrings (map (job: job + "\n") config.services.cron.systemCronJobs)} ''; @@ -34,21 +36,25 @@ in services.cron = { enable = mkOption { + type = types.bool; default = true; - description = "Whether to enable the `vixie cron' daemon."; + description = "Whether to enable the Vixie cron daemon."; }; mailto = mkOption { - default = ""; - description = " The job output will be mailed to this email address. "; + type = types.nullOr types.str; + default = null; + description = "Email address to which job output will be mailed."; }; systemCronJobs = mkOption { + type = types.listOf types.str; default = []; - example = [ - "* * * * * test ls -l / > /tmp/cronout 2>&1" - "* * * * * eelco echo Hello World > /home/eelco/cronout" - ]; + example = literalExample '' + [ "* * * * * test ls -l / > /tmp/cronout 2>&1" + "* * * * * eelco echo Hello World > /home/eelco/cronout" + ] + ''; description = '' A list of Cron jobs to be appended to the system-wide crontab. See the manual page for crontab for the expected diff --git a/nixos/modules/services/scheduling/fcron.nix b/nixos/modules/services/scheduling/fcron.nix index 95ff918eb6d..0c0811ca6e0 100644 --- a/nixos/modules/services/scheduling/fcron.nix +++ b/nixos/modules/services/scheduling/fcron.nix @@ -6,7 +6,7 @@ let cfg = config.services.fcron; - queuelen = if cfg.queuelen == "" then "" else "-q ${toString cfg.queuelen}"; + queuelen = if cfg.queuelen == null then "" else "-q ${toString cfg.queuelen}"; systemCronJobs = '' @@ -34,33 +34,40 @@ in services.fcron = { enable = mkOption { + type = types.bool; default = false; - description = "Whether to enable the `fcron' daemon."; + description = "Whether to enable the fcron daemon."; }; allow = mkOption { + type = types.listOf types.str; default = [ "all" ]; description = '' - Users allowed to use fcrontab and fcrondyn (one name per line, "all" for everyone). + Users allowed to use fcrontab and fcrondyn (one name per + line, all for everyone). ''; }; deny = mkOption { + type = types.listOf types.str; default = []; description = "Users forbidden from using fcron."; }; maxSerialJobs = mkOption { + type = types.int; default = 1; description = "Maximum number of serial jobs which can run simultaneously."; }; queuelen = mkOption { - default = ""; - description = "Number of jobs the serial queue and the lavg queue can contain - empty to net set this number (-q)"; + type = types.nullOr types.int; + default = null; + description = "Number of jobs the serial queue and the lavg queue can contain."; }; systab = mkOption { + type = types.lines; default = ""; description = ''The "system" crontab contents.''; }; diff --git a/nixos/modules/services/search/elasticsearch.nix b/nixos/modules/services/search/elasticsearch.nix index 3c27c1400f9..9d345e30361 100644 --- a/nixos/modules/services/search/elasticsearch.nix +++ b/nixos/modules/services/search/elasticsearch.nix @@ -29,31 +29,31 @@ in { host = mkOption { description = "Elasticsearch listen address"; default = "127.0.0.1"; - types = type.uniq types.string; + type = types.str; }; port = mkOption { description = "Elasticsearch port to listen for HTTP traffic"; default = "9200"; - types = type.uniq types.string; + type = types.str; }; tcp_port = mkOption { description = "Elasticsearch port for the node to node communication"; default = "9300"; - types = type.uniq types.string; + type = types.str; }; cluster_name = mkOption { description = "Elasticsearch name that identifies your cluster for auto-discovery"; default = "elasticsearch"; - types = type.uniq types.string; + type = types.str; }; extraConf = mkOption { description = "Extra configuration for elasticsearch"; default = ""; - types = type.uniq types.string; + type = types.str; example = '' node.name: "elasticsearch" node.master: true @@ -77,7 +77,7 @@ in { type: consolePattern conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n" ''; - types = type.uniq types.string; + type = types.str; }; }; diff --git a/nixos/modules/services/security/tor.nix b/nixos/modules/services/security/tor.nix index 2dafb4595c6..e70eb8511a6 100644 --- a/nixos/modules/services/security/tor.nix +++ b/nixos/modules/services/security/tor.nix @@ -53,9 +53,9 @@ in ''; }; - socksListenAddressFaster = mkOption { + socksListenAddressFaster = mkOption { default = "127.0.0.1:9063"; - description = '' + description = '' Same as socksListenAddress but uses weaker circuit isolation to provide performance suitable for a web browser. ''; @@ -227,10 +227,12 @@ in ###### implementation - config = mkIf (cfg.client.enable || cfg.relay.enable) ( - mkAssert (cfg.relay.enable -> !(cfg.relay.isBridge && cfg.relay.isExit)) " - Can't be both an exit and a bridge relay at the same time - " { + config = mkIf (cfg.client.enable || cfg.relay.enable) { + + assertions = singleton + { assertion = cfg.relay.enable -> !(cfg.relay.isBridge && cfg.relay.isExit); + message = "Can't be both an exit and a bridge relay at the same time"; + }; users.extraUsers = singleton { name = torUser; @@ -270,7 +272,7 @@ in '' + optionalString cfg.client.enable '' SOCKSPort ${cfg.client.socksListenAddress} IsolateDestAddr - SOCKSPort ${cfg.client.socksListenAddressFaster} + SOCKSPort ${cfg.client.socksListenAddressFaster} ${opt "SocksPolicy" cfg.client.socksPolicy} '' + optionalString cfg.relay.enable '' @@ -316,6 +318,6 @@ in # Extra config goes here ''; - }); + }; } diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix index eab876be76d..cb5110f6feb 100644 --- a/nixos/modules/services/system/dbus.nix +++ b/nixos/modules/services/system/dbus.nix @@ -68,15 +68,16 @@ in services.dbus = { enable = mkOption { + type = types.bool; default = true; description = '' Whether to start the D-Bus message bus daemon, which is required by many other system services and applications. ''; - merge = pkgs.lib.mergeEnableOption; }; packages = mkOption { + type = types.listOf types.path; default = []; description = '' Packages whose D-Bus configuration files should be included in @@ -122,7 +123,7 @@ in [Socket] ListenStream=/var/run/dbus/system_bus_socket ''; - + systemd.units."dbus.service".text = '' [Unit] @@ -137,41 +138,6 @@ in OOMScoreAdjust=-900 ''; - /* - jobs.dbus = - { startOn = "started udev and started syslogd"; - - restartIfChanged = false; - - path = [ pkgs.dbus_daemon pkgs.dbus_tools ]; - - preStart = - '' - mkdir -m 0755 -p ${homeDir} - chown messagebus ${homeDir} - - mkdir -m 0755 -p /var/lib/dbus - dbus-uuidgen --ensure - - rm -f ${homeDir}/pid - ''; - - daemonType = "fork"; - - exec = "dbus-daemon --system"; - - postStop = - '' - # !!! Hack: doesn't belong here. - pid=$(cat /var/run/ConsoleKit/pid || true) - if test -n "$pid"; then - kill $pid || true - rm -f /var/run/ConsoleKit/pid - fi - ''; - }; - */ - security.setuidOwners = singleton { program = "dbus-daemon-launch-helper"; source = "${pkgs.dbus_daemon}/libexec/dbus-daemon-launch-helper"; diff --git a/nixos/modules/services/system/nscd.nix b/nixos/modules/services/system/nscd.nix index e8534b12043..b817b1df779 100644 --- a/nixos/modules/services/system/nscd.nix +++ b/nixos/modules/services/system/nscd.nix @@ -19,6 +19,7 @@ in services.nscd = { enable = mkOption { + type = types.bool; default = true; description = "Whether to enable the Name Service Cache Daemon."; }; diff --git a/nixos/modules/services/ttys/agetty.nix b/nixos/modules/services/ttys/agetty.nix index 850f558e4cb..ae4fa87d4b7 100644 --- a/nixos/modules/services/ttys/agetty.nix +++ b/nixos/modules/services/ttys/agetty.nix @@ -11,6 +11,7 @@ with pkgs.lib; services.mingetty = { greetingLine = mkOption { + type = types.str; default = ''<<< Welcome to NixOS ${config.system.nixosVersion} (\m) - \l >>>''; description = '' Welcome line printed by mingetty. @@ -18,6 +19,7 @@ with pkgs.lib; }; helpLine = mkOption { + type = types.lines; default = ""; description = '' Help line printed by mingetty below the welcome line. diff --git a/nixos/modules/services/ttys/gpm.nix b/nixos/modules/services/ttys/gpm.nix index 6a425cf327f..74cee67aeae 100644 --- a/nixos/modules/services/ttys/gpm.nix +++ b/nixos/modules/services/ttys/gpm.nix @@ -17,6 +17,7 @@ in services.gpm = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable GPM, the General Purpose Mouse daemon, @@ -25,6 +26,7 @@ in }; protocol = mkOption { + type = types.str; default = "ps/2"; description = "Mouse protocol to use."; }; diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index e2cfc5cdb26..d21b6da0e77 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -30,7 +30,7 @@ let # Admin address: inherit from the main server if not specified for # a virtual host. - adminAddr = if cfg.adminAddr != "" then cfg.adminAddr else mainCfg.adminAddr; + adminAddr = if cfg.adminAddr != null then cfg.adminAddr else mainCfg.adminAddr; vhostConfig = cfg; serverConfig = mainCfg; @@ -38,21 +38,7 @@ let }; - vhostOptions = import ./per-server-options.nix { - inherit mkOption; - forMainServer = false; - }; - - vhosts = let - makeVirtualHost = cfgIn: - let - # Fill in defaults for missing options. - cfg = addDefaultOptionValues vhostOptions cfgIn; - in cfg; - in map makeVirtualHost mainCfg.virtualHosts; - - - allHosts = [mainCfg] ++ vhosts; + allHosts = [mainCfg] ++ mainCfg.virtualHosts; callSubservices = serverInfo: defs: @@ -60,9 +46,11 @@ let let svcFunction = if svc ? function then svc.function - else import "${./.}/${if svc ? serviceType then svc.serviceType else svc.serviceName}.nix"; - config = addDefaultOptionValues res.options - (if svc ? config then svc.config else svc); + else import (toString "${toString ./.}/${if svc ? serviceType then svc.serviceType else svc.serviceName}.nix"); + config = (evalModules + { modules = [ { options = res.options; config = svc.config or svc; } ]; + check = false; + }).config; defaults = { extraConfig = ""; extraModules = []; @@ -86,7 +74,7 @@ let mainSubservices = subservicesFor mainCfg; - allSubservices = mainSubservices ++ concatMap subservicesFor vhosts; + allSubservices = mainSubservices ++ concatMap subservicesFor mainCfg.virtualHosts; # !!! should be in lib @@ -229,7 +217,7 @@ let ${concatMapStrings (alias: "ServerAlias ${alias}\n") cfg.serverAliases} - ${if cfg.sslServerCert != "" then '' + ${if cfg.sslServerCert != null then '' SSLCertificateFile ${cfg.sslServerCert} SSLCertificateKeyFile ${cfg.sslServerKey} '' else ""} @@ -241,7 +229,7 @@ let SSLEngine off '' else ""} - ${if isMainServer || cfg.adminAddr != "" then '' + ${if isMainServer || cfg.adminAddr != null then '' ServerAdmin ${cfg.adminAddr} '' else ""} @@ -272,7 +260,7 @@ let '' else ""} - ${if cfg.globalRedirect != "" then '' + ${if cfg.globalRedirect != null then '' RedirectPermanent / ${cfg.globalRedirect} '' else ""} @@ -389,7 +377,7 @@ let ${perServerConf false vhost} ''; - in concatMapStrings makeVirtualHost vhosts + in concatMapStrings makeVirtualHost mainCfg.virtualHosts } ''; @@ -420,93 +408,107 @@ in services.httpd = { enable = mkOption { + type = types.bool; default = false; - description = " - Whether to enable the Apache httpd server. - "; + description = "Whether to enable the Apache HTTP Server."; }; package = mkOption { + type = types.path; default = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; }; - example = "pkgs.apacheHttpd_2_4"; - description = " + example = "pkgs.apacheHttpd_2_4"; + description = '' Overridable attribute of the Apache HTTP Server package to use. - "; + ''; }; configFile = mkOption { + type = types.path; default = confFile; - example = ''pkgs.writeText "httpd.conf" "# my custom config file ...";''; - description = " - Overridable config file to use for Apache. By default, use the - file automatically generated by nixos. - "; + example = literalExample ''pkgs.writeText "httpd.conf" "# my custom config file ...";''; + description = '' + Override the configuration file used by Apache. By default, + NixOS generates one automatically. + ''; }; extraConfig = mkOption { + type = types.lines; default = ""; - description = " - These configuration lines will be appended to the Apache config - file. Note that this mechanism may not work when - is overridden. - "; + description = '' + Cnfiguration lines appended to the generated Apache + configuration file. Note that this mechanism may not work + when is overridden. + ''; }; extraModules = mkOption { + type = types.listOf types.unspecified; default = []; - example = [ "proxy_connect" { name = "php5"; path = "${php}/modules/libphp5.so"; } ]; + example = literalExample ''[ "proxy_connect" { name = "php5"; path = "''${php}/modules/libphp5.so"; } ]''; description = '' - Specifies additional Apache modules. These can be specified - as a string in the case of modules distributed with Apache, - or as an attribute set specifying the + Additional Apache modules to be used. These can be + specified as a string in the case of modules distributed + with Apache, or as an attribute set specifying the name and path of the module. ''; }; logPerVirtualHost = mkOption { + type = types.bool; default = false; - description = " + description = '' If enabled, each virtual host gets its own access_log and error_log, namely suffixed by the of the virtual host. - "; + ''; }; user = mkOption { + type = types.str; default = "wwwrun"; - description = " + description = '' User account under which httpd runs. The account is created automatically if it doesn't exist. - "; + ''; }; group = mkOption { + type = types.str; default = "wwwrun"; - description = " + description = '' Group under which httpd runs. The account is created automatically if it doesn't exist. - "; + ''; }; logDir = mkOption { + type = types.path; default = "/var/log/httpd"; - description = " + description = '' Directory for Apache's log files. It is created automatically. - "; + ''; }; stateDir = mkOption { - default = "/var/run/httpd"; - description = " + type = types.path; + default = "/run/httpd"; + description = '' Directory for Apache's transient runtime state (such as PID files). It is created automatically. Note that the default, - /var/run/httpd, is deleted at boot time. - "; + /run/httpd, is deleted at boot time. + ''; }; virtualHosts = mkOption { + type = types.listOf (types.submodule ( + { options = import ./per-server-options.nix { + inherit pkgs; + forMainServer = false; + }; + })); default = []; example = [ { hostName = "foo"; @@ -525,6 +527,7 @@ in }; phpOptions = mkOption { + type = types.lines; default = ""; example = '' @@ -535,9 +538,9 @@ in }; multiProcessingModule = mkOption { + type = types.str; default = "prefork"; example = "worker"; - type = types.uniq types.string; description = '' Multi-processing module to be used by Apache. Available @@ -552,12 +555,14 @@ in }; maxClients = mkOption { + type = types.int; default = 150; example = 8; description = "Maximum number of httpd processes (prefork)"; }; maxRequestsPerChild = mkOption { + type = types.int; default = 0; example = 500; description = @@ -567,7 +572,7 @@ in # Include the options shared between the main server and virtual hosts. // (import ./per-server-options.nix { - inherit mkOption; + inherit pkgs; forMainServer = true; }); diff --git a/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix b/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix index a5227bae2d4..53f34e28c27 100644 --- a/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix +++ b/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix @@ -3,38 +3,40 @@ # has additional options that affect the web server as a whole, like # the user/group to run under.) -{forMainServer, mkOption}: +{ forMainServer, pkgs }: + +with pkgs.lib; { hostName = mkOption { + type = types.str; default = "localhost"; - description = " - Canonical hostname for the server. - "; + description = "Canonical hostname for the server."; }; serverAliases = mkOption { + type = types.listOf types.str; default = []; example = ["www.example.org" "www.example.org:8080" "example.org"]; - description = " + description = '' Additional names of virtual hosts served by this virtual host configuration. - "; + ''; }; port = mkOption { + type = types.int; default = 0; - description = " + description = '' Port for the server. 0 means use the default port: 80 for http and 443 for https (i.e. when enableSSL is set). - "; + ''; }; enableSSL = mkOption { + type = types.bool; default = false; - description = " - Whether to enable SSL (https) support. - "; + description = "Whether to enable SSL (https) support."; }; # Note: sslServerCert and sslServerKey can be left empty, but this @@ -42,62 +44,62 @@ # main server). sslServerCert = mkOption { - default = ""; + type = types.nullOr types.path; + default = null; example = "/var/host.cert"; - description = " - Path to server SSL certificate. - "; + description = "Path to server SSL certificate."; }; sslServerKey = mkOption { - default = ""; + type = types.path; example = "/var/host.key"; - description = " - Path to server SSL certificate key. - "; + description = "Path to server SSL certificate key."; }; adminAddr = mkOption ({ + type = types.nullOr types.str; example = "admin@example.org"; - description = " - E-mail address of the server administrator. - "; - } // (if forMainServer then {} else {default = "";})); + description = "E-mail address of the server administrator."; + } // (if forMainServer then {} else {default = null;})); documentRoot = mkOption { + type = types.nullOr types.path; default = null; example = "/data/webserver/docs"; - description = " + description = '' The path of Apache's document root directory. If left undefined, an empty directory in the Nix store will be used as root. - "; + ''; }; servedDirs = mkOption { + type = types.listOf types.attrs; default = []; example = [ { urlPath = "/nix"; dir = "/home/eelco/Dev/nix-homepage"; } ]; - description = " + description = '' This option provides a simple way to serve static directories. - "; + ''; }; servedFiles = mkOption { + type = types.listOf types.attrs; default = []; example = [ { urlPath = "/foo/bar.png"; dir = "/home/eelco/some-file.png"; } ]; - description = " + description = '' This option provides a simple way to serve individual, static files. - "; + ''; }; extraConfig = mkOption { + type = types.lines; default = ""; example = '' @@ -105,37 +107,39 @@ AllowOverride All ''; - description = " + description = '' These lines go to httpd.conf verbatim. They will go after directories and directory aliases defined by default. - "; + ''; }; extraSubservices = mkOption { + type = types.listOf types.unspecified; default = []; - description = " - Extra subservices to enable in the webserver. - "; + description = "Extra subservices to enable in the webserver."; }; enableUserDir = mkOption { + type = types.bool; default = false; - description = " + description = '' Whether to enable serving ~/public_html as /~username. - "; + ''; }; globalRedirect = mkOption { - default = ""; + type = types.nullOr types.str; + default = null; example = http://newserver.example.org/; - description = " + description = '' If set, all requests for this host are redirected permanently to the given URL. - "; + ''; }; logFormat = mkOption { + type = types.str; default = "common"; example = "combined"; description = " diff --git a/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix b/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix index f12ae842b58..1b754cf025e 100644 --- a/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix +++ b/nixos/modules/services/web-servers/apache-httpd/tomcat-connector.nix @@ -38,7 +38,7 @@ in JkWorkersFile ${workersProperties} # Where to put jk logs -JkLogFile ${config.logDir}/mod_jk.log +JkLogFile ${serverInfo.serverConfig.logDir}/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel info @@ -69,7 +69,7 @@ JkMount /__application__/* loadbalancer # for load balancing to work properly # Note: Replaced JkShmFile logs/jk.shm due to SELinux issues. Refer to # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225452 -JkShmFile ${config.stateDir}/jk.shm +JkShmFile ${serverInfo.serverConfig.stateDir}/jk.shm # Static files in all Tomcat webapp context directories are served by apache JkAutoAlias /var/tomcat/webapps diff --git a/nixos/modules/services/web-servers/lighttpd/default.nix b/nixos/modules/services/web-servers/lighttpd/default.nix index f9e40fc4b54..4cc34c65d84 100644 --- a/nixos/modules/services/web-servers/lighttpd/default.nix +++ b/nixos/modules/services/web-servers/lighttpd/default.nix @@ -102,7 +102,7 @@ in document-root = mkOption { default = "/srv/www"; - type = types.uniq types.string; + type = types.str; description = '' Document-root of the web server. Must be readable by the "lighttpd" user. ''; diff --git a/nixos/modules/services/web-servers/lighttpd/gitweb.nix b/nixos/modules/services/web-servers/lighttpd/gitweb.nix index d759d8144b6..f02bd4db264 100644 --- a/nixos/modules/services/web-servers/lighttpd/gitweb.nix +++ b/nixos/modules/services/web-servers/lighttpd/gitweb.nix @@ -25,7 +25,7 @@ in projectroot = mkOption { default = "/srv/git"; - type = types.uniq types.string; + type = types.str; description = '' Path to git projects (bare repositories) that should be served by gitweb. Must not end with a slash. @@ -34,7 +34,7 @@ in extraConfig = mkOption { default = ""; - type = types.uniq types.string; + type = types.str; description = '' Verbatim configuration text appended to the generated gitweb.conf file. ''; diff --git a/nixos/modules/services/web-servers/zope2.nix b/nixos/modules/services/web-servers/zope2.nix index f75b62b219a..576f4b08fb9 100644 --- a/nixos/modules/services/web-servers/zope2.nix +++ b/nixos/modules/services/web-servers/zope2.nix @@ -33,6 +33,11 @@ let description = "The name of the effective user for the Zope process."; }; + clientHome = mkOption { + default = "/var/lib/zope2/${name}"; + type = types.string; + description = "Home directory of zope2 instance."; + }; extra = mkOption { default = '' @@ -152,7 +157,7 @@ in '' %define INSTANCEHOME ${env} instancehome $INSTANCEHOME - %define CLIENTHOME /var/lib/zope2/${name} + %define CLIENTHOME ${opts.clientHome}/${opts.name} clienthome $CLIENTHOME debug-mode off @@ -162,8 +167,8 @@ in zserver-threads ${toString opts.threads} effective-user ${opts.user} - pid-filename /var/lib/zope2/${name}/pid - lock-filename /var/lib/zope2/${name}/lock + pid-filename ${opts.clientHome}/${opts.name}/pid + lock-filename ${opts.clientHome}/${opts.name}/lock python-check-interval 1000 enable-product-installation off @@ -221,7 +226,7 @@ in exec ${ctlScript} "$@" ''; in { - description = "zope2 ${name} instance"; + #description = "${name} instance"; after = [ "network.target" ]; # with RelStorage also add "postgresql.service" wantedBy = [ "multi-user.target" ]; path = opts.packages; @@ -233,8 +238,9 @@ in chown ${opts.user} /var/log/zope2/${name}.log chown ${opts.user} /var/log/zope2/${name}-Z2.log - mkdir -p /var/lib/zope2/${name}/filestorage /var/lib/zope2/${name}/blobstorage - chown ${opts.user} /var/lib/zope2/${name} -R + mkdir -p ${opts.clientHome}/filestorage ${opts.clientHome}/blobstorage + mkdir -p ${opts.clientHome}/${opts.name} + chown ${opts.user} ${opts.clientHome} -R ${ctl} adduser admin admin ''; diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix index 0fea74d5ba7..ab3ced4c9e2 100644 --- a/nixos/modules/services/x11/desktop-managers/default.nix +++ b/nixos/modules/services/x11/desktop-managers/default.nix @@ -24,17 +24,18 @@ in services.xserver.desktopManager = { session = mkOption { + internal = true; default = []; example = singleton { name = "kde"; bgSupport = true; start = "..."; }; - description = " + description = '' Internal option used to add some common line to desktop manager scripts before forwarding the value to the displayManager. - "; + ''; apply = list: { list = map (d: d // { manage = "desktop"; @@ -50,10 +51,10 @@ in }; default = mkOption { + type = types.str; default = ""; example = "none"; description = "Default desktop manager loaded if none have been chosen."; - merge = mergeOneOption; apply = defaultDM: if defaultDM == "" && cfg.session.list != [] then (head cfg.session.list).name @@ -69,7 +70,7 @@ in config = { services.xserver.displayManager.session = cfg.session.list; - environment.x11Packages = + environment.systemPackages = mkIf cfg.session.needBGPackages [ pkgs.feh ]; }; } diff --git a/nixos/modules/services/x11/desktop-managers/kde4.nix b/nixos/modules/services/x11/desktop-managers/kde4.nix index d1eb1799bc8..108b52bb951 100644 --- a/nixos/modules/services/x11/desktop-managers/kde4.nix +++ b/nixos/modules/services/x11/desktop-managers/kde4.nix @@ -51,13 +51,13 @@ in services.xserver.desktopManager.kde4 = { enable = mkOption { + type = types.bool; default = false; - example = true; description = "Enable the KDE 4 desktop environment."; }; phononBackends = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = ["gstreamer"]; example = ["gstreamer" "vlc"]; description = "Which phonon multimedia backend kde should use"; @@ -80,7 +80,7 @@ in # overridden by the user's configuration). # !!! doesn't work yet ("Multiple definitions. Only one is allowed # for this option.") - # services.xserver.desktopManager.default = mkOverrideTemplate 900 "kde4"; + # services.xserver.desktopManager.default = mkOverride 900 "kde4"; services.xserver.desktopManager.session = singleton { name = "kde4"; diff --git a/nixos/modules/services/x11/desktop-managers/xfce.nix b/nixos/modules/services/x11/desktop-managers/xfce.nix index f5d544ad046..8199829ef90 100644 --- a/nixos/modules/services/x11/desktop-managers/xfce.nix +++ b/nixos/modules/services/x11/desktop-managers/xfce.nix @@ -13,8 +13,8 @@ in options = { services.xserver.desktopManager.xfce.enable = mkOption { + type = types.bool; default = false; - example = true; description = "Enable the Xfce desktop environment."; }; @@ -60,7 +60,6 @@ in pkgs.xfce.xfce4session pkgs.xfce.xfce4settings pkgs.xfce.xfce4mixer - pkgs.xfce.xfceutils pkgs.xfce.xfconf pkgs.xfce.xfdesktop pkgs.xfce.xfwm4 diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index 91de910662f..c4fce3706dc 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -166,16 +166,19 @@ in services.xserver.displayManager = { xauthBin = mkOption { + internal = true; default = "${xorg.xauth}/bin/xauth"; description = "Path to the xauth program used by display managers."; }; xserverBin = mkOption { + type = types.path; default = "${xorg.xorgserver}/bin/X"; description = "Path to the X server used by display managers."; }; xserverArgs = mkOption { + type = types.listOf types.str; default = []; example = [ "-ac" "-logverbose" "-nolisten tcp" ]; description = "List of arguments for the X server."; @@ -183,16 +186,17 @@ in }; sessionCommands = mkOption { + type = types.lines; default = ""; example = '' xmessage "Hello World!" & ''; - type = types.string; description = "Shell commands executed just before the window or desktop manager is started."; }; desktopManagerHandlesLidAndPower = mkOption { + type = types.bool; default = true; description = '' Whether the display manager should prevent systemd from handling @@ -204,16 +208,17 @@ in session = mkOption { default = []; - example = [ - { - manage = "desktop"; - name = "xterm"; - start = " - ${pkgs.xterm}/bin/xterm -ls & - waitPID=$! - "; - } - ]; + example = literalExample + '' + [ { manage = "desktop"; + name = "xterm"; + start = ''' + ''${pkgs.xterm}/bin/xterm -ls & + waitPID=$! + '''; + } + ] + ''; description = '' List of sessions supported with the command used to start each session. Each session script can set the @@ -249,12 +254,13 @@ in }; execCmd = mkOption { - type = types.uniq types.string; + type = types.str; example = "${pkgs.slim}/bin/slim"; description = "Command to start the display manager."; }; environment = mkOption { + type = types.attrsOf types.unspecified; default = {}; example = { SLIM_CFGFILE = /etc/slim.conf; }; description = "Additional environment variables needed by the display manager."; diff --git a/nixos/modules/services/x11/display-managers/kdm.nix b/nixos/modules/services/x11/display-managers/kdm.nix index c03f7116454..c51e7edfddf 100644 --- a/nixos/modules/services/x11/display-managers/kdm.nix +++ b/nixos/modules/services/x11/display-managers/kdm.nix @@ -40,7 +40,7 @@ let [X-*-Greeter] HiddenUsers=root,nixbld1,nixbld2,nixbld3,nixbld4,nixbld5,nixbld6,nixbld7,nixbld8,nixbld9,nixbld10 PluginsLogin=${kdebase_workspace}/lib/kde4/kgreet_classic.so - ${optionalString (cfg.themeDirectory != "") + ${optionalString (cfg.themeDirectory != null) '' UseTheme=true Theme=${cfg.themeDirectory} @@ -78,6 +78,7 @@ in services.xserver.displayManager.kdm = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the KDE display manager. @@ -85,6 +86,7 @@ in }; enableXDMCP = mkOption { + type = types.bool; default = false; description = '' Whether to enable XDMCP, which allows remote logins. @@ -92,7 +94,8 @@ in }; themeDirectory = mkOption { - default = ""; + type = types.nullOr types.str; + default = null; description = '' The path to a KDM theme directory. This theme will be used by the KDM greeter. @@ -100,6 +103,7 @@ in }; setupScript = mkOption { + type = types.lines; default = ""; description = '' The path to a KDM setup script. This script is run as root just @@ -109,6 +113,7 @@ in }; extraConfig = mkOption { + type = types.lines; default = ""; description = '' Options appended to kdmrc, the @@ -128,7 +133,7 @@ in services.xserver.displayManager.slim.enable = false; services.xserver.displayManager.job = - { execCmd = mkFixStrictness + { execCmd = '' mkdir -m 0755 -p /var/lib/kdm chown kdm /var/lib/kdm diff --git a/nixos/modules/services/x11/display-managers/lightdm.nix b/nixos/modules/services/x11/display-managers/lightdm.nix index f4fb5ee003a..e4125891e6c 100644 --- a/nixos/modules/services/x11/display-managers/lightdm.nix +++ b/nixos/modules/services/x11/display-managers/lightdm.nix @@ -96,7 +96,7 @@ in logsXsession = true; # lightdm relaunches itself via just `lightdm`, so needs to be on the PATH - execCmd = mkFixStrictness '' + execCmd = '' export PATH=${lightdm}/sbin:$PATH ${lightdm}/sbin/lightdm --log-dir=/var/log --run-dir=/run --config=${lightdmConf} ''; diff --git a/nixos/modules/services/x11/display-managers/slim.nix b/nixos/modules/services/x11/display-managers/slim.nix index 01c9fa96c8c..35834ef3764 100644 --- a/nixos/modules/services/x11/display-managers/slim.nix +++ b/nixos/modules/services/x11/display-managers/slim.nix @@ -16,7 +16,7 @@ let login_cmd exec ${pkgs.stdenv.shell} ${dmcfg.session.script} "%session" halt_cmd ${config.systemd.package}/sbin/shutdown -h now reboot_cmd ${config.systemd.package}/sbin/shutdown -r now - ${optionalString (cfg.defaultUser != "") ("default_user " + cfg.defaultUser)} + ${optionalString (cfg.defaultUser != null) ("default_user " + cfg.defaultUser)} ${optionalString cfg.autoLogin "auto_login yes"} ''; @@ -45,6 +45,7 @@ in services.xserver.displayManager.slim = { enable = mkOption { + type = types.bool; default = config.services.xserver.enable; description = '' Whether to enable SLiM as the display manager. @@ -52,11 +53,14 @@ in }; theme = mkOption { + type = types.nullOr types.path; default = null; - example = pkgs.fetchurl { - url = http://download.berlios.de/slim/slim-wave.tar.gz; - sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy"; - }; + example = literalExample '' + pkgs.fetchurl { + url = http://download.berlios.de/slim/slim-wave.tar.gz; + sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy"; + } + ''; description = '' The theme for the SLiM login manager. If not specified, SLiM's default theme is used. See xorg.conf). @@ -299,12 +306,14 @@ in }; deviceSection = mkOption { + type = types.lines; default = ""; example = "VideoRAM 131072"; description = "Contents of the first Device section of the X server configuration file."; }; screenSection = mkOption { + type = types.lines; default = ""; example = '' Option "RandRRotation" "on" @@ -313,6 +322,7 @@ in }; monitorSection = mkOption { + type = types.lines; default = ""; example = "HorizSync 28-49"; description = "Contents of the first Monitor section of the X server configuration file."; @@ -334,6 +344,7 @@ in }; moduleSection = mkOption { + type = types.lines; default = ""; example = '' @@ -344,6 +355,7 @@ in }; serverLayoutSection = mkOption { + type = types.lines; default = ""; example = '' @@ -353,36 +365,40 @@ in }; extraDisplaySettings = mkOption { + type = types.lines; default = ""; example = "Virtual 2048 2048"; description = "Lines to be added to every Display subsection of the Screen section."; }; defaultDepth = mkOption { + type = types.int; default = 0; example = 8; description = "Default colour depth."; }; useXFS = mkOption { + # FIXME: what's the type of this option? default = false; example = "unix/:7100"; description = "Determines how to connect to the X Font Server."; }; tty = mkOption { + type = types.int; default = 7; - example = 9; description = "Virtual console for the X server."; }; display = mkOption { + type = types.int; default = 0; - example = 1; description = "Display number for the X server."; }; virtualScreen = mkOption { + type = types.nullOr types.attrs; default = null; example = { x = 2048; y = 2048; }; description = '' @@ -392,22 +408,26 @@ in }; - environment.x11Packages = mkOption { - default = []; - type = types.listOf types.package; - description = '' - List of packages added to the system when the X server is - activated (). - ''; - }; - }; ###### implementation - config = mkIf cfg.enable (checkAgent (checkPolkit { + config = mkIf cfg.enable { + + assertions = + [ { assertion = !(cfg.startOpenSSHAgent && cfg.startGnuPGAgent); + message = + '' + The OpenSSH agent and GnuPG agent cannot be started both. + Choose between `startOpenSSHAgent' and `startGnuPGAgent'. + ''; + } + { assertion = config.security.polkit.enable; + message = "X11 requires Polkit to be enabled (‘security.polkit.enable = true’)."; + } + ]; boot.extraModulePackages = optional (elem "nvidia" driverNames) kernelPackages.nvidia_x11 ++ @@ -450,7 +470,7 @@ in } ]); - environment.x11Packages = + environment.systemPackages = [ xorg.xorgserver xorg.xrandr xorg.xrdb @@ -471,8 +491,6 @@ in ++ optional (elem "virtualbox" driverNames) xorg.xrefresh ++ optional (elem "ati_unfree" driverNames) kernelPackages.ati_drivers_x11; - environment.systemPackages = config.environment.x11Packages; - environment.pathsToLink = [ "/etc/xdg" "/share/xdg" "/share/applications" "/share/icons" "/share/pixmaps" ]; @@ -653,7 +671,7 @@ in ${xrandrMonitorSections} ''; - })); + }; } diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix index ff3c844030b..e012c977164 100644 --- a/nixos/modules/system/activation/activation-script.nix +++ b/nixos/modules/system/activation/activation-script.nix @@ -52,7 +52,7 @@ in idempotent and fast. ''; - merge = mergeTypedOption "script" builtins.isAttrs (fold mergeAttrs {}); + type = types.attrsOf types.unspecified; # FIXME apply = set: { script = @@ -116,18 +116,10 @@ in mkdir -m 0755 -p /var/run/nix/current-load # for distributed builds mkdir -m 0700 -p /var/run/nix/remote-stores - # Directory holding symlinks to currently running Upstart - # jobs. Used to determine which jobs need to be restarted - # when switching to a new configuration. - mkdir -m 0700 -p /var/run/upstart-jobs - mkdir -m 0755 -p /var/log - touch /var/log/wtmp # must exist - chmod 644 /var/log/wtmp - - touch /var/log/lastlog - chmod 644 /var/log/lastlog + touch /var/log/wtmp /var/log/lastlog # must exist + chmod 644 /var/log/wtmp /var/log/lastlog mkdir -m 1777 -p /var/tmp diff --git a/nixos/modules/system/activation/no-clone.nix b/nixos/modules/system/activation/no-clone.nix index f15809e4d8b..c9ab691ce47 100644 --- a/nixos/modules/system/activation/no-clone.nix +++ b/nixos/modules/system/activation/no-clone.nix @@ -1,11 +1,9 @@ -# This configuration is not made to figure inside the module-list.nix to -# allow clone of the first level. {pkgs, ...}: with pkgs.lib; { - boot.loader.grub.device = mkOverrideTemplate 0 {} "nodev"; - nesting.children = mkOverrideTemplate 0 {} []; - nesting.clone = mkOverrideTemplate 0 {} []; + boot.loader.grub.device = mkOverride 0 "nodev"; + nesting.children = mkOverride 0 []; + nesting.clone = mkOverride 0 []; } diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index a04914bedaf..ada96131675 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -80,9 +80,9 @@ let # Putting it all together. This builds a store path containing # symlinks to the various parts of the built configuration (the - # kernel, the Upstart services, the init scripts, etc.) as well as a - # script `switch-to-configuration' that activates the configuration - # and makes it bootable. + # kernel, systemd units, init scripts, etc.) as well as a script + # `switch-to-configuration' that activates the configuration and + # makes it bootable. system = pkgs.stdenv.mkDerivation { name = "nixos-${config.system.nixosVersion}"; preferLocalBuild = true; @@ -92,23 +92,13 @@ let systemd = config.systemd.package; inherit children; - kernelParams = - config.boot.kernelParams ++ config.boot.extraKernelParams; + kernelParams = config.boot.kernelParams; installBootLoader = config.system.build.installBootLoader or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true"; activationScript = config.system.activationScripts.script; nixosVersion = config.system.nixosVersion; - jobs = map (j: j.name) (attrValues config.jobs); - - # Pass the names of all Upstart tasks to the activation script. - tasks = attrValues (mapAttrs (n: v: if v.task then ["[${v.name}]=1"] else []) config.jobs); - - # Pass the names of all Upstart jobs that shouldn't be restarted - # to the activation script. - noRestartIfChanged = attrValues (mapAttrs (n: v: if v.restartIfChanged then [] else ["[${v.name}]=1"]) config.jobs); - configurationName = config.boot.loader.grub.configurationName; # Needed by switch-to-configuration. @@ -155,13 +145,14 @@ in system.boot.loader.kernelFile = mkOption { internal = true; default = pkgs.stdenv.platform.kernelTarget; - type = types.uniq types.string; + type = types.str; description = '' Name of the kernel file to be passed to the bootloader. ''; }; system.copySystemConfiguration = mkOption { + type = types.bool; default = false; description = '' If enabled, copies the NixOS configuration file @@ -172,9 +163,9 @@ in }; system.extraSystemBuilderCmds = mkOption { + type = types.lines; internal = true; default = ""; - merge = concatStringsSep "\n"; description = '' This code will be added to the builder creating the system store path. ''; diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index 4ceabb20df5..006909fbd0c 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -24,7 +24,7 @@ in # We don't want to evaluate all of linuxPackages for the manual # - some of it might not even evaluate correctly. defaultText = "pkgs.linuxPackages"; - example = "pkgs.linuxPackages_2_6_25"; + example = literalExample "pkgs.linuxPackages_2_6_25"; description = '' This option allows you to override the Linux kernel used by NixOS. Since things like external kernel module packages are @@ -40,18 +40,9 @@ in }; boot.kernelParams = mkOption { + type = types.listOf types.str; default = [ ]; - description = '' - The kernel parameters. If you want to add additional - parameters, it's best to set - . - ''; - }; - - boot.extraKernelParams = mkOption { - default = [ ]; - example = [ "boot.trace" ]; - description = "Additional user-defined kernel parameters."; + description = "Parameters added to the kernel command line."; }; boot.consoleLogLevel = mkOption { @@ -65,6 +56,7 @@ in }; boot.vesa = mkOption { + type = types.bool; default = false; description = '' Whether to activate VESA video mode on boot. @@ -72,12 +64,14 @@ in }; boot.extraModulePackages = mkOption { + type = types.listOf types.path; default = []; - # !!! example = [pkgs.nvidia_x11]; + example = literalExample "[ pkgs.linuxPackages.nvidia_x11 ]"; description = "A list of additional packages supplying kernel modules."; }; boot.kernelModules = mkOption { + type = types.listOf types.str; default = []; description = '' The set of kernel modules to be loaded in the second stage of @@ -89,6 +83,7 @@ in }; boot.initrd.availableKernelModules = mkOption { + type = types.listOf types.str; default = []; example = [ "sata_nv" "ext3" ]; description = '' @@ -109,11 +104,13 @@ in }; boot.initrd.kernelModules = mkOption { + type = types.listOf types.str; default = []; description = "List of modules that are always loaded by the initrd."; }; system.modulesTree = mkOption { + type = types.listOf types.path; internal = true; default = []; description = '' @@ -121,7 +118,6 @@ in built outside of the kernel. Combine these into a single tree of symlinks because modprobe only supports one directory. ''; - merge = mergeListOption; # Convert the list of path to only one path. apply = pkgs.aggregateModules; }; diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index 955235da70f..8b3923e30a0 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -65,7 +65,7 @@ in device = mkOption { default = ""; example = "/dev/hda"; - type = types.uniq types.string; + type = types.str; description = '' The device on which the GRUB boot loader will be installed. The special value nodev means that a GRUB @@ -78,7 +78,7 @@ in devices = mkOption { default = []; example = [ "/dev/hda" ]; - type = types.listOf types.string; + type = types.listOf types.str; description = '' The devices on which the boot loader, GRUB, will be installed. Can be used instead of device to @@ -89,7 +89,7 @@ in configurationName = mkOption { default = ""; example = "Stable 2.6.21"; - type = types.uniq types.string; + type = types.str; description = '' GRUB entry name instead of default. ''; @@ -156,7 +156,7 @@ in extraFiles = mkOption { default = {}; example = literalExample '' - { "memtest.bin" = "${pkgs.memtest86plus}/memtest.bin"; } + { "memtest.bin" = "''${pkgs.memtest86plus}/memtest.bin"; } ''; description = '' A set of files to be copied to /boot. @@ -236,7 +236,7 @@ in system.build.installBootLoader = if cfg.devices == [] then - throw "You must set the ‘boot.loader.grub.device’ option to make the system bootable." + throw "You must set the option ‘boot.loader.grub.device’ to make the system bootable." else "PERL5LIB=${makePerlPath [ pkgs.perlPackages.XMLLibXML pkgs.perlPackages.XMLSAX ]} " + "${pkgs.perl}/bin/perl ${./install-grub.pl} ${grubConfig}"; @@ -247,7 +247,7 @@ in # set at once. system.boot.loader.id = "grub"; - environment.systemPackages = [ grub ]; + environment.systemPackages = optional (grub != null) grub; boot.loader.grub.extraPrepareConfig = concatStrings (mapAttrsToList (n: v: '' diff --git a/nixos/modules/system/boot/loader/grub/memtest.nix b/nixos/modules/system/boot/loader/grub/memtest.nix index a0726c01e20..80c1a160cfd 100644 --- a/nixos/modules/system/boot/loader/grub/memtest.nix +++ b/nixos/modules/system/boot/loader/grub/memtest.nix @@ -23,7 +23,7 @@ in config = mkIf config.boot.loader.grub.memtest86 { - boot.loader.grub.extraEntries = mkFixStrictness ( + boot.loader.grub.extraEntries = if config.boot.loader.grub.version == 2 then '' menuentry "Memtest86+" { @@ -31,7 +31,7 @@ in } '' else - throw "Memtest86+ is not supported with GRUB 1."); + throw "Memtest86+ is not supported with GRUB 1."; boot.loader.grub.extraFiles."memtest.bin" = "${memtest86}/memtest.bin"; diff --git a/nixos/modules/system/boot/modprobe.nix b/nixos/modules/system/boot/modprobe.nix index 8b2762e2526..39928da8d19 100644 --- a/nixos/modules/system/boot/modprobe.nix +++ b/nixos/modules/system/boot/modprobe.nix @@ -36,6 +36,7 @@ with pkgs.lib; }; boot.blacklistedKernelModules = mkOption { + type = types.listOf types.str; default = []; example = [ "cirrusfb" "i2c_piix4" ]; description = '' diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh index e3e07c08580..1f65026b5de 100644 --- a/nixos/modules/system/boot/stage-1-init.sh +++ b/nixos/modules/system/boot/stage-1-init.sh @@ -168,7 +168,7 @@ if test -e /sys/power/tuxonice/resume; then fi fi -if test -e /sys/power/resume -a -e /sys/power/disk; then +if test -n "@resumeDevice@" -a -e /sys/power/resume -a -e /sys/power/disk; then echo "@resumeDevice@" > /sys/power/resume 2> /dev/null || echo "failed to resume..." echo shutdown > /sys/power/disk fi diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index 3836d639513..b2b66280372 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -229,51 +229,53 @@ in options = { boot.resumeDevice = mkOption { - default = ""; - example = "0:0"; - description = " - Device for manual resume attempt during boot. Looks like - major:minor. ls -l /dev/SWAP_PARTION shows them. - "; + type = types.nullOr types.str; + default = null; + example = "8:2"; + description = '' + Device for manual resume attempt during boot, specified using + the device's major and minor number as + major:minor. + ''; }; boot.initrd.checkJournalingFS = mkOption { default = true; type = types.bool; description = '' - Whether to run fsck on journaling filesystems such as ext3. + Whether to run fsck on journaling filesystems such as ext3. ''; }; boot.initrd.mdadmConf = mkOption { default = ""; - type = with types; string; + type = types.lines; description = '' - Contents of /etc/mdadm.conf at initrd. + Contents of /etc/mdadm.conf in stage 1. ''; }; boot.initrd.preLVMCommands = mkOption { default = ""; - type = with types; string; + type = types.lines; description = '' - Shell commands to be executed immediately before lvm discovery. + Shell commands to be executed immediately before LVM discovery. ''; }; boot.initrd.postDeviceCommands = mkOption { default = ""; - type = with types; string; + type = types.lines; description = '' Shell commands to be executed immediately after stage 1 of the boot has loaded kernel modules and created device nodes in - /dev. + /dev. ''; }; boot.initrd.postMountCommands = mkOption { default = ""; - type = with types; string; + type = types.lines; description = '' Shell commands to be executed immediately after the stage 1 filesystems have been mounted. @@ -283,7 +285,7 @@ in boot.initrd.extraUtilsCommands = mkOption { internal = true; default = ""; - type = with types; string; + type = types.lines; description = '' Shell commands to be executed in the builder of the extra-utils derivation. This can be used to provide @@ -294,7 +296,7 @@ in boot.initrd.extraUtilsCommandsTest = mkOption { internal = true; default = ""; - type = with types; string; + type = types.lines; description = '' Shell commands to be executed in the builder of the extra-utils derivation after patchelf has done its @@ -304,12 +306,10 @@ in }; boot.initrd.compressor = mkOption { + internal = true; default = "gzip -9"; - - type = types.string; - - description = "The compressor to use on the initrd"; - + type = types.str; + description = "The compressor to use on the initrd image."; example = "xz"; }; diff --git a/nixos/modules/system/boot/stage-2.nix b/nixos/modules/system/boot/stage-2.nix index ff17535e418..aa0d7e0c138 100644 --- a/nixos/modules/system/boot/stage-2.nix +++ b/nixos/modules/system/boot/stage-2.nix @@ -43,7 +43,7 @@ in postBootCommands = mkOption { default = ""; example = "rm -f /var/log/messages"; - type = types.string; + type = types.lines; description = '' Shell commands to be executed just before systemd is started. ''; @@ -52,7 +52,7 @@ in devSize = mkOption { default = "5%"; example = "32m"; - type = types.uniq types.string; + type = types.str; description = '' Size limit for the /dev tmpfs. Look at mount(8), tmpfs size option, for the accepted syntax. @@ -62,7 +62,7 @@ in devShmSize = mkOption { default = "50%"; example = "256m"; - type = types.uniq types.string; + type = types.str; description = '' Size limit for the /dev/shm tmpfs. Look at mount(8), tmpfs size option, for the accepted syntax. @@ -72,7 +72,7 @@ in runSize = mkOption { default = "25%"; example = "256m"; - type = types.uniq types.string; + type = types.str; description = '' Size limit for the /run tmpfs. Look at mount(8), tmpfs size option, for the accepted syntax. @@ -80,10 +80,10 @@ in }; cleanTmpDir = mkOption { + type = types.bool; default = false; - example = true; description = '' - Delete all files in /tmp/ during boot. + Whether to delete all files in /tmp during boot. ''; }; diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix index dfb9036ab4d..a1faea886f9 100644 --- a/nixos/modules/system/boot/systemd-unit-options.nix +++ b/nixos/modules/system/boot/systemd-unit-options.nix @@ -2,13 +2,25 @@ with pkgs.lib; -rec { +let + + checkService = v: + let assertValueOneOf = name: values: attr: + let val = getAttr name attr; + in optional ( hasAttr name attr && !elem val values) "Systemd service field `${name}' cannot have value `${val}'."; + checkType = assertValueOneOf "Type" ["simple" "forking" "oneshot" "dbus" "notify" "idle"]; + checkRestart = assertValueOneOf "Restart" ["no" "on-success" "on-failure" "on-abort" "always"]; + errors = concatMap (c: c v) [checkType checkRestart]; + in if errors == [] then true + else builtins.trace (concatStringsSep "\n" errors) false; + +in rec { unitOptions = { enable = mkOption { default = true; - types = types.bool; + type = types.bool; description = '' If set to false, this unit will be a symlink to /dev/null. This is primarily useful to prevent specific @@ -19,13 +31,13 @@ rec { description = mkOption { default = ""; - types = types.uniq types.string; + type = types.str; description = "Description of this unit used in systemd messages and progress indicators."; }; requires = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = '' Start the specified units when this unit is started, and stop this unit when the specified units are stopped or fail. @@ -34,7 +46,7 @@ rec { wants = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = '' Start the specified units when this unit is started. ''; @@ -42,7 +54,7 @@ rec { after = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = '' If the specified units are started at the same time as this unit, delay this unit until they have started. @@ -51,7 +63,7 @@ rec { before = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = '' If the specified units are started at the same time as this unit, delay them until this unit has started. @@ -60,7 +72,7 @@ rec { bindsTo = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = '' Like ‘requires’, but in addition, if the specified units unexpectedly disappear, this unit will be stopped as well. @@ -69,7 +81,7 @@ rec { partOf = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = '' If the specified units are stopped or restarted, then this unit is stopped or restarted as well. @@ -78,7 +90,7 @@ rec { conflicts = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = '' If the specified units are started, then this unit is stopped and vice versa. @@ -87,13 +99,13 @@ rec { requiredBy = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = "Units that require (i.e. depend on and need to go down with) this unit."; }; wantedBy = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = "Units that want (i.e. depend on) this unit."; }; @@ -147,33 +159,23 @@ rec { { StartLimitInterval = 10; RestartSec = 5; }; - type = types.attrs; + type = types.addCheck types.attrs checkService; description = '' Each attribute in this set specifies an option in the [Service] section of the unit. See systemd.service 5 for details. ''; - - check = v: - let assertValueOneOf = name: values: attr: - let val = getAttr name attr; - in optional ( hasAttr name attr && !elem val values) "${name} ${val} not known to systemd"; - checkType = assertValueOneOf "Type" ["simple" "forking" "oneshot" "dbus" "notify" "idle"]; - checkRestart = assertValueOneOf "Restart" ["no" "on-success" "on-failure" "on-abort" "always"]; - errors = concatMap (c: c v) [checkType checkRestart]; - in if errors == [] then true - else builtins.trace (concatStringsSep "\n" errors) false; }; script = mkOption { - type = types.uniq types.string; + type = types.str; default = ""; description = "Shell commands executed as the service's main process."; }; scriptArgs = mkOption { - type = types.uniq types.string; + type = types.str; default = ""; description = "Arguments passed to the main process script."; }; @@ -230,7 +232,7 @@ rec { }; startAt = mkOption { - type = types.uniq types.string; + type = types.str; default = ""; example = "Sun 14:00:00"; description = '' @@ -250,7 +252,7 @@ rec { listenStreams = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; example = [ "0.0.0.0:993" "/run/my-socket" ]; description = '' For each item in this list, a ListenStream @@ -296,13 +298,13 @@ rec { what = mkOption { example = "/dev/sda1"; - type = types.uniq types.string; + type = types.str; description = "Absolute path of device node, file or other resource. (Mandatory)"; }; where = mkOption { example = "/mnt"; - type = types.uniq types.string; + type = types.str; description = '' Absolute path of a directory of the mount point. Will be created if it doesn't exist. (Mandatory) @@ -312,15 +314,14 @@ rec { type = mkOption { default = ""; example = "ext4"; - type = types.uniq types.string; + type = types.str; description = "File system type."; }; options = mkOption { default = ""; example = "noatime"; - type = types.string; - merge = concatStringsSep ","; + type = types.commas; description = "Options used to mount the file system."; }; @@ -341,7 +342,7 @@ rec { where = mkOption { example = "/mnt"; - type = types.uniq types.string; + type = types.str; description = '' Absolute path of a directory of the mount point. Will be created if it doesn't exist. (Mandatory) diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index a5e1165574c..c1fb2c45165 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -389,12 +389,12 @@ in type = types.attrsOf types.optionSet; options = { text = mkOption { - types = types.uniq types.string; + type = types.str; description = "Text of this systemd unit."; }; enable = mkOption { default = true; - types = types.bool; + type = types.bool; description = '' If set to false, this unit will be a symlink to /dev/null. This is primarily useful to prevent specific @@ -404,12 +404,12 @@ in }; requiredBy = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = "Units that require (i.e. depend on and need to go down with) this unit."; }; wantedBy = mkOption { default = []; - types = types.listOf types.string; + type = types.listOf types.string; description = "Units that want (i.e. depend on) this unit."; }; }; @@ -473,7 +473,7 @@ in systemd.defaultUnit = mkOption { default = "multi-user.target"; - type = types.uniq types.string; + type = types.str; description = "Default unit started when the system boots."; }; @@ -488,13 +488,13 @@ in services.journald.console = mkOption { default = ""; - type = types.uniq types.string; + type = types.str; description = "If non-empty, write log messages to the specified TTY device."; }; services.journald.rateLimitInterval = mkOption { default = "10s"; - type = types.uniq types.string; + type = types.str; description = '' Configures the rate limiting interval that is applied to all messages generated on the system. This rate limiting is applied @@ -518,7 +518,7 @@ in services.logind.extraConfig = mkOption { default = ""; - type = types.uniq types.string; + type = types.str; example = "HandleLidSwitch=ignore"; description = '' Extra config options for systemd-logind. See man logind.conf for diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix index 91fcdcf2435..a8f0a59b6fa 100644 --- a/nixos/modules/system/etc/etc.nix +++ b/nixos/modules/system/etc/etc.nix @@ -32,13 +32,14 @@ in environment.etc = mkOption { type = types.loaOf types.optionSet; default = {}; - example = + example = literalExample '' { hosts = { source = "/nix/store/.../etc/dir/file.conf.example"; mode = "0440"; }; "default/useradd".text = "GROUP=100 ..."; - }; + } + ''; description = '' Set of files that have to be linked in /etc. ''; @@ -56,6 +57,7 @@ in }; target = mkOption { + type = types.str; description = '' Name of symlink (relative to /etc). Defaults to the attribute @@ -65,16 +67,17 @@ in text = mkOption { default = null; - type = types.nullOr types.string; + type = types.nullOr types.lines; description = "Text of the file."; }; source = mkOption { - types = types.path; + type = types.path; description = "Path of the source file."; }; mode = mkOption { + type = types.str; default = "symlink"; example = "0600"; description = '' diff --git a/nixos/modules/system/upstart/upstart.nix b/nixos/modules/system/upstart/upstart.nix index 5d5139b7a57..aa5c8dfe64b 100644 --- a/nixos/modules/system/upstart/upstart.nix +++ b/nixos/modules/system/upstart/upstart.nix @@ -104,33 +104,34 @@ let name = mkOption { # !!! The type should ensure that this could be a filename. - type = types.string; + type = types.str; example = "sshd"; description = '' - Name of the Upstart job. + Name of the job, mapped to the systemd unit + name.service. ''; }; startOn = mkOption { - # !!! Re-enable this once we're on Upstart >= 0.6. - #type = types.string; + #type = types.str; default = ""; description = '' - The Upstart event that triggers this job to be started. - If empty, the job will not start automatically. + The Upstart event that triggers this job to be started. Some + are mapped to systemd dependencies; otherwise you will get a + warning. If empty, the job will not start automatically. ''; }; stopOn = mkOption { - type = types.string; + type = types.str; default = "starting shutdown"; description = '' - The Upstart event that triggers this job to be stopped. + Ignored; this was the Upstart event that triggers this job to be stopped. ''; }; postStart = mkOption { - type = types.string; + type = types.lines; default = ""; description = '' Shell commands executed after the job is started (i.e. after @@ -140,17 +141,17 @@ let }; preStop = mkOption { - type = types.string; + type = types.lines; default = ""; description = '' Shell commands executed before the job is stopped - (i.e. before Upstart kills the job's main process). This can + (i.e. before systemd kills the job's main process). This can be used to cleanly shut down a daemon. ''; }; postStop = mkOption { - type = types.string; + type = types.lines; default = ""; description = '' Shell commands executed after the job has stopped @@ -159,7 +160,7 @@ let }; exec = mkOption { - type = types.string; + type = types.str; default = ""; description = '' Command to start the job's main process. If empty, the @@ -189,10 +190,10 @@ let }; daemonType = mkOption { - type = types.string; + type = types.str; default = "none"; description = '' - Determines how Upstart detects when a daemon should be + Determines how systemd detects when a daemon should be considered “running”. The value none means that the daemon is considered ready immediately. The value fork means that the daemon will fork once. @@ -203,8 +204,7 @@ let }; setuid = mkOption { - type = types.string; - check = userExists; + type = types.addCheck types.str userExists; default = ""; description = '' Run the daemon as a different user. @@ -212,8 +212,7 @@ let }; setgid = mkOption { - type = types.string; - check = groupExists; + type = types.addCheck types.str groupExists; default = ""; description = '' Run the daemon as a different group. @@ -246,7 +245,7 @@ let config = { # The default name is the name extracted from the attribute path. - name = mkDefaultValue name; + name = mkDefault name; }; @@ -263,8 +262,13 @@ in jobs = mkOption { default = {}; description = '' - This option defines the system jobs started and managed by the - Upstart daemon. + This option is a legacy method to define system services, + dating from the era where NixOS used Upstart instead of + systemd. You should use + instead. Services defined using are + mapped automatically to , but + may not work perfectly; in particular, most + conditions are not supported. ''; type = types.loaOf types.optionSet; options = [ jobOptions upstartJob ]; diff --git a/nixos/modules/tasks/cpu-freq.nix b/nixos/modules/tasks/cpu-freq.nix index 3b21d831087..ce36a8bab09 100644 --- a/nixos/modules/tasks/cpu-freq.nix +++ b/nixos/modules/tasks/cpu-freq.nix @@ -8,9 +8,9 @@ with pkgs.lib; options = { powerManagement.cpuFreqGovernor = mkOption { - default = ""; + type = types.nullOr types.str; + default = null; example = "ondemand"; - type = types.uniq types.string; description = '' Configure the governor used to regulate the frequence of the available CPUs. By default, the kernel configures the @@ -23,7 +23,7 @@ with pkgs.lib; ###### implementation - config = mkIf (config.powerManagement.cpuFreqGovernor != "") { + config = mkIf (config.powerManagement.cpuFreqGovernor != null) { environment.systemPackages = [ pkgs.cpufrequtils ]; diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix index 4ca309f5a10..3f484045ed4 100644 --- a/nixos/modules/tasks/filesystems.nix +++ b/nixos/modules/tasks/filesystems.nix @@ -15,7 +15,7 @@ let mountPoint = mkOption { example = "/mnt/usb"; - type = types.uniq types.string; + type = types.str; description = "Location of the mounted the file system."; }; @@ -36,15 +36,14 @@ let fsType = mkOption { default = "auto"; example = "ext3"; - type = types.uniq types.string; + type = types.str; description = "Type of the file system."; }; options = mkOption { default = "defaults,relatime"; example = "data=journal"; - type = types.string; - merge = pkgs.lib.concatStringsSep ","; + type = types.commas; description = "Options used to mount the file system."; }; @@ -95,14 +94,14 @@ in options = [ fileSystemOpts ]; description = '' The file systems to be mounted. It must include an entry for - the root directory (mountPoint = \"/\"). Each + the root directory (mountPoint = "/"). Each entry in the list is an attribute set with the following fields: mountPoint, device, fsType (a file system type recognised by mount; defaults to - \"auto\"), and options + "auto"), and options (the mount options passed to mount using the - flag; defaults to \"defaults\"). + flag; defaults to "defaults"). Instead of specifying device, you can also specify a volume label (label) for file diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix index c1955b14691..efd546f3baa 100644 --- a/nixos/modules/tasks/filesystems/zfs.nix +++ b/nixos/modules/tasks/filesystems/zfs.nix @@ -55,11 +55,12 @@ in cp -v ${kernel.zfs}/sbin/zfs $out/bin cp -v ${kernel.zfs}/sbin/zdb $out/bin cp -v ${kernel.zfs}/sbin/zpool $out/bin + cp -pdv ${kernel.zfs}/lib/lib*.so* $out/lib + cp -pdv ${pkgs.zlib}/lib/lib*.so* $out/lib ''; postDeviceCommands = '' zpool import -f -a -d /dev - zfs mount -a ''; }; diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 0177d6396df..d8522b6abba 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -14,14 +14,14 @@ let name = mkOption { example = "eth0"; - type = types.string; + type = types.str; description = "Name of the interface."; }; ipAddress = mkOption { default = null; example = "10.0.0.1"; - type = types.nullOr types.string; + type = types.nullOr (types.str); description = '' IP address of the interface. Leave empty to configure the interface using DHCP. @@ -41,7 +41,7 @@ let subnetMask = mkOption { default = ""; example = "255.255.255.0"; - type = types.string; + type = types.str; description = '' Subnet mask of the interface, specified as a bitmask. This is deprecated; use @@ -52,7 +52,7 @@ let macAddress = mkOption { default = null; example = "00:11:22:33:44:55"; - type = types.nullOr types.string; + type = types.nullOr (types.str); description = '' MAC address of the interface. Leave empty to use the default. ''; @@ -72,7 +72,7 @@ let virtualOwner = mkOption { default = "root"; - type = types.uniq types.string; + type = types.str; description = '' In case of a virtual device, the user who owns it. ''; @@ -220,8 +220,8 @@ in }; networking.useDHCP = mkOption { + type = types.bool; default = true; - merge = mergeEnableOption; description = '' Whether to use DHCP to obtain an IP address and other configuration for all network interfaces that are not manually @@ -427,7 +427,7 @@ in # Set the host and domain names in the activation script. Don't # clear it if it's not configured in the NixOS configuration, - # since it may have been set by dhclient in the meantime. + # since it may have been set by dhcpcd in the meantime. system.activationScripts.hostname = optionalString (config.networking.hostName != "") '' hostname "${config.networking.hostName}" diff --git a/nixos/modules/tasks/scsi-link-power-management.nix b/nixos/modules/tasks/scsi-link-power-management.nix index 4ab67aee395..4927952080f 100644 --- a/nixos/modules/tasks/scsi-link-power-management.nix +++ b/nixos/modules/tasks/scsi-link-power-management.nix @@ -10,7 +10,7 @@ with pkgs.lib; powerManagement.scsiLinkPolicy = mkOption { default = ""; example = "min_power"; - type = types.uniq types.string; + type = types.str; description = '' Configure the SCSI link power management policy. By default, the kernel configures "max_performance". diff --git a/nixos/modules/virtualisation/amazon-image.nix b/nixos/modules/virtualisation/amazon-image.nix index 7e04f0d2911..cfc582170e6 100644 --- a/nixos/modules/virtualisation/amazon-image.nix +++ b/nixos/modules/virtualisation/amazon-image.nix @@ -40,10 +40,10 @@ with pkgs.lib; # Register the paths in the Nix database. printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ - chroot /mnt ${config.environment.nix}/bin/nix-store --load-db + chroot /mnt ${config.nix.package}/bin/nix-store --load-db # Create the system profile to allow nixos-rebuild to work. - chroot /mnt ${config.environment.nix}/bin/nix-env \ + chroot /mnt ${config.nix.package}/bin/nix-env \ -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} # `nixos-rebuild' requires an /etc/NIXOS. diff --git a/nixos/modules/virtualisation/ec2-data.nix b/nixos/modules/virtualisation/ec2-data.nix index fccf45e0e19..5133a98cd96 100644 --- a/nixos/modules/virtualisation/ec2-data.nix +++ b/nixos/modules/virtualisation/ec2-data.nix @@ -1,5 +1,5 @@ -# This module defines an Upstart job that obtains the SSH key and host -# name of virtual machines running on Amazon EC2, Eucalyptus and +# This module defines a systemd service that obtains the SSH key and +# host name of virtual machines running on Amazon EC2, Eucalyptus and # OpenStack Compute (Nova). { config, pkgs, ... }: diff --git a/nixos/modules/virtualisation/libvirtd.nix b/nixos/modules/virtualisation/libvirtd.nix index 280143d4e3f..d3884a503bc 100644 --- a/nixos/modules/virtualisation/libvirtd.nix +++ b/nixos/modules/virtualisation/libvirtd.nix @@ -1,4 +1,4 @@ -# Upstart jobs for libvirtd. +# Systemd services for libvirtd. { config, pkgs, ... }: @@ -122,9 +122,6 @@ in wants = [ "libvirtd.service" ]; after = [ "libvirtd.service" ]; - # We want to suspend VMs only on shutdown, but Upstart is broken. - #stopOn = ""; - restartIfChanged = false; path = [ pkgs.gettext pkgs.libvirt pkgs.gawk ]; diff --git a/nixos/modules/virtualisation/nova-image.nix b/nixos/modules/virtualisation/nova-image.nix index ab625dba11d..5c9481b7127 100644 --- a/nixos/modules/virtualisation/nova-image.nix +++ b/nixos/modules/virtualisation/nova-image.nix @@ -46,10 +46,10 @@ with pkgs.lib; # Register the paths in the Nix database. printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ - chroot /mnt ${config.environment.nix}/bin/nix-store --load-db + chroot /mnt ${config.nix.package}/bin/nix-store --load-db # Create the system profile to allow nixos-rebuild to work. - chroot /mnt ${config.environment.nix}/bin/nix-env \ + chroot /mnt ${config.nix.package}/bin/nix-env \ -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} # `nixos-rebuild' requires an /etc/NIXOS. diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 708b462e0e5..2218e1045eb 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -273,7 +273,7 @@ in config = { - boot.loader.grub.device = mkOverride 50 "/dev/vda"; + boot.loader.grub.device = mkVMOverride "/dev/vda"; boot.initrd.supportedFilesystems = optional cfg.writableStore "unionfs-fuse"; @@ -329,7 +329,7 @@ in boot.postBootCommands = '' if [[ "$(cat /proc/cmdline)" =~ regInfo=([^ ]*) ]]; then - ${config.environment.nix}/bin/nix-store --load-db < ''${BASH_REMATCH[1]} + ${config.nix.package}/bin/nix-store --load-db < ''${BASH_REMATCH[1]} fi ''; @@ -337,13 +337,13 @@ in virtualisation.qemu.options = [ "-vga std" "-usbdevice tablet" ]; - # Mount the host filesystem via 9P, and bind-mount the Nix store of - # the host into our own filesystem. We use mkOverride to allow this - # module to be applied to "normal" NixOS system configuration, where - # the regular value for the `fileSystems' attribute should be - # disregarded for the purpose of building a VM test image (since - # those filesystems don't exist in the VM). - fileSystems = mkOverride 10 + # Mount the host filesystem via 9P, and bind-mount the Nix store + # of the host into our own filesystem. We use mkVMOverride to + # allow this module to be applied to "normal" NixOS system + # configuration, where the regular value for the `fileSystems' + # attribute should be disregarded for the purpose of building a VM + # test image (since those filesystems don't exist in the VM). + fileSystems = mkVMOverride { "/".device = "/dev/vda"; "/nix/store" = { device = "store"; @@ -371,7 +371,8 @@ in }; }; - swapDevices = mkOverride 50 [ ]; + swapDevices = mkVMOverride [ ]; + boot.initrd.luks.devices = mkVMOverride []; # Don't run ntpd in the guest. It should get the correct time from KVM. services.ntp.enable = false; @@ -385,10 +386,10 @@ in # When building a regular system configuration, override whatever # video driver the host uses. - services.xserver.videoDriver = mkOverride 50 null; - services.xserver.videoDrivers = mkOverride 50 [ "vesa" ]; - services.xserver.defaultDepth = mkOverride 50 0; - services.xserver.resolutions = mkOverride 50 [ { x = 1024; y = 768; } ]; + services.xserver.videoDriver = mkVMOverride null; + services.xserver.videoDrivers = mkVMOverride [ "vesa" ]; + services.xserver.defaultDepth = mkVMOverride 0; + services.xserver.resolutions = mkVMOverride [ { x = 1024; y = 768; } ]; services.xserver.monitorSection = '' # Set a higher refresh rate so that resolutions > 800x600 work. @@ -397,7 +398,7 @@ in ''; # Wireless won't work in the VM. - networking.wireless.enable = mkOverride 50 false; + networking.wireless.enable = mkVMOverride false; system.requiredKernelConfig = with config.lib.kernelConfig; [ (isEnabled "VIRTIO_BLK") diff --git a/nixos/modules/virtualisation/virtualbox-image.nix b/nixos/modules/virtualisation/virtualbox-image.nix index e1b6def8edb..beed36b6a51 100644 --- a/nixos/modules/virtualisation/virtualbox-image.nix +++ b/nixos/modules/virtualisation/virtualbox-image.nix @@ -49,14 +49,14 @@ with pkgs.lib; echo "filling Nix store..." mkdir -p /mnt/nix/store set -f - cp -prvd $storePaths /mnt/nix/store/ + cp -prd $storePaths /mnt/nix/store/ # Register the paths in the Nix database. printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \ - chroot /mnt ${config.environment.nix}/bin/nix-store --load-db + chroot /mnt ${config.nix.package}/bin/nix-store --load-db # Create the system profile to allow nixos-rebuild to work. - chroot /mnt ${config.environment.nix}/bin/nix-env \ + chroot /mnt ${config.nix.package}/bin/nix-env \ -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} # `nixos-rebuild' requires an /etc/NIXOS. diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix index 6866c709dd4..dccc3acbf46 100644 --- a/nixos/release-combined.nix +++ b/nixos/release-combined.nix @@ -1,5 +1,6 @@ { nixpkgs ? { outPath = ./..; revCount = 5678; shortRev = "gfedcba"; } , officialRelease ? false +, stableBranch ? false }: let @@ -17,7 +18,7 @@ let in rec { nixos = removeMaintainers (import ./release.nix { - inherit officialRelease; + inherit officialRelease stableBranch; nixpkgs = nixpkgsSrc; }); @@ -37,13 +38,13 @@ in rec { constituents = let all = x: [ x.x86_64-linux x.i686-linux ]; in [ nixos.channel - nixos.manual + (all nixos.manual) (all nixos.iso_minimal) (all nixos.iso_graphical) (all nixos.ova) - (all nixos.tests.efi-installer.simple) + #(all nixos.tests.efi-installer.simple) (all nixos.tests.firefox) (all nixos.tests.firewall) (all nixos.tests.installer.grub1) diff --git a/nixos/release.nix b/nixos/release.nix index 866a992f79a..1ffb334d90a 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -12,8 +12,12 @@ let systems = [ "x86_64-linux" "i686-linux" ]; + forAllSystems = pkgs.lib.genAttrs systems; + pkgs = import nixpkgs { system = "x86_64-linux"; }; + lib = pkgs.lib; + versionModule = { system.nixosVersionSuffix = versionSuffix; @@ -109,23 +113,23 @@ in rec { }; - manual = iso_minimal.x86_64-linux.config.system.build.manual.manual; - manpages = iso_minimal.x86_64-linux.config.system.build.manual.manpages; + manual = forAllSystems (system: (builtins.getAttr system iso_minimal).config.system.build.manual.manual); + manpages = forAllSystems (system: (builtins.getAttr system iso_minimal).config.system.build.manual.manpages); - iso_minimal = pkgs.lib.genAttrs systems (system: makeIso { + iso_minimal = forAllSystems (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-minimal.nix; type = "minimal"; inherit system; }); - iso_minimal_new_kernel = pkgs.lib.genAttrs systems (system: makeIso { + iso_minimal_new_kernel = forAllSystems (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-minimal-new-kernel.nix; type = "minimal-new-kernel"; inherit system; }); - iso_graphical = pkgs.lib.genAttrs systems (system: makeIso { + iso_graphical = forAllSystems (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-graphical.nix; type = "graphical"; inherit system; @@ -133,7 +137,7 @@ in rec { # A variant with a more recent (but possibly less stable) kernel # that might support more hardware. - iso_new_kernel = pkgs.lib.genAttrs systems (system: makeIso { + iso_new_kernel = forAllSystems (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-new-kernel.nix; type = "new-kernel"; inherit system; @@ -141,7 +145,7 @@ in rec { # A variant with efi booting support. Once cd-minimal has a newer kernel, # this should be enabled by default. - iso_efi = pkgs.lib.genAttrs systems (system: makeIso { + iso_efi = forAllSystems (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-efi.nix; type = "efi"; maintainers = [ "shlevy" ]; @@ -150,7 +154,7 @@ in rec { # A bootable VirtualBox virtual appliance as an OVA file (i.e. packaged OVF). - ova = pkgs.lib.genAttrs systems (system: + ova = forAllSystems (system: with import nixpkgs { inherit system; }; @@ -186,7 +190,7 @@ in rec { # boot that system from uboot (like for the sheevaplug). # The pc variant helps preparing the expression for the system tarball # in a machine faster than the sheevpalug - system_tarball_pc = pkgs.lib.genAttrs systems (system: makeSystemTarball { + system_tarball_pc = forAllSystems (system: makeSystemTarball { module = ./modules/installer/cd-dvd/system-tarball-pc.nix; inherit system; }); @@ -211,7 +215,7 @@ in rec { # Run the tests in ./tests/default.nix for each platform. You can # run a test by doing e.g. "nix-build -A tests.login.x86_64-linux". tests = - with pkgs.lib; + with lib; let testsFor = system: mapAttrsRecursiveCond (x: !x ? test) (n: v: listToAttrs [(nameValuePair system v.test)]) diff --git a/nixos/tests/bittorrent.nix b/nixos/tests/bittorrent.nix index 180da8267e0..6e67edb0b82 100644 --- a/nixos/tests/bittorrent.nix +++ b/nixos/tests/bittorrent.nix @@ -40,7 +40,7 @@ in { environment.systemPackages = [ pkgs.miniupnpd ]; virtualisation.vlans = [ 1 2 ]; networking.nat.enable = true; - networking.nat.internalIPs = "192.168.2.0/24"; + networking.nat.internalIPs = [ "192.168.2.0/24" ]; networking.nat.externalInterface = "eth1"; }; diff --git a/nixos/tests/check-filesystems.nix b/nixos/tests/check-filesystems.nix index 39e8883ee59..09401f9a3f4 100644 --- a/nixos/tests/check-filesystems.nix +++ b/nixos/tests/check-filesystems.nix @@ -40,7 +40,7 @@ rec { device = "share:/repos2"; fsType = "nfs"; }; - in pkgs.lib.mkOverrideTemplate 50 {} [ + in pkgs.lib.mkVMOverride [ repos1 repos1 # check remount repos2 # check after remount diff --git a/nixos/tests/installer.nix b/nixos/tests/installer.nix index bebd6c04374..865b21d2444 100644 --- a/nixos/tests/installer.nix +++ b/nixos/tests/installer.nix @@ -14,7 +14,7 @@ let [ ../modules/installer/cd-dvd/installation-cd-graphical.nix ../modules/testing/test-instrumentation.nix { key = "serial"; - boot.loader.grub.timeout = mkOverrideTemplate 0 {} 0; + boot.loader.grub.timeout = mkOverride 0 0; # The test cannot access the network, so any sources we # need must be included in the ISO. diff --git a/nixos/tests/nat.nix b/nixos/tests/nat.nix index 55d87ed4fa1..a13714d60a9 100644 --- a/nixos/tests/nat.nix +++ b/nixos/tests/nat.nix @@ -20,7 +20,7 @@ { config, pkgs, ... }: { virtualisation.vlans = [ 2 1 ]; networking.nat.enable = true; - networking.nat.internalIPs = "192.168.1.0/24"; + networking.nat.internalIPs = [ "192.168.1.0/24" ]; networking.nat.externalInterface = "eth1"; }; diff --git a/nixos/tests/nfs.nix b/nixos/tests/nfs.nix index ee65c298dd0..51abf57e1b7 100644 --- a/nixos/tests/nfs.nix +++ b/nixos/tests/nfs.nix @@ -6,7 +6,7 @@ let client = { config, pkgs, ... }: - { fileSystems = pkgs.lib.mkOverride 50 + { fileSystems = pkgs.lib.mkVMOverride [ { mountPoint = "/data"; device = "server:${if version == 4 then "/" else "/data"}"; fsType = "nfs"; diff --git a/nixos/tests/tomcat.nix b/nixos/tests/tomcat.nix index c25276aa424..6bc88ec82fa 100644 --- a/nixos/tests/tomcat.nix +++ b/nixos/tests/tomcat.nix @@ -10,10 +10,7 @@ services.httpd.enable = true; services.httpd.adminAddr = "foo@bar.com"; services.httpd.extraSubservices = [ - { serviceType = "tomcat-connector"; - stateDir = "/var/run/httpd"; - logDir = "/var/log/httpd"; - } + { serviceType = "tomcat-connector"; } ]; }; diff --git a/nixos/tests/trac.nix b/nixos/tests/trac.nix index 72442c885ac..e0d256f5701 100644 --- a/nixos/tests/trac.nix +++ b/nixos/tests/trac.nix @@ -27,7 +27,7 @@ webserver = { config, pkgs, ... }: - { fileSystems = pkgs.lib.mkOverride 50 + { fileSystems = pkgs.lib.mkVMOverride [ { mountPoint = "/repos"; device = "storage:/repos"; fsType = "nfs"; diff --git a/pkgs/applications/audio/google-musicmanager/default.nix b/pkgs/applications/audio/google-musicmanager/default.nix new file mode 100644 index 00000000000..8cff94c25d9 --- /dev/null +++ b/pkgs/applications/audio/google-musicmanager/default.nix @@ -0,0 +1,57 @@ +{ stdenv, fetchurl, readline, patchelf, ncurses, qt48, libidn, expat, flac +, libvorbis }: + +assert stdenv.system == "x86_64-linux" || stdenv.system == "1686-linux"; + +stdenv.mkDerivation rec { + debversion = "beta_1.0.84.1107-r0"; + version = "1.0.84.1107-beta-r0"; # friendly to nix-env version sorting algo + product = "google-musicmanager"; + name = "${product}-${version}"; + + # When looking for newer versions, since google doesn't let you list their repo dirs, + # curl http://dl.google.com/linux/musicmanager/deb/dists/stable/Release + # fetch an appropriate packages file eg main/binary-amd64/Packages + # which will contain the links to all available *.debs for the arch. + + src = if stdenv.system == "x86_64-linux" + then fetchurl { + url = "http://dl.google.com/linux/musicmanager/deb/pool/main/g/${product}-beta/${product}-${debversion}_amd64.deb"; + sha256 = "0irlrspw508b1s9i5d1mddpp2x9w1ny3svf27gxf8pmwbiyd1cyi"; + } + else fetchurl { + url = "http://dl.google.com/linux/musicmanager/deb/pool/main/g/${product}-beta/${product}-${debversion}_i386.deb"; + sha256 = "13pfsjvaygap6axrlbfhyk1h8377xmwi47x4af6j57qq6z7329rg"; + }; + + unpackPhase = '' + ar vx ${src} + tar -xvf data.tar.lzma + ''; + + buildInputs = [ patchelf ]; + + buildPhase = '' + patchelf \ + --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \ + --set-rpath "$out/opt/google/musicmanager:${readline}/lib:${ncurses}/lib:${stdenv.gcc.libc}/lib:${qt48}/lib:${stdenv.gcc.gcc}/lib:${libidn}/lib:${expat}/lib:${flac}/lib:${libvorbis}/lib" opt/google/musicmanager/MusicManager + ''; + + dontPatchELF = true; + dontStrip = true; + + installPhase = '' + mkdir -p "$out" + cp -r opt "$out" + mkdir "$out/bin" + ln -s "$out/opt/google/musicmanager/google-musicmanager" "$out/bin" + ''; + + meta = with stdenv.lib; { + description = "Uploads music from your computer to Google Play"; + homepage = "https://support.google.com/googleplay/answer/1229970"; + license = licenses.unfree; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/applications/audio/mixxx/default.nix b/pkgs/applications/audio/mixxx/default.nix new file mode 100644 index 00000000000..b76eecc9e4a --- /dev/null +++ b/pkgs/applications/audio/mixxx/default.nix @@ -0,0 +1,51 @@ +{ stdenv, fetchurl, scons, pkgconfig, qt4, portaudio, portmidi, libusb1 +, libmad, protobuf, libvorbis, taglib, libid3tag, flac, libsndfile, libshout +, fftw, vampSDK +}: + +stdenv.mkDerivation rec { + name = "mixxx-${version}"; + version = "1.11.0"; + + src = fetchurl { + url = "http://downloads.mixxx.org/${name}/${name}-src.tar.gz"; + sha256 = "0c833gf4169xvpfn7car9vzvwfwl9d3xwmbfsy36cv8ydifip5h0"; + }; + + buildInputs = [ + scons pkgconfig qt4 portaudio portmidi libusb1 libmad protobuf libvorbis + taglib libid3tag flac libsndfile libshout fftw vampSDK + ]; + + sconsFlags = [ + "build=release" + "qtdir=${qt4}" + ]; + + postPatch = '' + sed -i -e 's/"which /"type -P /' build/depends.py + ''; + + buildPhase = '' + runHook preBuild + ensureDir "$out" + scons \ + -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES \ + $sconsFlags "prefix=$out" + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + scons $sconsFlags "prefix=$out" install + runHook postInstall + ''; + + meta = { + homepage = "http://mixxx.org/"; + description = "Digital DJ mixing software"; + license = stdenv.lib.licenses.gpl2Plus; + maintainers = [ stdenv.lib.maintainers.aszlig ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix index 76930646310..10d92e4d517 100644 --- a/pkgs/applications/misc/calibre/default.nix +++ b/pkgs/applications/misc/calibre/default.nix @@ -4,11 +4,11 @@ }: stdenv.mkDerivation rec { - name = "calibre-1.5.0"; + name = "calibre-1.8.0"; src = fetchurl { url = "mirror://sourceforge/calibre/${name}.tar.xz"; - sha256 = "17jpzj47120ghm584hxl526jdkh9whxrrqfdyn0gv0pb9kag1spn"; + sha256 = "0awh24n5bvypmiylngmz0w0126yz1jxlrjfy9b4w5aflg7vgr0qq"; }; inherit python; diff --git a/pkgs/applications/misc/redshift/default.nix b/pkgs/applications/misc/redshift/default.nix index ce7506672a5..3bed6e1a2d7 100644 --- a/pkgs/applications/misc/redshift/default.nix +++ b/pkgs/applications/misc/redshift/default.nix @@ -1,6 +1,6 @@ { fetchurl, stdenv, libX11, libXrandr, libXxf86vm, libxcb, pkgconfig, python , randrproto, xcbutil, xf86vidmodeproto, autoconf, automake, gettext, glib -, GConf, dbus, dbus_glib, makeWrapper, gtk, pygtk, pyxdg }: +, GConf, dbus, dbus_glib, makeWrapper, gtk, pygtk, pyxdg, geoclue }: stdenv.mkDerivation rec { version = "1.8"; @@ -13,9 +13,7 @@ stdenv.mkDerivation rec { buildInputs = [ libX11 libXrandr libXxf86vm libxcb pkgconfig python randrproto xcbutil xf86vidmodeproto autoconf automake gettext glib GConf dbus dbus_glib - makeWrapper gtk pygtk pyxdg - # TODO: - # geoclue + makeWrapper gtk pygtk pyxdg geoclue ]; preConfigure = '' diff --git a/pkgs/applications/misc/xmobar/default.nix b/pkgs/applications/misc/xmobar/default.nix index 42d11308267..273998dde5d 100644 --- a/pkgs/applications/misc/xmobar/default.nix +++ b/pkgs/applications/misc/xmobar/default.nix @@ -4,8 +4,8 @@ cabal.mkDerivation (self: { pname = "xmobar"; - version = "0.18"; - sha256 = "08kk0yjx51vjrvvvd34hv8v80dsh8kjv150qf413ikaff0i28v7w"; + version = "0.19"; + sha256 = "1lwbww9vpqscip16lqiax2qvfyksxms5xx4n0s61mzw7v61hyxq2"; isLibrary = false; isExecutable = true; buildDepends = [ diff --git a/pkgs/applications/networking/browsers/chromium/sources.nix b/pkgs/applications/networking/browsers/chromium/sources.nix index ae49890caf3..aae71e8dfb6 100644 --- a/pkgs/applications/networking/browsers/chromium/sources.nix +++ b/pkgs/applications/networking/browsers/chromium/sources.nix @@ -6,13 +6,13 @@ sha256 = "0bv86ig3mrd95zh78880bcyh9b8w46s7slxq3mwwmrmqp0s8qaq0"; }; beta = { - version = "31.0.1650.26"; - url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-31.0.1650.26.tar.xz"; - sha256 = "14jvbjn7nsc4psi7n6rjsb5d930k4jawbgqlx3hkhmkz5nhbrplx"; + version = "31.0.1650.34"; + url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-31.0.1650.34.tar.xz"; + sha256 = "0c73kvp09cmq4x42rcf45v0mnbyb8rcyi5i4pj0pvfn451vbngdq"; }; stable = { - version = "30.0.1599.101"; - url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-30.0.1599.101.tar.xz"; - sha256 = "0bd49k9qpycpp4z230pqwsi22565lzhyq59js34baawjqql6ynfr"; + version = "30.0.1599.114"; + url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-30.0.1599.114.tar.xz"; + sha256 = "0q5pq8bj4y0c7hd121db1fa9g3apkpkhb6cf14ag7abgrda2pzw2"; }; } diff --git a/pkgs/applications/networking/browsers/firefox/default.nix b/pkgs/applications/networking/browsers/firefox/default.nix index 8375bcdad3d..45606c9af82 100644 --- a/pkgs/applications/networking/browsers/firefox/default.nix +++ b/pkgs/applications/networking/browsers/firefox/default.nix @@ -18,9 +18,9 @@ assert stdenv.gcc ? libc && stdenv.gcc.libc != null; let optional = stdenv.lib.optional; in rec { - firefoxVersion = "24.0"; + firefoxVersion = "25.0"; - xulVersion = "24.0"; # this attribute is used by other packages + xulVersion = "25.0"; # this attribute is used by other packages src = fetchurl { @@ -28,9 +28,9 @@ in rec { # It is better to use this url for official releases, to take load off Mozilla's ftp server. "http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.bz2" # Fall back to this url for versions not available at releases.mozilla.org. - "ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.bz2" + "http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${firefoxVersion}/source/firefox-${firefoxVersion}.source.tar.bz2" ]; - sha1 = "8scch0gr59j86vp9c1v0yx6mq1pkwcvg"; + sha1 = "854722e283659d2b6b2eacd38f757b3c5b63a448"; }; commonConfigureFlags = diff --git a/pkgs/applications/networking/irc/kvirc/default.nix b/pkgs/applications/networking/irc/kvirc/default.nix new file mode 100644 index 00000000000..f4b451e66e0 --- /dev/null +++ b/pkgs/applications/networking/irc/kvirc/default.nix @@ -0,0 +1,24 @@ +{ stdenv, fetchurl, cmake, qt4, perl, gettext, kdelibs, openssl, zlib}: + +let + pn = "kvirc"; + v = "4.2.0"; +in + +stdenv.mkDerivation { + name = "${pn}-${v}"; + + src = fetchurl { + url = "ftp://ftp.kvirc.de/pub/${pn}/${v}/source/${pn}-${v}.tar.bz2"; + sha256 = "9a547d52d804e39c9635c8dc58bccaf4d34341ef16a9a652a5eb5568d4d762cb"; + }; + + buildInputs = [ cmake qt4 perl gettext kdelibs openssl zlib ]; + + meta = with stdenv.lib; { + description = "Graphic IRC client with Qt"; + license = licenses.gpl3; + homepage = http://www.kvirc.net/; + platforms = platforms.linux; + }; +} diff --git a/pkgs/applications/networking/mailreaders/sup/default.nix b/pkgs/applications/networking/mailreaders/sup/default.nix index 05833537026..dd2837da40a 100644 --- a/pkgs/applications/networking/mailreaders/sup/default.nix +++ b/pkgs/applications/networking/mailreaders/sup/default.nix @@ -1,9 +1,10 @@ { stdenv, fetchurl, ruby, rake, rubygems, makeWrapper, ncursesw_sup -, xapian_ruby, gpgme, libiconvOrEmpty, rmail, mime_types, chronic, trollop -, lockfile, gettext, iconv, locale, text, highline }: +, xapian_ruby, gpgme, libiconvOrEmpty, mime_types, chronic, trollop, lockfile +, gettext, iconv, locale, text, highline, rmail_sup, unicode, gnupg, which }: -stdenv.mkDerivation { - name = "sup-896ab66c0263e5ce0fa45857fb08e0fb78fcb6bd"; +stdenv.mkDerivation rec { + version = "f27661b1656ae1f0d28fd89595b5a16f268d8d3d"; + name = "sup-${version}"; meta = { homepage = http://supmua.org; @@ -16,8 +17,8 @@ stdenv.mkDerivation { dontStrip = true; src = fetchurl { - url = "https://github.com/sup-heliotrope/sup/archive/896ab66c0263e5ce0fa45857fb08e0fb78fcb6bd.tar.gz"; - sha256 = "0sknf4ha13m2478fa27qnm43bcn59g6qbd8f2nmv64k2zs7xnwmk"; + url = "https://github.com/sup-heliotrope/sup/archive/${version}.tar.gz"; + sha256 = "08fxf1knji3260d0mrp86x6yayp43iq7kc5rfay3hga8i2sckdia"; }; buildInputs = @@ -26,8 +27,6 @@ stdenv.mkDerivation { buildPhase = "rake gem"; - # TODO: Move gem dependencies out - installPhase = '' export HOME=$TMP/home; mkdir -pv "$HOME" @@ -35,16 +34,17 @@ stdenv.mkDerivation { GEM_PATH="$GEM_PATH:${chronic}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${gettext}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${gpgme}/${ruby.gemPath}" + GEM_PATH="$GEM_PATH:${highline}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${iconv}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${locale}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${lockfile}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${mime_types}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${ncursesw_sup}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${rmail}/${ruby.gemPath}" + GEM_PATH="$GEM_PATH:${rmail_sup}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${text}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${trollop}/${ruby.gemPath}" + GEM_PATH="$GEM_PATH:${unicode}/${ruby.gemPath}" GEM_PATH="$GEM_PATH:${xapian_ruby}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${highline}/${ruby.gemPath}" # Don't install some dependencies -- we have already installed # the dependencies but gem doesn't acknowledge this @@ -52,8 +52,13 @@ stdenv.mkDerivation { --bindir "$out/bin" --no-rdoc --no-ri pkg/sup-999.gem \ --ignore-dependencies + # specify ruby interpreter explicitly + sed -i '1 s|^.*$|#!${ruby}/bin/ruby|' bin/sup-sync-back-maildir + + cp bin/sup-sync-back-maildir "$out"/bin + for prog in $out/bin/*; do - wrapProgram "$prog" --prefix GEM_PATH : "$GEM_PATH" + wrapProgram "$prog" --prefix GEM_PATH : "$GEM_PATH" --prefix PATH : "${gnupg}/bin:${which}/bin" done for prog in $out/gems/*/bin/*; do @@ -61,4 +66,3 @@ stdenv.mkDerivation { done ''; } - diff --git a/pkgs/applications/networking/znc/default.nix b/pkgs/applications/networking/znc/default.nix index 13c3977a979..a43d8fa9d11 100644 --- a/pkgs/applications/networking/znc/default.nix +++ b/pkgs/applications/networking/znc/default.nix @@ -29,5 +29,6 @@ stdenv.mkDerivation rec { homepage = http://wiki.znc.in/ZNC; maintainers = [ stdenv.lib.maintainers.viric ]; license = "ASL2.0"; + platforms = stdenv.lib.platforms.unix; }; } diff --git a/pkgs/applications/networking/znc/modules.nix b/pkgs/applications/networking/znc/modules.nix new file mode 100644 index 00000000000..ba6d36a3c76 --- /dev/null +++ b/pkgs/applications/networking/znc/modules.nix @@ -0,0 +1,56 @@ +{ stdenv, fetchurl, fetchgit, znc }: + +let + + zncDerivation = a@{ + name, src, module_name, + buildPhase ? "${znc}/bin/znc-buildmod ${module_name}.cpp", + installPhase ? "install -D ${module_name}.so $out/lib/znc/${module_name}.so", ... + } : stdenv.mkDerivation (a // { + inherit buildPhase; + inherit installPhase; + + meta.platforms = stdenv.lib.platforms.unix; + passthru.module_name = module_name; + }); + +in rec { + + push = zncDerivation rec { + name = "znc-push-${version}"; + version = "1.0.0"; + module_name = "push"; + + src = fetchurl { + url = "https://github.com/jreese/znc-push/archive/v${version}.tar.gz"; + sha256 = "1v9a16b1d8mfzhddf4drh6rbxa0szr842g7614r8ninmc0gi7a2v"; + }; + + meta = { + description = "Push notification service module for ZNC"; + homepage = https://github.com/jreese/znc-push; + repositories.git = https://github.com/jreese/znc-push.git; + license = stdenv.lib.license.mit; + maintainers = [ stdenv.lib.maintainers.offline ]; + }; + }; + + fish = zncDerivation rec { + name = "znc-fish-8e1f150fda"; + module_name = "fish"; + + src = fetchgit { + url = meta.repositories.git; + rev = "8e1f150fdaf18dc33e023795584dec8255e6614e"; + sha256 = "0vpk4336c191irl3g7wibblnbqf3903hjrci4gs0qgg1wvj7fw66"; + }; + + meta = { + description = "ZNC FiSH module"; + homepage = https://github.com/dctrwatson/znc-fish; + repositories.git = https://github.com/dctrwatson/znc-fish.git; + maintainers = [ stdenv.lib.maintainers.offline ]; + }; + }; + +} diff --git a/pkgs/applications/version-management/git-and-tools/default.nix b/pkgs/applications/version-management/git-and-tools/default.nix index d53ca7a0135..af1ab52c04d 100644 --- a/pkgs/applications/version-management/git-and-tools/default.nix +++ b/pkgs/applications/version-management/git-and-tools/default.nix @@ -90,4 +90,6 @@ rec { svn2git_kde = callPackage ./svn2git-kde { }; darcsToGit = callPackage ./darcs-to-git { }; + + gitflow = callPackage ./gitflow { }; } diff --git a/pkgs/applications/version-management/git-and-tools/git-annex/default.nix b/pkgs/applications/version-management/git-and-tools/git-annex/default.nix index f67fc8553c0..e32a7dc52b9 100644 --- a/pkgs/applications/version-management/git-and-tools/git-annex/default.nix +++ b/pkgs/applications/version-management/git-and-tools/git-annex/default.nix @@ -14,8 +14,8 @@ cabal.mkDerivation (self: { pname = "git-annex"; - version = "4.20131002"; - sha256 = "00pjb0ivcggpx4qdihrarss68c1q5viwfz4jgg7rqjnhslwvk440"; + version = "4.20131024"; + sha256 = "1a4mrx8zr5znhcy2cszv5ri9avqj7lcn467nmaj172f00vn4fd5x"; isLibrary = false; isExecutable = true; buildDepends = [ diff --git a/pkgs/applications/version-management/git-and-tools/gitflow/default.nix b/pkgs/applications/version-management/git-and-tools/gitflow/default.nix new file mode 100644 index 00000000000..26a7826d4f0 --- /dev/null +++ b/pkgs/applications/version-management/git-and-tools/gitflow/default.nix @@ -0,0 +1,23 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + name = "gitflow-${version}"; + version = "1.6.1"; + + src = fetchurl { + url = "https://github.com/petervanderdoes/gitflow/archive/${version}.tar.gz"; + sha256 = "1f4879ahi8diddn7qvhr0dkj96gh527xnfihbf1ha83fn9cvvcls"; + }; + + preBuild = '' + makeFlagsArray+=(prefix="$out") + ''; + + meta = with stdenv.lib; { + homepage = https://github.com/petervanderdoes/gitflow; + description = "A collection of Git extensions to provide high-level repository operations for Vincent Driessen's branching model"; + license = licenses.bsd2; + platforms = platforms.all; + maintainers = [ maintainers.offline ]; + }; +} diff --git a/pkgs/applications/video/miro/default.nix b/pkgs/applications/video/miro/default.nix new file mode 100644 index 00000000000..5ca6c80dc7c --- /dev/null +++ b/pkgs/applications/video/miro/default.nix @@ -0,0 +1,76 @@ +{ stdenv, fetchurl, python, buildPythonPackage, pythonPackages, pkgconfig +, pyrex096, ffmpeg, boost, glib, pygobject, gtk2, webkit_gtk2, libsoup, pygtk +, taglib, pysqlite, pycurl, mutagen, pycairo, pythonDBus, pywebkitgtk +, libtorrentRasterbar +, gst_python, gst_plugins_base, gst_plugins_good, gst_ffmpeg +}: + +buildPythonPackage rec { + name = "miro-${version}"; + namePrefix = ""; + version = "6.0"; + + src = fetchurl { + url = "http://ftp.osuosl.org/pub/pculture.org/miro/src/${name}.tar.gz"; + sha256 = "0sq25w365i1fz95398vxql3yjl5i6mq77mnmlhmn0pgyg111k3am"; + }; + + setSourceRoot = '' + sourceRoot=${name}/linux + ''; + + patches = [ ./gconf.patch ]; + + postPatch = '' + sed -i -e '2i import os; os.environ["GST_PLUGIN_PATH"] = \\\ + '"'$GST_PLUGIN_PATH'" miro.real + + sed -i -e 's/\$(shell which python)/python/' Makefile + sed -i -e 's|/usr/bin/||' -e 's|/usr||' \ + -e 's/BUILD_TIME[^,]*/BUILD_TIME=0/' setup.py + + sed -i -e 's|default="/usr/bin/ffmpeg"|default="${ffmpeg}/bin/ffmpeg"|' \ + plat/options.py + + sed -i -e 's|/usr/share/miro/themes|'"$out/share/miro/themes"'|' \ + -e 's/gnome-open/xdg-open/g' \ + -e '/RESOURCE_ROOT =.*(/,/)/ { + c RESOURCE_ROOT = '"'$out/share/miro/resources/'"' + }' \ + plat/resources.py + ''; + + installCommand = '' + python setup.py install --prefix= --root="$out" + ''; + + # Disabled for now, because it requires networking and even if we skip those + # tests, the whole test run takes around 10-20 minutes. + doCheck = false; + checkPhase = '' + HOME="$TEMPDIR" LANG=en_US.UTF-8 python miro.real --unittest + ''; + + postInstall = '' + mv "$out/bin/miro.real" "$out/bin/miro" + ''; + + buildInputs = [ + pkgconfig pyrex096 ffmpeg boost glib pygobject gtk2 webkit_gtk2 libsoup + pygtk taglib + ]; + + propagatedBuildInputs = [ + pygobject pygtk pycurl python.modules.sqlite3 mutagen pycairo pythonDBus + pywebkitgtk libtorrentRasterbar + gst_python gst_plugins_base gst_plugins_good gst_ffmpeg + ]; + + meta = { + homepage = "http://www.getmiro.com/"; + description = "Video and audio feed aggregator"; + license = stdenv.lib.licenses.gpl2Plus; + maintainers = [ stdenv.lib.maintainers.aszlig ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/applications/video/miro/gconf.patch b/pkgs/applications/video/miro/gconf.patch new file mode 100644 index 00000000000..bc516da9cbf --- /dev/null +++ b/pkgs/applications/video/miro/gconf.patch @@ -0,0 +1,374 @@ +diff --git a/plat/associate.py b/plat/associate.py +index 0f3cd31..f9b5a76 100644 +--- a/plat/associate.py ++++ b/plat/associate.py +@@ -31,69 +31,8 @@ + Holds functions that associate Miro with certain protocols + """ + +-import gconf +-from miro.plat.config import gconf_lock +- + def associate_protocols(command): +- _associate_protocol("magnet", command, False) ++ pass + + def disassociate_protocols(command): +- _disassociate_protocol("magnet", command) +- +-def _associate_protocol(name, command, overwrite_existing=False): +- url_handlers_key = "/desktop/gnome/url-handlers/" + name + "/" +- if not _is_associated(name) or overwrite_existing: +- gconf_lock.acquire() +- try: +- gconf_client = gconf.client_get_default() +- if gconf_client.set_string(url_handlers_key + "command", command): +- gconf_client.set_bool(url_handlers_key + "needs_terminal", False) +- gconf_client.set_bool(url_handlers_key + "enabled", True) +- success = True +- else: +- success = False +- finally: +- gconf_lock.release() +- else: +- success = True +- return success +- +-def _disassociate_protocol(name, command): +- url_handlers_key = "/desktop/gnome/url-handlers/" + name + "/" +- if _is_associated(name, command): +- gconf_lock.acquire() +- try: +- gconf_client = gconf.client_get_default() +- if gconf_client.set_bool(url_handlers_key + "enabled", False): +- success = True +- else: +- success = False +- finally: +- gconf_lock.release() +- else: +- success = True +- return success +- +-def _is_associated(protocol, command=None): +- """ Checks whether a protocol currently is +- associated with the given command, or, +- if none is given, whether the protocol +- is associated with anything at all. +- """ +- url_handlers_key = "/desktop/gnome/url-handlers/" + protocol + "/" +- gconf_lock.acquire() +- try: +- gconf_client = gconf.client_get_default() +- key = gconf_client.get(url_handlers_key + "command") +- if key is None: +- associated = False +- else: +- enabled = gconf_client.get(url_handlers_key + "enabled") +- if command: +- associated = key.get_string() == command and enabled.get_bool() +- else: +- associated = key.get_string() != "" and enabled.get_bool() +- finally: +- gconf_lock.release() +- return associated +- ++ pass +diff --git a/plat/config.py b/plat/config.py +index 40895af..24f8815 100644 +--- a/plat/config.py ++++ b/plat/config.py +@@ -39,51 +39,20 @@ Preferences are listed in miro.pref and also miro.plat.options. + import os + import logging + from miro import prefs +-import gconf ++import shelve + import threading + from miro.plat import options + from miro.plat import resources + +-client = gconf.client_get_default() +-gconf_lock = threading.RLock() +- +- +-def gconf_key(key): +- if options.gconf_name is None: +- options.gconf_name = "miro" +- return '/apps/%s/%s' % (options.gconf_name, key) +- +- +-def _convert_gconf_value(value): +- if value.type == gconf.VALUE_STRING: +- return value.get_string() +- if value.type == gconf.VALUE_INT: +- return value.get_int() +- if value.type == gconf.VALUE_BOOL: +- return value.get_bool() +- if value.type == gconf.VALUE_FLOAT: +- return value.get_float() +- if value.type == gconf.VALUE_LIST: +- return [_convert_gconf_value(v) for v in value.get_list()] +- raise TypeError("unknown gconf type %s" % value.type) +- +- +-def _get_gconf(fullkey, default=None): +- gconf_lock.acquire() +- try: +- value = client.get(fullkey) +- if value != None: +- try: +- return _convert_gconf_value(value) +- except TypeError, e: +- logging.warn("type error while getting gconf value %s: %s", +- fullkey, str(e)) +- return default +- finally: +- gconf_lock.release() +- +- +-class GconfDict: ++ ++class ConfigFile(object): ++ def __init__(self): ++ support_dir = get(prefs.SUPPORT_DIRECTORY) ++ if not os.path.exists(support_dir): ++ os.makedirs(support_dir) ++ path = os.path.join(support_dir, 'config') ++ self.conf = shelve.open(path, 'c', -1, True) ++ + def get(self, key, default=None): + if not isinstance(key, str): + raise TypeError() +@@ -91,19 +56,16 @@ class GconfDict: + if "MIRO_%s" % key.upper() in os.environ: + return os.environ["MIRO_%s" % key.upper()] + +- fullkey = gconf_key(key) +- return _get_gconf(fullkey, default) ++ return self.conf.get(key, default) ++ ++ def __del__(self): ++ self.conf.close() + + def __contains__(self, key): + if "MIRO_%s" % key.upper() in os.environ: + return True + +- gconf_lock.acquire() +- try: +- fullkey = gconf_key(key) +- return client.get(fullkey) is not None +- finally: +- gconf_lock.release() ++ return key in self.conf + + def __getitem__(self, key): + rv = self.get(key) +@@ -116,43 +78,11 @@ class GconfDict: + if "MIRO_%s" % key.upper() in os.environ: + return + +- gconf_lock.acquire() +- try: +- if not isinstance(key, str): +- raise TypeError() +- +- fullkey = gconf_key(key) +- if isinstance(value, str): +- client.set_string(fullkey, value) +- elif isinstance(value, bool): +- client.set_bool(fullkey, value) +- elif isinstance(value, int): +- client.set_int(fullkey, value) +- elif isinstance(value, float): +- client.set_float(fullkey, value) +- elif isinstance(value, list): +- # this is lame, but there isn't enough information to +- # figure it out another way +- if len(value) == 0 or isinstance(value[0], str): +- list_type = gconf.VALUE_STRING +- elif isinstance(value[0], int): +- list_type = gconf.VALUE_INT +- elif isinstance(value[0], float): +- list_type = gconf.VALUE_FLOAT +- elif isinstance(value[0], bool): +- list_type = gconf.VALUE_BOOL +- else: +- raise TypeError("unknown gconf type %s" % type(value[0])) +- +- client.set_list(fullkey, list_type, value) +- else: +- raise TypeError() +- finally: +- gconf_lock.release() ++ self.conf[key] = value + + + def load(): +- return GconfDict() ++ return ConfigFile() + + + def save(data): +@@ -208,25 +138,4 @@ def get(descriptor): + value = get(prefs.SUPPORT_DIRECTORY) + value = os.path.join(value, 'miro-helper.log') + +- elif descriptor == prefs.HTTP_PROXY_ACTIVE: +- return _get_gconf("/system/http_proxy/use_http_proxy") +- +- elif descriptor == prefs.HTTP_PROXY_HOST: +- return _get_gconf("/system/http_proxy/host") +- +- elif descriptor == prefs.HTTP_PROXY_PORT: +- return _get_gconf("/system/http_proxy/port") +- +- elif descriptor == prefs.HTTP_PROXY_AUTHORIZATION_ACTIVE: +- return _get_gconf("/system/http_proxy/use_authentication") +- +- elif descriptor == prefs.HTTP_PROXY_AUTHORIZATION_USERNAME: +- return _get_gconf("/system/http_proxy/authentication_user") +- +- elif descriptor == prefs.HTTP_PROXY_AUTHORIZATION_PASSWORD: +- return _get_gconf("/system/http_proxy/authentication_password") +- +- elif descriptor == prefs.HTTP_PROXY_IGNORE_HOSTS: +- return _get_gconf("/system/http_proxy/ignore_hosts", []) +- + return value +diff --git a/plat/frontends/widgets/application.py b/plat/frontends/widgets/application.py +index a1eaaf3..20f4c23 100644 +--- a/plat/frontends/widgets/application.py ++++ b/plat/frontends/widgets/application.py +@@ -35,7 +35,6 @@ except RuntimeError: + sys.exit(1) + import gobject + import os +-import gconf + import shutil + import platform + +@@ -53,7 +52,6 @@ from miro import prefs + from miro.frontends.widgets.application import Application + # from miro.plat.frontends.widgets import threads + from miro.plat import renderers, options +-from miro.plat.config import gconf_lock, gconf_key + try: + from miro.plat.frontends.widgets import miroappindicator + APP_INDICATOR_SUPPORT = True +@@ -77,29 +75,13 @@ import sys + + + def _get_pref(key, getter_name): +- gconf_lock.acquire() +- try: +- client = gconf.client_get_default() +- fullkey = gconf_key(key) +- value = client.get(fullkey) +- if value is not None: +- getter = getattr(value, getter_name) +- return getter() +- else: +- return None +- finally: +- gconf_lock.release() ++ # XXX: ugly! ++ return app.config._data.get(key) + + + def _set_pref(key, setter_name, value): +- gconf_lock.acquire() +- try: +- client = gconf.client_get_default() +- fullkey = gconf_key(key) +- setter = getattr(client, setter_name) +- setter(fullkey, value) +- finally: +- gconf_lock.release() ++ # XXX: ugly! ++ app.config._data[key] = value + + + def get_int(key): +diff --git a/plat/options.py b/plat/options.py +index 4ea1a67..8e75e20 100644 +--- a/plat/options.py ++++ b/plat/options.py +@@ -69,14 +69,14 @@ USE_RENDERER = LinuxPref( + + GSTREAMER_IMAGESINK = LinuxPref( + key="DefaultGstreamerImagesink", +- default="gconfvideosink", ++ default="autovideosink", + alias="gstreamer-imagesink", + helptext=("Which GStreamer image sink to use for video. " + "(autovideosink, ximagesink, xvimagesink, gconfvideosink, ...)")) + + GSTREAMER_AUDIOSINK = LinuxPref( + key="DefaultGstreamerAudiosink", +- default="gconfaudiosink", ++ default="autoaudiosink", + alias="gstreamer-audiosink", + helptext=("Which GStreamer sink to use for audio. " + "(autoaudiosink, osssink, alsasink, gconfaudiosink, ...)")) +diff --git a/plat/upgrade.py b/plat/upgrade.py +index 9677e3a..f812ad4 100644 +--- a/plat/upgrade.py ++++ b/plat/upgrade.py +@@ -30,7 +30,6 @@ + import os + import shutil + from miro.plat import resources +-import gconf + + + def upgrade(): +@@ -64,47 +63,3 @@ def upgrade(): + os.remove(old_file) + except OSError: + pass +- +- # gconf settings +- client = gconf.client_get_default() +- +- def _copy_gconf(src, dst): +- for entry in client.all_entries(src): +- entry_dst = dst + '/' + entry.key.split('/')[-1] +- client.set(entry_dst, entry.value) +- for subdir in client.all_dirs(src): +- subdir_dst = dst + '/' + subdir.split('/')[-1] +- _copy_gconf(subdir, subdir_dst) +- +- if ((client.dir_exists("/apps/democracy/player") +- and not client.dir_exists("/apps/miro"))): +- _copy_gconf("/apps/democracy/player", "/apps/miro") +- client.recursive_unset("/apps/democracy", 1) +- +- # Set the MoviesDirectory and NonVideoDirectory based on the +- # possibilities that we've had over the years and what exists on +- # the user's system. This codifies it in the user's gconf so that +- # when we change it in future, then the user isn't affected. +- from miro.plat import options +- if options.gconf_name is None: +- options.gconf_name = "miro" +- key = "/apps/%s/MoviesDirectory" % options.gconf_name +- if client.get(key) is None: +- for mem in ["~/.miro/Movies", # packages +- "~/Videos/Miro", +- "~/Movies/Miro", # pre 3.5 +- "~/Movies/Democracy" # democracy player +- ]: +- mem = os.path.expanduser(mem) +- if os.path.exists(mem): +- client.set_string(key, mem) +- break +- +- key = "/apps/%s/NonVideoDirectory" % options.gconf_name +- if client.get(key) is None: +- for mem in ["~/.miro/Nonvideo" # packages +- ]: +- mem = os.path.expanduser(mem) +- if os.path.exists(mem): +- client.set_string(key, mem) +- break diff --git a/pkgs/build-support/upstream-updater/update-walker-service-specific.sh b/pkgs/build-support/upstream-updater/update-walker-service-specific.sh index 4f3a7110346..a979e24edf2 100644 --- a/pkgs/build-support/upstream-updater/update-walker-service-specific.sh +++ b/pkgs/build-support/upstream-updater/update-walker-service-specific.sh @@ -7,3 +7,10 @@ SF_redirect () { SF_version_dir () { version_link 'http://sourceforge.net/.+/[0-9.]+/$' } + +GH_latest () { + prefetch_command_rel ../fetchgit/nix-prefetch-git + revision "$("$(dirname "$0")/urls-from-page.sh" "$CURRENT_URL/commits" | grep /commit/ | head -n 1 | xargs basename )" + version '.*' "git-$(date +%Y-%m-%d)" + NEED_TO_CHOOSE_URL= +} diff --git a/pkgs/build-support/upstream-updater/update-walker.sh b/pkgs/build-support/upstream-updater/update-walker.sh index c4dc7713f50..5743a289a4c 100755 --- a/pkgs/build-support/upstream-updater/update-walker.sh +++ b/pkgs/build-support/upstream-updater/update-walker.sh @@ -3,6 +3,8 @@ own_dir="$(cd "$(dirname "$0")"; pwd)" CURRENT_URL= +CURRENT_REV= +PREFETCH_COMMAND= NEED_TO_CHOOSE_URL=1 url () { @@ -118,13 +120,26 @@ ensure_choice () { } } +revision () { + CURRENT_REV="$1" + echo "CURRENT_REV: $CURRENT_REV" +} + +prefetch_command () { + PREFETCH_COMMAND="$1" +} + +prefetch_command_rel () { + PREFETCH_COMMAND="$(dirname "$0")/$1" +} + ensure_hash () { echo "Ensuring hash. CURRENT_HASH: $CURRENT_HASH" >&2 [ -z "$CURRENT_HASH" ] && hash } hash () { - CURRENT_HASH="$(nix-prefetch-url "$CURRENT_URL")" + CURRENT_HASH="$(${PREFETCH_COMMAND:-nix-prefetch-url} "$CURRENT_URL" $CURRENT_REV)" echo "CURRENT_HASH: $CURRENT_HASH" >&2 } @@ -172,6 +187,7 @@ do_write_expression () { echo "${1} name=\"\${baseName}-\${version}\";" echo "${1} hash=\"$CURRENT_HASH\";" echo "${1} url=\"$CURRENT_URL\";" + [ -n "$CURRENT_REV" ] && echo "${1} rev=\"$CURRENT_REV\";" echo "${1} sha256=\"$CURRENT_HASH\";" echo "$2" } diff --git a/pkgs/desktops/xfce/4_08.nix b/pkgs/desktops/xfce/4_08.nix deleted file mode 100644 index d29e3ac51ef..00000000000 --- a/pkgs/desktops/xfce/4_08.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ pkgs, newScope }: let - -common = (import ./common.nix) { inherit pkgs newScope xfce_self; }; -callPackage = common.callPackage; - -xfce_self = common.xfce_common // rec { # the lines are very long but it seems better than the even-odd line approach - - #### CORE - - exo = callPackage ./core/exo.nix { v= "0.6.2"; h= "0f8zh5y057l7xffskjvky6k88hrnz6jyk35mvlfpmx26anlgd77l"; }; - libxfce4ui = callPackage ./core/libxfce4ui.nix { v= "4.8.1"; h= "0mlrcr8rqmv047xrb2dbh7f4knsppb1anx2b05s015h6v8lyvjrr"; }; - libxfce4util = callPackage ./core/libxfce4util.nix { v= "4.8.2"; h= "05n8586h2fwkibfld5fm4ygx1w66jnbqqb3li0ardjvm2n24k885"; }; - libxfcegui4 = callPackage ./core/libxfcegui4.nix { v= "4.8.1"; h= "0hr4h6a9p6w3qw1976p8v9c9pwhd9zhrjlbaph0p7nyz7j1836ih"; }; - thunar = callPackage ./core/thunar.nix { v= "1.2.3"; h= "19mczys6xr683r68g3s2njrrmnk1p73zypvwrhajw859c6nsjsp6"; }; - xfce4panel = callPackage ./core/xfce4-panel.nix { v= "4.8.6"; h= "00zdkg1jg4n2n109nxan8ji2m06r9mc4lnlrvb55xvj229m2dwb6"; }; - xfce4session = callPackage ./core/xfce4-session.nix { v= "4.8.2"; h= "1l608kik98jxbjl73waf8515hzji06lr80qmky2qlnp0b6js5g1i"; }; - xfce4settings = callPackage ./core/xfce4-settings.nix { v= "4.8.3"; h= "0bmw0s6jp2ws4n0f3387zwsyv46b0w89m6r70yb7wrqy9r3wqy6q"; }; - xfceutils = callPackage ./core/xfce-utils.nix { v= "4.8.3"; h= "09mr0amp2f632q9i3vykaa0x5nrfihfm9v5nxsx9vch8wvbp0l03"; }; - xfconf = callPackage ./core/xfconf.nix { v= "4.8.1"; h= "1jwkb73xcgqfly449jwbn2afiyx50p150z60x19bicps75sp6q4q"; }; - xfdesktop = callPackage ./core/xfdesktop.nix { v= "4.8.3"; h= "097lc9djmay0jyyl42jmvcfda75ndp265nzn0aa3hv795bsn1175"; }; - xfwm4 = callPackage ./core/xfwm4.nix { v= "4.8.3"; h= "0zi2g1d2jdgw5armlk9xjh4ykmydy266gdba86nmhy951gm8n3hb"; }; - - xfce4_appfinder = callPackage ./core/xfce4-appfinder.nix { v= "4.8.0"; h= "0zy7i9x4qjchmyb8nfpb7m2ply5n2aq35p9wrhb8lpz4am1ihx7x"; }; - - #### APPLICATIONS - - terminal = null; # newer versions don't build with 4.8 - - # versions > 0.3* don't build with xfce-4.8.* - ristretto = callPackage ./applications/ristretto.nix { v= "0.3.7"; h= "19mzy159j4qhd7pd1b83gimxfdg3mwdab9lq9kk505d21r7iqc9b"; }; - - xfce4mixer = callPackage ./applications/xfce4-mixer.nix { v= "4.8.0"; h= "1aqgjxvck6hx26sk3n4n5avhv02vs523mfclcvjb3xnks3yli7wz"; }; - -}; # xfce_self - -in xfce_self - diff --git a/pkgs/desktops/xfce/4_10.nix b/pkgs/desktops/xfce/4_10.nix deleted file mode 100644 index 3f846198e3f..00000000000 --- a/pkgs/desktops/xfce/4_10.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ pkgs, newScope }: let - -common = (import ./common.nix) { inherit pkgs newScope xfce_self; }; -callPackage = common.callPackage; - -xfce_self = common.xfce_common // rec { # the lines are very long but it seems better than the even-odd line approach - - #### CORE - - exo = callPackage ./core/exo.nix { v= "0.10.2"; h= "1kknxiz703q4snmry65ajm26jwjslbgpzdal6bd090m3z25q51dk"; }; - libxfce4ui = callPackage ./core/libxfce4ui.nix { v= "4.10.0"; h= "1qm31s6568cz4c8rl9fsfq0xmf7pldxm0ki62gx1cpybihlgmfd2"; }; - libxfce4util = callPackage ./core/libxfce4util.nix { v= "4.10.0"; h= "13k0wwbbqvdmbj4xmk4nxdlgvrdgr5y6r3dk380mzfw053hzwy89"; }; - libxfcegui4 = callPackage ./core/libxfcegui4.nix { v= "4.10.0"; h= "0cs5im0ib0cmr1lhr5765yliqjfyxvk4kwy8h1l8bn3mj6bzk0ib"; }; - thunar = callPackage ./core/thunar.nix { v= "1.6.2"; h= "11dx38rvkfbp91pxrprymxhimsm90gvizp277x9s5rwnwcm1ggbx"; }; - xfce4panel = callPackage ./core/xfce4-panel.nix { v= "4.10.0"; h= "1f8903nx6ivzircl8d8s9zna4vjgfy0qhjk5d2x19g9bmycgj89k"; }; - xfce4session = callPackage ./core/xfce4-session.nix { v= "4.10.0"; h= "1kj65jkjhd0ysf0yxsf88wzpyv6n8i8qgd3gb502hf1x9jksk2mv"; }; - xfce4settings = callPackage ./core/xfce4-settings.nix { v= "4.10.0"; h= "0zppq747z9lrxyv5zrrvpalq7hb3gfhy9p7qbldisgv7m6dz0hq8"; }; - xfceutils = null; # removed in 4.10 - xfconf = callPackage ./core/xfconf.nix { v= "4.10.0"; h= "0xh520z0qh0ib0ijgnyrgii9h5d4pc53n6mx1chhyzfc86j1jlhp"; }; - xfdesktop = callPackage ./core/xfdesktop.nix { v= "4.10.0"; h= "0yrddj1lgk3xn4w340y89z7x2isks72ia36pka08kk2x8gpfcyl9"; }; - xfwm4 = callPackage ./core/xfwm4.nix { v= "4.10.0"; h= "170zzs7adj47srsi2cl723w9pl8k8awd7w1bpzxby7hj92zmf8s9"; }; - - xfce4_appfinder = callPackage ./core/xfce4-appfinder.nix { v= "4.9.4"; h= "12lgrbd1n50w9n8xkpai98s2aw8vmjasrgypc57sp0x0qafsqaxq"; }; - - #### APPLICATIONS - - ristretto = callPackage ./applications/ristretto.nix { v= "0.6.3"; h= "0y9d8w1plwp4vmxs44y8k8x15i0k0xln89k6jndhv6lf57g1cs1b"; }; - terminal = xfce4terminal; # it has changed its name - xfce4mixer = callPackage ./applications/xfce4-mixer.nix { v= "4.10.0"; h= "1pnsd00583l7p5d80rxbh58brzy3jnccwikbbbm730a33c08kid8"; }; - xfce4terminal = callPackage ./applications/terminal.nix { v= "0.6.1"; h= "1j6lpkq952mrl5p24y88f89wn9g0namvywhma639xxsswlkn8d31"; }; - -}; - -in xfce_self - diff --git a/pkgs/desktops/xfce/core/xfce-utils.nix b/pkgs/desktops/xfce/core/xfce-utils.nix deleted file mode 100644 index 625780adb31..00000000000 --- a/pkgs/desktops/xfce/core/xfce-utils.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ v, h, stdenv, fetchXfce, pkgconfig, intltool, gtk, libxfce4util, libxfce4ui, dbus_glib }: - -stdenv.mkDerivation rec { - name = "xfce-utils-${v}"; - src = fetchXfce.core name h; - - configureFlags = "--with-xsession-prefix=$(out)/share/xsessions --with-vendor-info=NixOS.org"; - - buildInputs = [ pkgconfig intltool gtk libxfce4util libxfce4ui dbus_glib ]; - - preFixup = "rm $out/share/icons/hicolor/icon-theme.cache"; - - meta = { - homepage = http://www.xfce.org/projects/xfce-utils; - description = "Utilities and scripts for Xfce"; - license = "GPLv2+"; - platforms = stdenv.lib.platforms.linux; - maintainers = [ stdenv.lib.maintainers.eelco ]; - }; -} diff --git a/pkgs/desktops/xfce/default.nix b/pkgs/desktops/xfce/default.nix index a6107d0a870..f812336ee7f 100644 --- a/pkgs/desktops/xfce/default.nix +++ b/pkgs/desktops/xfce/default.nix @@ -30,7 +30,6 @@ xfce_self = rec { # the lines are very long but it seems better than the even-od xfce4session = callPackage ./core/xfce4-session.nix { }; xfce4settings = callPackage ./core/xfce4-settings.nix { }; xfce4_power_manager = callPackage ./core/xfce4-power-manager.nix { }; - xfceutils = null; # removed in 4.10 xfconf = callPackage ./core/xfconf.nix { }; xfdesktop = callPackage ./core/xfdesktop.nix { }; xfwm4 = callPackage ./core/xfwm4.nix { }; diff --git a/pkgs/development/compilers/elm/elm.nix b/pkgs/development/compilers/elm/elm.nix index 17b173a3334..c9e9fb9e14b 100644 --- a/pkgs/development/compilers/elm/elm.nix +++ b/pkgs/development/compilers/elm/elm.nix @@ -5,8 +5,8 @@ cabal.mkDerivation (self: { pname = "Elm"; - version = "0.10"; - sha256 = "0wwda9w9r3qw7b23bj4qnfj4vgl7zwwnslxmgz3rv0cmxn9klqx2"; + version = "0.10.0.1"; + sha256 = "1r7z2fw9v6ngr9w4lmj1l6sc78rmxvqkqlxv4a9yc5jm80k3ar0i"; isLibrary = true; isExecutable = true; buildDepends = [ diff --git a/pkgs/development/compilers/ghc/with-packages.nix b/pkgs/development/compilers/ghc/with-packages.nix index 979b2480586..b32b12d5b95 100644 --- a/pkgs/development/compilers/ghc/with-packages.nix +++ b/pkgs/development/compilers/ghc/with-packages.nix @@ -10,7 +10,7 @@ let in buildEnv { name = "haskell-env-${ghc.name}"; - paths = stdenv.lib.filter (x: x ? ghc) (stdenv.lib.closePropagation (packages ++ [ghc])); + paths = stdenv.lib.filter (x: x ? ghc) (stdenv.lib.closePropagation packages) ++ [ghc]; postBuild = '' . ${makeWrapper}/nix-support/setup-hook diff --git a/pkgs/development/interpreters/php/5.4.nix b/pkgs/development/interpreters/php/5.4.nix index eb3d796f229..3edf25b0cd9 100644 --- a/pkgs/development/interpreters/php/5.4.nix +++ b/pkgs/development/interpreters/php/5.4.nix @@ -58,6 +58,10 @@ composableDerivation.composableDerivation {} ( fixed : let inherit (fixed.fixed) buildInputs = [ libxml2 ]; }; + pcntl = { + configureFlags = [ "--enable-pcntl" ]; + }; + readline = { configureFlags = ["--with-readline=${readline}"]; buildInputs = [ readline ]; @@ -188,6 +192,7 @@ composableDerivation.composableDerivation {} ( fixed : let inherit (fixed.fixed) socketsSupport = config.php.sockets or true; curlSupport = config.php.curl or true; gettextSupport = config.php.gettext or true; + pcntlSupport = config.php.pcntl or true; postgresqlSupport = config.php.postgresql or true; readlineSupport = config.php.readline or true; sqliteSupport = config.php.sqlite or true; diff --git a/pkgs/development/interpreters/ruby/generated.nix b/pkgs/development/interpreters/ruby/generated.nix index 323d068bc9c..f0cfa7b0152 100644 --- a/pkgs/development/interpreters/ruby/generated.nix +++ b/pkgs/development/interpreters/ruby/generated.nix @@ -97,6 +97,7 @@ g: # Get dependencies from patched gems rjb = g.rjb_1_4_8; rkelly_remix = g.rkelly_remix_0_0_4; rmail = g.rmail_1_0_0; + rmail_sup = g.rmail_sup_1_0_1; rspec = g.rspec_2_11_0; rspec_core = g.rspec_core_2_11_1; rspec_expectations = g.rspec_expectations_2_11_3; @@ -129,6 +130,7 @@ g: # Get dependencies from patched gems tzinfo = g.tzinfo_0_3_37; unf = g.unf_0_1_2; unf_ext = g.unf_ext_0_0_6; + unicode = g.unicode_0_4_4; uuid = g.uuid_2_3_7; uuidtools = g.uuidtools_2_1_4; webrobots = g.webrobots_0_1_1; @@ -433,6 +435,17 @@ for those one-off tasks, with a language that's a joy to use. requiredGems = [ g.ffi_1_9_0 ]; sha256 = ''0jbz2ix7ff9ry8717lhcq9w8j8yd45akw48giwgdqccay5mlph7d''; }; + chronic_0_9_1 = { + basename = ''chronic''; + meta = { + description = ''Natural language date/time parsing.''; + homepage = ''http://github.com/mojombo/chronic''; + longDescription = ''Chronic is a natural language date/time parser written in pure Ruby.''; + }; + name = ''chronic-0.9.1''; + requiredGems = [ ]; + sha256 = ''0kspaxpfy7yvyk1lvpx31w852qfj8wb9z04mcj5bzi70ljb9awqk''; + }; chronic_0_10_1 = { basename = ''chronic''; meta = { @@ -1612,6 +1625,20 @@ in JSDuck. requiredGems = [ ]; sha256 = ''0nsg7yda1gdwa96j4hlrp2s0m06vrhcc4zy5mbq7gxmlmwf9yixp''; }; + rmail_sup_1_0_1 = { + basename = ''rmail_sup''; + meta = { + description = ''A MIME mail parsing and generation library.''; + homepage = ''http://supmua.org''; + longDescription = '' RMail is a lightweight mail library containing various utility classes and + modules that allow ruby scripts to parse, modify, and generate MIME mail + messages. +''; + }; + name = ''rmail-sup-1.0.1''; + requiredGems = [ ]; + sha256 = ''1xswk101s560lxqaax3plqh8vjx7jjspnggdwb3q80m358f92q9g''; + }; rspec_2_11_0 = { basename = ''rspec''; meta = { @@ -1991,6 +2018,17 @@ to Ruby/JRuby. requiredGems = [ ]; sha256 = ''07zbmkzcid6pzdqgla3456ipfdka7j1v4hsx1iaa8rbnllqbmkdg''; }; + unicode_0_4_4 = { + basename = ''unicode''; + meta = { + description = ''Unicode normalization library.''; + homepage = ''http://www.yoshidam.net/Ruby.html#unicode''; + longDescription = ''Unicode normalization library.''; + }; + name = ''unicode-0.4.4''; + requiredGems = [ ]; + sha256 = ''0la9dyxj7pr57g5727gj1h5c6h5kpbjdjpiv2vqi5gw5iglg0yqi''; + }; uuid_2_3_7 = { basename = ''uuid''; meta = { diff --git a/pkgs/development/libraries/geoclue/2.0.nix b/pkgs/development/libraries/geoclue/2.0.nix new file mode 100644 index 00000000000..d799dfb6027 --- /dev/null +++ b/pkgs/development/libraries/geoclue/2.0.nix @@ -0,0 +1,30 @@ +{ fetchurl, stdenv, intltool, pkgconfig, glib, json_glib, libsoup, geoip +, dbus, dbus_glib +}: + +stdenv.mkDerivation rec { + name = "geoclue-2.0.0"; + + src = fetchurl { + url = "http://www.freedesktop.org/software/geoclue/releases/2.0/${name}.tar.xz"; + sha256 = "18b7ikdcw2rm04gzw82216shp5m9pghvnsddw233s5jswn2g30ja"; + }; + + buildInputs = + [ intltool pkgconfig glib json_glib libsoup geoip + dbus dbus_glib + ]; + + preConfigure = '' + substituteInPlace configure --replace "-Werror" "" + ''; + + propagatedBuildInputs = [ dbus dbus_glib glib ]; + + meta = { + description = "Geolocation framework and some data providers"; + maintainers = with stdenv.lib.maintainers; [ raskin garbas ]; + platforms = stdenv.lib.platforms.linux; + license = stdenv.lib.licenses.lgpl2; + }; +} diff --git a/pkgs/development/libraries/haskell/Agda/default.nix b/pkgs/development/libraries/haskell/Agda/default.nix index 64c9d9d51e5..749802f95b2 100644 --- a/pkgs/development/libraries/haskell/Agda/default.nix +++ b/pkgs/development/libraries/haskell/Agda/default.nix @@ -5,8 +5,8 @@ cabal.mkDerivation (self: { pname = "Agda"; - version = "2.3.2.1"; - sha256 = "1dlf0cs913ma8wjvra8x6p0lwi1pk7ynbdq4lxgbdfgqkbnh43kr"; + version = "2.3.2.2"; + sha256 = "0zr2rg2yvq6pqg69c6h7hqqpc5nj8prfhcvj5p2alkby0vs110qc"; isLibrary = true; isExecutable = true; buildDepends = [ diff --git a/pkgs/development/libraries/haskell/Cabal/1.18.1.1.nix b/pkgs/development/libraries/haskell/Cabal/1.18.1.2.nix similarity index 89% rename from pkgs/development/libraries/haskell/Cabal/1.18.1.1.nix rename to pkgs/development/libraries/haskell/Cabal/1.18.1.2.nix index 431c62b85e0..024a4d5c135 100644 --- a/pkgs/development/libraries/haskell/Cabal/1.18.1.1.nix +++ b/pkgs/development/libraries/haskell/Cabal/1.18.1.2.nix @@ -5,8 +5,8 @@ cabal.mkDerivation (self: { pname = "Cabal"; - version = "1.18.1.1"; - sha256 = "1qa6z9kb46hmix15fdjw80jqd69v4rxr52mfq25m8c60l3kxbiny"; + version = "1.18.1.2"; + sha256 = "0pbg9d40lskcps248fdcnm4hnib3vl10mbcdf830zw45q29gfkjr"; buildDepends = [ deepseq filepath time ]; testDepends = [ extensibleExceptions filepath HUnit QuickCheck regexPosix diff --git a/pkgs/development/libraries/haskell/HDBC/HDBC-postgresql.nix b/pkgs/development/libraries/haskell/HDBC/HDBC-postgresql.nix index b66ed3ce28f..94fcd71adbd 100644 --- a/pkgs/development/libraries/haskell/HDBC/HDBC-postgresql.nix +++ b/pkgs/development/libraries/haskell/HDBC/HDBC-postgresql.nix @@ -4,8 +4,8 @@ cabal.mkDerivation (self: { pname = "HDBC-postgresql"; - version = "2.3.2.1"; - sha256 = "1ji10w4d91dp3ci7pn1jd8nb3wasszwlsy1lfbb4mqnr15c9vnpb"; + version = "2.3.2.2"; + sha256 = "0x42lf429dxjkz22jn5fybimlixxs20zq01ap40344qlwh01hd90"; isLibrary = true; isExecutable = true; buildDepends = [ convertible HDBC mtl parsec time utf8String ]; diff --git a/pkgs/development/libraries/haskell/OpenGL/2.9.0.0.nix b/pkgs/development/libraries/haskell/OpenGL/2.9.1.0.nix similarity index 84% rename from pkgs/development/libraries/haskell/OpenGL/2.9.0.0.nix rename to pkgs/development/libraries/haskell/OpenGL/2.9.1.0.nix index 869ca71dfb6..6f79b5c7a06 100644 --- a/pkgs/development/libraries/haskell/OpenGL/2.9.0.0.nix +++ b/pkgs/development/libraries/haskell/OpenGL/2.9.1.0.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "OpenGL"; - version = "2.9.0.0"; - sha256 = "0likrpzlzis8fk11g7mjn102y6y6k2w8bkybqqhhmfls7ccgpvhp"; + version = "2.9.1.0"; + sha256 = "09xzjaa9qyh7bfsnq226v9zi6lhnalhmlqlca3808hgax8ijwhp3"; buildDepends = [ GLURaw OpenGLRaw text ]; extraLibraries = [ libX11 mesa ]; meta = { diff --git a/pkgs/development/libraries/haskell/accelerate-fft/default.nix b/pkgs/development/libraries/haskell/accelerate-fft/default.nix index 4e9a75f64ee..b3c1cb90b29 100644 --- a/pkgs/development/libraries/haskell/accelerate-fft/default.nix +++ b/pkgs/development/libraries/haskell/accelerate-fft/default.nix @@ -9,6 +9,6 @@ cabal.mkDerivation (self: { homepage = "https://github.com/AccelerateHS/accelerate-fft"; description = "FFT using the Accelerate library"; license = self.stdenv.lib.licenses.bsd3; - platforms = self.stdenv.lib.platforms.linux; + platforms = self.stdenv.lib.platforms.none; }; }) diff --git a/pkgs/development/libraries/haskell/blaze-builder/default.nix b/pkgs/development/libraries/haskell/blaze-builder/default.nix index 816537b1ab6..7c2ee140c1a 100644 --- a/pkgs/development/libraries/haskell/blaze-builder/default.nix +++ b/pkgs/development/libraries/haskell/blaze-builder/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "blaze-builder"; - version = "0.3.1.1"; - sha256 = "1pnw5kjpyxf3mh72cb9a0f1qwpq3a2bkgqp1j3ny8l6nmzw0c9d1"; + version = "0.3.2.0"; + sha256 = "169q318jxhk7rmb8r679zhcdcmcca87d55341cnzajmc0580n6ih"; buildDepends = [ text ]; meta = { homepage = "http://github.com/meiersi/blaze-builder"; diff --git a/pkgs/development/libraries/haskell/cipher-des/default.nix b/pkgs/development/libraries/haskell/cipher-des/default.nix index 16b953c10bd..fdc30278425 100644 --- a/pkgs/development/libraries/haskell/cipher-des/default.nix +++ b/pkgs/development/libraries/haskell/cipher-des/default.nix @@ -4,8 +4,8 @@ cabal.mkDerivation (self: { pname = "cipher-des"; - version = "0.0.5"; - sha256 = "1j4nbmxdc3nb5q9gqmwp40dj7pdy71135kvhvl7dfh6mb18bk22v"; + version = "0.0.6"; + sha256 = "1isazxa2nr1y13y0danfk7wghy34rfpn3f43rw714nk2xk6vrwc5"; buildDepends = [ byteable cryptoCipherTypes securemem ]; testDepends = [ byteable cryptoCipherTests cryptoCipherTypes QuickCheck diff --git a/pkgs/development/libraries/haskell/constraints/default.nix b/pkgs/development/libraries/haskell/constraints/default.nix index e57b4e6c085..1e0dc901aaf 100644 --- a/pkgs/development/libraries/haskell/constraints/default.nix +++ b/pkgs/development/libraries/haskell/constraints/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "constraints"; - version = "0.3.4.1"; - sha256 = "13jxh2cgcfyiqhx7j5063k8k60wz9h4hd5lf2mw2skbcryg6csmb"; + version = "0.3.4.2"; + sha256 = "14bfar4d44yl9zxgqxj4p67ag2ndprm602l4pinfjk0ywbh63fwq"; buildDepends = [ newtype ]; meta = { homepage = "http://github.com/ekmett/constraints/"; diff --git a/pkgs/development/libraries/haskell/crypto-cipher-tests/default.nix b/pkgs/development/libraries/haskell/crypto-cipher-tests/default.nix index ed071bbc92a..3c514936468 100644 --- a/pkgs/development/libraries/haskell/crypto-cipher-tests/default.nix +++ b/pkgs/development/libraries/haskell/crypto-cipher-tests/default.nix @@ -5,8 +5,8 @@ cabal.mkDerivation (self: { pname = "crypto-cipher-tests"; - version = "0.0.10"; - sha256 = "1gmhpk1pdc9axkmpw9fyr1zgv6pskyzzlsq8icp2w4fc83l61smb"; + version = "0.0.11"; + sha256 = "19wqignlq90qwpam01hnmmrxaxh5lkax9l1l6rlbi4a07nvp1dnz"; buildDepends = [ byteable cryptoCipherTypes HUnit mtl QuickCheck securemem testFramework testFrameworkHunit testFrameworkQuickcheck2 diff --git a/pkgs/development/libraries/haskell/crypto-cipher-types/default.nix b/pkgs/development/libraries/haskell/crypto-cipher-types/default.nix index 70e61054137..8f52f724bcd 100644 --- a/pkgs/development/libraries/haskell/crypto-cipher-types/default.nix +++ b/pkgs/development/libraries/haskell/crypto-cipher-types/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "crypto-cipher-types"; - version = "0.0.7"; - sha256 = "1zvlc88c4w4rhj1imx3w3j3f4b6im9sj78fgwwyzwmn14mn1y6l8"; + version = "0.0.9"; + sha256 = "03qa1i1kj07pfrxsi7fiaqnnd0vi94jd4jfswbmnm4gp1nvzcwr0"; buildDepends = [ byteable securemem ]; meta = { homepage = "http://github.com/vincenthz/hs-crypto-cipher"; diff --git a/pkgs/development/libraries/haskell/cryptocipher/default.nix b/pkgs/development/libraries/haskell/cryptocipher/default.nix index 57d0e2483f8..7d3ddf57e52 100644 --- a/pkgs/development/libraries/haskell/cryptocipher/default.nix +++ b/pkgs/development/libraries/haskell/cryptocipher/default.nix @@ -4,8 +4,8 @@ cabal.mkDerivation (self: { pname = "cryptocipher"; - version = "0.6.1"; - sha256 = "1qa0s7mr1a3nv4ppyk8wr57rxbfc2qpw9rq26pfziwnpin5k2j3x"; + version = "0.6.2"; + sha256 = "0ip3a2as0df6drl29sryayxx22sx55v6bs60s2fh3i1nxqnydf9l"; buildDepends = [ cipherAes cipherBlowfish cipherCamellia cipherDes cipherRc4 cryptoCipherTypes diff --git a/pkgs/development/libraries/haskell/cufft/default.nix b/pkgs/development/libraries/haskell/cufft/default.nix index 213072b5cdf..e9f1fe166bd 100644 --- a/pkgs/development/libraries/haskell/cufft/default.nix +++ b/pkgs/development/libraries/haskell/cufft/default.nix @@ -10,6 +10,6 @@ cabal.mkDerivation (self: { homepage = "http://github.com/robeverest/cufft"; description = "Haskell bindings for the CUFFT library"; license = self.stdenv.lib.licenses.bsd3; - platforms = self.stdenv.lib.platforms.linux; + platforms = self.stdenv.lib.platforms.none; }; }) diff --git a/pkgs/development/libraries/haskell/data-lens/default.nix b/pkgs/development/libraries/haskell/data-lens/default.nix index 25a81084a4a..5276c1c9707 100644 --- a/pkgs/development/libraries/haskell/data-lens/default.nix +++ b/pkgs/development/libraries/haskell/data-lens/default.nix @@ -1,13 +1,10 @@ -{ cabal, comonad, comonadTransformers, semigroupoids, transformers -}: +{ cabal, comonad, semigroupoids, transformers }: cabal.mkDerivation (self: { pname = "data-lens"; - version = "2.10.3"; - sha256 = "0x8qrcsnl1z2n3vwld0jcnapmzlzjgyzpa34qjyxpv4f15xn8vic"; - buildDepends = [ - comonad comonadTransformers semigroupoids transformers - ]; + version = "2.10.4"; + sha256 = "1pzswlpphpipsqja825pyqjixp4akc5nmw9y61jwv6r4vsgdpg5i"; + buildDepends = [ comonad semigroupoids transformers ]; meta = { homepage = "http://github.com/roconnor/data-lens/"; description = "Haskell 98 Lenses"; diff --git a/pkgs/development/libraries/haskell/diagrams/svg.nix b/pkgs/development/libraries/haskell/diagrams/svg.nix index 320b9b481a6..062cee83e41 100644 --- a/pkgs/development/libraries/haskell/diagrams/svg.nix +++ b/pkgs/development/libraries/haskell/diagrams/svg.nix @@ -4,8 +4,8 @@ cabal.mkDerivation (self: { pname = "diagrams-svg"; - version = "0.8.0.1"; - sha256 = "0ar7z46759s75fff0132mf51q53fvp2fkyqhw8b3lszsxvqs4r7y"; + version = "0.8.0.2"; + sha256 = "0ahapj040qy74kcj9f786ddd28xysq1wch087wsh8sdfp57z5dbz"; buildDepends = [ blazeSvg cmdargs colour diagramsCore diagramsLib filepath monoidExtras mtl split time vectorSpace diff --git a/pkgs/development/libraries/haskell/fclabels/default.nix b/pkgs/development/libraries/haskell/fclabels/default.nix index cea3302cf58..162b83733b1 100644 --- a/pkgs/development/libraries/haskell/fclabels/default.nix +++ b/pkgs/development/libraries/haskell/fclabels/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "fclabels"; - version = "2.0"; - sha256 = "1zh8hr0nq7vnp0q5yf0qd4sbxpaq67l15gs1rvssxfj6n738kngq"; + version = "2.0.0.2"; + sha256 = "1c706v10g4av7jxiw3x4n1hg9h7sbwcnrj676b1q0rcb3pd32kz6"; buildDepends = [ mtl transformers ]; meta = { homepage = "https://github.com/sebastiaanvisser/fclabels"; diff --git a/pkgs/development/libraries/haskell/feed/default.nix b/pkgs/development/libraries/haskell/feed/default.nix index a2c1ccde86b..817276497da 100644 --- a/pkgs/development/libraries/haskell/feed/default.nix +++ b/pkgs/development/libraries/haskell/feed/default.nix @@ -1,10 +1,10 @@ -{ cabal, utf8String, xml }: +{ cabal, time, utf8String, xml }: cabal.mkDerivation (self: { pname = "feed"; - version = "0.3.9.1"; - sha256 = "1c7dj9w9qj8408qql1kfq8m28fwvfd7bpgkj32lmk5x9qm5iz04k"; - buildDepends = [ utf8String xml ]; + version = "0.3.9.2"; + sha256 = "05sg2ly1pvni3sfv03rbf60vdjkrfa0f9mmc1dm1hrmp638j67gg"; + buildDepends = [ time utf8String xml ]; meta = { homepage = "https://github.com/sof/feed"; description = "Interfacing with RSS (v 0.9x, 2.x, 1.0) + Atom feeds."; diff --git a/pkgs/development/libraries/haskell/gloss/default.nix b/pkgs/development/libraries/haskell/gloss/default.nix index f397a60017f..0f0777909e8 100644 --- a/pkgs/development/libraries/haskell/gloss/default.nix +++ b/pkgs/development/libraries/haskell/gloss/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "gloss"; - version = "1.8.0.1"; - sha256 = "17nnmv84pjls1my58yzifbin3pxcnlbpkprglad707rr4lrkkjvv"; + version = "1.8.1.1"; + sha256 = "135rrgzx4xq8279zbsl4538hjn8np4g6409fgva2cb9shw8z5pmj"; buildDepends = [ bmp GLUT OpenGL ]; jailbreak = true; meta = { diff --git a/pkgs/development/libraries/haskell/hexpat/default.nix b/pkgs/development/libraries/haskell/hexpat/default.nix index 5a656bc19c7..03aa9c16ed2 100644 --- a/pkgs/development/libraries/haskell/hexpat/default.nix +++ b/pkgs/development/libraries/haskell/hexpat/default.nix @@ -1,14 +1,10 @@ -{ cabal, deepseq, extensibleExceptions, List, text, transformers -, utf8String -}: +{ cabal, deepseq, List, text, transformers, utf8String }: cabal.mkDerivation (self: { pname = "hexpat"; - version = "0.20.3"; - sha256 = "13dh0cvcmp6yi4nncsn6q9pkisld9xvz6j4xabng5ax67vdgdvrs"; - buildDepends = [ - deepseq extensibleExceptions List text transformers utf8String - ]; + version = "0.20.4"; + sha256 = "09ixvwgrr1046v806d23ngdhc8xqkf0yadzlbwxcy228ka13xwdw"; + buildDepends = [ deepseq List text transformers utf8String ]; meta = { homepage = "http://haskell.org/haskellwiki/Hexpat/"; description = "XML parser/formatter based on expat"; diff --git a/pkgs/development/libraries/haskell/hslua/default.nix b/pkgs/development/libraries/haskell/hslua/default.nix index 11740095284..0cdd309d81b 100644 --- a/pkgs/development/libraries/haskell/hslua/default.nix +++ b/pkgs/development/libraries/haskell/hslua/default.nix @@ -1,10 +1,12 @@ -{ cabal, mtl }: +{ cabal, lua, mtl }: cabal.mkDerivation (self: { pname = "hslua"; - version = "0.3.7"; - sha256 = "1q5s2b7x9idvdvp31yl86mmy476gfq6rg8f0r8faqxrm45jwgv2q"; + version = "0.3.8"; + sha256 = "1yb23cyb3wj70z8lvk6w2sn13kc17v53fd8m587kb4fpqzpdz44d"; buildDepends = [ mtl ]; + pkgconfigDepends = [ lua ]; + configureFlags = "-fsystem-lua"; meta = { description = "A Lua language interpreter embedding in Haskell"; license = self.stdenv.lib.licenses.bsd3; diff --git a/pkgs/development/libraries/haskell/intervals/default.nix b/pkgs/development/libraries/haskell/intervals/default.nix index 9a270574570..788962412d7 100644 --- a/pkgs/development/libraries/haskell/intervals/default.nix +++ b/pkgs/development/libraries/haskell/intervals/default.nix @@ -1,10 +1,9 @@ -{ cabal, numericExtras }: +{ cabal }: cabal.mkDerivation (self: { pname = "intervals"; - version = "0.2.2.1"; - sha256 = "0kbsms3742ppmzbmrfp94aq4wvwrayx5ppsyk7pd1mj7y47aay0f"; - buildDepends = [ numericExtras ]; + version = "0.3"; + sha256 = "1k8dhhwa6y5hrkm9np9x953bdn3pgk5c2lkl3zgrrmrwmd075422"; meta = { homepage = "http://github.com/ekmett/intervals"; description = "Interval Arithmetic"; diff --git a/pkgs/development/libraries/haskell/modular-arithmetic/default.nix b/pkgs/development/libraries/haskell/modular-arithmetic/default.nix index c4a77630e6a..9a15b32f307 100644 --- a/pkgs/development/libraries/haskell/modular-arithmetic/default.nix +++ b/pkgs/development/libraries/haskell/modular-arithmetic/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "modular-arithmetic"; - version = "1.0.1.1"; - sha256 = "14n83kjmz8mqjivjhwxk1zckms5z3gn77yq2hsw2yybzff2vkdkd"; + version = "1.1.0.0"; + sha256 = "02zxxz204ydyj28p65fqb920x5gbm7gba4yf9mhiw6ff0dcmxp37"; meta = { description = "A type for integers modulo some constant"; license = self.stdenv.lib.licenses.bsd3; diff --git a/pkgs/development/libraries/haskell/parsers/default.nix b/pkgs/development/libraries/haskell/parsers/0.10.nix similarity index 100% rename from pkgs/development/libraries/haskell/parsers/default.nix rename to pkgs/development/libraries/haskell/parsers/0.10.nix diff --git a/pkgs/development/libraries/haskell/parsers/0.9.nix b/pkgs/development/libraries/haskell/parsers/0.9.nix new file mode 100644 index 00000000000..dc42228df66 --- /dev/null +++ b/pkgs/development/libraries/haskell/parsers/0.9.nix @@ -0,0 +1,17 @@ +{ cabal, charset, doctest, filepath, text, transformers +, unorderedContainers +}: + +cabal.mkDerivation (self: { + pname = "parsers"; + version = "0.9"; + sha256 = "04lbayvdv2hax4s9sqlnia7jpzv1sgls41ylql0xbi2zhz5rvyyi"; + buildDepends = [ charset text transformers unorderedContainers ]; + testDepends = [ doctest filepath ]; + meta = { + homepage = "http://github.com/ekmett/parsers/"; + description = "Parsing combinators"; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + }; +}) diff --git a/pkgs/development/libraries/haskell/pipes-parse/default.nix b/pkgs/development/libraries/haskell/pipes-parse/default.nix index 2584e001c4f..33892ef8fc6 100644 --- a/pkgs/development/libraries/haskell/pipes-parse/default.nix +++ b/pkgs/development/libraries/haskell/pipes-parse/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "pipes-parse"; - version = "2.0.0"; - sha256 = "092y0a4lvll451gnbz6ddrqgh22bd69wi00c0zd8s0hmf2f53y0s"; + version = "2.0.1"; + sha256 = "04sqjdmgkgk5qva0gyrblhdvmljgmci2yzzw7y17pmnwxwdja4f0"; buildDepends = [ free pipes transformers ]; meta = { description = "Parsing infrastructure for the pipes ecosystem"; diff --git a/pkgs/development/libraries/haskell/postgresql-simple/default.nix b/pkgs/development/libraries/haskell/postgresql-simple/default.nix index a6412006e8f..4203c0cd84c 100644 --- a/pkgs/development/libraries/haskell/postgresql-simple/default.nix +++ b/pkgs/development/libraries/haskell/postgresql-simple/default.nix @@ -1,15 +1,15 @@ { cabal, aeson, attoparsec, base16Bytestring, blazeBuilder , blazeTextual, cryptohash, HUnit, postgresqlLibpq, text, time -, transformers, vector +, transformers, uuid, vector }: cabal.mkDerivation (self: { pname = "postgresql-simple"; - version = "0.3.8.0"; - sha256 = "1p1cxp7mjrxyxxqrq2skm3kqrnmb3k6fb8kwr2aj9cnbqfhwl1qf"; + version = "0.3.9.1"; + sha256 = "0byzlmcbwlycvlk35w0gdp5x7860jcc589ypbdx0vm08aq5vz87v"; buildDepends = [ aeson attoparsec blazeBuilder blazeTextual postgresqlLibpq text - time transformers vector + time transformers uuid vector ]; testDepends = [ base16Bytestring cryptohash HUnit text time vector diff --git a/pkgs/development/libraries/haskell/socks/default.nix b/pkgs/development/libraries/haskell/socks/default.nix index f939708c16a..1953e3436ee 100644 --- a/pkgs/development/libraries/haskell/socks/default.nix +++ b/pkgs/development/libraries/haskell/socks/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "socks"; - version = "0.5.3"; - sha256 = "0cajbl7vrljawaxl3vbbf0sq92ry3cj925sww4nw70lhpz96ay4x"; + version = "0.5.4"; + sha256 = "1nmldlwxqasmg359i2aa3a903gi3lmnlspvf12xk49jrg3mf3dg9"; buildDepends = [ cereal network ]; meta = { homepage = "http://github.com/vincenthz/hs-socks"; diff --git a/pkgs/development/libraries/haskell/symbol/default.nix b/pkgs/development/libraries/haskell/symbol/default.nix index e92c2ec03ad..7b1c2d3821c 100644 --- a/pkgs/development/libraries/haskell/symbol/default.nix +++ b/pkgs/development/libraries/haskell/symbol/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "symbol"; - version = "0.1.4"; - sha256 = "00318syprv1ixfbr4v7xq86z10f0psxk0b8kaxvawvacm8hp61bn"; + version = "0.2.0"; + sha256 = "13vr6j3wkxbdbd27xklnidfkpkjwl0kldf69z470bm5indvaaxfd"; buildDepends = [ deepseq syb ]; jailbreak = true; meta = { diff --git a/pkgs/development/libraries/haskell/trifecta/1.1.nix b/pkgs/development/libraries/haskell/trifecta/1.1.nix new file mode 100644 index 00000000000..ac6cfdd43ae --- /dev/null +++ b/pkgs/development/libraries/haskell/trifecta/1.1.nix @@ -0,0 +1,30 @@ +{ cabal, ansiTerminal, ansiWlPprint, blazeBuilder, blazeHtml +, blazeMarkup, charset, comonad, deepseq, doctest, filepath +, fingertree, hashable, lens, mtl, parsers, reducers, semigroups +, transformers, unorderedContainers, utf8String +}: + +cabal.mkDerivation (self: { + pname = "trifecta"; + version = "1.1"; + sha256 = "19wnblpn31hvdi5dc8ir24s0hfjj4vvzr43gg9ydl2qdjq6s166w"; + buildDepends = [ + ansiTerminal ansiWlPprint blazeBuilder blazeHtml blazeMarkup + charset comonad deepseq fingertree hashable lens mtl parsers + reducers semigroups transformers unorderedContainers utf8String + ]; + testDepends = [ doctest filepath ]; + postPatch = '' + substituteInPlace trifecta.cabal \ + --replace "blaze-html >= 0.5 && < 0.6," "blaze-html >= 0.5 && < 0.7," \ + --replace "hashable >= 1.2 && < 1.3," "hashable >= 1.1 && < 1.3," \ + --replace "fingertree >= 0.0.1 && < 0.1," "fingertree >= 0.0.1 && < 0.2," \ + --replace "comonad == 3.*," "comonad >= 3 && < 5," + ''; + meta = { + homepage = "http://github.com/ekmett/trifecta/"; + description = "A modern parser combinator library with convenient diagnostics"; + license = self.stdenv.lib.licenses.bsd3; + platforms = self.ghc.meta.platforms; + }; +}) diff --git a/pkgs/development/libraries/haskell/trifecta/default.nix b/pkgs/development/libraries/haskell/trifecta/1.2.nix similarity index 89% rename from pkgs/development/libraries/haskell/trifecta/default.nix rename to pkgs/development/libraries/haskell/trifecta/1.2.nix index f7b9a7aea81..de876fa7f67 100644 --- a/pkgs/development/libraries/haskell/trifecta/default.nix +++ b/pkgs/development/libraries/haskell/trifecta/1.2.nix @@ -18,7 +18,8 @@ cabal.mkDerivation (self: { substituteInPlace trifecta.cabal \ --replace "blaze-html >= 0.5 && < 0.6," "blaze-html >= 0.5 && < 0.7," \ --replace "hashable >= 1.2 && < 1.3," "hashable >= 1.1 && < 1.3," \ - --replace "fingertree >= 0.0.1 && < 0.1," "fingertree >= 0.0.1 && < 0.2," + --replace "fingertree >= 0.0.1 && < 0.1," "fingertree >= 0.0.1 && < 0.2," \ + --replace "comonad >= 3 && < 4," "comonad >= 3 && < 5," ''; meta = { homepage = "http://github.com/ekmett/trifecta/"; diff --git a/pkgs/development/libraries/haskell/uniplate/default.nix b/pkgs/development/libraries/haskell/uniplate/default.nix index 8b0825ea119..ab9471bc3f2 100644 --- a/pkgs/development/libraries/haskell/uniplate/default.nix +++ b/pkgs/development/libraries/haskell/uniplate/default.nix @@ -2,8 +2,8 @@ cabal.mkDerivation (self: { pname = "uniplate"; - version = "1.6.11"; - sha256 = "10ppc9hqc0y17r3y4vdajshrp3956dybna7qa5zm0akgl3pbla9j"; + version = "1.6.12"; + sha256 = "1dx8f9aw27fz8kw0ad1nm6355w5rdl7bjvb427v2bsgnng30pipw"; buildDepends = [ hashable syb unorderedContainers ]; meta = { homepage = "http://community.haskell.org/~ndm/uniplate/"; diff --git a/pkgs/development/libraries/haskell/uuid/default.nix b/pkgs/development/libraries/haskell/uuid/default.nix index 2160d22607b..a38a108bc03 100644 --- a/pkgs/development/libraries/haskell/uuid/default.nix +++ b/pkgs/development/libraries/haskell/uuid/default.nix @@ -5,8 +5,8 @@ cabal.mkDerivation (self: { pname = "uuid"; - version = "1.3.2"; - sha256 = "0kwrb200i41l8ipgwviv934sa2ic2hqvlpj72pmkw4ba50viyc8m"; + version = "1.3.3"; + sha256 = "12sfspmrnpqbwwscv3w41pkkdbfvy1aaa84y7is0d3ffk5rll80m"; buildDepends = [ binary cryptohash deepseq hashable networkInfo random time ]; diff --git a/pkgs/development/libraries/libedit/default.nix b/pkgs/development/libraries/libedit/default.nix index dca4d8efc13..1382af16484 100644 --- a/pkgs/development/libraries/libedit/default.nix +++ b/pkgs/development/libraries/libedit/default.nix @@ -1,11 +1,11 @@ { stdenv, fetchurl, ncurses, groff }: stdenv.mkDerivation rec { - name = "libedit-20100424-3.0"; + name = "libedit-20130712-3.1"; src = fetchurl { url = "http://www.thrysoee.dk/editline/${name}.tar.gz"; - sha256 = "11hxaq58gym7kqccjhxywjxdibffzg545z1aj997y1dn0rckhav0"; + sha256 = "0dwav34041sariyl00nr106xmn123bnxir4qpn5y47vgssfim6sx"; }; # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds. @@ -15,12 +15,16 @@ stdenv.mkDerivation rec { sed -i s/-lncurses/-lncursesw/g $out/lib/pkgconfig/libedit.pc ''; + # taken from gentoo http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/libedit/files/ + patches = [ ./freebsd.patch ./freebsd_weak_ref.patch ]; + configureFlags = "--enable-widec"; propagatedBuildInputs = [ ncurses ]; - meta = { + meta = with stdenv.lib; { homepage = "http://www.thrysoee.dk/editline/"; description = "A port of the NetBSD Editline library (libedit)"; + license = licenses.bsd3; }; } diff --git a/pkgs/development/libraries/libedit/freebsd.patch b/pkgs/development/libraries/libedit/freebsd.patch new file mode 100644 index 00000000000..e230a76d709 --- /dev/null +++ b/pkgs/development/libraries/libedit/freebsd.patch @@ -0,0 +1,13 @@ +diff --git a/src/chartype.h b/src/chartype.h +index c35825c..be5aac0 100644 +--- a/src/chartype.h ++++ b/src/chartype.h +@@ -44,7 +44,7 @@ + * supports non-BMP code points without requiring UTF-16, but nothing + * seems to actually advertise this properly, despite Unicode 3.1 having + * been around since 2001... */ +-#if !defined(__NetBSD__) && !defined(__sun) && !(defined(__APPLE__) && defined(__MACH__)) ++#if !defined(__NetBSD__) && !defined(__sun) && !(defined(__APPLE__) && defined(__MACH__)) && !defined(__DragonFly__) && !defined(__FreeBSD__) + #ifndef __STDC_ISO_10646__ + /* In many places it is assumed that the first 127 code points are ASCII + * compatible, so ensure wchar_t indeed does ISO 10646 and not some other diff --git a/pkgs/development/libraries/libedit/freebsd_weak_ref.patch b/pkgs/development/libraries/libedit/freebsd_weak_ref.patch new file mode 100644 index 00000000000..a4399593d63 --- /dev/null +++ b/pkgs/development/libraries/libedit/freebsd_weak_ref.patch @@ -0,0 +1,20 @@ +--- libedit-20110709-3.0/src/vi.c.old 2011-07-11 18:21:16.000000000 +0000 ++++ libedit-20110709-3.0/src/vi.c 2011-07-11 18:24:29.000000000 +0000 +@@ -918,7 +918,7 @@ + * NB: posix implies that we should enter insert mode, however + * this is against historical precedent... + */ +-#ifdef __weak_reference ++#if defined(__weak_reference) && defined(__NetBSD__) + __weakref_visible char *my_get_alias_text(const char *) + __weak_reference(get_alias_text); + #endif +@@ -926,7 +926,7 @@ + /*ARGSUSED*/ + vi_alias(EditLine *el, Int c) + { +-#ifdef __weak_reference ++#if defined(__weak_reference) && defined(__NetBSD__) + char alias_name[3]; + char *alias_text; + diff --git a/pkgs/development/libraries/libsoup/2.40.nix b/pkgs/development/libraries/libsoup/2.40.nix new file mode 100644 index 00000000000..ca37ceb941c --- /dev/null +++ b/pkgs/development/libraries/libsoup/2.40.nix @@ -0,0 +1,32 @@ +{ stdenv, fetchurl, pkgconfig, glib, libxml2, sqlite, intltool, python +, gnomeSupport ? true, libgnome_keyring, glib_networking +}: + +stdenv.mkDerivation { + name = "libsoup-2.44.1"; + + src = fetchurl { + url = mirror://gnome/sources/libsoup/2.44/libsoup-2.44.1.tar.xz; + sha256 = "07acjwvik3gagcsdjzi85g44ga4pd3nh4ww6722bfzjzvlqw6cn5"; + }; + + + preConfigure = '' + substituteInPlace libsoup/tld-parser.py \ + --replace "!/usr/bin/env python" "!${python}/bin/${python.executable}" + ''; + buildInputs = [ pkgconfig intltool python ]; + nativeBuildInputs = [ pkgconfig ]; + propagatedBuildInputs = [ glib libxml2 sqlite ] + ++ stdenv.lib.optionals gnomeSupport [ libgnome_keyring ]; + passthru.propagatedUserEnvPackages = [ glib_networking ]; + + # glib_networking is a runtime dependency, not a compile-time dependency + configureFlags = "--disable-tls-check"; + + NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-lintl"; + + meta = { +# inherit (glib.meta) maintainers platforms; + }; +} diff --git a/pkgs/development/libraries/libusb1/default.nix b/pkgs/development/libraries/libusb1/default.nix index d4504a26b7f..9a6a303fe32 100644 --- a/pkgs/development/libraries/libusb1/default.nix +++ b/pkgs/development/libraries/libusb1/default.nix @@ -11,7 +11,7 @@ stdenv.mkDerivation rec { buildInputs = [ pkgconfig ]; propagatedBuildInputs = stdenv.lib.optional (stdenv.isLinux) udev; - NIX_LDFLAGS = "-lgcc_s"; + NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s"; meta = { homepage = http://www.libusb.org; diff --git a/pkgs/development/libraries/portmidi/default.nix b/pkgs/development/libraries/portmidi/default.nix new file mode 100644 index 00000000000..19eb390388b --- /dev/null +++ b/pkgs/development/libraries/portmidi/default.nix @@ -0,0 +1,54 @@ +{ stdenv, fetchurl, unzip, cmake, /*openjdk,*/ alsaLib }: + +stdenv.mkDerivation rec { + name = "portmidi-${version}"; + version = "217"; + + src = fetchurl { + url = "mirror://sourceforge/portmedia/portmidi-src-${version}.zip"; + sha256 = "03rfsk7z6rdahq2ihy5k13qjzgx757f75yqka88v3gc0pn9ais88"; + }; + + cmakeFlags = let + #base = "${openjdk}/jre/lib/${openjdk.architecture}"; + in [ + "-DPORTMIDI_ENABLE_JAVA=0" + /* TODO: Fix Java support. + "-DJAVA_AWT_LIBRARY=${base}/libawt.so" + "-DJAVA_JVM_LIBRARY=${base}/server/libjvm.so" + */ + "-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=Release" + "-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=Release" + "-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=Release" + ]; + + # XXX: This is to deactivate Java support. + patches = stdenv.lib.singleton (fetchurl rec { + url = "https://raw.github.com/Rogentos/argent-gentoo/master/media-libs/" + + "portmidi/files/portmidi-217-cmake-libdir-java-opts.patch"; + sha256 = "1jbjwan61iqq9fqfpq2a4fd30k3clg7a6j0gfgsw87r8c76kqf6h"; + }); + + postPatch = '' + sed -i -e 's|/usr/local/|'"$out"'|' -e 's|/usr/share/|'"$out"'/share/|' \ + pm_common/CMakeLists.txt pm_dylib/CMakeLists.txt pm_java/CMakeLists.txt + sed -i \ + -e 's|-classpath .|-classpath '"$(pwd)"'/pm_java|' \ + -e 's|pmdefaults/|'"$(pwd)"'/pm_java/&|g' \ + -e 's|jportmidi/|'"$(pwd)"'/pm_java/&|g' \ + -e 's/WORKING_DIRECTORY pm_java//' \ + pm_java/CMakeLists.txt + ''; + + postInstall = '' + ln -s libportmidi.so "$out/lib/libporttime.so" + ''; + + buildInputs = [ unzip cmake /*openjdk*/ alsaLib ]; + + meta = { + homepage = "http://portmedia.sourceforge.net/portmidi/"; + description = "Platform independent library for MIDI I/O"; + license = stdenv.lib.licenses.mit; + }; +} diff --git a/pkgs/development/libraries/unixODBCDrivers/default.nix b/pkgs/development/libraries/unixODBCDrivers/default.nix index 421843b2737..47925520ab4 100644 --- a/pkgs/development/libraries/unixODBCDrivers/default.nix +++ b/pkgs/development/libraries/unixODBCDrivers/default.nix @@ -78,19 +78,29 @@ args : with args; "FileUsage = 3\n "; }; sqlite = rec { - deriv = stdenv.mkDerivation { - name = "sqlite-connector-odbc-3.51.12"; + deriv = let version = "0.995"; in + stdenv.mkDerivation { + name = "sqlite-connector-odbc-${version}"; + src = fetchurl { - url = http://www.ch-werner.de/sqliteodbc/sqliteodbc-0.70.tar.gz; - sha256 = "0ysyqdqkxqcqxrxgi15cbrzia9z6yalim5c88faad85bwanx4db8"; + url = "http://www.ch-werner.de/sqliteodbc/sqliteodbc-${version}.tar.gz"; + sha256 = "1r97fw6xy5w2f8c0ii7blfqfi6salvd3k8wnxpx9wqc1gxk8jnyy"; }; + + buildInputs = [ sqlite ]; + configureFlags = "--with-sqlite3=${sqlite} --with-odbc=${unixODBC}"; - postInstall = ''mkdir lib; mv $out/* lib; mv lib $out''; - buildInputs = [libtool zlib sqlite]; + + postInstall = '' + mkdir -p $out/lib + ''; + meta = { - description = "sqlite odbc connector, install using configuration.nix"; - homepage = http://www.ch-werner.de/sqliteodbc/html/index.html; - license = "BSD"; + description = "ODBC driver for SQLite"; + homepage = http://www.ch-werner.de/sqliteodbc; + license = stdenv.lib.licenses.bsd2; + platforms = stdenv.lib.platforms.linux; + maintainers = with stdenv.lib.maintainers; [ vlstill ]; }; }; ini = diff --git a/pkgs/development/lisp-modules/clwrapper/setup-hook.sh b/pkgs/development/lisp-modules/clwrapper/setup-hook.sh index 5de43dc0e9a..e5deb47fd5d 100644 --- a/pkgs/development/lisp-modules/clwrapper/setup-hook.sh +++ b/pkgs/development/lisp-modules/clwrapper/setup-hook.sh @@ -25,9 +25,15 @@ setLisp () { fi } +collectNixLispLDLP () { + if echo "$1/lib"/lib*.so* | grep . > /dev/null; then + export NIX_LISP_LD_LIBRARY_PATH="$NIX_LISP_LD_LIBRARY_PATH${NIX_LISP_LD_LIBRARY_PATH:+:}$1/lib" + fi +} + export NIX_LISP_COMMAND NIX_LISP CL_SOURCE_REGISTRY NIX_LISP_ASDF -envHooks=(envHooks[@] addASDFPaths setLisp) +envHooks=(envHooks[@] addASDFPaths setLisp collectNixLispLDLP) mkdir -p "$HOME"/.cache/common-lisp || HOME="$TMP/.temp-$USER-home" mkdir -p "$HOME"/.cache/common-lisp diff --git a/pkgs/development/lisp-modules/define-package.nix b/pkgs/development/lisp-modules/define-package.nix index 4fe3bb68373..675fc7e7468 100644 --- a/pkgs/development/lisp-modules/define-package.nix +++ b/pkgs/development/lisp-modules/define-package.nix @@ -9,6 +9,10 @@ let echo "export NIX_LISP_COMMAND='$NIX_LISP_COMMAND'" >> "$config_script" echo "export NIX_LISP_ASDF='$NIX_LISP_ASDF'" >> "$config_script" echo "export CL_SOURCE_REGISTRY="\$CL_SOURCE_REGISTRY\''${CL_SOURCE_REGISTRY:+:}"'$CL_SOURCE_REGISTRY:$out/lib/common-lisp/${args.baseName}/'" >> "$config_script" + test -n "$LD_LIBRARY_PATH" && + echo "export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH\''${LD_LIBRARY_PATH:+:}\"'$LD_LIBRARY_PATH'" >> "$config_script" + test -n "$NIX_LISP_LD_LIBRARY_PATH" && + echo "export NIX_LISP_LD_LIBRARY_PATH=\"\$NIX_LISP_LD_LIBRARY_PATH\''${NIX_LISP_LD_LIBRARY_PATH:+:}\"'$NIX_LISP_LD_LIBRARY_PATH'" >> "$config_script" ''; deployLaunchScript = '' launch_script="$out"/bin/${args.baseName}-lisp-launcher.sh @@ -17,6 +21,7 @@ let chmod a+x "$launch_script" echo "#! /bin/sh" >> "$launch_script" echo "source '$config_script'" >> "$launch_script" + echo "export LD_LIBRARY_PATH=\"\$NIX_LISP_LD_LIBRARY_PATH\''${NIX_LISP_LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH\"" >> "$launch_script" echo '"${clwrapper}/bin/common-lisp.sh" "$@"' >> "$launch_script" ''; basePackage = { diff --git a/pkgs/development/lisp-modules/from-quicklisp/asdf-description.sh b/pkgs/development/lisp-modules/from-quicklisp/asdf-description.sh new file mode 100755 index 00000000000..6c240d15c76 --- /dev/null +++ b/pkgs/development/lisp-modules/from-quicklisp/asdf-description.sh @@ -0,0 +1,16 @@ +#! /bin/sh + +[ -z "$NIX_QUICKLISP_DIR" ] && { + export NIX_QUICKLISP_DIR="$(mktemp -d --tmpdir nix-quicklisp.XXXXXX)" +} + +[ -f "$NIX_QUICKLISP_DIR/setup.lisp" ] || { + "$(dirname "$0")/quicklisp-beta-env.sh" "$NIX_QUICKLISP_DIR" &> /dev/null < /dev/null +} + +name="$1" + +sbcl --noinform --load "$NIX_QUICKLISP_DIR"/setup.lisp --eval "(ql:quickload :$name)" \ + --eval "(format t \"~a~%\" (or (asdf::system-description (asdf::find-system \"$name\")) \"\"))" \ + --eval '(quit)' --script | + tee /dev/stderr | tail -n 1 diff --git a/pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh b/pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh new file mode 100755 index 00000000000..61c00eb92ae --- /dev/null +++ b/pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh @@ -0,0 +1,78 @@ +#! /bin/sh + +name="$1" + +nix-instantiate "$(dirname "$0")"/../../../../ -A "lispPackages.$name" > /dev/null && exit +[ "$NIX_LISP_PACKAGES_DEFINED" != "${NIX_LISP_PACKAGES_DEFINED/$name/@@}" ] && exit + +NIX_LISP_PACKAGES_DEFINED="$NIX_LISP_PACKAGES_DEFINED $1 " + +[ -z "$NIX_QUICKLISP_DIR" ] && { + export NIX_QUICKLISP_DIR="$(mktemp -d --tmpdir nix-quicklisp.XXXXXX)" +} + +[ -f "$NIX_QUICKLISP_DIR/setup.lisp" ] || { + "$(dirname "$0")/quicklisp-beta-env.sh" "$NIX_QUICKLISP_DIR" &> /dev/null < /dev/null +} + +description="$("$(dirname "$0")/asdf-description.sh" "$name")" +[ -z "$description" ] && { + description="$(curl -L https://github.com/quicklisp/quicklisp-projects/raw/master/"$name"/description.txt)" + [ "$(echo "$description" | wc -l)" -gt 10 ] && description="" +} + +dependencies="$("$(dirname "$0")/quicklisp-dependencies.sh" "$name" | xargs)" +ql_src="$(curl -L https://github.com/quicklisp/quicklisp-projects/raw/master/"$name"/source.txt)" +ql_src_type="${ql_src%% *}" +url="${ql_src##* }" + +[ "$ql_src_type" = git ] && { + fetcher="pkgs.fetchgit" + [ "${url#git://github.com/}" != "$url" ] && { + url="${url/git:/https:}" + url="${url%.git}" + rev=$("$(dirname "$0")/../../../build-support/upstream-updater/urls-from-page.sh" "$url/commits" | grep /commit/ | head -n 1 | xargs basename) + hash=$("$(dirname "$0")/../../../build-support/fetchgit/nix-prefetch-git" "$url" "$rev") + version="git-$(date +%Y%m%d)"; + } + [ "${url#git://common-lisp.net/}" != "$url" ] && { + http_repo_url="$url" + http_repo_url="${http_repo_url/git:/http:}" + http_repo_url="${http_repo_url/\/projects\// /r/projects/}" + http_repo_head="$http_repo_url/refs/heads/master" + echo "$http_repo_head" >&2 + rev=$(curl -L "$http_repo_head"); + hash=$("$(dirname "$0")/../../../build-support/fetchgit/nix-prefetch-git" "$url" "$rev") + version="git-$(date +%Y%m%d)"; + } +} + +[ "$ql_src_type" = cvs ] && { + fetcher="pkgs.fetchcvs" + date="$(date -d yesterday +%Y-%m-%d)" + version="cvs-$date" + module="${module:-$name}" + hash=$(USE_DATE=1 "$(dirname "$0")/../../../build-support/fetchcvs/nix-prefetch-cvs" "$url" "$module" "$date") + cvsRoot="$url" + unset url +} + +cat << EOF + + $name = buildLispPackage rec { + baseName = "$name"; + version = "${version:-\${Set me //}"; + description = "$description"; + deps = [$dependencies]; + src = ${fetcher:-pkgs.fetchurl} { + ${url:+url = ''$url'';} + sha256 = "${hash:-0000000000000000000000000000000000000000000000000000000000000000}"; + ${rev:+rev = ''$rev'';} + ${date:+date = ''$date'';} + ${module:+module = ''$module'';} + ${cvsRoot:+cvsRoot = ''$cvsRoot'';} + }; + }; +EOF + +for i in $dependencies; do "$0" "$i"; done diff --git a/pkgs/development/lisp-modules/from-quicklisp/quicklisp-beta-env.sh b/pkgs/development/lisp-modules/from-quicklisp/quicklisp-beta-env.sh new file mode 100755 index 00000000000..32fbbe4bb2b --- /dev/null +++ b/pkgs/development/lisp-modules/from-quicklisp/quicklisp-beta-env.sh @@ -0,0 +1,16 @@ +#! /bin/sh + +WORK_DIR=$(mktemp -d "/tmp/ql-venv-XXXXXX") +mkdir -p "${1:-.}" +TARGET="$(cd "${1:-.}"; pwd)" + +curl http://beta.quicklisp.org/quicklisp.lisp > "$WORK_DIR/ql.lisp" + +sbcl --noinform \ + --load "$WORK_DIR/ql.lisp" \ + --eval "(quicklisp-quickstart:install :path \"$TARGET/\")" \ + --eval "(cl-user::quit)" \ + --script + + +rm -rf "$WORK_DIR" diff --git a/pkgs/development/lisp-modules/from-quicklisp/quicklisp-dependencies.sh b/pkgs/development/lisp-modules/from-quicklisp/quicklisp-dependencies.sh new file mode 100755 index 00000000000..24efbdd3e16 --- /dev/null +++ b/pkgs/development/lisp-modules/from-quicklisp/quicklisp-dependencies.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +[ -z "$NIX_QUICKLISP_DIR" ] && { + export NIX_QUICKLISP_DIR="$(mktemp -d --tmpdir nix-quicklisp.XXXXXX)" +} + +[ -f "$NIX_QUICKLISP_DIR/setup.lisp" ] || { + "$(dirname "$0")/quicklisp-beta-env.sh" "$NIX_QUICKLISP_DIR" &> /dev/null < /dev/null +} + +sbcl --noinform --eval "(with-output-to-string (*standard-output*) (load \"$NIX_QUICKLISP_DIR/setup.lisp\"))" --eval "(with-output-to-string (*standard-output*) (with-output-to-string (*error-output*) (with-output-to-string (*trace-output*) (ql:quickload :$1))))" --eval "(format t \"~{~a~%~}\" (mapcar 'ql::name (mapcar 'car (cdr (ql::dependency-tree \"$1\")))))" --eval '(quit)' --script diff --git a/pkgs/development/lisp-modules/from-quicklisp/tmp.nix b/pkgs/development/lisp-modules/from-quicklisp/tmp.nix new file mode 100644 index 00000000000..e69de29bb2d diff --git a/pkgs/development/lisp-modules/lisp-packages.nix b/pkgs/development/lisp-modules/lisp-packages.nix index 8eaaf151fa7..015d5fccdc3 100644 --- a/pkgs/development/lisp-modules/lisp-packages.nix +++ b/pkgs/development/lisp-modules/lisp-packages.nix @@ -45,5 +45,59 @@ let lispPackages = rec { }; stumpwm = callPackage ./stumpwm {}; + + alexandria = buildLispPackage rec { + baseName = "alexandria"; + version = "git-20131029"; + description = "Alexandria is a collection of portable public domain utilities."; + deps = []; + src = pkgs.fetchgit { + url = "git://common-lisp.net/projects/alexandria/alexandria.git"; + sha256 = "1d981a243f9d4d3c9fd86cc47698050507ff615b87b9a710449abdb4234e501b"; + rev = ''2b1eb4067fb34bc501e527de75d09166a8ba9ceb''; + }; + }; + + esrap-peg = buildLispPackage rec { + baseName = "esrap-peg"; + version = "git-20131029"; + description = "A wrapper around Esrap to allow generating Esrap grammars from PEG definitions"; + deps = [alexandria cl-unification esrap iterate]; + src = pkgs.fetchgit { + url = "https://github.com/fb08af68/esrap-peg"; + sha256 = "48e616a697aca95e90e55052fdc9a7f96bf29b3208b1b4012fcd3189c2eceeb1"; + rev = ''1f2f21e32e618f71ed664cdc5e7005f8b6b0f7c8''; + + + }; + }; + + cl-unification = buildLispPackage rec { + baseName = "cl-unification"; + version = "cvs-2013-10-28"; + description = ""; + deps = []; + src = pkgs.fetchcvs { + sha256 = "a574b7f9615232366e3e5e7ee400d60dbff23f6d0e1def5a3c77aafdfd786e6a"; + + date = ''2013-10-28''; + module = ''cl-unification''; + cvsRoot = '':pserver:anonymous:anonymous@common-lisp.net:/project/cl-unification/cvsroot''; + }; + }; + + esrap = buildLispPackage rec { + baseName = "esrap"; + version = "git-20131029"; + description = "A Packrat / Parsing Grammar / TDPL parser for Common Lisp."; + deps = [alexandria]; + src = pkgs.fetchgit { + url = "https://github.com/scymtym/esrap"; + sha256 = "c56616ac01be0f69e72902f9fd830a8af2c2fa9018b66747a5da3988ae38817f"; + rev = ''c71933b84e220f21e8a509ec26afe3e3871e2e26''; + + + }; + }; }; in lispPackages diff --git a/pkgs/development/tools/haskell/cabal2nix/default.nix b/pkgs/development/tools/haskell/cabal2nix/default.nix index 4e2bbf63b31..cc44268f3a3 100644 --- a/pkgs/development/tools/haskell/cabal2nix/default.nix +++ b/pkgs/development/tools/haskell/cabal2nix/default.nix @@ -3,8 +3,8 @@ cabal.mkDerivation (self: { pname = "cabal2nix"; - version = "1.54"; - sha256 = "169syf99gs0gj44hcnpgx0xvrmz5mq70hb6bq6ydma9ivjvz2jg4"; + version = "1.55"; + sha256 = "0rda8g595pr7vlhzyflw9kz6fw1iz76yimbl1zizgrnpnq3h11w3"; isLibrary = false; isExecutable = true; buildDepends = [ Cabal filepath hackageDb HTTP mtl regexPosix ]; diff --git a/pkgs/development/tools/misc/ninka/default.nix b/pkgs/development/tools/misc/ninka/default.nix index 1cb491df8d1..a5410204340 100644 --- a/pkgs/development/tools/misc/ninka/default.nix +++ b/pkgs/development/tools/misc/ninka/default.nix @@ -1,41 +1,34 @@ -{stdenv, fetchgit, perl}: +{ stdenv, fetchurl, perl }: assert stdenv ? glibc; -let - rev = "7a9a5c48ede207eec881"; -in -stdenv.mkDerivation { - name = "ninka-"+rev; - src = fetchgit { - url = http://github.com/dmgerman/ninka.git; - inherit rev; - sha256 = "3e877fadf074b9c5abfe36ff10b7e332423d1d4c5b17accc5586c7cffdb2c7dd"; +stdenv.mkDerivation rec { + name = "ninka-${version}"; + version = "1.1"; + + src = fetchurl { + url = "https://github.com/dmgerman/ninka/archive/${version}.tar.gz"; + sha256 = "1cvbsmanw3i9igiafpx0ghg658c37riw56mjk5vsgpmnn3flvhib"; }; buildInputs = [ perl ]; buildPhase = '' - cd comments - tar xfvz comments.tar.gz cd comments sed -i -e "s|/usr/local/bin|$out/bin|g" -e "s|/usr/local/man|$out/share/man|g" Makefile make ''; installPhase = '' - cd ../.. - mkdir -p $out/bin - cp ninka.pl $out/bin - cp -av {extComments,splitter,filter,senttok,matcher} $out/bin - - cd comments/comments mkdir -p $out/{bin,share/man/man1} make install + + cp -a ../{ninka.pl,extComments,splitter,filter,senttok,matcher} $out/bin ''; meta = { - license = "AGPLv3+"; description = "A sentence based license detector"; + homepage = "http://ninka.turingmachine.org/"; + license = "AGPLv3+"; }; } diff --git a/pkgs/development/tools/slimerjs/default.nix b/pkgs/development/tools/slimerjs/default.nix index 23aae157f09..0fe10a0003a 100644 --- a/pkgs/development/tools/slimerjs/default.nix +++ b/pkgs/development/tools/slimerjs/default.nix @@ -1,28 +1,36 @@ -{stdenv, fetchurl, unzip, xulrunner, bash}: +{stdenv, fetchurl, fetchgit, zip, unzip, xulrunner, bash}: let s = # Generated upstream information rec { baseName="slimerjs"; - version="0.8.3"; + version="git-2013-10-31"; name="${baseName}-${version}"; - hash="07gwiay2pbzyscn8gnwb8i92xffjahhinlswc1z4h8dbjk837d8h"; - url="http://download.slimerjs.org/v0.8/slimerjs-0.8.3.zip"; - sha256="07gwiay2pbzyscn8gnwb8i92xffjahhinlswc1z4h8dbjk837d8h"; + hash="643a9d2f97f238bbd9debb17c010946d507a3b740079d9398939e7fdd70256b9"; + url="https://github.com/laurentj/slimerjs"; + rev="fdeb7364d3e29b47391ed0651176c1aedcb5277f"; + sha256="643a9d2f97f238bbd9debb17c010946d507a3b740079d9398939e7fdd70256b9"; }; buildInputs = [ - unzip + unzip zip ]; in stdenv.mkDerivation { inherit (s) name version; inherit buildInputs; - src = fetchurl { - inherit (s) url sha256; + # src = fetchurl { + # inherit (s) url sha256; + # }; + src = fetchgit { + inherit (s) url sha256 rev; }; + preConfigure = '' + test -d src && cd src + test -f omni.ja || zip omni.ja -r */ + ''; installPhase = '' mkdir -p "$out"/{bin,share/doc/slimerjs,lib/slimerjs} cp LICENSE README* "$out/share/doc/slimerjs" - cp * "$out/lib/slimerjs" + cp -r * "$out/lib/slimerjs" echo '#!${bash}/bin/bash' >> "$out/bin/slimerjs" echo 'export SLIMERJSLAUNCHER=${xulrunner}/bin/xulrunner' >> "$out/bin/slimerjs" echo "'$out/lib/slimerjs/slimerjs' \"\$@\"" >> "$out/bin/slimerjs" diff --git a/pkgs/development/tools/slimerjs/default.upstream.git b/pkgs/development/tools/slimerjs/default.upstream.git new file mode 100644 index 00000000000..3066d5de829 --- /dev/null +++ b/pkgs/development/tools/slimerjs/default.upstream.git @@ -0,0 +1,3 @@ +url https://github.com/laurentj/slimerjs +target default.nix +GH_latest diff --git a/pkgs/games/dwarf-therapist/default.nix b/pkgs/games/dwarf-therapist/default.nix index 8ac84a96aeb..d8f39ceeea4 100644 --- a/pkgs/games/dwarf-therapist/default.nix +++ b/pkgs/games/dwarf-therapist/default.nix @@ -54,7 +54,7 @@ stdenv.mkDerivation rec { description = "Tool to manage dwarves in in a running game of Dwarf Fortress"; maintainers = with stdenv.lib.maintainers; [ the-kenny ]; license = "MIT"; - platforms = stdenv.lib.platforms.linux; + platforms = stdenv.lib.platforms.none; homepage = https://code.google.com/r/splintermind-attributes/; }; } diff --git a/pkgs/games/quantumminigolf/default.nix b/pkgs/games/quantumminigolf/default.nix new file mode 100644 index 00000000000..94035179016 --- /dev/null +++ b/pkgs/games/quantumminigolf/default.nix @@ -0,0 +1,40 @@ +{stdenv, fetchurl, fftwSinglePrec, freetype, SDL, SDL_ttf}: +let + s = # Generated upstream information + rec { + baseName="quantumminigolf"; + version="1.1.1"; + name="${baseName}-${version}"; + hash="16av7fk0irhi5nd7y9h9vhb0kf0dk12p6976ai3f60m99qdd8wk3"; + url="mirror://sourceforge/project/quantumminigolf/quantumminigolf/1.1.1/quantumminigolf-1.1.1.src.tar.gz"; + sha256="16av7fk0irhi5nd7y9h9vhb0kf0dk12p6976ai3f60m99qdd8wk3"; + }; + buildInputs = [ + fftwSinglePrec freetype SDL SDL_ttf + ]; +in +stdenv.mkDerivation { + inherit (s) name version; + inherit buildInputs; + src = fetchurl { + inherit (s) url sha256; + }; + preBuild = '' + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${SDL}/include/SDL" + + sed -re 's@"(gfx|fonts|tracks)/@"'"$out"'/share/quantumminigolf/\1/@g' -i *.cpp + ''; + installPhase = '' + mkdir -p "$out"/{share/doc,share/quantumminigolf,bin} + cp README THANKS LICENSE "$out/share/doc" + cp -r fonts gfx tracks "$out/share/quantumminigolf" + cp quantumminigolf "$out/bin" + ''; + meta = { + inherit (s) version; + description = ''Quantum mechanics-based minigolf-like game''; + license = stdenv.lib.licenses.gpl2 ; + maintainers = [stdenv.lib.maintainers.raskin]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/games/quantumminigolf/default.upstream b/pkgs/games/quantumminigolf/default.upstream new file mode 100644 index 00000000000..813c3643a3c --- /dev/null +++ b/pkgs/games/quantumminigolf/default.upstream @@ -0,0 +1,4 @@ +url http://sourceforge.net/projects/quantumminigolf/files/quantumminigolf/ +SF_version_dir +version_link '[.]tar[.][^.]+/download$' +SF_redirect diff --git a/pkgs/games/sdlmame/default.nix b/pkgs/games/sdlmame/default.nix index bd6e9011178..645312dd54e 100644 --- a/pkgs/games/sdlmame/default.nix +++ b/pkgs/games/sdlmame/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchurl, alsaLib, qt48, SDL, fontconfig, freetype, SDL_ttf, xlibs }: -assert stdenv.system == "x86_64-linux" || stdenv.system == "1686-linux"; +assert stdenv.system == "x86_64-linux" || stdenv.system == "i686-linux"; stdenv.mkDerivation rec { version = "0.150.u0-1"; diff --git a/pkgs/misc/vim-plugins/default.nix b/pkgs/misc/vim-plugins/default.nix index b17b8490a0b..01ce5f423c3 100644 --- a/pkgs/misc/vim-plugins/default.nix +++ b/pkgs/misc/vim-plugins/default.nix @@ -197,6 +197,23 @@ in rec }; }; + ipython = simpleDerivation { + name = "vim-ipython-ff8f88f3fe518851a91dc88aaa5a75f8f352a960"; + src = fetchurl { + url = "https://github.com/ivanov/vim-ipython/archive/ff8f88f3fe518851a91dc88aaa5a75f8f352a960.tar.gz"; + sha256 = "0hlx526dm8amrvh41kwnmgvvdzs6sh5yc5sfq4nk1zjkfcp1ah5j"; + }; + path = "ipython"; + meta = with stdenv.lib; { + description = "A two-way integration between vim and iPython"; + homepage = https://github.com/ivanov/vim-ipython; + repositories.git = https://github.com/ivanov/vim-ipython.git; + license = licenses.publicDomain; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.unix; + }; + }; + taglist = simpleDerivation { name = "vim-taglist-4.6"; meta = with stdenv.lib; { diff --git a/pkgs/os-specific/linux/kernel/linux-3.2.nix b/pkgs/os-specific/linux/kernel/linux-3.2.nix index 46c9108ec08..ae065499c65 100644 --- a/pkgs/os-specific/linux/kernel/linux-3.2.nix +++ b/pkgs/os-specific/linux/kernel/linux-3.2.nix @@ -1,11 +1,11 @@ { stdenv, fetchurl, ... } @ args: import ./generic.nix (args // rec { - version = "3.2.51"; + version = "3.2.52"; src = fetchurl { url = "mirror://kernel/linux/kernel/v3.x/linux-${version}.tar.xz"; - sha256 = "1x1yk07ihfbrhsycmd44h9fn6ajg6akwgsxxdi2rk5cs8g706s63"; + sha256 = "1wpr5xs6vg0xjlzrlbkv7bjvv34psw57crkdh4lybghi4rgrmkzl"; }; features.iwlwifi = true; diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix index 5bda5b1f263..613f40c6fc9 100644 --- a/pkgs/os-specific/linux/kernel/patches.nix +++ b/pkgs/os-specific/linux/kernel/patches.nix @@ -131,13 +131,13 @@ rec { patch = ./mips-ext3-n32.patch; }; - grsecurity_2_9_1_3_2_51 = - { name = "grsecurity-2.9.1-3.2.51"; + grsecurity_2_9_1_3_2_52 = + { name = "grsecurity-2.9.1-3.2.52"; patch = fetchurl { - url = http://grsecurity.net/stable/grsecurity-2.9.1-3.2.51-201309281102.patch; - sha256 = "0mwwdmccihzhl25c9q92x0k33c5kxbz6mikid9diramvki7sk0l8"; + url = http://grsecurity.net/stable/grsecurity-2.9.1-3.2.52-201310271550.patch; + sha256 = "08y4y323y2lfvdj67gmg3ca8gaf3snhr3pyrmgvj877avaz0475m"; }; - # The grsec kernel patch seems to include the apparmor patches as of 2.9.1-3.2.51 + # The grsec kernel patch seems to include the apparmor patches as of 2.9.1-3.2.52 features.apparmor = true; }; diff --git a/pkgs/servers/amqp/qpid-cpp/default.nix b/pkgs/servers/amqp/qpid-cpp/default.nix new file mode 100644 index 00000000000..9fc3520002c --- /dev/null +++ b/pkgs/servers/amqp/qpid-cpp/default.nix @@ -0,0 +1,37 @@ +{ stdenv, fetchurl, cmake, python, boost, libuuid }: + +stdenv.mkDerivation rec { + name = "${project}-cpp-${version}"; + + project = "qpid"; + version = "0.24"; + + src = fetchurl { + url = "mirror://apache/${project}/${version}/${name}.tar.gz"; + sha256 = "08nfks5jjipy5i4b6mz62ijrz5ryq32c478ix7l3fzmaim3cy8b8"; + }; + + buildInputs = [ cmake python boost libuuid ]; + + # workaround this + #/nix/store/n38ns73bm4iv62fihd9ih5b39w54yyaf-boost-1.54.0/include/boost/ptr_container/detail/map_iterator.hpp:52:48: + #error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers] + cmakeFlags = "-DENABLE_WARNINGS=OFF"; + + # the subdir managementgen wants to install python stuff in ${python} and + # the installation tries to create some folders in /var + patchPhase = '' + sed -i '/managementgen/d' CMakeLists.txt + sed -i '/ENV/d' src/CMakeLists.txt + ''; + + meta = { + homepage = http://qpid.apache.org; + repositories.git = git://git.apache.org/qpid.git; + repositories.svn = http://svn.apache.org/repos/asf/qpid; + description = "An AMQP message broker and a C++ messaging API"; + license = stdenv.lib.licenses.asl20; + platforms = stdenv.lib.platforms.linux; + maintainers = [ stdenv.lib.maintainers.page ]; + }; +} diff --git a/pkgs/tools/filesystems/btrfsprogs/default.nix b/pkgs/tools/filesystems/btrfsprogs/default.nix index 9c8d18231f0..0661755d2e1 100644 --- a/pkgs/tools/filesystems/btrfsprogs/default.nix +++ b/pkgs/tools/filesystems/btrfsprogs/default.nix @@ -13,6 +13,9 @@ stdenv.mkDerivation { buildInputs = [ zlib libuuid acl attr e2fsprogs lzo ]; + # for btrfs to get the rpath to libgcc_s, needed for pthread_cancel to work + NIX_CFLAGS_LINK = "-lgcc_s"; + postPatch = '' cp ${./btrfs-set-received-uuid.c} btrfs-set-received-uuid.c ''; diff --git a/pkgs/tools/graphics/optipng/default.nix b/pkgs/tools/graphics/optipng/default.nix index a7cb20ca1cf..1b2fc6dbb90 100644 --- a/pkgs/tools/graphics/optipng/default.nix +++ b/pkgs/tools/graphics/optipng/default.nix @@ -3,11 +3,11 @@ # This package comes with its own copy of zlib, libpng and pngxtern stdenv.mkDerivation rec { - name = "optipng-0.6.5"; + name = "optipng-0.7.4"; src = fetchurl { url = "mirror://sourceforge/optipng/${name}.tar.gz"; - sha256 = "0i2vpakj60bb0zgy4bynly2mwxiv5fq48yjqjzmrbnqwjh1y5619"; + sha256 = "1zrphbz17rhhfl1l95q5s979rrhifbwczl2xj1fdrnq5jid5s2sj"; }; meta = { diff --git a/pkgs/tools/graphics/pngquant/default.nix b/pkgs/tools/graphics/pngquant/default.nix new file mode 100644 index 00000000000..560352c481e --- /dev/null +++ b/pkgs/tools/graphics/pngquant/default.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchgit, libpng }: + +stdenv.mkDerivation rec { + name = "pngquant-${version}"; + version = "2.0.1"; + + src = fetchgit { + url = https://github.com/pornel/pngquant.git; + rev = "refs/tags/${version}"; + sha256 = "00mrv9wgxbwy517l8i4n7n3jpzirjdgi0zass3wj29i7xyipwlhf"; + }; + + buildInputs = [ libpng ]; + + preInstall = '' + mkdir -p $out/bin + export PREFIX=$out + ''; + + meta = with stdenv.lib; { + homepage = https://github.com/pornel/pngquant; + description = "pngquant converts 24/32-bit RGBA PNGs to 8-bit palette with alpha channel preserved"; + platforms = platforms.all; + license = licenses.bsd2; # Not exactly bsd2, but alike + }; +} diff --git a/pkgs/tools/misc/ngrok/default.nix b/pkgs/tools/misc/ngrok/default.nix new file mode 100644 index 00000000000..971c42aac71 --- /dev/null +++ b/pkgs/tools/misc/ngrok/default.nix @@ -0,0 +1,94 @@ +{ stdenv, fetchurl, go, fetchgit, fetchbzr, fetchhg }: + +let + go-websocket = fetchgit { + url = "git://github.com/garyburd/go-websocket"; + rev = "refs/heads/master"; + sha256 = "1e4fcff29c961cd7433ba1b655412d466edfeb1f0829b41f578764857bc801fe"; + }; + go-metrics = fetchgit { + url = "https://github.com/inconshreveable/go-metrics"; + sha256 = "3dc8c229ce5123d86269c0c48401a9cdd2cde7558d85374c9dbc4bbd531e86d5"; + }; + termbox-go = fetchgit { + url = "https://github.com/nsf/termbox-go"; + sha256 = "6b23e8eabb1c7a99dc8c5a7dd5ecb2c2ae736c7f54e485548d08ac337b3a0400"; + }; + go-bindata = fetchgit { + url = "https://github.com/inconshreveable/go-bindata"; + sha256 = "518a5b61cfbe58f8bc55bd6139adcd69997b6ba474536a70b538879aaf118578"; + }; + go-update = fetchgit { + url = "https://github.com/inconshreveable/go-update"; + sha256 = "34647689a50b9d12e85a280d9034cc1772079163481c4778ee4b3e6c4b41e2f4"; + }; + goyaml = fetchbzr { + url = "https://launchpad.net/goyaml"; + sha256 = "03is37cgw62cha316xrs5h7q97im46ry5qldkfvbhimjq3ww0swj"; + revision = "branch:lp:goyaml"; + }; + log4go = fetchhg { + url = "https://code.google.com/p/log4go/"; + sha256 = "0q906sxrmwir295virfibqvdzlaj340qh2r4ysx1ccjrjazc0q5p"; + }; + osext = fetchhg { + url = "https://bitbucket.org/kardianos/osext"; + sha256 = "1w9x2zj716agfd5x5497ajb9nz3ljar74768vjidsyly143vzjws"; + }; +in stdenv.mkDerivation rec { + name = "ngrok-${version}"; + version = "1.6"; + + src = fetchurl { + url = "https://github.com/inconshreveable/ngrok/archive/${version}.tar.gz"; + sha256 = "0w54ck00ma8wd87gc3dligypdjs7vrzbi9py46sqphsid3rihkjr"; + }; + + buildInputs = [ go ]; + + preBuild = '' + export HOME="$PWD" + + mkdir -p src/github.com/garyburd/go-websocket/ + ln -s ${go-websocket}/* src/github.com/garyburd/go-websocket + + mkdir -p src/github.com/inconshreveable/go-metrics/ + ln -s ${go-metrics}/* src/github.com/inconshreveable/go-metrics + + mkdir -p src/github.com/inconshreveable/go-bindata + ln -s ${go-bindata}/* src/github.com/inconshreveable/go-bindata + + mkdir -p src/github.com/inconshreveable/go-update + ln -s ${go-update}/* src/github.com/inconshreveable/go-update + + mkdir -p src/github.com/nsf/termbox-go/ + ln -s ${termbox-go}/* src/github.com/nsf/termbox-go + + mkdir -p src/launchpad.net/goyaml + ln -s ${goyaml}/* src/launchpad.net/goyaml + + mkdir -p src/code.google.com/p/log4go + ln -s ${log4go}/* src/code.google.com/p/log4go + + mkdir -p src/bitbucket.org/kardianos/osext + ln -s ${osext}/* src/bitbucket.org/kardianos/osext + + # don't download dependencies as we already have them + sed -i '/go get/d' Makefile + ''; + + installPhase = '' + make release-client + mkdir -p $out/bin + cp bin/ngrok $out/bin + cp -R assets $out + ''; + + meta = with stdenv.lib; { + description = "Reverse proxy that creates a secure tunnel between from a public endpoint to a locally running web service"; + homepage = https://ngrok.com/; + license = licenses.asl20; + maintainers = with maintainers; [ iElectric ]; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/tools/misc/youtube-dl/default.nix b/pkgs/tools/misc/youtube-dl/default.nix index e4d934968b2..86ef7617808 100644 --- a/pkgs/tools/misc/youtube-dl/default.nix +++ b/pkgs/tools/misc/youtube-dl/default.nix @@ -1,14 +1,14 @@ { stdenv, fetchurl, python, zip }: let - version = "2013.06.21"; + version = "2013.10.23.2"; in stdenv.mkDerivation rec { name = "youtube-dl-${version}"; src = fetchurl { url = "http://youtube-dl.org/downloads/${version}/${name}.tar.gz"; - sha256 = "3d4e9cc38af3c2fccfafd83d0c6382080531fd03e9067ceccc6864dfbea92b1e"; + sha256 = "d3f4c9e0da165395856e690314caa5eef4382bd994dd46f041a520bf9747c35d"; }; buildInputs = [ python ]; diff --git a/pkgs/tools/networking/haproxy/default.nix b/pkgs/tools/networking/haproxy/default.nix index 3946f1eef0f..e4a32e14260 100644 --- a/pkgs/tools/networking/haproxy/default.nix +++ b/pkgs/tools/networking/haproxy/default.nix @@ -3,7 +3,7 @@ stdenv.mkDerivation rec { version = "1.4.24"; name = "haproxy-${version}"; - + src = fetchurl { url = "http://haproxy.1wt.eu/download/1.4/src/${name}.tar.gz"; sha256 = "1vy7jz7l8qdd6ah3y65zarz9x9pf3bs02icxnrckpgh1s3s2h2b8"; diff --git a/pkgs/tools/networking/openssh/default.nix b/pkgs/tools/networking/openssh/default.nix index 6d3120e7b99..35586031ef5 100644 --- a/pkgs/tools/networking/openssh/default.nix +++ b/pkgs/tools/networking/openssh/default.nix @@ -71,7 +71,7 @@ stdenv.mkDerivation rec { homepage = http://www.openssh.org/; description = "An implementation of the SSH protocol"; license = "bsd"; - platforms = stdenv.lib.platforms.linux; + platforms = stdenv.lib.platforms.unix; maintainers = stdenv.lib.maintainers.eelco; }; } diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix index 7b4bb3c6193..9b0b8b3f24e 100644 --- a/pkgs/tools/package-management/nix/default.nix +++ b/pkgs/tools/package-management/nix/default.nix @@ -5,11 +5,11 @@ }: stdenv.mkDerivation rec { - name = "nix-1.6"; + name = "nix-1.6.1"; src = fetchurl { url = "http://nixos.org/releases/nix/${name}/${name}.tar.xz"; - sha256 = "2e451a6ad0b43997d8df71d29a7d20ef42f7715fe16efbf4b53bdcdd1d5227fe"; + sha256 = "31d15f99b2405924a4be278334cc973a71999303631e6798c1d294db9be4bf84"; }; nativeBuildInputs = [ perl pkgconfig ]; diff --git a/pkgs/tools/package-management/nixops/default.nix b/pkgs/tools/package-management/nixops/default.nix index 18144b41d91..b23c8139309 100644 --- a/pkgs/tools/package-management/nixops/default.nix +++ b/pkgs/tools/package-management/nixops/default.nix @@ -40,6 +40,6 @@ pythonPackages.buildPythonPackage rec { homepage = https://github.com/NixOS/nixops; description = "NixOS cloud provisioning and deployment tool"; maintainers = [ lib.maintainers.eelco lib.maintainers.rob ]; - platforms = lib.platforms.linux; + platforms = lib.platforms.unix; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 69ad9a99adc..e07fba1b138 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1408,6 +1408,8 @@ let newsbeuter = callPackage ../applications/networking/feedreaders/newsbeuter { }; + ngrok = callPackage ../tools/misc/ngrok { }; + mpack = callPackage ../tools/networking/mpack { }; pa_applet = callPackage ../tools/audio/pa-applet { }; @@ -1595,6 +1597,8 @@ let libpng = libpng12; }; + pngquant = callPackage ../tools/graphics/pngquant { }; + podiff = callPackage ../tools/text/podiff { }; poedit = callPackage ../tools/text/poedit { }; @@ -4125,6 +4129,10 @@ let geoclue = callPackage ../development/libraries/geoclue {}; + geoclue2 = callPackage ../development/libraries/geoclue/2.0.nix { + libsoup = libsoup_2_40; + }; + geoip = builderDefsPackage ../development/libraries/geoip { inherit zlib; }; @@ -4969,6 +4977,7 @@ let libsodium = callPackage ../development/libraries/libsodium { }; libsoup = callPackage ../development/libraries/libsoup { }; + libsoup_2_40 = callPackage ../development/libraries/libsoup/2.40.nix { }; libssh = callPackage ../development/libraries/libssh { }; @@ -5177,6 +5186,10 @@ let minmay = callPackage ../development/libraries/minmay { }; + miro = callPackage ../applications/video/miro { + inherit (pythonPackages) pywebkitgtk pysqlite pycurl mutagen; + }; + mkvtoolnix = callPackage ../applications/video/mkvtoolnix { }; mlt = callPackage ../development/libraries/mlt { @@ -5385,6 +5398,8 @@ let portaudioSVN = callPackage ../development/libraries/portaudio/svn-head.nix { }; + portmidi = callPackage ../development/libraries/portmidi {}; + prison = callPackage ../development/libraries/prison { }; proj = callPackage ../development/libraries/proj { }; @@ -5714,8 +5729,7 @@ let inherit (gnome) gtkdoc libsoup; inherit pkgconfig libtool intltool autoconf automake gperf bison flex libjpeg libpng libtiff libxml2 libxslt sqlite icu curl - which libproxy geoclue enchant python ruby perl - mesa xlibs; + which libproxy geoclue enchant python ruby perl mesa xlibs; inherit gstreamer gst_plugins_base gst_ffmpeg gst_plugins_good; }; @@ -5725,8 +5739,7 @@ let inherit (gnome) gtkdoc libsoup; inherit pkgconfig libtool intltool autoconf automake gperf bison flex libjpeg libpng libtiff libxml2 libxslt sqlite icu curl - which libproxy geoclue enchant python ruby perl - mesa xlibs; + which libproxy geoclue enchant python ruby perl mesa xlibs; inherit gstreamer gst_plugins_base gst_ffmpeg gst_plugins_good; }; @@ -6254,6 +6267,8 @@ let inherit xmpppy python makeWrapper fetchcvs; }; + qpid-cpp = callPackage ../servers/amqp/qpid-cpp { }; + rabbitmq_server = callPackage ../servers/amqp/rabbitmq-server { }; radius = callPackage ../servers/radius { }; @@ -6571,7 +6586,7 @@ let # config options you need (e.g. by overriding extraConfig). See list of options here: # https://en.wikibooks.org/wiki/Grsecurity/Appendix/Grsecurity_and_PaX_Configuration_Options linux_3_2_grsecurity = lowPrio (lib.overrideDerivation (linux_3_2.override (args: { - kernelPatches = args.kernelPatches ++ [ kernelPatches.grsecurity_2_9_1_3_2_51 ]; + kernelPatches = args.kernelPatches ++ [ kernelPatches.grsecurity_2_9_1_3_2_52 ]; })) (args: { # Install gcc plugins. These are needed for compiling dependant packages. postInstall = '' @@ -7747,6 +7762,8 @@ let goldendict = callPackage ../applications/misc/goldendict { }; + google-musicmanager = callPackage ../applications/audio/google-musicmanager { }; + gpicview = callPackage ../applications/graphics/gpicview { }; grass = import ../applications/misc/grass { @@ -8259,6 +8276,10 @@ let mirage = callPackage ../applications/graphics/mirage {}; + mixxx = callPackage ../applications/audio/mixxx { + inherit (vamp) vampSDK; + }; + mmex = callPackage ../applications/office/mmex { }; monkeysAudio = callPackage ../applications/audio/monkeys-audio { }; @@ -8351,23 +8372,18 @@ let smplayer = callPackage ../applications/video/smplayer { }; - sup = callPackage ../applications/networking/mailreaders/sup { - ruby = ruby19; + sup = with rubyLibs; callPackage ../applications/networking/mailreaders/sup { + ruby = ruby19.override { + cursesSupport = true; + }; - chronic = rubyLibs.chronic; - gettext = rubyLibs.gettext; - gpgme = ruby_gpgme; - highline = rubyLibs.highline; - iconv = rubyLibs.iconv; - locale = rubyLibs.locale; - lockfile = rubyLibs.lockfile; - mime_types = rubyLibs.mime_types; + inherit gettext highline iconv locale lockfile mime_types rmail_sup text + trollop unicode xapian_ruby which; + + chronic = chronic_0_9_1; + gpgme = ruby_gpgme; ncursesw_sup = ruby_ncursesw_sup; - rake = rubyLibs.rake_10_1_0; - rmail = rubyLibs.rmail; - text = rubyLibs.text; - trollop = rubyLibs.trollop; - xapian_ruby = rubyLibs.xapian_ruby; + rake = rake_10_1_0; }; msmtp = callPackage ../applications/networking/msmtp { }; @@ -9263,6 +9279,8 @@ let quake3game = callPackage ../games/quake3/game { }; + quantumminigolf = callPackage ../games/quantumminigolf {}; + racer = callPackage ../games/racer { }; residualvm = callPackage ../games/residualvm { @@ -9517,6 +9535,8 @@ let konversation = callPackage ../applications/networking/irc/konversation { }; + kvirc = callPackage ../applications/networking/irc/kvirc { }; + krename = callPackage ../applications/misc/krename { }; krusader = callPackage ../applications/misc/krusader { }; @@ -9579,6 +9599,7 @@ let xf86vidmodeproto; inherit (gnome) GConf; inherit (pythonPackages) pyxdg; + geoclue = geoclue2; }; oxygen_gtk = callPackage ../misc/themes/gtk2/oxygen-gtk { }; @@ -9959,10 +9980,13 @@ let stateDir = config.nix.stateDir or "/nix/var"; }; + nixUnstable = nixStable; + /* nixUnstable = callPackage ../tools/package-management/nix/unstable.nix { storeDir = config.nix.storeDir or "/nix/store"; stateDir = config.nix.stateDir or "/nix/var"; }; + */ nixops = callPackage ../tools/package-management/nixops { }; @@ -10213,6 +10237,10 @@ let znc = callPackage ../applications/networking/znc { }; + zncModules = recurseIntoAttrs ( + callPackage ../applications/networking/znc/modules.nix { } + ); + zsnes = callPackage_i686 ../misc/emulators/zsnes { }; misc = import ../misc/misc.nix { inherit pkgs stdenv; }; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index c8d7b0dee85..be07da47393 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -153,7 +153,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x HUnit = self.HUnit_1_2_5_2; mtl = self.mtl_2_1_2; network = self.network_2_4_2_0; - OpenGL = self.OpenGL_2_8_0_0; + OpenGL = self.OpenGL_2_9_1_0; OpenGLRaw = self.OpenGLRaw_1_4_0_0; parallel = self.parallel_3_2_0_3; parsec = self.parsec_3_1_3; @@ -659,7 +659,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x Cabal_1_14_0 = callPackage ../development/libraries/haskell/Cabal/1.14.0.nix { cabal = self.cabal.override { Cabal = null; }; }; Cabal_1_16_0_3 = callPackage ../development/libraries/haskell/Cabal/1.16.0.3.nix { cabal = self.cabal.override { Cabal = null; }; }; - Cabal_1_18_1_1 = callPackage ../development/libraries/haskell/Cabal/1.18.1.1.nix { + Cabal_1_18_1_2 = callPackage ../development/libraries/haskell/Cabal/1.18.1.2.nix { cabal = self.cabal.override { Cabal = null; }; deepseq = self.deepseq_1_3_0_1; }; @@ -1074,10 +1074,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x GlomeVec = callPackage ../development/libraries/haskell/GlomeVec {}; - gloss = callPackage ../development/libraries/haskell/gloss { - OpenGL = self.OpenGL_2_6_0_1; - GLUT = self.GLUT_2_3_1_0; - }; + gloss = callPackage ../development/libraries/haskell/gloss {}; glpkHs = callPackage ../development/libraries/haskell/glpk-hs {}; @@ -1098,7 +1095,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x OpenGL = self.OpenGL_2_8_0_0; }; GLUT_2_5_0_1 = callPackage ../development/libraries/haskell/GLUT/2.5.0.1.nix { - OpenGL = self.OpenGL_2_9_0_0; + OpenGL = self.OpenGL_2_9_0_1; }; GLUT = self.GLUT_2_5_0_1; @@ -1259,7 +1256,9 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x hsemail = callPackage ../development/libraries/haskell/hsemail {}; - hslua = callPackage ../development/libraries/haskell/hslua {}; + hslua = callPackage ../development/libraries/haskell/hslua { + lua = pkgs.lua5_1; + }; HSH = callPackage ../development/libraries/haskell/HSH {}; @@ -1608,8 +1607,8 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x OpenGL_2_4_0_2 = callPackage ../development/libraries/haskell/OpenGL/2.4.0.2.nix {}; OpenGL_2_6_0_1 = callPackage ../development/libraries/haskell/OpenGL/2.6.0.1.nix {}; OpenGL_2_8_0_0 = callPackage ../development/libraries/haskell/OpenGL/2.8.0.0.nix {}; - OpenGL_2_9_0_0 = callPackage ../development/libraries/haskell/OpenGL/2.9.0.0.nix {}; - OpenGL = self.OpenGL_2_9_0_0; + OpenGL_2_9_0_1 = callPackage ../development/libraries/haskell/OpenGL/2.9.1.0.nix {}; + OpenGL = self.OpenGL_2_9_1_0; OpenGLRaw_1_3_0_0 = callPackage ../development/libraries/haskell/OpenGLRaw/1.3.0.0.nix {}; OpenGLRaw_1_4_0_0 = callPackage ../development/libraries/haskell/OpenGLRaw/1.4.0.0.nix {}; @@ -1651,7 +1650,9 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x parsec3 = self.parsec_3_1_3; parsec = self.parsec3; - parsers = callPackage ../development/libraries/haskell/parsers {}; + parsers_0_9 = callPackage ../development/libraries/haskell/parsers/0.9.nix {}; + parsers_0_10 = callPackage ../development/libraries/haskell/parsers/0.10.nix {}; + parsers = self.parsers_0_10; parsimony = callPackage ../development/libraries/haskell/parsimony {}; @@ -2117,7 +2118,11 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x transformersCompat = callPackage ../development/libraries/haskell/transformers-compat {}; - trifecta = callPackage ../development/libraries/haskell/trifecta {}; + trifecta_1_1 = callPackage ../development/libraries/haskell/trifecta/1.1.nix { + parsers = self.parsers_0_9; + }; + trifecta_1_2 = callPackage ../development/libraries/haskell/trifecta/1.2.nix {}; + trifecta = self.trifecta_1_2; tuple = callPackage ../development/libraries/haskell/tuple {}; @@ -2443,7 +2448,10 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x darcs = callPackage ../applications/version-management/darcs {}; - idris_plain = callPackage ../development/compilers/idris {}; + idris_plain = callPackage ../development/compilers/idris { + parsers = self.parsers_0_9; + trifecta = self.trifecta_1_1; + }; idris = callPackage ../development/compilers/idris/wrapper.nix {}; @@ -2476,7 +2484,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x cabalInstall_0_14_0 = callPackage ../tools/package-management/cabal-install/0.14.0.nix {}; cabalInstall_1_16_0_2 = callPackage ../tools/package-management/cabal-install/1.16.0.2.nix {}; cabalInstall_1_18_0_2 = callPackage ../tools/package-management/cabal-install/1.18.0.2.nix { - Cabal = self.Cabal_1_18_1_1; + Cabal = self.Cabal_1_18_1_2; }; cabalInstall = self.cabalInstall_1_18_0_2; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6f6c52a1b0d..3dc6a36bb7e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1402,6 +1402,36 @@ pythonPackages = modules // import ./python-packages-generated.nix { }; }; + faker = buildPythonPackage rec { + name = "faker-0.0.4"; + src = fetchurl { + url = https://pypi.python.org/packages/source/F/Faker/Faker-0.0.4.tar.gz; + sha256 = "09q5jna3j8di0gw5yjx0dvlndkrk2x9vvqzwyfsvg3nlp8h38js1"; + }; + buildInputs = [ nose ]; + meta = with stdenv.lib; { + description = "A Python library for generating fake user data."; + homepage = http://pypi.python.org/pypi/Faker; + license = licenses.mit; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.unix; + }; + }; + + fake_factory = buildPythonPackage rec { + name = "fake-factory-0.2"; + src = fetchurl { + url = https://pypi.python.org/packages/source/f/fake-factory/fake-factory-0.2.tar.gz; + sha256 = "0qdmk8p4anrj9mf95dh9v7bkhv1pz69hvhlw380kj4iz7b44b6zn"; + }; + meta = with stdenv.lib; { + description = "A Python package that generates fake data for you."; + homepage = https://pypi.python.org/pypi/fake-factory; + license = licenses.mit; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.unix; + }; + }; fabric = buildPythonPackage rec { name = "fabric-1.6.1"; @@ -1821,6 +1851,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { src = fetchgit { inherit rev; url = "https://github.com/Pylons/substanced.git"; + sha256 = "eded6468563328af37a07aeb88ef81ed78ccaff2ab687cac34ad2b36e19abcb4"; }; buildInputs = [ mock ]; @@ -4022,7 +4053,7 @@ pythonPackages = modules // import ./python-packages-generated.nix { homepage = "https://github.com/paramiko/paramiko/"; description = "Native Python SSHv2 protocol library"; license = stdenv.lib.licenses.lgpl21Plus; - maintainer = [ stdenv.lib.maintainers.aszlig ]; + maintainers = [ stdenv.lib.maintainers.aszlig ]; longDescription = '' This is a library for making SSH2 connections (client or server). @@ -5205,6 +5236,27 @@ pythonPackages = modules // import ./python-packages-generated.nix { }); + pywebkitgtk = stdenv.mkDerivation rec { + name = "pywebkitgtk-${version}"; + version = "1.1.8"; + + src = fetchurl { + url = "http://pywebkitgtk.googlecode.com/files/${name}.tar.bz2"; + sha256 = "1svlwyl61rvbqbcbalkg6pbf38yjyv7qkq9sx4x35yk69lscaac2"; + }; + + buildInputs = with pkgs; [ + pkgconfig python gtk2 pygtk libxml2 libxslt libsoup webkit_gtk2 icu + ]; + + meta = { + homepage = "https://code.google.com/p/pywebkitgtk/"; + description = "Python bindings for the WebKit GTK+ port"; + license = stdenv.lib.licenses.lgpl2Plus; + }; + }; + + pyxattr = buildPythonPackage (rec { name = "pyxattr-0.5.1"; @@ -5657,6 +5709,23 @@ pythonPackages = modules // import ./python-packages-generated.nix { }; }; + sympy = buildPythonPackage rec { + name = "sympy-0.7.3"; + + src = fetchurl { + url = "https://github.com/sympy/sympy/releases/download/${name}/${name}.tar.gz"; + sha256 = "081g9gs2d1d41ipn8zr034d98cnrxvc4zsmihqmfwzirwzpcii5x"; + }; + + meta = with stdenv.lib; { + description = "A Python library for symbolic mathematics"; + homepage = http://www.sympy.org/; + license = "free"; + maintainers = with maintainers; [ lovek323 ]; + platforms = platforms.unix; + }; + }; + pilkit = buildPythonPackage rec { name = "pilkit-1.1.4";