| 
									
										
										
										
											2019-06-16 19:59:06 +00:00
										 |  |  | { config, lib, pkgs, ... }: | 
					
						
							| 
									
										
										
										
											2012-04-10 20:56:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-14 16:26:48 +02:00
										 |  |  | with lib; | 
					
						
							| 
									
										
										
										
											2012-04-10 20:56:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-18 13:46:47 +00:00
										 |  |  | let | 
					
						
							| 
									
										
										
										
											2017-04-01 00:00:00 +00:00
										 |  |  |   cfg = config.system.nixos; | 
					
						
							| 
									
										
										
										
											2015-09-18 13:46:47 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-24 23:34:28 +01:00
										 |  |  |   gitRepo      = "${toString pkgs.path}/.git"; | 
					
						
							|  |  |  |   gitCommitId  = lib.substring 0 7 (commitIdFromGitRepo gitRepo); | 
					
						
							| 
									
										
										
										
											2015-09-18 13:46:47 +00:00
										 |  |  | in | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-10 20:56:38 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 23:22:54 +03:00
										 |  |  |   options.system = { | 
					
						
							| 
									
										
										
										
											2013-01-16 14:40:41 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 23:22:54 +03:00
										 |  |  |     nixos.version = mkOption { | 
					
						
							| 
									
										
										
										
											2013-10-23 16:59:33 +02:00
										 |  |  |       internal = true; | 
					
						
							| 
									
										
										
										
											2013-10-30 11:02:04 +01:00
										 |  |  |       type = types.str; | 
					
						
							| 
									
										
										
										
											2016-07-28 18:27:03 +02:00
										 |  |  |       description = "The full NixOS version (e.g. <literal>16.03.1160.f2d4ee1</literal>)."; | 
					
						
							| 
									
										
										
										
											2012-04-10 20:56:38 +00:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2012-05-17 21:10:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 23:22:54 +03:00
										 |  |  |     nixos.release = mkOption { | 
					
						
							| 
									
										
										
										
											2015-07-30 13:36:57 +02:00
										 |  |  |       readOnly = true; | 
					
						
							| 
									
										
										
										
											2015-07-27 19:46:36 +02:00
										 |  |  |       type = types.str; | 
					
						
							| 
									
										
										
										
											2018-04-26 10:31:05 +02:00
										 |  |  |       default = trivial.release; | 
					
						
							| 
									
										
										
										
											2016-07-28 18:27:03 +02:00
										 |  |  |       description = "The NixOS release (e.g. <literal>16.03</literal>)."; | 
					
						
							| 
									
										
										
										
											2015-07-27 19:46:36 +02:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 23:22:54 +03:00
										 |  |  |     nixos.versionSuffix = mkOption { | 
					
						
							| 
									
										
										
										
											2013-10-23 16:59:33 +02:00
										 |  |  |       internal = true; | 
					
						
							| 
									
										
										
										
											2013-10-30 11:02:04 +01:00
										 |  |  |       type = types.str; | 
					
						
							| 
									
										
										
										
											2018-04-26 10:31:05 +02:00
										 |  |  |       default = trivial.versionSuffix; | 
					
						
							| 
									
										
										
										
											2016-07-28 18:27:03 +02:00
										 |  |  |       description = "The NixOS version suffix (e.g. <literal>1160.f2d4ee1</literal>)."; | 
					
						
							| 
									
										
										
										
											2013-01-16 14:40:41 +01:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 23:22:54 +03:00
										 |  |  |     nixos.revision = mkOption { | 
					
						
							| 
									
										
										
										
											2013-10-24 19:58:34 +02:00
										 |  |  |       internal = true; | 
					
						
							| 
									
										
										
										
											2013-10-30 11:02:04 +01:00
										 |  |  |       type = types.str; | 
					
						
							| 
									
										
										
										
											2019-02-03 20:10:12 +00:00
										 |  |  |       default = trivial.revisionWithDefault "master"; | 
					
						
							| 
									
										
										
										
											2016-07-28 18:27:03 +02:00
										 |  |  |       description = "The Git revision from which this NixOS configuration was built."; | 
					
						
							| 
									
										
										
										
											2013-10-24 19:58:34 +02:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 23:22:54 +03:00
										 |  |  |     nixos.codeName = mkOption { | 
					
						
							| 
									
										
										
										
											2015-07-30 13:36:57 +02:00
										 |  |  |       readOnly = true; | 
					
						
							| 
									
										
										
										
											2013-10-30 11:02:04 +01:00
										 |  |  |       type = types.str; | 
					
						
							| 
									
										
										
										
											2019-02-03 20:10:12 +00:00
										 |  |  |       default = trivial.codeName; | 
					
						
							| 
									
										
										
										
											2016-07-28 18:27:03 +02:00
										 |  |  |       description = "The NixOS release code name (e.g. <literal>Emu</literal>)."; | 
					
						
							| 
									
										
										
										
											2013-07-17 13:34:40 +02:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-01 00:00:00 +00:00
										 |  |  |     stateVersion = mkOption { | 
					
						
							|  |  |  |       type = types.str; | 
					
						
							|  |  |  |       default = cfg.release; | 
					
						
							|  |  |  |       description = ''
 | 
					
						
							|  |  |  |         Every once in a while, a new NixOS release may change | 
					
						
							|  |  |  |         configuration defaults in a way incompatible with stateful | 
					
						
							|  |  |  |         data. For instance, if the default version of PostgreSQL | 
					
						
							|  |  |  |         changes, the new version will probably be unable to read your | 
					
						
							|  |  |  |         existing databases. To prevent such breakage, you can set the | 
					
						
							|  |  |  |         value of this option to the NixOS release with which you want | 
					
						
							|  |  |  |         to be compatible. The effect is that NixOS will option | 
					
						
							|  |  |  |         defaults corresponding to the specified release (such as using | 
					
						
							|  |  |  |         an older version of PostgreSQL). | 
					
						
							|  |  |  |       '';
 | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-18 13:46:47 +00:00
										 |  |  |     defaultChannel = mkOption { | 
					
						
							| 
									
										
										
										
											2013-10-24 15:09:00 +02:00
										 |  |  |       internal = true; | 
					
						
							| 
									
										
										
										
											2013-10-30 11:02:04 +01:00
										 |  |  |       type = types.str; | 
					
						
							| 
									
										
										
										
											2013-11-11 11:22:41 +01:00
										 |  |  |       default = https://nixos.org/channels/nixos-unstable; | 
					
						
							| 
									
										
										
										
											2013-10-24 15:09:00 +02:00
										 |  |  |       description = "Default NixOS channel to which the root user is subscribed."; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-17 21:10:42 +00:00
										 |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   config = { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-01 00:00:00 +00:00
										 |  |  |     system.nixos = { | 
					
						
							| 
									
										
										
										
											2015-09-18 16:50:48 +00:00
										 |  |  |       # These defaults are set here rather than up there so that | 
					
						
							|  |  |  |       # changing them would not rebuild the manual | 
					
						
							| 
									
										
										
										
											2017-04-01 00:00:00 +00:00
										 |  |  |       version = mkDefault (cfg.release + cfg.versionSuffix); | 
					
						
							|  |  |  |       revision      = mkIf (pathIsDirectory gitRepo) (mkDefault            gitCommitId); | 
					
						
							|  |  |  |       versionSuffix = mkIf (pathIsDirectory gitRepo) (mkDefault (".git." + gitCommitId)); | 
					
						
							| 
									
										
										
										
											2015-09-18 13:46:47 +00:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2013-07-17 13:34:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-17 21:10:42 +00:00
										 |  |  |     # Generate /etc/os-release.  See | 
					
						
							| 
									
										
										
										
											2017-01-07 17:28:11 +01:00
										 |  |  |     # https://www.freedesktop.org/software/systemd/man/os-release.html for the | 
					
						
							| 
									
										
										
										
											2012-05-17 21:10:42 +00:00
										 |  |  |     # format. | 
					
						
							| 
									
										
										
										
											2019-08-13 21:52:01 +00:00
										 |  |  |     environment.etc.os-release.text = | 
					
						
							| 
									
										
										
										
											2013-10-31 23:01:07 +01:00
										 |  |  |       ''
 | 
					
						
							|  |  |  |         NAME=NixOS | 
					
						
							|  |  |  |         ID=nixos | 
					
						
							| 
									
										
										
										
											2017-04-01 00:00:00 +00:00
										 |  |  |         VERSION="${cfg.version} (${cfg.codeName})" | 
					
						
							|  |  |  |         VERSION_CODENAME=${toLower cfg.codeName} | 
					
						
							|  |  |  |         VERSION_ID="${cfg.version}" | 
					
						
							|  |  |  |         PRETTY_NAME="NixOS ${cfg.version} (${cfg.codeName})" | 
					
						
							| 
									
										
										
										
											2019-01-05 00:03:39 -05:00
										 |  |  |         LOGO="nix-snowflake" | 
					
						
							| 
									
										
										
										
											2017-02-25 22:15:45 +01:00
										 |  |  |         HOME_URL="https://nixos.org/" | 
					
						
							| 
									
										
										
										
											2019-02-22 09:22:51 +00:00
										 |  |  |         DOCUMENTATION_URL="https://nixos.org/nixos/manual/index.html" | 
					
						
							| 
									
										
										
										
											2017-02-25 22:15:45 +01:00
										 |  |  |         SUPPORT_URL="https://nixos.org/nixos/support.html" | 
					
						
							|  |  |  |         BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues" | 
					
						
							| 
									
										
										
										
											2013-10-31 23:01:07 +01:00
										 |  |  |       '';
 | 
					
						
							| 
									
										
										
										
											2013-01-16 14:40:41 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-10 20:56:38 +00:00
										 |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |