nix: Add nixPath option

This commit is contained in:
Zhong Jianxin 2022-04-11 00:14:51 +08:00 committed by Alexander Sosedkin
parent 07c4406897
commit 1a8ae407f5

View file

@ -1,4 +1,9 @@
# Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE.
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
# Based on
# https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/nix-daemon.nix
# (Copyright (c) 2003-2022 Eelco Dolstra and the Nixpkgs/NixOS contributors,
# licensed under MIT License as well)
{ config, lib, pkgs, ... }:
@ -31,6 +36,16 @@ in
'';
};
nixPath = mkOption {
type = types.listOf types.str;
default = [];
description = ''
The default Nix expression search path, used by the Nix
evaluator to look up paths enclosed in angle brackets
(e.g. <literal>&lt;nixpkgs&gt;</literal>).
'';
};
substituters = mkOption {
type = types.listOf types.str;
default = [];
@ -62,8 +77,8 @@ in
###### implementation
config = {
config = mkMerge [
{
environment.etc = {
"nix/nix.conf".text = ''
sandbox = false
@ -83,7 +98,11 @@ in
"nix-on-droid.cachix.org-1:56snoMJTXmDRC1Ei24CmKoUqvHJ9XCp+nidK7qkMQrU="
];
};
}
};
(mkIf (cfg.nixPath != []) {
environment.sessionVariables.NIX_PATH = cfg.nixPath;
})
];
}