config: fix conditional home-manager config

This should now work both for standalone home-manager and
home-manager-with-NixOS setup.
This commit is contained in:
Gabriel Arazas 2023-12-10 17:49:52 +08:00
parent 05c27221d9
commit e1c081b96d
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
3 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,5 @@
# Enables all of my usual setup for desktop-oriented stuff. # Enables all of my usual setup for desktop-oriented stuff.
{ config, lib, pkgs, osConfig ? { }, ... }: { config, lib, pkgs, ... }@attrs:
let cfg = config.profiles.desktop; let cfg = config.profiles.desktop;
in { in {
@ -26,7 +26,7 @@ in {
ffmpeg-full # Ah yes, everyman's multimedia swiss army knife. ffmpeg-full # Ah yes, everyman's multimedia swiss army knife.
imagemagick # Ah yes, everyman's image manipulation tool. imagemagick # Ah yes, everyman's image manipulation tool.
gmic # Don't let the gimmicks fool you, it's a magical image framework. gmic # Don't let the gimmicks fool you, it's a magical image framework.
] ++ (lib.optional (osConfig ? programs.blender.enable -> !osConfig.programs.blender.enable) blender); ] ++ (lib.optional (attrs ? osConfig -> !attrs.osConfig.programs.blender.enable) blender);
}) })
(lib.mkIf cfg.audio.enable { (lib.mkIf cfg.audio.enable {

View File

@ -1,6 +1,6 @@
# Arsenal for development (which is rare nowadays). ;p # Arsenal for development (which is rare nowadays). ;p
# If you're looking for text editors, go to `./editors.nix`. # If you're looking for text editors, go to `./editors.nix`.
{ config, lib, pkgs, osConfig ? { } ,... }: { config, lib, pkgs, ... }@attrs:
let cfg = config.profiles.dev; let cfg = config.profiles.dev;
in { in {
@ -110,7 +110,7 @@ in {
}; };
# Echolocation. # Echolocation.
programs.nix-index.enable = lib.mkIf (osConfig ? programs.nix-index.enable -> !osConfig.programs.nix-index.enable) true; programs.nix-index.enable = lib.mkIf (attrs ? osConfig -> !attrs.osConfig.programs.nix-index.enable) true;
}) })
(lib.mkIf cfg.shell.enable { (lib.mkIf cfg.shell.enable {

View File

@ -1,5 +1,5 @@
# WHOA! Even browsers with extensions can be declarative! # WHOA! Even browsers with extensions can be declarative!
{ config, lib, pkgs, osConfig ? { }, ... }: { config, lib, pkgs, ... }@attrs:
{ {
config = lib.mkMerge [ config = lib.mkMerge [
@ -35,7 +35,7 @@
}; };
} }
(lib.mkIf (osConfig ? programs.firefox.enable -> !osConfig.programs.firefox.enable) { (lib.mkIf (attrs ? osConfig -> !attrs.osConfig.programs.firefox.enable) {
# Despite the name, it isn't a browser for furries. # Despite the name, it isn't a browser for furries.
programs.firefox = { programs.firefox = {
enable = true; enable = true;