use the same nixpkgs and home-manager

Co-authored-by: Tobias Happ <Gerschtli@users.noreply.github.com>
This commit is contained in:
Bruno Bigras 2021-01-13 09:57:57 -05:00 committed by Alexander Sosedkin
parent 2fba450df0
commit abf7f56cb6
3 changed files with 10 additions and 7 deletions

View file

@ -1,6 +1,6 @@
# Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE. # Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE.
{ pkgs ? import <nixpkgs> { }, config ? null }: { pkgs ? import <nixpkgs> { }, home-manager ? import <home-manager> { }, config ? null }:
with pkgs.lib; with pkgs.lib;
@ -16,10 +16,11 @@ let
rawModule = evalModules { rawModule = evalModules {
modules = [ modules = [
{ {
_module.args.home-manager = home-manager;
_module.args.pkgs = mkDefault pkgs; _module.args.pkgs = mkDefault pkgs;
} }
configModule configModule
] ++ import ./module-list.nix; ] ++ import ./module-list.nix { inherit pkgs; };
}; };
failedAssertions = map (x: x.message) (filter (x: !x.assertion) rawModule.config.assertions); failedAssertions = map (x: x.message) (filter (x: !x.assertion) rawModule.config.assertions);

View file

@ -1,24 +1,24 @@
# Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE. # Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE.
{ config, lib, pkgs, ... }: { config, lib, pkgs, home-manager, ... }:
with lib; with lib;
let let
cfg = config.home-manager; cfg = config.home-manager;
tryEval = builtins.tryEval <home-manager/modules/modules.nix>; tryEval = builtins.tryEval (home-manager.path + "/modules/modules.nix");
assertionNixpkgs = types ? submoduleWith; assertionNixpkgs = types ? submoduleWith;
assertionHomeManager = tryEval.success && builtins.functionArgs (import tryEval.value) ? useNixpkgsModule; assertionHomeManager = tryEval.success && builtins.functionArgs (import tryEval.value) ? useNixpkgsModule;
assertion = assertionNixpkgs && assertionHomeManager; assertion = assertionNixpkgs && assertionHomeManager;
extendedLib = import <home-manager/modules/lib/stdlib-extended.nix> pkgs.lib; extendedLib = import (home-manager.path + "/modules/lib/stdlib-extended.nix") pkgs.lib;
hmModule = types.submoduleWith { hmModule = types.submoduleWith {
specialArgs = { lib = extendedLib; }; specialArgs = { lib = extendedLib; };
modules = [ modules = [
({ name, ... }: { ({ name, ... }: {
imports = import <home-manager/modules/modules.nix> { imports = import (home-manager.path + "/modules/modules.nix") {
inherit pkgs; inherit pkgs;
lib = extendedLib; lib = extendedLib;
useNixpkgsModule = !cfg.useGlobalPkgs; useNixpkgsModule = !cfg.useGlobalPkgs;

View file

@ -1,5 +1,7 @@
# Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE. # Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE.
{ pkgs }:
[ [
./build/activation.nix ./build/activation.nix
./build/config.nix ./build/config.nix
@ -15,5 +17,5 @@
./user.nix ./user.nix
./version.nix ./version.nix
./workaround-make.nix ./workaround-make.nix
<nixpkgs/nixos/modules/misc/assertions.nix> (pkgs.path + "/nixos/modules/misc/assertions.nix")
] ]