From 2d9b11406a1ed7c9e0dbce458e83c518f0a438af Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 29 May 2021 20:34:38 +0200 Subject: [PATCH] modules: system: packages: make it configurable --- modules/system/packages.nix | 47 +++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/modules/system/packages.nix b/modules/system/packages.nix index 4560ab1..faee86b 100644 --- a/modules/system/packages.nix +++ b/modules/system/packages.nix @@ -1,23 +1,36 @@ # Common packages -{ config, pkgs, ... }: - +{ config, lib, pkgs, ... }: +let + cfg = config.my.system.packages; +in { - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - git - git-crypt - mosh - vim - wget - ]; + options.my.system.packages = with lib; { + enable = my.mkDisableOption "packages configuration"; - programs.vim.defaultEditor = true; # Modal editing is life - programs.zsh = { - enable = true; # Use integrations - # Disable global compinit when a user config exists - enableGlobalCompInit = !config.my.home.zsh.enable; + allowUnfree = my.mkDisableOption "allow unfree packages"; }; - nixpkgs.config.allowUnfree = true; # Because I don't care *that* much. + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + git + git-crypt + mosh + vim + wget + ]; + + programs = { + vim.defaultEditor = true; # Modal editing is life + + zsh = { + enable = true; # Use integrations + # Disable global compinit when a user config exists + enableGlobalCompInit = !config.my.home.zsh.enable; + }; + }; + + nixpkgs.config = { + allowUnfree = cfg.allowUnfree; # Because I don't care *that* much. + }; + }; }