From a83ffb43de504535df0f97b9d504b2c120529396 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Wed, 28 Aug 2024 21:19:12 +0200 Subject: [PATCH] nixos/boot.tmp: remove `with lib;` --- nixos/modules/system/boot/tmp.nix | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/nixos/modules/system/boot/tmp.nix b/nixos/modules/system/boot/tmp.nix index 150f4adaf3ee..8287fa5f872f 100644 --- a/nixos/modules/system/boot/tmp.nix +++ b/nixos/modules/system/boot/tmp.nix @@ -1,29 +1,26 @@ { config, lib, ... }: - -with lib; - let cfg = config.boot.tmp; in { imports = [ - (mkRenamedOptionModule [ "boot" "cleanTmpDir" ] [ "boot" "tmp" "cleanOnBoot" ]) - (mkRenamedOptionModule [ "boot" "tmpOnTmpfs" ] [ "boot" "tmp" "useTmpfs" ]) - (mkRenamedOptionModule [ "boot" "tmpOnTmpfsSize" ] [ "boot" "tmp" "tmpfsSize" ]) + (lib.mkRenamedOptionModule [ "boot" "cleanTmpDir" ] [ "boot" "tmp" "cleanOnBoot" ]) + (lib.mkRenamedOptionModule [ "boot" "tmpOnTmpfs" ] [ "boot" "tmp" "useTmpfs" ]) + (lib.mkRenamedOptionModule [ "boot" "tmpOnTmpfsSize" ] [ "boot" "tmp" "tmpfsSize" ]) ]; options = { boot.tmp = { - cleanOnBoot = mkOption { - type = types.bool; + cleanOnBoot = lib.mkOption { + type = lib.types.bool; default = false; description = '' Whether to delete all files in {file}`/tmp` during boot. ''; }; - tmpfsSize = mkOption { - type = types.oneOf [ types.str types.types.ints.positive ]; + tmpfsSize = lib.mkOption { + type = lib.types.oneOf [ lib.types.str lib.types.ints.positive ]; default = "50%"; description = '' Size of tmpfs in percentage. @@ -31,8 +28,8 @@ in ''; }; - useTmpfs = mkOption { - type = types.bool; + useTmpfs = lib.mkOption { + type = lib.types.bool; default = false; description = '' Whether to mount a tmpfs on {file}`/tmp` during boot. @@ -48,12 +45,12 @@ in config = { # When changing remember to update /tmp mount in virtualisation/qemu-vm.nix - systemd.mounts = mkIf cfg.useTmpfs [ + systemd.mounts = lib.mkIf cfg.useTmpfs [ { what = "tmpfs"; where = "/tmp"; type = "tmpfs"; - mountConfig.Options = concatStringsSep "," [ + mountConfig.Options = lib.concatStringsSep "," [ "mode=1777" "strictatime" "rw" @@ -64,6 +61,6 @@ in } ]; - systemd.tmpfiles.rules = optional cfg.cleanOnBoot "D! /tmp 1777 root root"; + systemd.tmpfiles.rules = lib.optional cfg.cleanOnBoot "D! /tmp 1777 root root"; }; }