feat: add content - reduce disk usage

This commit is contained in:
Ryan Yin 2023-06-23 23:53:25 +08:00
parent ea8d7edc52
commit 86ab7528ff
2 changed files with 57 additions and 0 deletions

View file

@ -65,3 +65,32 @@ Another command returns all packages installed in the system:
```shell ```shell
nix-env -qa nix-env -qa
``` ```
## Reduce Disk Usage
```nix
{ lib, pkgs, ... }:
{
# ......
# do not need to keep too much generations
boot.loader.systemd-boot.configurationLimit = lib.mkDefault 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";
};
# Optimise storage
# you can alse optimise the store manually via:
# nix-store --optimise
# https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-auto-optimise-store
nix.settings.auto-optimise-store = true;
}
```

View file

@ -62,3 +62,31 @@ sudo nix store gc --debug
```shell ```shell
nix-env -qa nix-env -qa
``` ```
## 节约存储空间
```nix
{ lib, pkgs, ... }:
{
# ......
# do not need to keep too much generations
boot.loader.systemd-boot.configurationLimit = lib.mkDefault 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";
};
# Optimise storage
# you can alse optimise the store manually via:
# nix-store --optimise
# https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-auto-optimise-store
nix.settings.auto-optimise-store = true;
}
```