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.
This commit is contained in:
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 that affect multiple modules
options.sbruder = { 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"; gui.enable = lib.mkEnableOption "gui";
games.enable = lib.mkEnableOption "games"; games.enable = lib.mkEnableOption "games";
}; };

View file

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

View file

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

View file

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

View file

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

View file

@ -167,39 +167,6 @@ in
autocmd Filetype zsh setlocal ts=4 sw=4 sts=4 expandtab autocmd Filetype zsh setlocal ts=4 sw=4 sts=4 expandtab
''; '';
plugins = (with pkgs.vimPlugins; [ 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; plugin = deoplete-nvim;
config = '' config = ''
@ -279,7 +246,41 @@ in
autocmd BufEnter *.tex syntax sync fromstart 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 Vim-Jinja2-Syntax
nerdtree-git-plugin nerdtree-git-plugin
rainbow_csv rainbow_csv

View file

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