add compatibility with Nix PR #6530 (`Source tree abstraction`)

Avoid adding flake resource paths to the store (via string
interpolation).
This reduces performance and can lead to modules getting imported
twice, once through a local path and once through a store path.

This might not be needed in a future Nix release, in which case we can
revert this.
This commit is contained in:
Erik Arvstedt 2022-10-22 19:37:47 +02:00 committed by Greg Shuflin
parent 514c05ee47
commit ada564c1ea
7 changed files with 13 additions and 13 deletions

View File

@ -14,7 +14,7 @@
# Import the secure-node preset, an opinionated config to enhance security # Import the secure-node preset, an opinionated config to enhance security
# and privacy. # and privacy.
# #
# "${nix-bitcoin}/modules/presets/secure-node.nix" # (nix-bitcoin + "/modules/presets/secure-node.nix")
{ {
# Automatically generate all secrets required by services. # Automatically generate all secrets required by services.

View File

@ -13,13 +13,13 @@ rec {
QEMU_OPTS="-smp $(nproc) -m 1500" ${vm}/bin/run-*-vm QEMU_OPTS="-smp $(nproc) -m 1500" ${vm}/bin/run-*-vm
''; '';
vm = (import "${nixpkgs}/nixos" { vm = (import (nixpkgs + "/nixos") {
inherit system; inherit system;
configuration = { config, lib, modulesPath, ... }: { configuration = { config, lib, modulesPath, ... }: {
imports = [ imports = [
nix-bitcoin.nixosModules.default nix-bitcoin.nixosModules.default
"${nix-bitcoin}/modules/presets/secure-node.nix" (nix-bitcoin + "/modules/presets/secure-node.nix")
"${modulesPath}/virtualisation/qemu-vm.nix" (modulesPath + "/virtualisation/qemu-vm.nix")
]; ];
virtualisation.graphics = false; virtualisation.graphics = false;

View File

@ -3,7 +3,7 @@
# Disable the hardened preset to improve VM performance # Disable the hardened preset to improve VM performance
disabledModules = [ <nix-bitcoin/modules/presets/hardened.nix> ]; disabledModules = [ <nix-bitcoin/modules/presets/hardened.nix> ];
imports = [ "${modulesPath}/virtualisation/qemu-vm.nix" ]; imports = [ (modulesPath + "/virtualisation/qemu-vm.nix" ];
config = { config = {
virtualisation.graphics = false; virtualisation.graphics = false;

View File

@ -5,7 +5,7 @@
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-14_x"}: }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-14_x"}:
let let
nodeEnv = import "${toString pkgs.path}/pkgs/development/node-packages/node-env.nix" { nodeEnv = import (pkgs.path + "/pkgs/development/node-packages/node-env.nix") {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs; inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;

View File

@ -6,12 +6,12 @@ in
import "${nixpkgs}/nixos/tests/make-test-python.nix" ({ pkgs, ... }: import "${nixpkgs}/nixos/tests/make-test-python.nix" ({ pkgs, ... }:
with pkgs.lib; with pkgs.lib;
let let
keyDir = "${nixpkgs}/nixos/tests/initrd-network-ssh"; keyDir = nixpkgs + "/nixos/tests/initrd-network-ssh";
keys = { keys = {
server = "${keyDir}/ssh_host_ed25519_key"; server = keyDir + "/ssh_host_ed25519_key";
client = "${keyDir}/id_ed25519"; client = keyDir + "/id_ed25519";
serverPub = readFile "${keys.server}.pub"; serverPub = readFile (keys.server + ".pub");
clientPub = readFile "${keys.client}.pub"; clientPub = readFile (keys.client + ".pub");
}; };
clientBaseConfig = { clientBaseConfig = {

View File

@ -1,6 +1,6 @@
pkgs: pkgs:
let let
pythonTesting = import "${toString pkgs.path}/nixos/lib/testing-python.nix" { pythonTesting = import (pkgs.path + "/nixos/lib/testing-python.nix") {
system = pkgs.stdenv.hostPlatform.system; system = pkgs.stdenv.hostPlatform.system;
inherit pkgs; inherit pkgs;
}; };

View File

@ -89,7 +89,7 @@ name: testConfig:
vmWithoutTests = (pkgs.nixos ({ config, ... }: { vmWithoutTests = (pkgs.nixos ({ config, ... }: {
imports = [ imports = [
testConfig testConfig
"${toString pkgs.path}/nixos/modules/virtualisation/qemu-vm.nix" (pkgs.path + "/nixos/modules/virtualisation/qemu-vm.nix")
]; ];
virtualisation.graphics = false; virtualisation.graphics = false;
services.getty.autologinUser = "root"; services.getty.autologinUser = "root";