diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2016-02-14 08:33:51 +0100 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2016-02-14 08:33:51 +0100 |
commit | d039c879845ddcde6108203781e4b001c409e2c2 (patch) | |
tree | 1f9e2a99d95c8866ddbef81b4bfa6a49ce979451 /nixos/modules/config | |
parent | 34922a3951a0ada7af4fe808250abaf5feb4e28e (diff) | |
parent | 6a036d9fca013265b4109ffcaf6df62efa010fa3 (diff) | |
download | nixlib-d039c879845ddcde6108203781e4b001c409e2c2.tar nixlib-d039c879845ddcde6108203781e4b001c409e2c2.tar.gz nixlib-d039c879845ddcde6108203781e4b001c409e2c2.tar.bz2 nixlib-d039c879845ddcde6108203781e4b001c409e2c2.tar.lz nixlib-d039c879845ddcde6108203781e4b001c409e2c2.tar.xz nixlib-d039c879845ddcde6108203781e4b001c409e2c2.tar.zst nixlib-d039c879845ddcde6108203781e4b001c409e2c2.zip |
Merge branch 'master' into closure-size
Diffstat (limited to 'nixos/modules/config')
-rw-r--r-- | nixos/modules/config/zram.nix | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/nixos/modules/config/zram.nix b/nixos/modules/config/zram.nix index 22b74847f871..019932b04e8d 100644 --- a/nixos/modules/config/zram.nix +++ b/nixos/modules/config/zram.nix @@ -98,11 +98,9 @@ in script = '' set -u set -o pipefail - - PATH=${pkgs.procps}/bin:${pkgs.gnugrep}/bin:${pkgs.gnused}/bin - + # Calculate memory to use for zram - totalmem=$(free | grep -e "^Mem:" | sed -e 's/^Mem: *//' -e 's/ *.*//') + totalmem=$(${pkgs.gnugrep}/bin/grep 'MemTotal: ' /proc/meminfo | ${pkgs.gawk}/bin/awk '{print $2}') mem=$(((totalmem * ${toString cfg.memoryPercent} / 100 / ${toString cfg.numDevices}) * 1024)) echo $mem > /sys/class/block/${dev}/disksize |