mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 19:46:07 +01:00
nix: Add nixPath option
This commit is contained in:
parent
07c4406897
commit
e3f821de81
1 changed files with 41 additions and 22 deletions
|
|
@ -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, ... }:
|
{ 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><nixpkgs></literal>).
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
substituters = mkOption {
|
substituters = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
|
|
@ -62,28 +77,32 @@ in
|
||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = {
|
config = mkMerge [
|
||||||
|
{
|
||||||
|
environment.etc = {
|
||||||
|
"nix/nix.conf".text = ''
|
||||||
|
sandbox = false
|
||||||
|
substituters = ${concatStringsSep " " cfg.substituters}
|
||||||
|
trusted-public-keys = ${concatStringsSep " " cfg.trustedPublicKeys}
|
||||||
|
${cfg.extraConfig}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
environment.etc = {
|
nix = {
|
||||||
"nix/nix.conf".text = ''
|
substituters = [
|
||||||
sandbox = false
|
"https://cache.nixos.org"
|
||||||
substituters = ${concatStringsSep " " cfg.substituters}
|
"https://nix-on-droid.cachix.org"
|
||||||
trusted-public-keys = ${concatStringsSep " " cfg.trustedPublicKeys}
|
];
|
||||||
${cfg.extraConfig}
|
trustedPublicKeys = [
|
||||||
'';
|
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||||
};
|
"nix-on-droid.cachix.org-1:56snoMJTXmDRC1Ei24CmKoUqvHJ9XCp+nidK7qkMQrU="
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
nix = {
|
(mkIf (cfg.nixPath != []) {
|
||||||
substituters = [
|
environment.sessionVariables.NIX_PATH = cfg.nixPath;
|
||||||
"https://cache.nixos.org"
|
})
|
||||||
"https://nix-on-droid.cachix.org"
|
];
|
||||||
];
|
|
||||||
trustedPublicKeys = [
|
|
||||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
|
||||||
"nix-on-droid.cachix.org-1:56snoMJTXmDRC1Ei24CmKoUqvHJ9XCp+nidK7qkMQrU="
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue