summaryrefslogtreecommitdiff
path: root/modules/pkgs.nix
diff options
context:
space:
mode:
authorSeth Flynn <[email protected]>2025-03-11 16:31:03 -0400
committerSeth Flynn <[email protected]>2025-03-11 17:57:46 -0400
commit336dc00a94e39337c64decd6d0f4f6e4a4d43187 (patch)
tree7e5cb2b56913e398afab4de495bed0401a16493f /modules/pkgs.nix
initial commitHEADmain
Diffstat (limited to 'modules/pkgs.nix')
-rw-r--r--modules/pkgs.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/pkgs.nix b/modules/pkgs.nix
new file mode 100644
index 0000000..d984859
--- /dev/null
+++ b/modules/pkgs.nix
@@ -0,0 +1,22 @@
+{ config, lib, ... }:
+
+{
+ options.pkgs = lib.mkOption {
+ type = lib.types.nullOr (lib.types.lazyAttrsOf lib.types.raw);
+ default =
+ if (config.sources ? "nixpkgs") then
+ import config.sources.nixpkgs {
+ config = { };
+ overlays = [ ];
+ }
+ else
+ null;
+ defaultText = "if (sources has nixpkgs) import sources.nixpkgs { ... } else null";
+ description = "The instance of `nixpkgs` to pass as a module argument.";
+ example = lib.literalExpression "import <nixpkgs> { config = { allowUnfree = true; }; }";
+ };
+
+ config = {
+ _module.args = { inherit (config) pkgs; };
+ };
+}