diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/profiles/common.nix | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/modules/profiles/common.nix b/modules/profiles/common.nix index 9b04fb97..c9f67e7d 100644 --- a/modules/profiles/common.nix +++ b/modules/profiles/common.nix @@ -1,11 +1,48 @@ -{ config, ... }: +{ config, lib, ... }: + +with lib; { - nixpkgs.config.packageOverrides = pkgs: { - inherit (import ../../pkgs { - # We need to make sure to incorporate other package overrides, - # otherwise we are unable to override packages in vuizvui.*. - pkgs = pkgs // config.nixpkgs.config.packageOverrides pkgs; - }) vuizvui; + options.vuizvui = { + modifyNixPath = mkOption { + type = types.bool; + default = true; + description = '' + Whether to modify NIX_PATH for vuizvui, so that <nixpkgs> points + to the path within the Nix channel instead of the + <literal>nixpkgs</literal> or <literal>nixos</literal> channel from the + root user. + ''; + }; + + channelName = mkOption { + type = types.str; + default = "vuizvui"; + description = '' + The channel name which is used to refer to <literal>vuizvui</literal>. + ''; + }; + }; + + config = { + nixpkgs.config.packageOverrides = pkgs: { + inherit (import ../../pkgs { + # We need to make sure to incorporate other package overrides, + # otherwise we are unable to override packages in vuizvui.*. + pkgs = pkgs // config.nixpkgs.config.packageOverrides pkgs; + }) vuizvui; + }; + + environment.sessionVariables = let + rootChannelsPath = "/nix/var/nix/profiles/per-user/root/channels"; + channelPath = "${rootChannelsPath}/${config.vuizvui.channelName}"; + in mkIf config.vuizvui.modifyNixPath (mkOverride 90 { + NIX_PATH = [ + "vuizvui=${channelPath}" + "nixpkgs=${channelPath}/nixpkgs" + "nixos-config=/etc/nixos/configuration.nix" + rootChannelsPath + ]; + }); }; } |