summaryrefslogtreecommitdiffstats
path: root/nixos
diff options
context:
space:
mode:
authorNick Cao <nickcao@nichi.co>2023-02-02 11:04:46 +0800
committerGitHub <noreply@github.com>2023-02-02 11:04:46 +0800
commit338657be21c1fdb60e9e02b0d972f01e8507cb09 (patch)
treef2677e3608ea0d1f105afb8ac27f4a17eed15661 /nixos
parent1602f4034c9d122a239f77c553a351a0624081f0 (diff)
parent4ed5e94f9d381eb33e5c5713f245e3a02c416b4e (diff)
Merge pull request #210190 from NickCao/zram-generator
zram-generator: init at 1.1.2
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/zram-generator.nix18
2 files changed, 19 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index fe51123f1d0f..a041faa8feb2 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -753,6 +753,7 @@ in {
zigbee2mqtt = handleTest ./zigbee2mqtt.nix {};
zoneminder = handleTest ./zoneminder.nix {};
zookeeper = handleTest ./zookeeper.nix {};
+ zram-generator = handleTest ./zram-generator.nix {};
zrepl = handleTest ./zrepl.nix {};
zsh-history = handleTest ./zsh-history.nix {};
}
diff --git a/nixos/tests/zram-generator.nix b/nixos/tests/zram-generator.nix
new file mode 100644
index 000000000000..affa081bcc35
--- /dev/null
+++ b/nixos/tests/zram-generator.nix
@@ -0,0 +1,18 @@
+import ./make-test-python.nix {
+ name = "zram-generator";
+
+ nodes.machine = { pkgs, ... }: {
+ environment.etc."systemd/zram-generator.conf".text = ''
+ [zram0]
+ zram-size = ram / 2
+ '';
+ systemd.packages = [ pkgs.zram-generator ];
+ systemd.services."systemd-zram-setup@".path = [ pkgs.util-linux ]; # for mkswap
+ };
+
+ testScript = ''
+ machine.wait_for_unit("systemd-zram-setup@zram0.service")
+ assert "zram0" in machine.succeed("zramctl -n")
+ assert "zram0" in machine.succeed("swapon --show --noheadings")
+ '';
+}