From 192df99403f21c86ca06221053392a7d3a30ef03 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Fri, 23 Jun 2023 23:54:50 +0800 Subject: [PATCH] feat: update - reduce disk usage --- docs/nixos-with-flakes/other-useful-tips.md | 9 +++++---- docs/zh/nixos-with-flakes/other-useful-tips.md | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/nixos-with-flakes/other-useful-tips.md b/docs/nixos-with-flakes/other-useful-tips.md index 9735053..5a717b8 100644 --- a/docs/nixos-with-flakes/other-useful-tips.md +++ b/docs/nixos-with-flakes/other-useful-tips.md @@ -69,6 +69,7 @@ nix-env -qa ## Reduce Disk Usage +The following configuration can be used to reduce disk usage, feel free to add it into your NixOS Configuration. ```nix { lib, pkgs, ... }: @@ -77,14 +78,14 @@ nix-env -qa # ...... # do not need to keep too much generations - boot.loader.systemd-boot.configurationLimit = lib.mkDefault 10; + boot.loader.systemd-boot.configurationLimit = 10; # boot.loader.grub.configurationLimit = 10; # do garbage collection weekly to keep disk usage low nix.gc = { - automatic = lib.mkDefault true; - dates = lib.mkDefault "weekly"; - options = lib.mkDefault "--delete-older-than 1w"; + automatic = true; + dates = "weekly"; + options = "--delete-older-than 1w"; }; # Optimise storage diff --git a/docs/zh/nixos-with-flakes/other-useful-tips.md b/docs/zh/nixos-with-flakes/other-useful-tips.md index 9981578..837c22a 100644 --- a/docs/zh/nixos-with-flakes/other-useful-tips.md +++ b/docs/zh/nixos-with-flakes/other-useful-tips.md @@ -65,6 +65,7 @@ nix-env -qa ## 节约存储空间 +如下配置可以比较好的缩减 NixOS 的磁盘占用,可以考虑将它们添加到你的 NixOS 配置中: ```nix { lib, pkgs, ... }: @@ -73,14 +74,14 @@ nix-env -qa # ...... # do not need to keep too much generations - boot.loader.systemd-boot.configurationLimit = lib.mkDefault 10; + boot.loader.systemd-boot.configurationLimit = 10; # boot.loader.grub.configurationLimit = 10; # do garbage collection weekly to keep disk usage low nix.gc = { - automatic = lib.mkDefault true; - dates = lib.mkDefault "weekly"; - options = lib.mkDefault "--delete-older-than 1w"; + automatic = true; + dates = "weekly"; + options = "--delete-older-than 1w"; }; # Optimise storage