diff --git a/home/base/nix/default.nix b/home/base/nix/default.nix index 32a59275..b33b981e 100644 --- a/home/base/nix/default.nix +++ b/home/base/nix/default.nix @@ -1,34 +1,50 @@ -{ pkgs, inputs, ... }: +{ config, lib, pkgs, inputs, ... }: + +with lib; + +let + + cfg = config.custom.base.nix; + +in { - home.packages = [ - pkgs.nix-output-monitor - ]; - - nix = { - registry = { - nixpkgs.flake = inputs.nixpkgs; - nix-config.flake = inputs.self; - }; - settings = { - auto-optimise-store = true; - experimental-features = [ "nix-command" "flakes" ]; - log-lines = 30; - substituters = [ - "https://christianharke.cachix.org/" - "https://nix-community.cachix.org" - "https://cache.nixos.org" - ]; - trusted-public-keys = [ - "christianharke.cachix.org-1:TzmbiNLRcH8G0932XRlQzh8GPvuV9pJcHLqLnzznLKU=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - ]; + options = { + custom.base.nix = { + enableStoreOptimization = mkEnableOption "Optimize nix store" // { default = true; }; }; }; - nixpkgs.config = import ./nixpkgs-config.nix; - xdg.configFile."nixpkgs/config.nix".source = ./nixpkgs-config.nix; - # Command-not-found replacement - programs.nix-index.enable = true; + config = { + home.packages = [ + pkgs.nix-output-monitor + ]; + + nix = { + registry = { + nixpkgs.flake = inputs.nixpkgs; + nix-config.flake = inputs.self; + }; + settings = { + auto-optimise-store = cfg.enableStoreOptimization; + experimental-features = [ "nix-command" "flakes" ]; + log-lines = 30; + substituters = [ + "https://christianharke.cachix.org/" + "https://nix-community.cachix.org" + "https://cache.nixos.org" + ]; + trusted-public-keys = [ + "christianharke.cachix.org-1:TzmbiNLRcH8G0932XRlQzh8GPvuV9pJcHLqLnzznLKU=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + ]; + }; + }; + nixpkgs.config = import ./nixpkgs-config.nix; + xdg.configFile."nixpkgs/config.nix".source = ./nixpkgs-config.nix; + + # Command-not-found replacement + programs.nix-index.enable = true; + }; } diff --git a/home/roles/mobile/default.nix b/home/roles/mobile/default.nix index aded93fb..d6705e60 100644 --- a/home/roles/mobile/default.nix +++ b/home/roles/mobile/default.nix @@ -25,9 +25,12 @@ in }; custom = { - base.non-nixos = { - enable = true; - installNix = false; + base = { + nix.enableStoreOptimization = false; + non-nixos = { + enable = true; + installNix = false; + }; }; programs.ssh = {