Add option to disable large packages

Fixes #27

This adds the `sbruder.full` option (enabled by default), which disables
some otherwise enabled packages/modules when disabled. When setting it
to false on a full gui system it reduces the size of the system closure
by over 50%. It is intended for systems with low (main) disk space.
pull/30/head
Simon Bruder 2021-01-20 16:23:18 +01:00
parent 80cae99fef
commit c1283b6ffa
Signed by: simon
GPG Key ID: 8D3C82F9F309F8EC
7 changed files with 82 additions and 57 deletions

View File

@ -19,6 +19,14 @@ in
{
# Options that affect multiple modules
options.sbruder = {
full = lib.mkOption {
type = lib.types.bool;
description = ''
Whether to build the full system. If disabled, the system closure will
be smaller, but some features will not be available.
'';
default = true;
};
gui.enable = lib.mkEnableOption "gui";
games.enable = lib.mkEnableOption "games";
};

View File

@ -3,12 +3,14 @@
lib.mkIf config.sbruder.gui.enable {
fonts = {
fonts = with pkgs; [
(nerdfonts.override { fonts = [ "Iosevka" ]; }) # default monospace font
] ++ lib.optionals config.sbruder.full [
google-fonts # google font collection (free)
lmodern # Latin Modern for non-latex applications
(nerdfonts.override { fonts = [ "Iosevka" ]; })
#roboto # standalone roboto has awful kerning
source-han-sans
source-han-serif # CJK fonts
] ++ lib.optionals (!config.sbruder.full) [
roboto # default sans-serif font (normally included in google-fonts)
] ++ lib.optionals config.sbruder.unfree.allowAssets [
corefonts # good ol microsoft fonts
vistafonts # newer microsoft fonts

View File

@ -1,13 +1,11 @@
{ config, lib, pkgs, ... }:
let
bluetoothSupport = config.sbruder.full;
in
lib.mkIf config.sbruder.gui.enable {
sound.enable = true;
hardware.pulseaudio = {
enable = true;
package = pkgs.pulseaudioFull;
extraModules = [
pkgs.pulseaudio-modules-bt # Non-standard codecs for bluetooth
];
daemon.config = {
"default-sample-format" = "s16le";
"default-sample-rate" = "48000";
@ -15,13 +13,17 @@ lib.mkIf config.sbruder.gui.enable {
"resample-method" = "soxr-hq";
"flat-volumes" = "no";
};
} // lib.optionalAttrs bluetoothSupport {
package = pkgs.pulseaudioFull;
extraModules = [
pkgs.pulseaudio-modules-bt # Non-standard codecs for bluetooth
];
};
# Bluetooth support
hardware.bluetooth.enable = true;
services.blueman.enable = true;
environment.systemPackages = with pkgs; [
pavucontrol
];
hardware.bluetooth.enable = lib.mkDefault bluetoothSupport;
services.blueman.enable = lib.mkDefault bluetoothSupport;
}

View File

@ -1,6 +1,8 @@
{ config, ... }:
{
programs = {
adb.enable = builtins.currentSystem == "x86_64-linux";
adb.enable = builtins.currentSystem == "x86_64-linux" && config.sbruder.full;
bandwhich.enable = true;
iotop.enable = true;
};

View File

@ -35,6 +35,7 @@ in
home-manager.users.simon = { lib, pkgs, ... }: {
options.sbruder = {
full = inheritOption "sbruder.full";
gui.enable = inheritOption "sbruder.gui.enable";
games.enable = inheritOption "sbruder.games.enable";
unfree = {

View File

@ -167,39 +167,6 @@ in
autocmd Filetype zsh setlocal ts=4 sw=4 sts=4 expandtab
'';
plugins = (with pkgs.vimPlugins; [
{
plugin = LanguageClient-neovim;
config = ''
let g:LanguageClient_serverCommands = {
\ 'rust': ['${pkgs.rls}/bin/rls'],
\ 'go': ['${pkgs.gopls}/bin/gopls'],
\ 'python': ['${pyls}/bin/pyls'],
\ 'typescript': ['${pkgs.nodePackages.javascript-typescript-langserver}/bin/javascript-typescript-stdio'],
\ 'javascript': ['${pkgs.nodePackages.javascript-typescript-langserver}/bin/javascript-typescript-stdio'],
\ 'haskell': ['${pkgs.haskellPackages.haskell-language-server}/bin/haskell-language-server', '--lsp'],
\ 'nix': ['${pkgs.rnix-lsp}/bin/rnix-lsp'],
\ }
let g:LanguageClient_loggingFile = '${config.xdg.dataHome}/nvim/LanguageClient.log'
let g:LanguageClient_settingsPath = '${languageClientSettings}'
let g:LanguageClient_selectionUI='fzf'
function LC_maps()
if has_key(g:LanguageClient_serverCommands, &filetype)
nnoremap <buffer> <silent> <F5> :call LanguageClient_contextMenu()<CR>
nnoremap <buffer> <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <buffer> <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <buffer> <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
nnoremap <buffer> <silent> <Leader>f :call LanguageClient#textDocument_formatting()<CR>
" disable since it breaks most code
"set formatexpr=LanguageClient#textDocument_rangeFormatting_sync()
endif
endfunction
autocmd FileType * call LC_maps()
'';
}
{
plugin = deoplete-nvim;
config = ''
@ -279,7 +246,41 @@ in
autocmd BufEnter *.tex syntax sync fromstart
'';
}
]) ++ [
] ++ (lib.optionals config.sbruder.full [
{
plugin = LanguageClient-neovim;
config = ''
let g:LanguageClient_serverCommands = {
\ 'rust': ['${pkgs.rls}/bin/rls'],
\ 'go': ['${pkgs.gopls}/bin/gopls'],
\ 'python': ['${pyls}/bin/pyls'],
\ 'typescript': ['${pkgs.nodePackages.javascript-typescript-langserver}/bin/javascript-typescript-stdio'],
\ 'javascript': ['${pkgs.nodePackages.javascript-typescript-langserver}/bin/javascript-typescript-stdio'],
\ 'haskell': ['${pkgs.haskellPackages.haskell-language-server}/bin/haskell-language-server', '--lsp'],
\ 'nix': ['${pkgs.rnix-lsp}/bin/rnix-lsp'],
\ }
let g:LanguageClient_loggingFile = '${config.xdg.dataHome}/nvim/LanguageClient.log'
let g:LanguageClient_settingsPath = '${languageClientSettings}'
let g:LanguageClient_selectionUI='fzf'
function LC_maps()
if has_key(g:LanguageClient_serverCommands, &filetype)
nnoremap <buffer> <silent> <F5> :call LanguageClient_contextMenu()<CR>
nnoremap <buffer> <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <buffer> <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <buffer> <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
nnoremap <buffer> <silent> <Leader>f :call LanguageClient#textDocument_formatting()<CR>
" disable since it breaks most code
"set formatexpr=LanguageClient#textDocument_rangeFormatting_sync()
endif
endfunction
autocmd FileType * call LC_maps()
'';
}
])) ++ [
Vim-Jinja2-Syntax
nerdtree-git-plugin
rainbow_csv

View File

@ -168,23 +168,14 @@ in
})
];
})) # VoIP group chat
ungoogled-chromium # useful for exporting pages as pdf
# creative/design
blender # 3d animation
darktable # photo development
gimp-with-plugins # bitmap image editor
krita # drawing
openscad # parametric/procedural 3d modelling
inkscape # vector graphics editor
# audio and video
wf-recorder # wlroots screen recorder
# audio
audacity # audio editor
picard # musicbrainz tagger
# documents
calibre # ebook library
@ -194,9 +185,7 @@ in
hunspellDicts.de-de
hunspellDicts.en-gb-ise # dictionary
gscan2pdf # scanning tool
jameica # application framework (used for hibiscus online banking)
libreoffice # office suite
pdfsam-basic # pdf multitool
xournalpp # notebook
xsane # scanning tool
@ -209,5 +198,25 @@ in
wl-clipboard # not really gui, but cli tool to manage wayland clipboard
wxhexeditor # hex editor
xfce.thunar # graphical file manager
] ++ lib.optionals config.sbruder.full [
# communication
ungoogled-chromium # useful for exporting pages as pdf
# creative/design
blender # 3d animation
darktable # photo development
gimp-with-plugins # bitmap image editor
krita # drawing
# audio
audacity # audio editor
picard # musicbrainz tagger
# office
jameica # application framework (used for hibiscus online banking)
pdfsam-basic # pdf multitool
] ++ lib.optionals (!config.sbruder.full) [
# creative/design
gimp # without plugins
];
}