mirror of
https://github.com/nix-community/home-manager
synced 2024-11-10 07:04:17 +00:00
systemd: name slice unit correctly
This commit is contained in:
parent
be2cade373
commit
9fcae11ff2
3 changed files with 36 additions and 4 deletions
|
@ -125,9 +125,9 @@ in {
|
||||||
|
|
||||||
slices = mkOption {
|
slices = mkOption {
|
||||||
default = { };
|
default = { };
|
||||||
type = unitType "slices";
|
type = unitType "slice";
|
||||||
description = unitDescription "slices";
|
description = unitDescription "slice";
|
||||||
example = unitExample "Slices";
|
example = unitExample "Slice";
|
||||||
};
|
};
|
||||||
|
|
||||||
sockets = mkOption {
|
sockets = mkOption {
|
||||||
|
@ -263,7 +263,7 @@ in {
|
||||||
(mkIf (pkgs.stdenv.isLinux && config.home.username != "root") {
|
(mkIf (pkgs.stdenv.isLinux && config.home.username != "root") {
|
||||||
xdg.configFile = mkMerge [
|
xdg.configFile = mkMerge [
|
||||||
(lib.listToAttrs ((buildServices "service" cfg.services)
|
(lib.listToAttrs ((buildServices "service" cfg.services)
|
||||||
++ (buildServices "slices" cfg.slices)
|
++ (buildServices "slice" cfg.slices)
|
||||||
++ (buildServices "socket" cfg.sockets)
|
++ (buildServices "socket" cfg.sockets)
|
||||||
++ (buildServices "target" cfg.targets)
|
++ (buildServices "target" cfg.targets)
|
||||||
++ (buildServices "timer" cfg.timers)
|
++ (buildServices "timer" cfg.timers)
|
||||||
|
|
|
@ -2,5 +2,6 @@
|
||||||
systemd-services = ./services.nix;
|
systemd-services = ./services.nix;
|
||||||
systemd-services-disabled-for-root = ./services-disabled-for-root.nix;
|
systemd-services-disabled-for-root = ./services-disabled-for-root.nix;
|
||||||
systemd-session-variables = ./session-variables.nix;
|
systemd-session-variables = ./session-variables.nix;
|
||||||
|
systemd-slices = ./slices.nix;
|
||||||
systemd-timers = ./timers.nix;
|
systemd-timers = ./timers.nix;
|
||||||
}
|
}
|
||||||
|
|
31
tests/modules/systemd/slices.nix
Normal file
31
tests/modules/systemd/slices.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
systemd.user.slices.app-test = {
|
||||||
|
Unit = { Description = "Slice for a test app"; };
|
||||||
|
|
||||||
|
Slice = {
|
||||||
|
MemoryHigh = "30%";
|
||||||
|
MemoryMax = "40%";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
sliceFile=home-files/.config/systemd/user/app-test.slice
|
||||||
|
assertFileExists $sliceFile
|
||||||
|
assertFileContent $sliceFile ${
|
||||||
|
builtins.toFile "app-test-expected.conf" ''
|
||||||
|
[Slice]
|
||||||
|
MemoryHigh=30%
|
||||||
|
MemoryMax=40%
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Slice for a test app
|
||||||
|
''
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue