Make pkgsets accessible to service configurations.

This commit is contained in:
Kevin Baensch 2019-10-11 20:51:46 +02:00
parent 206c2e42af
commit cc21ece351
7 changed files with 29 additions and 35 deletions

View file

@ -14,7 +14,7 @@ in {
machineOpts machineOpts
./config/default.nix ./config/default.nix
./pkgs/nixpkgs.nix ./pkgs/nixpkgs.nix
./pkgs/pkgsets.nix ./pkgs/systemPackages.nix
./services/containers.nix ./services/containers.nix
./services/default.nix ./services/default.nix
]; ];

View file

@ -25,7 +25,7 @@ with lib;
"extra" "extra"
"cpp" "cpp"
"haskell" "haskell"
"mailutils" "mail_utils"
"python3" "python3"
"rustpkgs" "rustpkgs"
"xpkgs" "xpkgs"

View file

@ -10,7 +10,5 @@
networking.dhcpcd.extraConfig = "noarp"; networking.dhcpcd.extraConfig = "noarp";
environment.systemPackages = with pkgs; [ xdiskusage ];
system.stateVersion = "19.09"; system.stateVersion = "19.09";
} }

View file

@ -25,7 +25,7 @@ with lib;
"extra" "extra"
"cpp" "cpp"
"haskell" "haskell"
"mailutils" "mail_utils"
"python3" "python3"
"rustpkgs" "rustpkgs"
"xpkgs" "xpkgs"

View file

@ -1,14 +1,12 @@
{ config, lib, ... }: { config, lib, pkgs, ... }:
{ {
nixpkgs.config = { nixpkgs.config = {
allowUnfree = true; allowUnfree = true;
mpv.vaapiSupport = (lib.elem "xserver" config.machine.services); mpv.vaapiSupport = (lib.elem "xserver" config.machine.services);
packageOverrides = pkgs: with pkgs; rec { packageOverrides = {
theme_flat-remix = callPackage ./flat-remix { }; pkgsets = import ./pkgsets.nix { inherit config lib pkgs; };
theme_sddm_midnight = callPackage ./sddm_midnight { };
xdiskusage = callPackage ./xdiskusage { };
}; };
}; };
} }

View file

@ -1,13 +1,17 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs }:
with lib; with lib;
let let
cfg = config.machine; cfg = config.machine;
optPkgs = package: pkgstring: optionals (elem pkgstring cfg.pkgs) (toList package);
gitpkgs = import /nixpkgs {}; gitpkgs = import /nixpkgs {};
stablepkgs = import <nixos-stable> {}; stablepkgs = import <nixos-stable> {};
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 # Programms I'm likely to want on every machine and/or may execute as root
base = with pkgs; [ base = with pkgs; [
alsaUtils alsaUtils
@ -236,7 +240,7 @@ let
# flask_testing # flask_testing
# flask_wtf # flask_wtf
# flaskbabel # flaskbabel
] ++ optionals (elem "i3" cfg.desktop.wms) [ py3status pytz tzlocal ]); ] ++ optionals (elem "i3" config.machine.desktop.wms) [ py3status pytz tzlocal ]);
rustpkgs = with stablepkgs; [ rustpkgs = with stablepkgs; [
rustup rustup
@ -272,26 +276,4 @@ let
xorg.xbacklight xorg.xbacklight
xdiskusage 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;
};
} }

16
pkgs/systemPackages.nix Normal file
View file

@ -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;
};
}