From c33b4517a7d85fbf268b8addc67ae1e0db9d2833 Mon Sep 17 00:00:00 2001 From: derped Date: Wed, 23 Oct 2019 03:44:17 +0200 Subject: [PATCH] Reworked pkgsets implementation again, still not really what I want yet. --- machines/Lilim/options.nix | 7 +- options/machine.nix | 32 +++- pkgs/nixpkgs.nix | 8 +- pkgs/pkgsets.nix | 279 --------------------------------- pkgs/pkgsets/base.nix | 68 ++++++++ pkgs/pkgsets/cpp.nix | 11 ++ pkgs/pkgsets/dict.nix | 9 ++ pkgs/pkgsets/emacs.nix | 62 ++++++++ pkgs/pkgsets/extra.nix | 9 ++ pkgs/pkgsets/haskell-tools.nix | 5 + pkgs/pkgsets/haskell.nix | 10 ++ pkgs/pkgsets/java.nix | 18 +++ pkgs/pkgsets/mail_utils.nix | 14 ++ pkgs/pkgsets/python3.nix | 63 ++++++++ pkgs/pkgsets/rustpkgs.nix | 11 ++ pkgs/pkgsets/server.nix | 10 ++ pkgs/pkgsets/uniProgs.nix | 5 + pkgs/pkgsets/xpkgs.nix | 21 +++ pkgs/systemPackages.nix | 11 +- services/desktop.nix | 1 + 20 files changed, 364 insertions(+), 290 deletions(-) delete mode 100644 pkgs/pkgsets.nix create mode 100644 pkgs/pkgsets/base.nix create mode 100644 pkgs/pkgsets/cpp.nix create mode 100644 pkgs/pkgsets/dict.nix create mode 100644 pkgs/pkgsets/emacs.nix create mode 100644 pkgs/pkgsets/extra.nix create mode 100644 pkgs/pkgsets/haskell-tools.nix create mode 100644 pkgs/pkgsets/haskell.nix create mode 100644 pkgs/pkgsets/java.nix create mode 100644 pkgs/pkgsets/mail_utils.nix create mode 100644 pkgs/pkgsets/python3.nix create mode 100644 pkgs/pkgsets/rustpkgs.nix create mode 100644 pkgs/pkgsets/server.nix create mode 100644 pkgs/pkgsets/uniProgs.nix create mode 100644 pkgs/pkgsets/xpkgs.nix diff --git a/machines/Lilim/options.nix b/machines/Lilim/options.nix index 87a0165..3d07b81 100644 --- a/machines/Lilim/options.nix +++ b/machines/Lilim/options.nix @@ -1,13 +1,12 @@ -{ lib, ... }: +{ pkgs, lib, ... }: with lib; { - imports = [ - ../../options/machine.nix + imports = [ + ../../options/machine.nix ../../options/copySysConf.nix ]; - config.machine = { allowUnfree = true; hostName = "Lilim"; diff --git a/options/machine.nix b/options/machine.nix index a240635..bbad460 100644 --- a/options/machine.nix +++ b/options/machine.nix @@ -1,16 +1,42 @@ -{ lib, ... }: +{ config, lib, ... }: +with builtins; with lib; -{ +let + cfg = config.machine; + metapkgs = (lists.forEach + (attrNames (filterAttrs (n: v: v == "regular" ) (readDir ../pkgs/pkgsets))) + (v: replaceStrings [ ".nix" ] [ "" ] v)); + pkgOption = pname: { + name = pname; + value = rec { + pkgwrap = mkOption { + type = types.listOf types.package; + default = cfg.pkgsets."${pname}".pkgs; + description = '' + Package Wrapper for packages using a wrapper function (like python, emacs, haskell, ...) + ''; + }; + pkgs = mkOption { + type = with types; listOf (nullOr attrs); + default = []; + description = '' + ${pname} package list. + ''; + }; + }; + }; +in { options.machine = { pkgs = mkOption { - type = types.listOf types.str; + type = (types.listOf (types.enum metapkgs)); default = [ "base" ]; description = '' The list of metapackages to be installed. ''; }; + pkgsets = listToAttrs (map pkgOption metapkgs); services = mkOption { type = types.listOf types.str; default = []; diff --git a/pkgs/nixpkgs.nix b/pkgs/nixpkgs.nix index 3ab9cdb..b70db58 100644 --- a/pkgs/nixpkgs.nix +++ b/pkgs/nixpkgs.nix @@ -1,12 +1,16 @@ { config, lib, pkgs, ... }: -{ +let + callPackage = pkgs.callPackage; +in { nixpkgs.config = { allowUnfree = true; mpv.vaapiSupport = (lib.elem "xserver" config.machine.services); packageOverrides = { - pkgsets = import ./pkgsets.nix { inherit config lib pkgs; }; + theme_flat-remix = callPackage ./flat-remix { }; + theme_sddm_midnight = callPackage ./sddm_midnight { }; + xdiskusage = callPackage ./xdiskusage { }; }; }; } diff --git a/pkgs/pkgsets.nix b/pkgs/pkgsets.nix deleted file mode 100644 index e954bf7..0000000 --- a/pkgs/pkgsets.nix +++ /dev/null @@ -1,279 +0,0 @@ -{ config, lib, pkgs }: - -with lib; - -let - cfg = config.machine; - gitpkgs = import /nixpkgs {}; - stablepkgs = import {}; - - callPackage = pkgs.callPackage; - theme_flat-remix = callPackage ./flat-remix { }; - theme_sddm_midnight = callPackage ./sddm_midnight { }; - xdiskusage = callPackage ./xdiskusage { }; -in { - # Programms I'm likely to want on every machine and/or may execute as root - base = with pkgs; [ - alsaUtils - finger_bsd - ccze - cksfv - cryptsetup - dhcpcd - dnsutils - gitFull git-lfs - gnupg - gptfdisk - haskellPackages.nix-derivation - home-manager - htop - hwinfo - indent - iptables - jp - lrzip - lsof - lshw - macchanger - mkpasswd - netcat - nix-diff - nix-index - nix-plugins - nix-prefetch-git - nix-serve - nix-update-source - nix-zsh-completions - nixbang - nixops - nmap - nox - ntfs3g - oh-my-zsh - openssl - parted - p7zip - pciutils - psmisc - rfkill - ripgrep - rsync - sl - sysvtools - telnet - traceroute - tree - unrar - unzipNLS - usbutils - vim - vulnix - wget - whois - wirelesstools - wpa_supplicant - zip unzipNLS - zlib - zsh - ]; - - dict = with pkgs; [ - translate-shell - ( hunspellWithDicts (with pkgs.hunspellDicts; [ de-de en-us ] )) - ( aspellWithDicts (d: with d; [ de en en-computers en-science ] )) - ]; - - emacs = gitpkgs.emacsWithPackages (epkgs: with epkgs; [ - /* Theming */ - solarized-theme color-theme-sanityinc-tomorrow moe-theme powerline moody minions - /*General Stuff */ - rainbow-delimiters # color parenthesis by indentation - color-identifiers-mode - /* Python */ - company-jedi pylint elpy flycheck-mypy - /* Git support */ - magit - emms # multimedia support - wsd-mode - plantuml-mode - /* Other Stuff, not yet sorted */ - mu4e-alert - google-translate - tramp - transmission - org-plus-contrib orgit ox-gfm ox-rst - easy-jekyll markdown-mode impatient-mode simple-httpd htmlize - eclim - auto-complete - pkgs.aspell pkgs.aspellDicts.en pkgs.aspellDicts.de - use-package diminish bind-key - smartparens - evil-surround evil-indent-textobject evil-cleverparens avy undo-tree - cdlatex # for math expressions - helm - /* LaTeX */ auctex helm-bibtex cdlatex - markdown-mode - flycheck - pkgs.ledger - yaml-mode - company - # Irony is currently broken. - /* C/C++ */ irony company-irony company-irony-c-headers flycheck-irony clang-format pkgs.clang-tools - /* Haskell */ haskell-mode flycheck-haskell - /* Org */ org org-ref pdf-tools org-bullets org-caldav - /* Rust */ rust-mode flycheck-rust racer - /* mail */ messages-are-flowing - /* Nix */ nix-buffer nix-mode nixos-options company-nixos-options nix-sandbox - paganini-theme - json-navigator - spaceline # modeline beautification - winum eyebrowse # window management - auto-compile - /* Maxima */ pkgs.maxima - visual-fill-column - web-mode - melpaStablePackages.idris-mode helm-idris - /* Java */ -# projectile yasnippet lsp-mode hydra company-lsp lsp-ui lsp-java dap-mode - cl-lib meghanada autodisass-java-bytecode google-c-style realgud - weechat - ]); - - extra = with pkgs; [ - imagemagick - texlive.combined.scheme-full - transmission - ]; - - mail_utils = with pkgs; [ - fetchmail - isync - mailutils - gitpkgs.mu - pandoc - postfix - ]; - - cpp = with pkgs; [ - clang - cmake - gcc - global - irony-server - ]; - - haskell = pkgs.haskellPackages.ghcWithPackages (pkgs: with pkgs; [ - hindent - mtl - random - ]); - - haskell-tools = with pkgs; [ cabal-install hlint]; # ghcid - - java = with pkgs; [ - openjdk11 - maven - (with gitpkgs.eclipses; eclipseWithPlugins { - eclipse = eclipse-platform; - jvmArgs = [ "-Xmx2048m" ]; - plugins = with plugins; [ - color-theme - # emacsplus - checkstyle - eclemma - ]; - }) - ]; - - python3 = gitpkgs.python3Full.withPackages(ps: with ps; [ - GitPython - bpython - # cairosvg cairocffi - configparser - django - emoji - epc - flake8 - genanki - mypy - numpy - opencv3 - paho-mqtt - pep8 - pillow - pip - plotly - pyflakes - pygame pygame_sdl2 - pylama - pylint - pyopengl - pyproj - pytest - requests - schedule - scipy - selenium - telegram - tkinter - toolz - virtualenv - xdot -# flask -# flask-common -# flask-compress -# flask-cors -# flask-limiter -# flask-pymongo -# flask-restful -# flask-restplus -# flask_assets -# flask_elastic -# flask_login -# flask_mail -# flask_marshmallow -# flask_migrate -# flask_oauthlib -# flask_principal -# flask_script -# flask_sqlalchemy -# flask_testing -# flask_wtf -# flaskbabel - ] ++ optionals (elem "i3" config.machine.desktop.wms) [ py3status pytz tzlocal ]); - - rustpkgs = with stablepkgs; [ - rustup - carnix - rustracer - ]; - - server = with pkgs; [ - audit - letsencrypt - php - simp_le - ]; - - uniProgs = with pkgs; [ - qucs - ]; - - xpkgs = with pkgs; [ - feh - scrot - theme_flat-remix - theme_sddm_midnight - gnome3.dconf - gnome3.gnome-terminal - gnome3.gvfs - gvfs - oneko - pcmanfm lxmenu-data shared_mime_info - pavucontrol - xclip - xlibs.xkill - xorg.xbacklight - xdiskusage - ]; -} diff --git a/pkgs/pkgsets/base.nix b/pkgs/pkgsets/base.nix new file mode 100644 index 0000000..cfff992 --- /dev/null +++ b/pkgs/pkgsets/base.nix @@ -0,0 +1,68 @@ +# Programms I'm likely to want on every machine and/or may execute as root +{ config, pkgs, ... }: + +{ + config.machine.pkgsets.base.pkgs = with pkgs; [ + alsaUtils + finger_bsd + ccze + cksfv + cryptsetup + dhcpcd + dnsutils + gitFull git-lfs + gnupg + gptfdisk + haskellPackages.nix-derivation + home-manager + htop + hwinfo + indent + iptables + jp + lrzip + lsof + lshw + macchanger + mkpasswd + netcat + nix-diff + nix-index + nix-plugins + nix-prefetch-git + nix-serve + nix-update-source + nix-zsh-completions + nixbang + nixops + nmap + nox + ntfs3g + oh-my-zsh + openssl + parted + p7zip + pciutils + psmisc + rfkill + ripgrep + rsync + sl + sysvtools + telnet + traceroute + tree + unrar + unzipNLS + usbutils + vim + vulnix + wget + whois + wirelesstools + wpa_supplicant + zip unzipNLS + zlib + zsh + ]; +} diff --git a/pkgs/pkgsets/cpp.nix b/pkgs/pkgsets/cpp.nix new file mode 100644 index 0000000..02ca4df --- /dev/null +++ b/pkgs/pkgsets/cpp.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + config.machine.pkgsets.cpp.pkgs = with pkgs; [ + clang + cmake + gcc + global + irony-server + ]; +} diff --git a/pkgs/pkgsets/dict.nix b/pkgs/pkgsets/dict.nix new file mode 100644 index 0000000..a8f1492 --- /dev/null +++ b/pkgs/pkgsets/dict.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + config.machine.pkgsets.dict.pkgs = with pkgs; [ + translate-shell + ( hunspellWithDicts (with pkgs.hunspellDicts; [ de-de en-us ] )) + ( aspellWithDicts (d: with d; [ de en en-computers en-science ] )) + ]; +} diff --git a/pkgs/pkgsets/emacs.nix b/pkgs/pkgsets/emacs.nix new file mode 100644 index 0000000..a4f2cee --- /dev/null +++ b/pkgs/pkgsets/emacs.nix @@ -0,0 +1,62 @@ +{ config, pkgs, ... }: + +let + gitpkgs = import /nixpkgs {}; +in { + config.machine.pkgsets.emacs.pkgwrap = [ (gitpkgs.emacsWithPackages (epkgs: with epkgs; config.machine.pkgsets.emacs.pkgs)) ]; + config.machine.pkgsets.emacs.pkgs = with pkgs; with pkgs.emacsPackages; [ + /* Theming */ + solarized-theme color-theme-sanityinc-tomorrow moe-theme powerline moody minions + /*General Stuff */ + rainbow-delimiters # color parenthesis by indentation + color-identifiers-mode + /* Python */ + company-jedi pylint elpy flycheck-mypy + /* Git support */ + magit + emms # multimedia support + wsd-mode + plantuml-mode + /* Other Stuff, not yet sorted */ + mu4e-alert + google-translate + tramp + transmission + org-plus-contrib orgit ox-gfm ox-rst + easy-jekyll markdown-mode impatient-mode simple-httpd htmlize + eclim + auto-complete + pkgs.aspell pkgs.aspellDicts.en pkgs.aspellDicts.de + use-package diminish bind-key + smartparens + evil-surround evil-indent-textobject evil-cleverparens avy undo-tree + cdlatex # for math expressions + helm + /* LaTeX */ auctex helm-bibtex cdlatex + markdown-mode + flycheck + pkgs.ledger + yaml-mode + company + # Irony is currently broken. + /* C/C++ */ irony company-irony company-irony-c-headers flycheck-irony clang-format pkgs.clang-tools + /* Haskell */ haskell-mode flycheck-haskell + /* Org */ org org-ref pdf-tools org-bullets org-caldav + /* Rust */ rust-mode flycheck-rust racer + /* mail */ messages-are-flowing + /* Nix */ nix-buffer nix-mode nixos-options company-nixos-options nix-sandbox + paganini-theme + json-navigator + spaceline # modeline beautification + winum eyebrowse # window management + auto-compile + /* Maxima */ pkgs.maxima + visual-fill-column + web-mode + melpaStablePackages.idris-mode helm-idris + /* Java */ +# projectile yasnippet lsp-mode hydra company-lsp lsp-ui lsp-java dap-mode + cl-lib meghanada autodisass-java-bytecode google-c-style realgud + weechat + ]; +} diff --git a/pkgs/pkgsets/extra.nix b/pkgs/pkgsets/extra.nix new file mode 100644 index 0000000..2ed2f8d --- /dev/null +++ b/pkgs/pkgsets/extra.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + config.machine.pkgsets.extra.pkgs = with pkgs; [ + imagemagick + texlive.combined.scheme-full + transmission + ]; +} diff --git a/pkgs/pkgsets/haskell-tools.nix b/pkgs/pkgsets/haskell-tools.nix new file mode 100644 index 0000000..5483ca5 --- /dev/null +++ b/pkgs/pkgsets/haskell-tools.nix @@ -0,0 +1,5 @@ +{ config, pkgs, ... }: + +{ + config.machine.pkgsets.haskell-tools.pkgs = with pkgs; [ cabal-install hlint ]; # ghcid +} diff --git a/pkgs/pkgsets/haskell.nix b/pkgs/pkgsets/haskell.nix new file mode 100644 index 0000000..59bbe7a --- /dev/null +++ b/pkgs/pkgsets/haskell.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + config.machine.pkgsets.haskell.pkgwrap = [ (pkgs.haskellPackages.ghcWithPackages (pkgs: config.machine.pkgsets.haskell.pkgs)) ]; + config.machine.pkgsets.haskell.pkgs = with pkgs.haskellPackages; [ + hindent + mtl + random + ]; +} diff --git a/pkgs/pkgsets/java.nix b/pkgs/pkgsets/java.nix new file mode 100644 index 0000000..fa19b1c --- /dev/null +++ b/pkgs/pkgsets/java.nix @@ -0,0 +1,18 @@ +{ config, pkgs, ... }: + +{ + config.machine.pkgsets.java.pkgs = with pkgs; [ + openjdk11 + maven + (with gitpkgs.eclipses; eclipseWithPlugins { + eclipse = eclipse-platform; + jvmArgs = [ "-Xmx2048m" ]; + plugins = with plugins; [ + color-theme + # emacsplus + checkstyle + eclemma + ]; + }) + ]; +} diff --git a/pkgs/pkgsets/mail_utils.nix b/pkgs/pkgsets/mail_utils.nix new file mode 100644 index 0000000..f3c4f42 --- /dev/null +++ b/pkgs/pkgsets/mail_utils.nix @@ -0,0 +1,14 @@ +{ config, pkgs, ... }: + +let + gitpkgs = import /nixpkgs {}; +in { + config.machine.pkgsets.mail_utils.pkgs = with pkgs; [ + fetchmail + isync + mailutils + gitpkgs.mu + pandoc + postfix + ]; +} diff --git a/pkgs/pkgsets/python3.nix b/pkgs/pkgsets/python3.nix new file mode 100644 index 0000000..887d9ce --- /dev/null +++ b/pkgs/pkgsets/python3.nix @@ -0,0 +1,63 @@ +{ config, pkgs, ... }: + +let + gitpkgs = import /nixpkgs {}; +in { + config.machine.pkgsets.python3.pkgwrap = [ (gitpkgs.python3Full.withPackages (ps: with ps; config.machine.pkgsets.python3.pkgs)) ]; + config.machine.pkgsets.python3.pkgs = with gitpkgs.python3Packages; [ + GitPython + bpython + # cairosvg cairocffi + configparser + django + emoji + epc + flake8 + genanki + mypy + numpy + opencv3 + paho-mqtt + pep8 + pillow + pip + plotly + pyflakes + pygame pygame_sdl2 + pylama + pylint + pyopengl + pyproj + pytest + requests + schedule + scipy + selenium + telegram + tkinter + toolz + virtualenv + xdot +# flask +# flask-common +# flask-compress +# flask-cors +# flask-limiter +# flask-pymongo +# flask-restful +# flask-restplus +# flask_assets +# flask_elastic +# flask_login +# flask_mail +# flask_marshmallow +# flask_migrate +# flask_oauthlib +# flask_principal +# flask_script +# flask_sqlalchemy +# flask_testing +# flask_wtf +# flaskbabel + ]; +} diff --git a/pkgs/pkgsets/rustpkgs.nix b/pkgs/pkgsets/rustpkgs.nix new file mode 100644 index 0000000..d2c8453 --- /dev/null +++ b/pkgs/pkgsets/rustpkgs.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +let + stablepkgs = import {}; +in { + config.machine.pkgsets.rustpkgs.pkgs = with stablepkgs; [ + rustup + carnix + rustracer + ]; +} diff --git a/pkgs/pkgsets/server.nix b/pkgs/pkgsets/server.nix new file mode 100644 index 0000000..12efb85 --- /dev/null +++ b/pkgs/pkgsets/server.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + config.machine.pkgsets.server.pkgs = with pkgs; [ + audit + letsencrypt + php + simp_le + ]; +} diff --git a/pkgs/pkgsets/uniProgs.nix b/pkgs/pkgsets/uniProgs.nix new file mode 100644 index 0000000..b47d92c --- /dev/null +++ b/pkgs/pkgsets/uniProgs.nix @@ -0,0 +1,5 @@ +{ config, pkgs, ... }: + +{ + config.machine.pkgsets.uniProgs.pkgs = with pkgs; [ qucs ]; +} diff --git a/pkgs/pkgsets/xpkgs.nix b/pkgs/pkgsets/xpkgs.nix new file mode 100644 index 0000000..7d65fce --- /dev/null +++ b/pkgs/pkgsets/xpkgs.nix @@ -0,0 +1,21 @@ +{ config, pkgs, ... }: + +{ + config.machine.pkgsets.xpkgs.pkgs = with pkgs; [ + feh + scrot + theme_flat-remix + theme_sddm_midnight + gnome3.dconf + gnome3.gnome-terminal + gnome3.gvfs + gvfs + oneko + pcmanfm lxmenu-data shared_mime_info + pavucontrol + xclip + xlibs.xkill + xorg.xbacklight + xdiskusage + ]; +} diff --git a/pkgs/systemPackages.nix b/pkgs/systemPackages.nix index cd464e3..99fa244 100644 --- a/pkgs/systemPackages.nix +++ b/pkgs/systemPackages.nix @@ -4,13 +4,20 @@ with lib; let cfg = config.machine; + pkgsets = (lists.forEach + (attrNames (filterAttrs (n: v: v == "regular") (builtins.readDir ./pkgsets))) + (v: (./. + "/pkgsets/${v}"))); in { - environment.systemPackages = flatten (attrVals cfg.pkgs pkgs.pkgsets); + imports = pkgsets; + + environment.systemPackages = flatten (lists.forEach + (attrVals cfg.pkgs cfg.pkgsets) + (v: v.pkgwrap)); services.emacs = mkIf (elem "emacs" cfg.pkgs) { defaultEditor = true; enable = true; install = true; - package = pkgs.pkgsets.emacs; + package = (elemAt cfg.pkgsets.emacs.pkgwrap 0); }; } diff --git a/services/desktop.nix b/services/desktop.nix index f098b6a..89b59de 100644 --- a/services/desktop.nix +++ b/services/desktop.nix @@ -56,4 +56,5 @@ in mkIf (elem "desktop" cfg.services) { horizontalScrolling = true; }; }; + machine.pkgsets.python3.pkgs = with pkgs.python3Packages; [ py3status pytz tzlocal ]; }