Configure Lix, the package manager powering Isabel’s Dotfiles
Isabel’s Dotfiles uses Lix, a fork of the Nix package manager with improved features and fixes. This configuration makes extensive use of Lix’s experimental features and optimizations.
The configuration enables several experimental Lix features:
Core features
Advanced features
modules/base/nix/nix.nix
experimental-features = [ # Enables flakes, needed for this config "flakes" # Enables the nix3 commands, a requirement for flakes "nix-command" # Adds a new command called `lix` which allows you to run nix plugins, # similar to how cargo works "lix-custom-sub-commands"];
modules/base/nix/nix.nix
experimental-features = [ # Allows Nix to automatically pick UIDs for builds, rather than creating # nixbld* user accounts which is BEYOND annoying "auto-allocate-uids" # Allow usage of the pipe operator in nix expressions "pipe-operator" # Allow nix to automatically coerce integers to strings "coerce-integers"];
Lix includes a fix for auto-optimise-store that allows safe usage:
modules/base/nix/nix.nix
# Automatically optimise symlinks# Disable auto-optimise-store because of this issue:# https://github.com/NixOS/nix/issues/7273# but we use lix which has a fix for this issue:# https://gerrit.lix.systems/c/lix/+/2100auto-optimise-store = true;
This feature was broken in upstream Nix but is safe to use in Lix due to this patch.
# Free up to 20GiB whenever there is less than 5GB left.# This setting is in bytes, so we multiply with 1024 by 3min-free = 5 * 1024 * 1024 * 1024;max-free = 20 * 1024 * 1024 * 1024;
When disk space drops below 5GB, Lix automatically frees up to 20GB by removing old store paths.
The configuration pins the registry to avoid unnecessary network requests:
modules/base/nix/nix.nix
# Pin the registry to avoid downloading and evaluating a new nixpkgs# version everytimeregistry = (mapAttrs (_: flake: { inherit flake; }) flakeInputs) // { nixpkgs = lib.mkForce { flake = inputs.nixpkgs; };};# We don't want to track the registry, but we do want to allow the usage# of the `flake:` references, so we need to enable use-registriesuse-registries = true;flake-registry = "";
# Continue building derivations even if one fails# This is important for keeping a nice cache of derivationskeep-going = true;# Show more log lines for failed buildslog-lines = 30;
let sudoers = if (_class == "nixos") then "@wheel" else "@admin";in{ # Users or groups which are allowed to do anything with the Nix daemon allowed-users = [ sudoers ]; # Users or groups which are allowed to manage the nix store trusted-users = [ sudoers ];}
Permissions adapt based on whether you’re running NixOS or Darwin (macOS).