mirror of
https://github.com/ryan4yin/nixos-and-flakes-book.git
synced 2025-03-01 00:31:14 +01:00
feat: update - reduce disk usage
This commit is contained in:
parent
86ab7528ff
commit
192df99403
@ -69,6 +69,7 @@ nix-env -qa
|
|||||||
|
|
||||||
## Reduce Disk Usage
|
## Reduce Disk Usage
|
||||||
|
|
||||||
|
The following configuration can be used to reduce disk usage, feel free to add it into your NixOS Configuration.
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{ lib, pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
@ -77,14 +78,14 @@ nix-env -qa
|
|||||||
# ......
|
# ......
|
||||||
|
|
||||||
# do not need to keep too much generations
|
# 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;
|
# boot.loader.grub.configurationLimit = 10;
|
||||||
|
|
||||||
# do garbage collection weekly to keep disk usage low
|
# do garbage collection weekly to keep disk usage low
|
||||||
nix.gc = {
|
nix.gc = {
|
||||||
automatic = lib.mkDefault true;
|
automatic = true;
|
||||||
dates = lib.mkDefault "weekly";
|
dates = "weekly";
|
||||||
options = lib.mkDefault "--delete-older-than 1w";
|
options = "--delete-older-than 1w";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Optimise storage
|
# Optimise storage
|
||||||
|
@ -65,6 +65,7 @@ nix-env -qa
|
|||||||
|
|
||||||
## 节约存储空间
|
## 节约存储空间
|
||||||
|
|
||||||
|
如下配置可以比较好的缩减 NixOS 的磁盘占用,可以考虑将它们添加到你的 NixOS 配置中:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{ lib, pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
@ -73,14 +74,14 @@ nix-env -qa
|
|||||||
# ......
|
# ......
|
||||||
|
|
||||||
# do not need to keep too much generations
|
# 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;
|
# boot.loader.grub.configurationLimit = 10;
|
||||||
|
|
||||||
# do garbage collection weekly to keep disk usage low
|
# do garbage collection weekly to keep disk usage low
|
||||||
nix.gc = {
|
nix.gc = {
|
||||||
automatic = lib.mkDefault true;
|
automatic = true;
|
||||||
dates = lib.mkDefault "weekly";
|
dates = "weekly";
|
||||||
options = lib.mkDefault "--delete-older-than 1w";
|
options = "--delete-older-than 1w";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Optimise storage
|
# Optimise storage
|
||||||
|
Loading…
Reference in New Issue
Block a user