File tree 2 files changed +32
-0
lines changed
nixos/modules/system/boot
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -465,4 +465,20 @@ in rec {
465
465
466
466
targetOptions = commonUnitOptions ;
467
467
468
+ sliceOptions = commonUnitOptions // {
469
+
470
+ sliceConfig = mkOption {
471
+ default = { } ;
472
+ example = { MemoryMax = "2G" ; } ;
473
+ type = types . attrsOf unitOption ;
474
+ description = ''
475
+ Each attribute in this set specifies an option in the
476
+ <literal>[Slice]</literal> section of the unit. See
477
+ <citerefentry><refentrytitle>systemd.slice</refentrytitle>
478
+ <manvolnum>5</manvolnum></citerefentry> for details.
479
+ '' ;
480
+ } ;
481
+
482
+ } ;
483
+
468
484
}
Original file line number Diff line number Diff line change 375
375
'' ;
376
376
} ;
377
377
378
+ sliceToUnit = name : def :
379
+ { inherit ( def ) wantedBy requiredBy enable ;
380
+ text = commonUnitText def +
381
+ ''
382
+ [Slice]
383
+ ${ attrsToSection def . sliceConfig }
384
+ '' ;
385
+ } ;
386
+
378
387
in
379
388
380
389
{
458
467
'' ;
459
468
} ;
460
469
470
+ systemd . slices = mkOption {
471
+ default = { } ;
472
+ type = with types ; attrsOf ( submodule [ { options = sliceOptions ; } unitConfig ] ) ;
473
+ description = "Definition of slice configurations." ;
474
+ } ;
475
+
461
476
systemd . generators = mkOption {
462
477
type = types . attrsOf types . path ;
463
478
default = { } ;
748
763
// mapAttrs' ( n : v : nameValuePair "${ n } .socket" ( socketToUnit n v ) ) cfg . sockets
749
764
// mapAttrs' ( n : v : nameValuePair "${ n } .timer" ( timerToUnit n v ) ) cfg . timers
750
765
// mapAttrs' ( n : v : nameValuePair "${ n } .path" ( pathToUnit n v ) ) cfg . paths
766
+ // mapAttrs' ( n : v : nameValuePair "${ n } .slice" ( sliceToUnit n v ) ) cfg . slices
751
767
// listToAttrs ( map
752
768
( v : let n = escapeSystemdPath v . where ;
753
769
in nameValuePair "${ n } .mount" ( mountToUnit n v ) ) cfg . mounts )
You can’t perform that action at this time.
0 commit comments