Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e116b4b331b8
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 91da4b3c5db8
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Jan 10, 2020

  1. lib/modules: Fix store imports

    This fixes imports from the store not being possible, which was caused by
    #76857
    
    E.g. such a case:
    
      imports = [ "${home-manager}/nixos" ];
    infinisil committed Jan 10, 2020
    Copy the full SHA
    e0ea5f4 View commit details
  2. Copy the full SHA
    2955e6b View commit details
  3. Fix store imports from NixOS modules (#77416)

    Fix store imports from NixOS modules
    infinisil authored Jan 10, 2020
    Copy the full SHA
    91da4b3 View commit details
Showing with 23 additions and 3 deletions.
  1. +2 −2 lib/modules.nix
  2. +4 −1 lib/tests/modules.sh
  3. +17 −0 lib/tests/modules/import-from-store.nix
4 changes: 2 additions & 2 deletions lib/modules.nix
Original file line number Diff line number Diff line change
@@ -151,8 +151,8 @@ rec {
filterModules = modulesPath: { disabled, modules }:
let
moduleKey = m: if isString m then toString modulesPath + "/" + m else toString m;
disabledKeys = listToAttrs (map (k: nameValuePair (moduleKey k) null) disabled);
keyFilter = filter (attrs: ! disabledKeys ? ${attrs.key});
disabledKeys = map moduleKey disabled;
keyFilter = filter (attrs: ! elem attrs.key disabledKeys);
in map (attrs: attrs.module) (builtins.genericClosure {
startSet = keyFilter modules;
operator = attrs: keyFilter attrs.modules;
5 changes: 4 additions & 1 deletion lib/tests/modules.sh
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ evalConfig() {
local attr=$1
shift;
local script="import ./default.nix { modules = [ $@ ];}"
nix-instantiate --timeout 1 -E "$script" -A "$attr" --eval-only --show-trace
nix-instantiate --timeout 1 -E "$script" -A "$attr" --eval-only --show-trace --read-write-mode
}

reportFailure() {
@@ -183,6 +183,9 @@ checkConfigOutput "true" config.enable ./disable-recursive/{main.nix,disable-foo
checkConfigOutput "true" config.enable ./disable-recursive/{main.nix,disable-bar.nix}
checkConfigError 'The option .* defined in .* does not exist' config.enable ./disable-recursive/{main.nix,disable-foo.nix,disable-bar.nix}

# Check that imports can depend on derivations
checkConfigOutput "true" config.enable ./import-from-store.nix

cat <<EOF
====== module tests ======
$pass Pass
17 changes: 17 additions & 0 deletions lib/tests/modules/import-from-store.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ lib, ... }:
let
drv = derivation {
name = "derivation";
system = builtins.currentSystem;
builder = "/bin/sh";
args = [ "-c" "echo {} > $out" ];
};
in {

imports = [
"${drv}"
./declare-enable.nix
./define-enable.nix
];

}