From cc21ece35176f75efe6ab6ed788a47d7bae23627 Mon Sep 17 00:00:00 2001 From: derped Date: Fri, 11 Oct 2019 20:51:46 +0200 Subject: [PATCH] Make pkgsets accessible to service configurations. --- configuration.nix | 2 +- machines/Behemoth/options.nix | 2 +- machines/Lilim/configuration.nix | 2 -- machines/Lilim/options.nix | 2 +- pkgs/nixpkgs.nix | 8 +++----- pkgs/pkgsets.nix | 32 +++++++------------------------- pkgs/systemPackages.nix | 16 ++++++++++++++++ 7 files changed, 29 insertions(+), 35 deletions(-) create mode 100644 pkgs/systemPackages.nix diff --git a/configuration.nix b/configuration.nix index f6007a1..fa4566d 100644 --- a/configuration.nix +++ b/configuration.nix @@ -14,7 +14,7 @@ in { machineOpts ./config/default.nix ./pkgs/nixpkgs.nix - ./pkgs/pkgsets.nix + ./pkgs/systemPackages.nix ./services/containers.nix ./services/default.nix ]; diff --git a/machines/Behemoth/options.nix b/machines/Behemoth/options.nix index d543e0f..70d7e81 100644 --- a/machines/Behemoth/options.nix +++ b/machines/Behemoth/options.nix @@ -25,7 +25,7 @@ with lib; "extra" "cpp" "haskell" - "mailutils" + "mail_utils" "python3" "rustpkgs" "xpkgs" diff --git a/machines/Lilim/configuration.nix b/machines/Lilim/configuration.nix index 80886bc..8055035 100644 --- a/machines/Lilim/configuration.nix +++ b/machines/Lilim/configuration.nix @@ -10,7 +10,5 @@ networking.dhcpcd.extraConfig = "noarp"; - environment.systemPackages = with pkgs; [ xdiskusage ]; - system.stateVersion = "19.09"; } diff --git a/machines/Lilim/options.nix b/machines/Lilim/options.nix index b8c07b7..87a0165 100644 --- a/machines/Lilim/options.nix +++ b/machines/Lilim/options.nix @@ -25,7 +25,7 @@ with lib; "extra" "cpp" "haskell" - "mailutils" + "mail_utils" "python3" "rustpkgs" "xpkgs" diff --git a/pkgs/nixpkgs.nix b/pkgs/nixpkgs.nix index 1e15ad1..3ab9cdb 100644 --- a/pkgs/nixpkgs.nix +++ b/pkgs/nixpkgs.nix @@ -1,14 +1,12 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: { nixpkgs.config = { allowUnfree = true; mpv.vaapiSupport = (lib.elem "xserver" config.machine.services); - packageOverrides = pkgs: with pkgs; rec { - theme_flat-remix = callPackage ./flat-remix { }; - theme_sddm_midnight = callPackage ./sddm_midnight { }; - xdiskusage = callPackage ./xdiskusage { }; + packageOverrides = { + pkgsets = import ./pkgsets.nix { inherit config lib pkgs; }; }; }; } diff --git a/pkgs/pkgsets.nix b/pkgs/pkgsets.nix index 8a6ab6c..e954bf7 100644 --- a/pkgs/pkgsets.nix +++ b/pkgs/pkgsets.nix @@ -1,13 +1,17 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs }: with lib; let cfg = config.machine; - optPkgs = package: pkgstring: optionals (elem pkgstring cfg.pkgs) (toList package); 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 @@ -236,7 +240,7 @@ let # flask_testing # flask_wtf # flaskbabel - ] ++ optionals (elem "i3" cfg.desktop.wms) [ py3status pytz tzlocal ]); + ] ++ optionals (elem "i3" config.machine.desktop.wms) [ py3status pytz tzlocal ]); rustpkgs = with stablepkgs; [ rustup @@ -272,26 +276,4 @@ let xorg.xbacklight xdiskusage ]; - -in { - environment.systemPackages = base - ++ (optPkgs dict "dict") - ++ (optPkgs emacs "emacs") - ++ (optPkgs extra "extra") - ++ (optPkgs mail_utils "mailutils") - ++ (optPkgs cpp "cpp") - ++ (optPkgs haskell "haskell") - ++ (optPkgs java "java") - ++ (optPkgs python3 "python3") - ++ (optPkgs rustpkgs "rustpkgs") - ++ (optPkgs server "server") - ++ (optPkgs uniProgs "uniProgs") - ++ (optPkgs xpkgs "xpkgs"); - - services.emacs = mkIf (elem "emacs" cfg.pkgs) { - defaultEditor = true; - enable = true; - install = true; - package = emacs; - }; } diff --git a/pkgs/systemPackages.nix b/pkgs/systemPackages.nix new file mode 100644 index 0000000..cd464e3 --- /dev/null +++ b/pkgs/systemPackages.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.machine; +in { + environment.systemPackages = flatten (attrVals cfg.pkgs pkgs.pkgsets); + + services.emacs = mkIf (elem "emacs" cfg.pkgs) { + defaultEditor = true; + enable = true; + install = true; + package = pkgs.pkgsets.emacs; + }; +}