Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules/nixpkgs: init #2022

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ let
modules = [
../modules/top-level
{ isDocs = true; }
{ nixpkgs.pkgs = pkgs; }
];
};

Expand Down
3 changes: 3 additions & 0 deletions flake-modules/legacy-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
makeNixvim = module: makeNixvimWithModule { inherit module; };

nixvimConfiguration = helpers.modules.evalNixvim {
modules = [
{ nixpkgs.pkgs = pkgs; }
];
extraSpecialArgs = {
defaultPkgs = pkgs;
};
Expand Down
1 change: 1 addition & 0 deletions lib/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ rec {
inherit lib defaultPkgs;
# TODO: deprecate `helpers`
helpers = self;
pkgsPath = defaultPkgs.path;
}
// extraSpecialArgs;

Expand Down
2 changes: 2 additions & 0 deletions lib/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ let
{ config.test.runNvim = !dontRun; }
))
{ wrapRc = true; }
# FIXME: don't do this by default
{ nixpkgs.pkgs = pkgs; }
];
extraSpecialArgs = {
defaultPkgs = pkgs;
Expand Down
12 changes: 3 additions & 9 deletions modules/misc/default.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
{ defaultPkgs, ... }:
let
# We can't use config._module.args to define imports,
# so we're forced to use specialArgs.defaultPkgs's path
nixosModules = defaultPkgs.path + "/nixos/modules/";
in
{ pkgsPath, ... }:
{
imports = [
./context.nix
./nixpkgs.nix
./nixvim-info.nix
(nixosModules + "/misc/assertions.nix")
(nixosModules + "/misc/meta.nix")
(pkgsPath + "/nixos/modules/misc/assertions.nix")
(pkgsPath + "/nixos/modules/misc/meta.nix")
];
}
16 changes: 0 additions & 16 deletions modules/misc/nixpkgs.nix

This file was deleted.

1 change: 1 addition & 0 deletions modules/top-level/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
imports = [
../.
./files
./nixpkgs.nix
./output.nix
./test.nix
];
Expand Down
10 changes: 10 additions & 0 deletions modules/top-level/files/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ let
modules = lib.optionals (!config.isDocs) [
../../.
./submodule.nix
# Pass module args through to the submodule (except `name`)
# Wrap each arg with the correct priority
{
_file = ./.;
_module.args = lib.pipe options._module.args [
lib.modules.mergeAttrDefinitionsWithPrio
(lib.flip builtins.removeAttrs [ "name" ])
(lib.mapAttrs (_: { highestPrio, value }: lib.mkOverride highestPrio value))
];
}
];
description = "Nixvim configuration";
};
Expand Down
Loading