From 6a2a9c48bc5856d01b1e87ca7b1b3521cd46c713 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sat, 5 Dec 2020 13:48:06 +0100 Subject: [PATCH] Make gui global option --- machines/nunotaba/configuration.nix | 7 +- machines/sayuri/configuration.nix | 7 +- modules/base.nix | 16 ++++ modules/cli-tools.nix | 111 ------------------------- modules/communication.nix | 4 +- modules/creative.nix | 4 +- modules/cups.nix | 4 +- modules/fonts.nix | 4 +- modules/gui-tools.nix | 14 ---- modules/libvirt.nix | 4 +- modules/media.nix | 4 +- modules/network-manager.nix | 4 +- modules/office.nix | 4 +- modules/options.nix | 7 ++ modules/pulseaudio.nix | 4 +- modules/sway.nix | 4 +- modules/tools.nix | 123 ++++++++++++++++++++++++++++ modules/web.nix | 4 +- profiles/base.nix | 1 - profiles/gui.nix | 18 ---- 20 files changed, 178 insertions(+), 170 deletions(-) delete mode 100644 modules/cli-tools.nix delete mode 100644 modules/gui-tools.nix create mode 100644 modules/options.nix create mode 100644 modules/tools.nix delete mode 100644 profiles/gui.nix diff --git a/machines/nunotaba/configuration.nix b/machines/nunotaba/configuration.nix index e08b82a..6347fbc 100644 --- a/machines/nunotaba/configuration.nix +++ b/machines/nunotaba/configuration.nix @@ -8,15 +8,18 @@ ../../modules/gpu/intel.nix ../../modules/restic.nix ../../modules/ssd.nix - (import ../../modules/libvirt.nix { inherit pkgs; gui = true; }) + ../../modules/libvirt.nix #../../modules/texlive.nix ../../profiles/base.nix ../../profiles/dev.nix - ../../profiles/gui.nix ../../profiles/laptop.nix ../../users/simon ]; + sbruder = { + gui = true; + }; + boot.loader.grub.device = "/dev/disk/by-id/ata-INTEL_SSDSC2KB480G7_PHYS749202D6480BGN"; boot.initrd.luks.devices = { diff --git a/machines/sayuri/configuration.nix b/machines/sayuri/configuration.nix index e5efcd4..60c3319 100644 --- a/machines/sayuri/configuration.nix +++ b/machines/sayuri/configuration.nix @@ -6,15 +6,18 @@ ./hardware-configuration.nix ../../modules/cpu/intel.nix ../../modules/gpu/amd.nix - (import ../../modules/libvirt.nix { inherit pkgs; gui = true; }) + ../../modules/libvirt.nix ../../modules/restic.nix ../../modules/ssd.nix ../../profiles/base.nix ../../profiles/dev.nix - ../../profiles/gui.nix ../../users/simon ]; + sbruder = { + gui = true; + }; + boot.loader.grub.device = "/dev/disk/by-id/ata-MTFDDAK256TBN-1AR15ABHA_UFZMQ01ZR50NMM"; boot.initrd.luks.devices = { diff --git a/modules/base.nix b/modules/base.nix index e9334f5..d9e2bd0 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -1,6 +1,22 @@ { config, lib, pkgs, ... }: { + imports = [ + ./options.nix + ./tools.nix + ./communication.nix + ./creative.nix + ./cups.nix + ./fonts.nix + ./tools.nix + ./media.nix + ./network-manager.nix + ./office.nix + ./pulseaudio.nix + ./sway.nix + ./web.nix + ]; + # Essential system tools environment.systemPackages = with pkgs; [ git diff --git a/modules/cli-tools.nix b/modules/cli-tools.nix deleted file mode 100644 index 9e80e4f..0000000 --- a/modules/cli-tools.nix +++ /dev/null @@ -1,111 +0,0 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - # top like tools - bmon # network monitor - gotop # fancy top - mtr # interactive traceroute - - # batch processing/automation - jq # sed for json - parallel # parallel batch processing - yq # sed for yaml - - # unix tools on steroids - curlie # better httpie (easier curl) - exa # better ls - fd # better find - ripgrep # better grep - - # file tools - aria # multithreaded http/ftp/bittorrent download manager - dos2unix # convert CRLF (dos) or CR (classic mac) line endings to LF (unix) - fdupes # find duplicate files - file # file type - hexyl # user friendly hex file viewer - hyperfine # cli benchmarking - megatools # cli for mega.nz - minio-client # client for s3 compatible storage systems - mktorrent # bittorrent seed file generator - ntfs3g # ntfs filesystem driver - rclone # rsync for cloud storage - rename # sed for filenames - rsync # incremental file transfer - tokei # fast cloc - wget # download tool - xdelta # binary diff - - # file format tools - imagemagick # image conversion - p7zip # 7z cli - pdftk # pdf multitool - sqlite-interactive # cli for sqlite databses - upx # executable packer - - # network tools - dnsutils # dig - gatling # high performance web serve - iperf - iperf2 # bandwidth measurement tool - nmap # port scanner - sshfs # mount remote host - vnstat # client for vnstatd - whois # whois client - zmap # scanner for large address spaces - - # system tools - libva-utils # vainfo - lm_sensors # temperature sensors - ncdu # interactive du - pciutils # lspci - reptyr # move process to current terminal - smartmontools # hard drive monitoring - usbutils # lsusb - - # clients - drone-cli # client for drone ci - hcloud # cli for Hetzner Cloud - libnotify # notify-send - - # function eye candy - fzf # fuzzy finder - pv # monitor progress in pipe - starship # zsh prompt - - # end user programs - apacheHttpd # for htpasswd - libqalculate # flexible calculator for humans - scrcpy # stream/control android phones over adb - taskwarrior # todo list manager - - # passwords - (pass-wayland.withExtensions (es: with es; [ pass-otp ])) # password manager - pwgen - pwgen-secure # password generator - xkcdpass # memorable password generator - - # misc - toilet # free figlet - python38Packages.ipython # better python repl (useful for one-liners) - - # vim - neovim-remote # controlling another neovim process - universal-ctags # ctags - - # git - gitAndTools.delta # nicer diff - gitAndTools.git-annex - gitAndTools.git-annex-remote-rclone # git for non source files - gitAndTools.pre-commit # pre-commit hook for git - - # nix tools - niv # depdendency manager - ]; - - programs = { - adb.enable = true; - bandwhich.enable = true; - iotop.enable = true; - }; -} diff --git a/modules/communication.nix b/modules/communication.nix index 7f8855c..4f70193 100644 --- a/modules/communication.nix +++ b/modules/communication.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ config, lib, pkgs, ... }: -{ +lib.mkIf config.sbruder.gui { environment.systemPackages = with pkgs; [ (mumble.override { pulseSupport = true; }) # VoIP group chat claws-mail # email client that looks ugly but just works diff --git a/modules/creative.nix b/modules/creative.nix index 3df3256..924ec1e 100644 --- a/modules/creative.nix +++ b/modules/creative.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ config, lib, pkgs, ... }: -{ +lib.mkIf config.sbruder.gui { environment.systemPackages = with pkgs; [ blender # 3d animation darktable # photo development diff --git a/modules/cups.nix b/modules/cups.nix index a90a883..62891da 100644 --- a/modules/cups.nix +++ b/modules/cups.nix @@ -1,8 +1,8 @@ -{ lib, pkgs, ... }: +{ config, lib, pkgs, ... }: let gutenprintWithVersion = "gutenprint.${lib.versions.majorMinor (lib.getVersion pkgs.gutenprint)}"; in -{ +lib.mkIf config.sbruder.gui { services = { printing = { enable = true; diff --git a/modules/fonts.nix b/modules/fonts.nix index 789813a..5ac5482 100644 --- a/modules/fonts.nix +++ b/modules/fonts.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ config, lib, pkgs, ... }: -{ +lib.mkIf config.sbruder.gui { fonts = { fonts = with pkgs; [ corefonts # good ol’ microsoft fonts diff --git a/modules/gui-tools.nix b/modules/gui-tools.nix deleted file mode 100644 index ad4a4a7..0000000 --- a/modules/gui-tools.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - anki # flashcard SRS - filezilla # ftp client - gparted # gui for parted - qalculate-gtk # flexible calculator - antimicroX # gamepad to keyboard/mouse mapping - wl-clipboard # not really gui, but cli tool to manage wayland clipboard - wxhexeditor # hex editor - xfce.thunar # graphical file manager - ]; -} diff --git a/modules/libvirt.nix b/modules/libvirt.nix index c4f1490..b40cfff 100644 --- a/modules/libvirt.nix +++ b/modules/libvirt.nix @@ -1,7 +1,7 @@ -{ pkgs, gui ? false, ... }: +{ config, lib, pkgs, ... }: { virtualisation.libvirtd.enable = true; - environment.systemPackages = if gui then [ pkgs.virt-manager ] else [ ]; + environment.systemPackages = lib.mkIf config.sbruder.gui [ pkgs.virt-manager ]; } diff --git a/modules/media.nix b/modules/media.nix index 39aa0ad..28b52ee 100644 --- a/modules/media.nix +++ b/modules/media.nix @@ -1,4 +1,4 @@ -{ pkgs, gui ? false, ... }: +{ config, pkgs, ... }: { environment.systemPackages = with pkgs; [ @@ -24,7 +24,7 @@ # Literature mupdf # document (pdf) viewer and tools ] ++ ( - if gui then [ + if config.sbruder.gui then [ # Audio audacity # audio editor picard # musicbrainz tagger diff --git a/modules/network-manager.nix b/modules/network-manager.nix index fd91b03..da43136 100644 --- a/modules/network-manager.nix +++ b/modules/network-manager.nix @@ -1,6 +1,6 @@ -{ ... }: +{ config, lib, ... }: -{ +lib.mkIf config.sbruder.gui { networking.networkmanager = { enable = true; }; diff --git a/modules/office.nix b/modules/office.nix index 7114ce7..fa1a3eb 100644 --- a/modules/office.nix +++ b/modules/office.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ config, lib, pkgs, ... }: -{ +lib.mkIf config.sbruder.gui { environment.systemPackages = with pkgs; [ aspellDicts.de aspellDicts.en diff --git a/modules/options.nix b/modules/options.nix new file mode 100644 index 0000000..e5b3fa3 --- /dev/null +++ b/modules/options.nix @@ -0,0 +1,7 @@ +{ config, lib, pkgs, ... }: + +{ + options.sbruder = { + gui = lib.mkEnableOption "Enable gui configuration"; + }; +} diff --git a/modules/pulseaudio.nix b/modules/pulseaudio.nix index 19acbf2..a896d41 100644 --- a/modules/pulseaudio.nix +++ b/modules/pulseaudio.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ config, lib, pkgs, ... }: -{ +lib.mkIf config.sbruder.gui { sound.enable = true; hardware.pulseaudio = { enable = true; diff --git a/modules/sway.nix b/modules/sway.nix index 7693ded..2011268 100644 --- a/modules/sway.nix +++ b/modules/sway.nix @@ -1,6 +1,6 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -{ +lib.mkIf config.sbruder.gui { programs.sway.enable = true; # actual configuration happens in home-manager services.logind.lidSwitchDocked = config.services.logind.lidSwitch; diff --git a/modules/tools.nix b/modules/tools.nix new file mode 100644 index 0000000..9d9a6dc --- /dev/null +++ b/modules/tools.nix @@ -0,0 +1,123 @@ +{ config, lib, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; lib.mkMerge [ + [ + # top like tools + bmon # network monitor + gotop # fancy top + mtr # interactive traceroute + + # batch processing/automation + jq # sed for json + parallel # parallel batch processing + yq # sed for yaml + + # unix tools on steroids + curlie # better httpie (easier curl) + exa # better ls + fd # better find + ripgrep # better grep + + # file tools + aria # multithreaded http/ftp/bittorrent download manager + dos2unix # convert CRLF (dos) or CR (classic mac) line endings to LF (unix) + fdupes # find duplicate files + file # file type + hexyl # user friendly hex file viewer + hyperfine # cli benchmarking + megatools # cli for mega.nz + minio-client # client for s3 compatible storage systems + mktorrent # bittorrent seed file generator + ntfs3g # ntfs filesystem driver + rclone # rsync for cloud storage + rename # sed for filenames + rsync # incremental file transfer + tokei # fast cloc + wget # download tool + xdelta # binary diff + + # file format tools + imagemagick # image conversion + p7zip # 7z cli + pdftk # pdf multitool + sqlite-interactive # cli for sqlite databses + upx # executable packer + + # network tools + dnsutils # dig + gatling # high performance web serve + iperf + iperf2 # bandwidth measurement tool + nmap # port scanner + sshfs # mount remote host + vnstat # client for vnstatd + whois # whois client + zmap # scanner for large address spaces + + # system tools + libva-utils # vainfo + lm_sensors # temperature sensors + ncdu # interactive du + pciutils # lspci + reptyr # move process to current terminal + smartmontools # hard drive monitoring + usbutils # lsusb + + # clients + drone-cli # client for drone ci + hcloud # cli for Hetzner Cloud + libnotify # notify-send + + # function eye candy + fzf # fuzzy finder + pv # monitor progress in pipe + starship # zsh prompt + + # end user programs + apacheHttpd # for htpasswd + libqalculate # flexible calculator for humans + scrcpy # stream/control android phones over adb + taskwarrior # todo list manager + + # passwords + (pass-wayland.withExtensions (es: with es; [ pass-otp ])) # password manager + pwgen + pwgen-secure # password generator + xkcdpass # memorable password generator + + # misc + toilet # free figlet + python38Packages.ipython # better python repl (useful for one-liners) + + # vim + neovim-remote # controlling another neovim process + universal-ctags # ctags + + # git + gitAndTools.delta # nicer diff + gitAndTools.git-annex + gitAndTools.git-annex-remote-rclone # git for non source files + gitAndTools.pre-commit # pre-commit hook for git + + # nix tools + niv # depdendency manager + ] + (lib.mkIf config.sbruder.gui [ + anki # flashcard SRS + filezilla # ftp client + gparted # gui for parted + qalculate-gtk # flexible calculator + antimicroX # gamepad to keyboard/mouse mapping + wl-clipboard # not really gui, but cli tool to manage wayland clipboard + wxhexeditor # hex editor + xfce.thunar # graphical file manager + ]) + ]; + + programs = { + adb.enable = true; + bandwhich.enable = true; + iotop.enable = true; + }; +} diff --git a/modules/web.nix b/modules/web.nix index 5b99857..8894fd9 100644 --- a/modules/web.nix +++ b/modules/web.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ config, lib, pkgs, ... }: -{ +lib.mkIf config.sbruder.gui { environment.systemPackages = with pkgs; [ firefox-wayland # Buidling chromium from source on a potato laptop is not fun diff --git a/profiles/base.nix b/profiles/base.nix index 5914757..19976f2 100644 --- a/profiles/base.nix +++ b/profiles/base.nix @@ -4,7 +4,6 @@ imports = [ ../modules/base.nix - ../modules/cli-tools.nix ../modules/docker.nix ../modules/grub.nix ../modules/locales.nix diff --git a/profiles/gui.nix b/profiles/gui.nix deleted file mode 100644 index ddb24b1..0000000 --- a/profiles/gui.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ pkgs, ... }: - -{ - imports = - [ - ../modules/communication.nix - ../modules/creative.nix - ../modules/cups.nix - ../modules/fonts.nix - ../modules/gui-tools.nix - (import ../modules/media.nix { inherit pkgs; gui = true; }) - ../modules/network-manager.nix - ../modules/office.nix - ../modules/pulseaudio.nix - ../modules/sway.nix - ../modules/web.nix - ]; -}