Loading nixos/doc/manual/installation/building-images-via-systemd-repart.chapter.md +4 −13 Original line number Diff line number Diff line Loading @@ -75,9 +75,10 @@ image with a new one or by updating partitions via an A/B scheme. See the [Chrome OS update process][chrome-os-update] for an example of how to achieve this. The appliance image built in the following example does not contain a `configuration.nix` and thus you will not be able to call `nixos-rebuild` from this system. this system. Furthermore, it uses a [Unified Kernel Image][unified-kernel-image]. [chrome-os-update]: https://chromium.googlesource.com/aosp/platform/system/update_engine/+/HEAD/README.md [unified-kernel-image]: https://uapi-group.org/specifications/specs/unified_kernel_image/ ```nix let Loading @@ -101,18 +102,8 @@ in "/EFI/BOOT/BOOT${lib.toUpper efiArch}.EFI".source = "${pkgs.systemd}/lib/systemd/boot/efi/systemd-boot${efiArch}.efi"; "/loader/entries/nixos.conf".source = pkgs.writeText "nixos.conf" '' title NixOS linux /EFI/nixos/kernel.efi initrd /EFI/nixos/initrd.efi options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} ''; "/EFI/nixos/kernel.efi".source = "${config.boot.kernelPackages.kernel}/${config.system.boot.loader.kernelFile}"; "/EFI/nixos/initrd.efi".source = "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}"; "/EFI/Linux/${config.system.boot.loader.ukiFile}".source = "${config.system.build.uki}/${config.system.boot.loader.ukiFile}"; }; repartConfig = { Type = "esp"; Loading nixos/modules/misc/version.nix +76 −70 Original line number Diff line number Diff line Loading @@ -5,17 +5,21 @@ let opt = options.system.nixos; inherit (lib) concatStringsSep mapAttrsToList toLower concatStringsSep mapAttrsToList toLower optionalString literalExpression mkRenamedOptionModule mkDefault mkOption trivial types; needsEscaping = s: null != builtins.match "[a-zA-Z0-9]+" s; escapeIfNecessary = s: if needsEscaping s then s else ''"${lib.escape [ "\$" "\"" "\\" "\`" ] s}"''; attrsToText = attrs: concatStringsSep "\n" ( mapAttrsToList (n: v: ''${n}=${escapeIfNecessary (toString v)}'') attrs ) + "\n"; concatStringsSep "\n" (mapAttrsToList (n: v: ''${n}=${escapeIfNecessary (toString v)}'') attrs) + "\n"; osReleaseContents = { osReleaseContents = let isNixos = cfg.distroId == "nixos"; in { NAME = "${cfg.distroName}"; ID = "${cfg.distroId}"; VERSION = "${cfg.release} (${cfg.codeName})"; Loading @@ -24,12 +28,13 @@ let BUILD_ID = cfg.version; PRETTY_NAME = "${cfg.distroName} ${cfg.release} (${cfg.codeName})"; LOGO = "nix-snowflake"; HOME_URL = lib.optionalString (cfg.distroId == "nixos") "https://nixos.org/"; DOCUMENTATION_URL = lib.optionalString (cfg.distroId == "nixos") "https://nixos.org/learn.html"; SUPPORT_URL = lib.optionalString (cfg.distroId == "nixos") "https://nixos.org/community.html"; BUG_REPORT_URL = lib.optionalString (cfg.distroId == "nixos") "https://github.com/NixOS/nixpkgs/issues"; IMAGE_ID = lib.optionalString (config.system.image.id != null) config.system.image.id; IMAGE_VERSION = lib.optionalString (config.system.image.version != null) config.system.image.version; HOME_URL = optionalString isNixos "https://nixos.org/"; DOCUMENTATION_URL = optionalString isNixos "https://nixos.org/learn.html"; SUPPORT_URL = optionalString isNixos "https://nixos.org/community.html"; BUG_REPORT_URL = optionalString isNixos "https://github.com/NixOS/nixpkgs/issues"; ANSI_COLOR = optionalString isNixos "1;34"; IMAGE_ID = optionalString (config.system.image.id != null) config.system.image.id; IMAGE_VERSION = optionalString (config.system.image.version != null) config.system.image.version; } // lib.optionalAttrs (cfg.variant_id != null) { VARIANT_ID = cfg.variant_id; }; Loading @@ -56,61 +61,62 @@ in }; options.system = { nixos.version = mkOption { nixos = { version = mkOption { internal = true; type = types.str; description = lib.mdDoc "The full NixOS version (e.g. `16.03.1160.f2d4ee1`)."; }; nixos.release = mkOption { release = mkOption { readOnly = true; type = types.str; default = trivial.release; description = lib.mdDoc "The NixOS release (e.g. `16.03`)."; }; nixos.versionSuffix = mkOption { versionSuffix = mkOption { internal = true; type = types.str; default = trivial.versionSuffix; description = lib.mdDoc "The NixOS version suffix (e.g. `1160.f2d4ee1`)."; }; nixos.revision = mkOption { revision = mkOption { internal = true; type = types.nullOr types.str; default = trivial.revisionWithDefault null; description = lib.mdDoc "The Git revision from which this NixOS configuration was built."; }; nixos.codeName = mkOption { codeName = mkOption { readOnly = true; type = types.str; default = trivial.codeName; description = lib.mdDoc "The NixOS release code name (e.g. `Emu`)."; }; nixos.distroId = mkOption { distroId = mkOption { internal = true; type = types.str; default = "nixos"; description = lib.mdDoc "The id of the operating system"; }; nixos.distroName = mkOption { distroName = mkOption { internal = true; type = types.str; default = "NixOS"; description = lib.mdDoc "The name of the operating system"; }; nixos.variant_id = mkOption { variant_id = mkOption { type = types.nullOr (types.strMatching "^[a-z0-9._-]+$"); default = null; description = lib.mdDoc "A lower-case string identifying a specific variant or edition of the operating system"; example = "installer"; }; }; image = { Loading nixos/modules/services/misc/gitlab.nix +6 −8 Original line number Diff line number Diff line Loading @@ -1386,10 +1386,8 @@ in { systemd.services.gitlab-db-config = { after = [ "gitlab-config.service" "gitlab-postgresql.service" "postgresql.service" ]; bindsTo = [ "gitlab-config.service" ] ++ optional (cfg.databaseHost == "") "postgresql.service" ++ optional databaseActuallyCreateLocally "gitlab-postgresql.service"; wants = optional (cfg.databaseHost == "") "postgresql.service" ++ optional databaseActuallyCreateLocally "gitlab-postgresql.service"; bindsTo = [ "gitlab-config.service" ]; wantedBy = [ "gitlab.target" ]; partOf = [ "gitlab.target" ]; serviceConfig = { Loading Loading @@ -1422,10 +1420,10 @@ in { "gitlab-db-config.service" ]; bindsTo = [ "redis-gitlab.service" "gitlab-config.service" "gitlab-db-config.service" ] ++ optional (cfg.databaseHost == "") "postgresql.service"; ]; wants = [ "redis-gitlab.service" ] ++ optional (cfg.databaseHost == "") "postgresql.service"; wantedBy = [ "gitlab.target" ]; partOf = [ "gitlab.target" ]; environment = gitlabEnv // (optionalAttrs cfg.sidekiq.memoryKiller.enable { Loading Loading @@ -1612,10 +1610,10 @@ in { "gitlab-db-config.service" ]; bindsTo = [ "redis-gitlab.service" "gitlab-config.service" "gitlab-db-config.service" ] ++ optional (cfg.databaseHost == "") "postgresql.service"; ]; wants = [ "redis-gitlab.service" ] ++ optional (cfg.databaseHost == "") "postgresql.service"; requiredBy = [ "gitlab.target" ]; partOf = [ "gitlab.target" ]; environment = gitlabEnv; Loading nixos/modules/services/web-apps/tt-rss.nix +15 −4 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ with lib; let cfg = config.services.tt-rss; inherit (cfg) phpPackage; configVersion = 26; dbPort = if cfg.database.port == null Loading @@ -26,7 +28,7 @@ let ; in pkgs.writeText "config.php" '' <?php putenv('TTRSS_PHP_EXECUTABLE=${pkgs.php}/bin/php'); putenv('TTRSS_PHP_EXECUTABLE=${phpPackage}/bin/php'); putenv('TTRSS_LOCK_DIRECTORY=${cfg.root}/lock'); putenv('TTRSS_CACHE_DIR=${cfg.root}/cache'); Loading Loading @@ -456,6 +458,15 @@ let ''; }; phpPackage = lib.mkOption { type = lib.types.package; default = pkgs.php; defaultText = "pkgs.php"; description = lib.mdDoc '' php package to use for php fpm and update daemon. ''; }; plugins = mkOption { type = types.listOf types.str; default = ["auth_internal" "note"]; Loading Loading @@ -543,7 +554,7 @@ let services.phpfpm.pools = mkIf (cfg.pool == "${poolName}") { ${poolName} = { inherit (cfg) user; phpPackage = pkgs.php81; inherit phpPackage; settings = mapAttrs (name: mkDefault) { "listen.owner" = "nginx"; "listen.group" = "nginx"; Loading Loading @@ -605,13 +616,13 @@ let description = "Tiny Tiny RSS feeds update daemon"; preStart = '' ${pkgs.php81}/bin/php ${cfg.root}/www/update.php --update-schema --force-yes ${phpPackage}/bin/php ${cfg.root}/www/update.php --update-schema --force-yes ''; serviceConfig = { User = "${cfg.user}"; Group = "tt_rss"; ExecStart = "${pkgs.php}/bin/php ${cfg.root}/www/update.php --daemon --quiet"; ExecStart = "${phpPackage}/bin/php ${cfg.root}/www/update.php --daemon --quiet"; Restart = "on-failure"; RestartSec = "60"; SyslogIdentifier = "tt-rss"; Loading nixos/tests/gitlab.nix +1 −1 Original line number Diff line number Diff line Loading @@ -419,7 +419,7 @@ in { gitlab.systemctl("start gitlab-backup.service") gitlab.wait_for_unit("gitlab-backup.service") gitlab.wait_for_file("${nodes.gitlab.services.gitlab.statePath}/backup/dump_gitlab_backup.tar") gitlab.systemctl("stop postgresql.service gitlab.target") gitlab.systemctl("stop postgresql.service gitlab-config.service gitlab.target") gitlab.succeed( "find ${nodes.gitlab.services.gitlab.statePath} -mindepth 1 -maxdepth 1 -not -name backup -execdir rm -r {} +" ) Loading Loading
nixos/doc/manual/installation/building-images-via-systemd-repart.chapter.md +4 −13 Original line number Diff line number Diff line Loading @@ -75,9 +75,10 @@ image with a new one or by updating partitions via an A/B scheme. See the [Chrome OS update process][chrome-os-update] for an example of how to achieve this. The appliance image built in the following example does not contain a `configuration.nix` and thus you will not be able to call `nixos-rebuild` from this system. this system. Furthermore, it uses a [Unified Kernel Image][unified-kernel-image]. [chrome-os-update]: https://chromium.googlesource.com/aosp/platform/system/update_engine/+/HEAD/README.md [unified-kernel-image]: https://uapi-group.org/specifications/specs/unified_kernel_image/ ```nix let Loading @@ -101,18 +102,8 @@ in "/EFI/BOOT/BOOT${lib.toUpper efiArch}.EFI".source = "${pkgs.systemd}/lib/systemd/boot/efi/systemd-boot${efiArch}.efi"; "/loader/entries/nixos.conf".source = pkgs.writeText "nixos.conf" '' title NixOS linux /EFI/nixos/kernel.efi initrd /EFI/nixos/initrd.efi options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} ''; "/EFI/nixos/kernel.efi".source = "${config.boot.kernelPackages.kernel}/${config.system.boot.loader.kernelFile}"; "/EFI/nixos/initrd.efi".source = "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}"; "/EFI/Linux/${config.system.boot.loader.ukiFile}".source = "${config.system.build.uki}/${config.system.boot.loader.ukiFile}"; }; repartConfig = { Type = "esp"; Loading
nixos/modules/misc/version.nix +76 −70 Original line number Diff line number Diff line Loading @@ -5,17 +5,21 @@ let opt = options.system.nixos; inherit (lib) concatStringsSep mapAttrsToList toLower concatStringsSep mapAttrsToList toLower optionalString literalExpression mkRenamedOptionModule mkDefault mkOption trivial types; needsEscaping = s: null != builtins.match "[a-zA-Z0-9]+" s; escapeIfNecessary = s: if needsEscaping s then s else ''"${lib.escape [ "\$" "\"" "\\" "\`" ] s}"''; attrsToText = attrs: concatStringsSep "\n" ( mapAttrsToList (n: v: ''${n}=${escapeIfNecessary (toString v)}'') attrs ) + "\n"; concatStringsSep "\n" (mapAttrsToList (n: v: ''${n}=${escapeIfNecessary (toString v)}'') attrs) + "\n"; osReleaseContents = { osReleaseContents = let isNixos = cfg.distroId == "nixos"; in { NAME = "${cfg.distroName}"; ID = "${cfg.distroId}"; VERSION = "${cfg.release} (${cfg.codeName})"; Loading @@ -24,12 +28,13 @@ let BUILD_ID = cfg.version; PRETTY_NAME = "${cfg.distroName} ${cfg.release} (${cfg.codeName})"; LOGO = "nix-snowflake"; HOME_URL = lib.optionalString (cfg.distroId == "nixos") "https://nixos.org/"; DOCUMENTATION_URL = lib.optionalString (cfg.distroId == "nixos") "https://nixos.org/learn.html"; SUPPORT_URL = lib.optionalString (cfg.distroId == "nixos") "https://nixos.org/community.html"; BUG_REPORT_URL = lib.optionalString (cfg.distroId == "nixos") "https://github.com/NixOS/nixpkgs/issues"; IMAGE_ID = lib.optionalString (config.system.image.id != null) config.system.image.id; IMAGE_VERSION = lib.optionalString (config.system.image.version != null) config.system.image.version; HOME_URL = optionalString isNixos "https://nixos.org/"; DOCUMENTATION_URL = optionalString isNixos "https://nixos.org/learn.html"; SUPPORT_URL = optionalString isNixos "https://nixos.org/community.html"; BUG_REPORT_URL = optionalString isNixos "https://github.com/NixOS/nixpkgs/issues"; ANSI_COLOR = optionalString isNixos "1;34"; IMAGE_ID = optionalString (config.system.image.id != null) config.system.image.id; IMAGE_VERSION = optionalString (config.system.image.version != null) config.system.image.version; } // lib.optionalAttrs (cfg.variant_id != null) { VARIANT_ID = cfg.variant_id; }; Loading @@ -56,61 +61,62 @@ in }; options.system = { nixos.version = mkOption { nixos = { version = mkOption { internal = true; type = types.str; description = lib.mdDoc "The full NixOS version (e.g. `16.03.1160.f2d4ee1`)."; }; nixos.release = mkOption { release = mkOption { readOnly = true; type = types.str; default = trivial.release; description = lib.mdDoc "The NixOS release (e.g. `16.03`)."; }; nixos.versionSuffix = mkOption { versionSuffix = mkOption { internal = true; type = types.str; default = trivial.versionSuffix; description = lib.mdDoc "The NixOS version suffix (e.g. `1160.f2d4ee1`)."; }; nixos.revision = mkOption { revision = mkOption { internal = true; type = types.nullOr types.str; default = trivial.revisionWithDefault null; description = lib.mdDoc "The Git revision from which this NixOS configuration was built."; }; nixos.codeName = mkOption { codeName = mkOption { readOnly = true; type = types.str; default = trivial.codeName; description = lib.mdDoc "The NixOS release code name (e.g. `Emu`)."; }; nixos.distroId = mkOption { distroId = mkOption { internal = true; type = types.str; default = "nixos"; description = lib.mdDoc "The id of the operating system"; }; nixos.distroName = mkOption { distroName = mkOption { internal = true; type = types.str; default = "NixOS"; description = lib.mdDoc "The name of the operating system"; }; nixos.variant_id = mkOption { variant_id = mkOption { type = types.nullOr (types.strMatching "^[a-z0-9._-]+$"); default = null; description = lib.mdDoc "A lower-case string identifying a specific variant or edition of the operating system"; example = "installer"; }; }; image = { Loading
nixos/modules/services/misc/gitlab.nix +6 −8 Original line number Diff line number Diff line Loading @@ -1386,10 +1386,8 @@ in { systemd.services.gitlab-db-config = { after = [ "gitlab-config.service" "gitlab-postgresql.service" "postgresql.service" ]; bindsTo = [ "gitlab-config.service" ] ++ optional (cfg.databaseHost == "") "postgresql.service" ++ optional databaseActuallyCreateLocally "gitlab-postgresql.service"; wants = optional (cfg.databaseHost == "") "postgresql.service" ++ optional databaseActuallyCreateLocally "gitlab-postgresql.service"; bindsTo = [ "gitlab-config.service" ]; wantedBy = [ "gitlab.target" ]; partOf = [ "gitlab.target" ]; serviceConfig = { Loading Loading @@ -1422,10 +1420,10 @@ in { "gitlab-db-config.service" ]; bindsTo = [ "redis-gitlab.service" "gitlab-config.service" "gitlab-db-config.service" ] ++ optional (cfg.databaseHost == "") "postgresql.service"; ]; wants = [ "redis-gitlab.service" ] ++ optional (cfg.databaseHost == "") "postgresql.service"; wantedBy = [ "gitlab.target" ]; partOf = [ "gitlab.target" ]; environment = gitlabEnv // (optionalAttrs cfg.sidekiq.memoryKiller.enable { Loading Loading @@ -1612,10 +1610,10 @@ in { "gitlab-db-config.service" ]; bindsTo = [ "redis-gitlab.service" "gitlab-config.service" "gitlab-db-config.service" ] ++ optional (cfg.databaseHost == "") "postgresql.service"; ]; wants = [ "redis-gitlab.service" ] ++ optional (cfg.databaseHost == "") "postgresql.service"; requiredBy = [ "gitlab.target" ]; partOf = [ "gitlab.target" ]; environment = gitlabEnv; Loading
nixos/modules/services/web-apps/tt-rss.nix +15 −4 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ with lib; let cfg = config.services.tt-rss; inherit (cfg) phpPackage; configVersion = 26; dbPort = if cfg.database.port == null Loading @@ -26,7 +28,7 @@ let ; in pkgs.writeText "config.php" '' <?php putenv('TTRSS_PHP_EXECUTABLE=${pkgs.php}/bin/php'); putenv('TTRSS_PHP_EXECUTABLE=${phpPackage}/bin/php'); putenv('TTRSS_LOCK_DIRECTORY=${cfg.root}/lock'); putenv('TTRSS_CACHE_DIR=${cfg.root}/cache'); Loading Loading @@ -456,6 +458,15 @@ let ''; }; phpPackage = lib.mkOption { type = lib.types.package; default = pkgs.php; defaultText = "pkgs.php"; description = lib.mdDoc '' php package to use for php fpm and update daemon. ''; }; plugins = mkOption { type = types.listOf types.str; default = ["auth_internal" "note"]; Loading Loading @@ -543,7 +554,7 @@ let services.phpfpm.pools = mkIf (cfg.pool == "${poolName}") { ${poolName} = { inherit (cfg) user; phpPackage = pkgs.php81; inherit phpPackage; settings = mapAttrs (name: mkDefault) { "listen.owner" = "nginx"; "listen.group" = "nginx"; Loading Loading @@ -605,13 +616,13 @@ let description = "Tiny Tiny RSS feeds update daemon"; preStart = '' ${pkgs.php81}/bin/php ${cfg.root}/www/update.php --update-schema --force-yes ${phpPackage}/bin/php ${cfg.root}/www/update.php --update-schema --force-yes ''; serviceConfig = { User = "${cfg.user}"; Group = "tt_rss"; ExecStart = "${pkgs.php}/bin/php ${cfg.root}/www/update.php --daemon --quiet"; ExecStart = "${phpPackage}/bin/php ${cfg.root}/www/update.php --daemon --quiet"; Restart = "on-failure"; RestartSec = "60"; SyslogIdentifier = "tt-rss"; Loading
nixos/tests/gitlab.nix +1 −1 Original line number Diff line number Diff line Loading @@ -419,7 +419,7 @@ in { gitlab.systemctl("start gitlab-backup.service") gitlab.wait_for_unit("gitlab-backup.service") gitlab.wait_for_file("${nodes.gitlab.services.gitlab.statePath}/backup/dump_gitlab_backup.tar") gitlab.systemctl("stop postgresql.service gitlab.target") gitlab.systemctl("stop postgresql.service gitlab-config.service gitlab.target") gitlab.succeed( "find ${nodes.gitlab.services.gitlab.statePath} -mindepth 1 -maxdepth 1 -not -name backup -execdir rm -r {} +" ) Loading