From 73d2fbb448fde5a298564ea03c032030bac2a635 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Sat, 22 Oct 2022 19:37:47 +0200 Subject: [PATCH] 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. --- examples/flakes/flake.nix | 2 +- examples/qemu-vm/minimal-vm.nix | 6 +++--- examples/qemu-vm/vm-config.nix | 2 +- pkgs/spark-wallet/composition.nix | 2 +- test/clightning-replication.nix | 10 +++++----- test/lib/make-test-vm.nix | 2 +- test/lib/make-test.nix | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/flakes/flake.nix b/examples/flakes/flake.nix index 24b7d53..4b23845 100644 --- a/examples/flakes/flake.nix +++ b/examples/flakes/flake.nix @@ -14,7 +14,7 @@ # Import the secure-node preset, an opinionated config to enhance security # and privacy. # - # "${nix-bitcoin}/modules/presets/secure-node.nix" + # (nix-bitcoin + "/modules/presets/secure-node.nix") { # Automatically generate all secrets required by services. diff --git a/examples/qemu-vm/minimal-vm.nix b/examples/qemu-vm/minimal-vm.nix index 8fb86ca..25a66c7 100644 --- a/examples/qemu-vm/minimal-vm.nix +++ b/examples/qemu-vm/minimal-vm.nix @@ -13,13 +13,13 @@ rec { QEMU_OPTS="-smp $(nproc) -m 1500" ${vm}/bin/run-*-vm ''; - vm = (import "${nixpkgs}/nixos" { + vm = (import (nixpkgs + "/nixos") { inherit system; configuration = { config, lib, modulesPath, ... }: { imports = [ nix-bitcoin.nixosModules.default - "${nix-bitcoin}/modules/presets/secure-node.nix" - "${modulesPath}/virtualisation/qemu-vm.nix" + (nix-bitcoin + "/modules/presets/secure-node.nix") + (modulesPath + "/virtualisation/qemu-vm.nix") ]; virtualisation.graphics = false; diff --git a/examples/qemu-vm/vm-config.nix b/examples/qemu-vm/vm-config.nix index 28f8cd3..b3cd0d3 100644 --- a/examples/qemu-vm/vm-config.nix +++ b/examples/qemu-vm/vm-config.nix @@ -3,7 +3,7 @@ # Disable the hardened preset to improve VM performance disabledModules = [ ]; - imports = [ "${modulesPath}/virtualisation/qemu-vm.nix" ]; + imports = [ (modulesPath + "/virtualisation/qemu-vm.nix" ]; config = { virtualisation.graphics = false; diff --git a/pkgs/spark-wallet/composition.nix b/pkgs/spark-wallet/composition.nix index 087380e..7eb0a0d 100644 --- a/pkgs/spark-wallet/composition.nix +++ b/pkgs/spark-wallet/composition.nix @@ -5,7 +5,7 @@ }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-14_x"}: 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 nodejs; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; diff --git a/test/clightning-replication.nix b/test/clightning-replication.nix index 1a4c3bc..06aad37 100644 --- a/test/clightning-replication.nix +++ b/test/clightning-replication.nix @@ -6,12 +6,12 @@ in import "${nixpkgs}/nixos/tests/make-test-python.nix" ({ pkgs, ... }: with pkgs.lib; let - keyDir = "${nixpkgs}/nixos/tests/initrd-network-ssh"; + keyDir = nixpkgs + "/nixos/tests/initrd-network-ssh"; keys = { - server = "${keyDir}/ssh_host_ed25519_key"; - client = "${keyDir}/id_ed25519"; - serverPub = readFile "${keys.server}.pub"; - clientPub = readFile "${keys.client}.pub"; + server = keyDir + "/ssh_host_ed25519_key"; + client = keyDir + "/id_ed25519"; + serverPub = readFile (keys.server + ".pub"); + clientPub = readFile (keys.client + ".pub"); }; clientBaseConfig = { diff --git a/test/lib/make-test-vm.nix b/test/lib/make-test-vm.nix index d494116..43f89bf 100644 --- a/test/lib/make-test-vm.nix +++ b/test/lib/make-test-vm.nix @@ -1,6 +1,6 @@ pkgs: 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; inherit pkgs; }; diff --git a/test/lib/make-test.nix b/test/lib/make-test.nix index 7fce27c..bad9f86 100644 --- a/test/lib/make-test.nix +++ b/test/lib/make-test.nix @@ -89,7 +89,7 @@ name: testConfig: vmWithoutTests = (pkgs.nixos ({ config, ... }: { imports = [ testConfig - "${toString pkgs.path}/nixos/modules/virtualisation/qemu-vm.nix" + (pkgs.path + "/nixos/modules/virtualisation/qemu-vm.nix") ]; virtualisation.graphics = false; services.getty.autologinUser = "root";