lol

Merge pull request #10076 from ts468/upstream.systemd

systemd module: add option to specify generators

ts468 1ddc1cdc df9fc0f8

+29 -23
+29 -23
nixos/modules/system/boot/systemd.nix
··· 445 445 ''; 446 446 }; 447 447 448 + systemd.generators = mkOption { 449 + type = types.attrsOf types.path; 450 + default = {}; 451 + example = { "systemd-gpt-auto-generator" = "/dev/null"; }; 452 + description = '' 453 + Definition of systemd generators. 454 + For each <literal>NAME = VALUE</literal> pair of the attrSet, a link is generated from 455 + <literal>/etc/systemd/system-generators/NAME</literal> to <literal>VALUE</literal>. 456 + ''; 457 + }; 458 + 448 459 systemd.defaultUnit = mkOption { 449 460 default = "multi-user.target"; 450 461 type = types.str; ··· 601 612 602 613 environment.systemPackages = [ systemd ]; 603 614 604 - environment.etc."systemd/system".source = 605 - generateUnits "system" cfg.units upstreamSystemUnits upstreamSystemWants; 615 + environment.etc = { 616 + "systemd/system".source = generateUnits "system" cfg.units upstreamSystemUnits upstreamSystemWants; 606 617 607 - environment.etc."systemd/user".source = 608 - generateUnits "user" cfg.user.units upstreamUserUnits []; 618 + "systemd/user".source = generateUnits "user" cfg.user.units upstreamUserUnits []; 609 619 610 - environment.etc."systemd/system.conf".text = 611 - '' 620 + "systemd/system.conf".text = '' 612 621 [Manager] 613 622 ${config.systemd.extraConfig} 614 623 ''; 615 624 616 - environment.etc."systemd/journald.conf".text = 617 - '' 625 + "systemd/journald.conf".text = '' 618 626 [Journal] 619 627 RateLimitInterval=${config.services.journald.rateLimitInterval} 620 628 RateLimitBurst=${toString config.services.journald.rateLimitBurst} ··· 625 633 ${config.services.journald.extraConfig} 626 634 ''; 627 635 628 - environment.etc."systemd/logind.conf".text = 629 - '' 636 + "systemd/logind.conf".text = '' 630 637 [Login] 631 638 ${config.services.logind.extraConfig} 632 639 ''; 633 640 634 - environment.etc."systemd/sleep.conf".text = 635 - '' 641 + "systemd/sleep.conf".text = '' 636 642 [Sleep] 637 643 ''; 644 + 645 + "tmpfiles.d/systemd.conf".source = "${systemd}/example/tmpfiles.d/systemd.conf"; 646 + "tmpfiles.d/x11.conf".source = "${systemd}/example/tmpfiles.d/x11.conf"; 647 + 648 + "tmpfiles.d/nixos.conf".text = '' 649 + # This file is created automatically and should not be modified. 650 + # Please change the option ‘systemd.tmpfiles.rules’ instead. 651 + 652 + ${concatStringsSep "\n" cfg.tmpfiles.rules} 653 + ''; 654 + } // mapAttrs' (n: v: nameValuePair "systemd/system-generators/${n}" {"source"=v;}) cfg.generators; 638 655 639 656 system.activationScripts.systemd = stringAfter [ "groups" ] 640 657 '' ··· 735 752 # in systemd to provide XDG_RUNTIME_DIR. 736 753 startSession = true; 737 754 }; 738 - 739 - environment.etc."tmpfiles.d/systemd.conf".source = "${systemd}/example/tmpfiles.d/systemd.conf"; 740 - environment.etc."tmpfiles.d/x11.conf".source = "${systemd}/example/tmpfiles.d/x11.conf"; 741 - 742 - environment.etc."tmpfiles.d/nixos.conf".text = 743 - '' 744 - # This file is created automatically and should not be modified. 745 - # Please change the option ‘systemd.tmpfiles.rules’ instead. 746 - 747 - ${concatStringsSep "\n" cfg.tmpfiles.rules} 748 - ''; 749 755 750 756 # Some overrides to upstream units. 751 757 systemd.services."systemd-backlight@".restartIfChanged = false;