mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
Merge remote-tracking branch 'origin/master' into lazy-trees
This commit is contained in:
commit
dbe7fcebff
25 changed files with 188 additions and 120 deletions
3
Makefile
3
Makefile
|
@ -28,7 +28,8 @@ makefiles = \
|
||||||
OPTIMIZE = 1
|
OPTIMIZE = 1
|
||||||
|
|
||||||
ifeq ($(OPTIMIZE), 1)
|
ifeq ($(OPTIMIZE), 1)
|
||||||
GLOBAL_CXXFLAGS += -O3
|
GLOBAL_CXXFLAGS += -O3 $(CXXLTO)
|
||||||
|
GLOBAL_LDFLAGS += $(CXXLTO)
|
||||||
else
|
else
|
||||||
GLOBAL_CXXFLAGS += -O0 -U_FORTIFY_SOURCE
|
GLOBAL_CXXFLAGS += -O0 -U_FORTIFY_SOURCE
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -7,6 +7,7 @@ CC = @CC@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
CXX = @CXX@
|
CXX = @CXX@
|
||||||
CXXFLAGS = @CXXFLAGS@
|
CXXFLAGS = @CXXFLAGS@
|
||||||
|
CXXLTO = @CXXLTO@
|
||||||
EDITLINE_LIBS = @EDITLINE_LIBS@
|
EDITLINE_LIBS = @EDITLINE_LIBS@
|
||||||
ENABLE_S3 = @ENABLE_S3@
|
ENABLE_S3 = @ENABLE_S3@
|
||||||
GTEST_LIBS = @GTEST_LIBS@
|
GTEST_LIBS = @GTEST_LIBS@
|
||||||
|
|
14
configure.ac
14
configure.ac
|
@ -147,6 +147,20 @@ if test "x$GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC" = xyes; then
|
||||||
LDFLAGS="-latomic $LDFLAGS"
|
LDFLAGS="-latomic $LDFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# LTO is currently broken with clang for unknown reasons; ld segfaults in the llvm plugin
|
||||||
|
AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto],[Enable LTO (only supported with GCC) [default=no]]),
|
||||||
|
lto=$enableval, lto=no)
|
||||||
|
if test "$lto" = yes; then
|
||||||
|
if $CXX --version | grep -q GCC; then
|
||||||
|
AC_SUBST(CXXLTO, [-flto=jobserver])
|
||||||
|
else
|
||||||
|
echo "error: LTO is only supported with GCC at the moment" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
AC_SUBST(CXXLTO, [""])
|
||||||
|
fi
|
||||||
|
|
||||||
PKG_PROG_PKG_CONFIG
|
PKG_PROG_PKG_CONFIG
|
||||||
|
|
||||||
AC_ARG_ENABLE(shared, AS_HELP_STRING([--enable-shared],[Build shared libraries for Nix [default=yes]]),
|
AC_ARG_ENABLE(shared, AS_HELP_STRING([--enable-shared],[Build shared libraries for Nix [default=yes]]),
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
# Release X.Y (202?-??-??)
|
# Release X.Y (202?-??-??)
|
||||||
|
|
||||||
|
* Nix can now be built with LTO by passing `--enable-lto` to `configure`.
|
||||||
|
LTO is currently only supported when building with GCC.
|
||||||
|
|
|
@ -18,16 +18,16 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1645296114,
|
"lastModified": 1653988320,
|
||||||
"narHash": "sha256-y53N7TyIkXsjMpOG7RhvqJFGDacLs9HlyHeSTBioqYU=",
|
"narHash": "sha256-ZaqFFsSDipZ6KVqriwM34T739+KLYJvNmCWzErjAg7c=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "530a53dcbc9437363471167a5e4762c5fcfa34a1",
|
"rev": "2fa57ed190fd6c7c746319444f34b5917666e5c1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-21.05-small",
|
"ref": "nixos-22.05-small",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|
92
flake.nix
92
flake.nix
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
description = "The purely functional package manager";
|
description = "The purely functional package manager";
|
||||||
|
|
||||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05-small";
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05-small";
|
||||||
inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
|
inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
|
||||||
inputs.lowdown-src = { url = "github:kristapsdz/lowdown"; flake = false; };
|
inputs.lowdown-src = { url = "github:kristapsdz/lowdown"; flake = false; };
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
forAllStdenvs = stdenvs: f: nixpkgs.lib.genAttrs stdenvs (stdenv: f stdenv);
|
forAllStdenvs = f: nixpkgs.lib.genAttrs stdenvs (stdenv: f stdenv);
|
||||||
|
|
||||||
# Memoize nixpkgs for different platforms for efficiency.
|
# Memoize nixpkgs for different platforms for efficiency.
|
||||||
nixpkgsFor =
|
nixpkgsFor =
|
||||||
|
@ -88,7 +88,6 @@
|
||||||
"LDFLAGS=-fuse-ld=gold"
|
"LDFLAGS=-fuse-ld=gold"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
nativeBuildDeps =
|
nativeBuildDeps =
|
||||||
[
|
[
|
||||||
buildPackages.bison
|
buildPackages.bison
|
||||||
|
@ -315,6 +314,7 @@
|
||||||
for LIB in $out/lib/*.dylib; do
|
for LIB in $out/lib/*.dylib; do
|
||||||
chmod u+w $LIB
|
chmod u+w $LIB
|
||||||
install_name_tool -id $LIB $LIB
|
install_name_tool -id $LIB $LIB
|
||||||
|
install_name_tool -delete_rpath ${boost}/lib/ $LIB || true
|
||||||
done
|
done
|
||||||
install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib
|
install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib
|
||||||
''}
|
''}
|
||||||
|
@ -371,10 +371,10 @@
|
||||||
++ lib.optional (currentStdenv.isLinux || currentStdenv.isDarwin) libsodium
|
++ lib.optional (currentStdenv.isLinux || currentStdenv.isDarwin) libsodium
|
||||||
++ lib.optional currentStdenv.isDarwin darwin.apple_sdk.frameworks.Security;
|
++ lib.optional currentStdenv.isDarwin darwin.apple_sdk.frameworks.Security;
|
||||||
|
|
||||||
configureFlags = ''
|
configureFlags = [
|
||||||
--with-dbi=${perlPackages.DBI}/${pkgs.perl.libPrefix}
|
"--with-dbi=${perlPackages.DBI}/${pkgs.perl.libPrefix}"
|
||||||
--with-dbd-sqlite=${perlPackages.DBDSQLite}/${pkgs.perl.libPrefix}
|
"--with-dbd-sqlite=${perlPackages.DBDSQLite}/${pkgs.perl.libPrefix}"
|
||||||
'';
|
];
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@
|
||||||
|
|
||||||
# A Nixpkgs overlay that overrides the 'nix' and
|
# A Nixpkgs overlay that overrides the 'nix' and
|
||||||
# 'nix.perl-bindings' packages.
|
# 'nix.perl-bindings' packages.
|
||||||
overlay = overlayFor (p: p.stdenv);
|
overlays.default = overlayFor (p: p.stdenv);
|
||||||
|
|
||||||
hydraJobs = {
|
hydraJobs = {
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@
|
||||||
value = let
|
value = let
|
||||||
nixpkgsCross = import nixpkgs {
|
nixpkgsCross = import nixpkgs {
|
||||||
inherit system crossSystem;
|
inherit system crossSystem;
|
||||||
overlays = [ self.overlay ];
|
overlays = [ self.overlays.default ];
|
||||||
};
|
};
|
||||||
in binaryTarball nixpkgsFor.${system} self.packages.${system}."nix-${crossSystem}" nixpkgsCross;
|
in binaryTarball nixpkgsFor.${system} self.packages.${system}."nix-${crossSystem}" nixpkgsCross;
|
||||||
}) crossSystems));
|
}) crossSystems));
|
||||||
|
@ -477,31 +477,31 @@
|
||||||
tests.remoteBuilds = import ./tests/remote-builds.nix {
|
tests.remoteBuilds = import ./tests/remote-builds.nix {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
inherit nixpkgs;
|
inherit nixpkgs;
|
||||||
inherit (self) overlay;
|
overlay = self.overlays.default;
|
||||||
};
|
};
|
||||||
|
|
||||||
tests.nix-copy-closure = import ./tests/nix-copy-closure.nix {
|
tests.nix-copy-closure = import ./tests/nix-copy-closure.nix {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
inherit nixpkgs;
|
inherit nixpkgs;
|
||||||
inherit (self) overlay;
|
overlay = self.overlays.default;
|
||||||
};
|
};
|
||||||
|
|
||||||
tests.nssPreload = (import ./tests/nss-preload.nix rec {
|
tests.nssPreload = (import ./tests/nss-preload.nix rec {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
inherit nixpkgs;
|
inherit nixpkgs;
|
||||||
inherit (self) overlay;
|
overlay = self.overlays.default;
|
||||||
});
|
});
|
||||||
|
|
||||||
tests.githubFlakes = (import ./tests/github-flakes.nix rec {
|
tests.githubFlakes = (import ./tests/github-flakes.nix rec {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
inherit nixpkgs;
|
inherit nixpkgs;
|
||||||
inherit (self) overlay;
|
overlay = self.overlays.default;
|
||||||
});
|
});
|
||||||
|
|
||||||
tests.sourcehutFlakes = (import ./tests/sourcehut-flakes.nix rec {
|
tests.sourcehutFlakes = (import ./tests/sourcehut-flakes.nix rec {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
inherit nixpkgs;
|
inherit nixpkgs;
|
||||||
inherit (self) overlay;
|
overlay = self.overlays.default;
|
||||||
});
|
});
|
||||||
|
|
||||||
tests.setuid = nixpkgs.lib.genAttrs
|
tests.setuid = nixpkgs.lib.genAttrs
|
||||||
|
@ -509,7 +509,7 @@
|
||||||
(system:
|
(system:
|
||||||
import ./tests/setuid.nix rec {
|
import ./tests/setuid.nix rec {
|
||||||
inherit nixpkgs system;
|
inherit nixpkgs system;
|
||||||
inherit (self) overlay;
|
overlay = self.overlays.default;
|
||||||
});
|
});
|
||||||
|
|
||||||
# Make sure that nix-env still produces the exact same result
|
# Make sure that nix-env still produces the exact same result
|
||||||
|
@ -554,8 +554,9 @@
|
||||||
dockerImage = self.hydraJobs.dockerImage.${system};
|
dockerImage = self.hydraJobs.dockerImage.${system};
|
||||||
});
|
});
|
||||||
|
|
||||||
packages = forAllSystems (system: {
|
packages = forAllSystems (system: rec {
|
||||||
inherit (nixpkgsFor.${system}) nix;
|
inherit (nixpkgsFor.${system}) nix;
|
||||||
|
default = nix;
|
||||||
} // (nixpkgs.lib.optionalAttrs (builtins.elem system linux64BitSystems) {
|
} // (nixpkgs.lib.optionalAttrs (builtins.elem system linux64BitSystems) {
|
||||||
nix-static = let
|
nix-static = let
|
||||||
nixpkgs = nixpkgsFor.${system}.pkgsStatic;
|
nixpkgs = nixpkgsFor.${system}.pkgsStatic;
|
||||||
|
@ -611,12 +612,14 @@
|
||||||
ln -s ${image} $image
|
ln -s ${image} $image
|
||||||
echo "file binary-dist $image" >> $out/nix-support/hydra-build-products
|
echo "file binary-dist $image" >> $out/nix-support/hydra-build-products
|
||||||
'';
|
'';
|
||||||
} // builtins.listToAttrs (map (crossSystem: {
|
}
|
||||||
|
|
||||||
|
// builtins.listToAttrs (map (crossSystem: {
|
||||||
name = "nix-${crossSystem}";
|
name = "nix-${crossSystem}";
|
||||||
value = let
|
value = let
|
||||||
nixpkgsCross = import nixpkgs {
|
nixpkgsCross = import nixpkgs {
|
||||||
inherit system crossSystem;
|
inherit system crossSystem;
|
||||||
overlays = [ self.overlay ];
|
overlays = [ self.overlays.default ];
|
||||||
};
|
};
|
||||||
in with commonDeps nixpkgsCross; nixpkgsCross.stdenv.mkDerivation {
|
in with commonDeps nixpkgsCross; nixpkgsCross.stdenv.mkDerivation {
|
||||||
name = "nix-${version}";
|
name = "nix-${version}";
|
||||||
|
@ -650,44 +653,45 @@
|
||||||
doInstallCheck = true;
|
doInstallCheck = true;
|
||||||
installCheckFlags = "sysconfdir=$(out)/etc";
|
installCheckFlags = "sysconfdir=$(out)/etc";
|
||||||
};
|
};
|
||||||
}) crossSystems)) // (builtins.listToAttrs (map (stdenvName:
|
}) (if system == "x86_64-linux" then crossSystems else [])))
|
||||||
|
|
||||||
|
// (builtins.listToAttrs (map (stdenvName:
|
||||||
nixpkgsFor.${system}.lib.nameValuePair
|
nixpkgsFor.${system}.lib.nameValuePair
|
||||||
"nix-${stdenvName}"
|
"nix-${stdenvName}"
|
||||||
nixpkgsFor.${system}."${stdenvName}Packages".nix
|
nixpkgsFor.${system}."${stdenvName}Packages".nix
|
||||||
) stdenvs)));
|
) stdenvs)));
|
||||||
|
|
||||||
defaultPackage = forAllSystems (system: self.packages.${system}.nix);
|
devShells = forAllSystems (system:
|
||||||
|
forAllStdenvs (stdenv:
|
||||||
|
with nixpkgsFor.${system};
|
||||||
|
with commonDeps pkgs;
|
||||||
|
nixpkgsFor.${system}.${stdenv}.mkDerivation {
|
||||||
|
name = "nix";
|
||||||
|
|
||||||
devShell = forAllSystems (system: self.devShells.${system}.stdenvPackages);
|
outputs = [ "out" "dev" "doc" ];
|
||||||
|
|
||||||
devShells = forAllSystemsAndStdenvs (system: stdenv:
|
nativeBuildInputs = nativeBuildDeps;
|
||||||
with nixpkgsFor.${system};
|
buildInputs = buildDeps ++ propagatedDeps ++ awsDeps;
|
||||||
with commonDeps pkgs;
|
|
||||||
|
|
||||||
nixpkgsFor.${system}.${stdenv}.mkDerivation {
|
inherit configureFlags;
|
||||||
name = "nix";
|
|
||||||
|
|
||||||
outputs = [ "out" "dev" "doc" ];
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
nativeBuildInputs = nativeBuildDeps;
|
installFlags = "sysconfdir=$(out)/etc";
|
||||||
buildInputs = buildDeps ++ propagatedDeps ++ awsDeps;
|
|
||||||
|
|
||||||
inherit configureFlags;
|
shellHook =
|
||||||
|
''
|
||||||
|
PATH=$prefix/bin:$PATH
|
||||||
|
unset PYTHONPATH
|
||||||
|
export MANPATH=$out/share/man:$MANPATH
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
# Make bash completion work.
|
||||||
|
XDG_DATA_DIRS+=:$out/share
|
||||||
installFlags = "sysconfdir=$(out)/etc";
|
'';
|
||||||
|
}
|
||||||
shellHook =
|
)
|
||||||
''
|
// { default = self.devShells.${system}.stdenv; }
|
||||||
PATH=$prefix/bin:$PATH
|
);
|
||||||
unset PYTHONPATH
|
|
||||||
export MANPATH=$out/share/man:$MANPATH
|
|
||||||
|
|
||||||
# Make bash completion work.
|
|
||||||
XDG_DATA_DIRS+=:$out/share
|
|
||||||
'';
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ define build-library
|
||||||
$(1)_PATH := $$(_d)/$$($(1)_NAME).$(SO_EXT)
|
$(1)_PATH := $$(_d)/$$($(1)_NAME).$(SO_EXT)
|
||||||
|
|
||||||
$$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/
|
$$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/
|
||||||
$$(trace-ld) $(CXX) -o $$(abspath $$@) -shared $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE)) $$($(1)_LDFLAGS_UNINSTALLED)
|
+$$(trace-ld) $(CXX) -o $$(abspath $$@) -shared $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE)) $$($(1)_LDFLAGS_UNINSTALLED)
|
||||||
|
|
||||||
ifndef HOST_DARWIN
|
ifndef HOST_DARWIN
|
||||||
$(1)_LDFLAGS_USE += -Wl,-rpath,$$(abspath $$(_d))
|
$(1)_LDFLAGS_USE += -Wl,-rpath,$$(abspath $$(_d))
|
||||||
|
@ -105,7 +105,7 @@ define build-library
|
||||||
$$(eval $$(call create-dir, $$($(1)_INSTALL_DIR)))
|
$$(eval $$(call create-dir, $$($(1)_INSTALL_DIR)))
|
||||||
|
|
||||||
$$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR)/
|
$$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR)/
|
||||||
$$(trace-ld) $(CXX) -o $$@ -shared $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
|
+$$(trace-ld) $(CXX) -o $$@ -shared $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
|
||||||
|
|
||||||
$(1)_LDFLAGS_USE_INSTALLED += -L$$(DESTDIR)$$($(1)_INSTALL_DIR) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME)))
|
$(1)_LDFLAGS_USE_INSTALLED += -L$$(DESTDIR)$$($(1)_INSTALL_DIR) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME)))
|
||||||
ifndef HOST_DARWIN
|
ifndef HOST_DARWIN
|
||||||
|
@ -125,7 +125,7 @@ define build-library
|
||||||
$(1)_PATH := $$(_d)/$$($(1)_NAME).a
|
$(1)_PATH := $$(_d)/$$($(1)_NAME).a
|
||||||
|
|
||||||
$$($(1)_PATH): $$($(1)_OBJS) | $$(_d)/
|
$$($(1)_PATH): $$($(1)_OBJS) | $$(_d)/
|
||||||
$$(trace-ld) $(LD) -Ur -o $$(_d)/$$($(1)_NAME).o $$?
|
+$$(trace-ld) $(LD) -Ur -o $$(_d)/$$($(1)_NAME).o $$?
|
||||||
$$(trace-ar) $(AR) crs $$@ $$(_d)/$$($(1)_NAME).o
|
$$(trace-ar) $(AR) crs $$@ $$(_d)/$$($(1)_NAME).o
|
||||||
|
|
||||||
$(1)_LDFLAGS_USE += $$($(1)_PATH) $$($(1)_LDFLAGS)
|
$(1)_LDFLAGS_USE += $$($(1)_PATH) $$($(1)_LDFLAGS)
|
||||||
|
|
|
@ -32,7 +32,7 @@ define build-program
|
||||||
$$(eval $$(call create-dir, $$(_d)))
|
$$(eval $$(call create-dir, $$(_d)))
|
||||||
|
|
||||||
$$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/
|
$$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/
|
||||||
$$(trace-ld) $(CXX) -o $$@ $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
|
+$$(trace-ld) $(CXX) -o $$@ $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
|
||||||
|
|
||||||
$(1)_INSTALL_DIR ?= $$(bindir)
|
$(1)_INSTALL_DIR ?= $$(bindir)
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ define build-program
|
||||||
_libs_final := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_INSTALL_PATH))
|
_libs_final := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_INSTALL_PATH))
|
||||||
|
|
||||||
$(DESTDIR)$$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR)/
|
$(DESTDIR)$$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR)/
|
||||||
$$(trace-ld) $(CXX) -o $$@ $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
|
+$$(trace-ld) $(CXX) -o $$@ $$(LDFLAGS) $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|
|
@ -442,8 +442,9 @@ add_nix_vol_fstab_line() {
|
||||||
local escaped_mountpoint="${NIX_ROOT/ /'\\\'040}"
|
local escaped_mountpoint="${NIX_ROOT/ /'\\\'040}"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
# wrap `ex` to work around a problem with vim plugins breaking exit codes
|
# wrap `ex` to work around problems w/ vim features breaking exit codes
|
||||||
# (see github.com/NixOS/nix/issues/5468)
|
# - plugins (see github.com/NixOS/nix/issues/5468): -u NONE
|
||||||
|
# - swap file: -n
|
||||||
#
|
#
|
||||||
# the first draft used `--noplugin`, but github.com/NixOS/nix/issues/6462
|
# the first draft used `--noplugin`, but github.com/NixOS/nix/issues/6462
|
||||||
# suggests we need the less-semantic `-u NONE`
|
# suggests we need the less-semantic `-u NONE`
|
||||||
|
@ -456,7 +457,7 @@ add_nix_vol_fstab_line() {
|
||||||
# minver 10.12.6 seems to have released with vim 7.4
|
# minver 10.12.6 seems to have released with vim 7.4
|
||||||
cat > "$SCRATCH/ex_cleanroom_wrapper" <<EOF
|
cat > "$SCRATCH/ex_cleanroom_wrapper" <<EOF
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
/usr/bin/ex -u NONE "\$@"
|
/usr/bin/ex -u NONE -n "\$@"
|
||||||
EOF
|
EOF
|
||||||
chmod 755 "$SCRATCH/ex_cleanroom_wrapper"
|
chmod 755 "$SCRATCH/ex_cleanroom_wrapper"
|
||||||
|
|
||||||
|
@ -650,9 +651,9 @@ EOF
|
||||||
task "Configuring /etc/synthetic.conf to make a mount-point at $NIX_ROOT" >&2
|
task "Configuring /etc/synthetic.conf to make a mount-point at $NIX_ROOT" >&2
|
||||||
# technically /etc/synthetic.d/nix is supported in Big Sur+
|
# technically /etc/synthetic.d/nix is supported in Big Sur+
|
||||||
# but handling both takes even more code...
|
# but handling both takes even more code...
|
||||||
# Note: `-u NONE` disables vim plugins/rc; see note on --clean earlier
|
# See earlier note; `-u NONE` disables vim plugins/rc, `-n` skips swapfile
|
||||||
_sudo "to add Nix to /etc/synthetic.conf" \
|
_sudo "to add Nix to /etc/synthetic.conf" \
|
||||||
/usr/bin/ex -u NONE /etc/synthetic.conf <<EOF
|
/usr/bin/ex -u NONE -n /etc/synthetic.conf <<EOF
|
||||||
:a
|
:a
|
||||||
${NIX_ROOT:1}
|
${NIX_ROOT:1}
|
||||||
.
|
.
|
||||||
|
@ -820,8 +821,8 @@ setup_volume_daemon() {
|
||||||
local volume_uuid="$2"
|
local volume_uuid="$2"
|
||||||
if ! test_voldaemon; then
|
if ! test_voldaemon; then
|
||||||
task "Configuring LaunchDaemon to mount '$NIX_VOLUME_LABEL'" >&2
|
task "Configuring LaunchDaemon to mount '$NIX_VOLUME_LABEL'" >&2
|
||||||
# Note: `-u NONE` disables vim plugins/rc; see note on --clean earlier
|
# See earlier note; `-u NONE` disables vim plugins/rc, `-n` skips swapfile
|
||||||
_sudo "to install the Nix volume mounter" /usr/bin/ex -u NONE "$NIX_VOLUME_MOUNTD_DEST" <<EOF
|
_sudo "to install the Nix volume mounter" /usr/bin/ex -u NONE -n "$NIX_VOLUME_MOUNTD_DEST" <<EOF
|
||||||
:a
|
:a
|
||||||
$(generate_mount_daemon "$cmd_type" "$volume_uuid")
|
$(generate_mount_daemon "$cmd_type" "$volume_uuid")
|
||||||
.
|
.
|
||||||
|
|
|
@ -107,7 +107,7 @@ bool LocalBinaryCacheStore::fileExists(const std::string & path)
|
||||||
|
|
||||||
std::set<std::string> LocalBinaryCacheStore::uriSchemes()
|
std::set<std::string> LocalBinaryCacheStore::uriSchemes()
|
||||||
{
|
{
|
||||||
if (getEnv("_NIX_FORCE_HTTP_BINARY_CACHE_STORE") == "1")
|
if (getEnv("_NIX_FORCE_HTTP") == "1")
|
||||||
return {};
|
return {};
|
||||||
else
|
else
|
||||||
return {"file"};
|
return {"file"};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
create table if not exists ValidPaths (
|
create table if not exists ValidPaths (
|
||||||
id integer primary key autoincrement not null,
|
id integer primary key autoincrement not null,
|
||||||
path text unique not null,
|
path text unique not null,
|
||||||
hash text not null,
|
hash text not null, -- base16 representation
|
||||||
registrationTime integer not null,
|
registrationTime integer not null,
|
||||||
deriver text,
|
deriver text,
|
||||||
narSize integer,
|
narSize integer,
|
||||||
|
|
|
@ -8,9 +8,9 @@ std::string hiliteMatches(
|
||||||
std::string_view prefix,
|
std::string_view prefix,
|
||||||
std::string_view postfix)
|
std::string_view postfix)
|
||||||
{
|
{
|
||||||
// Avoid copy on zero matches
|
// Avoid extra work on zero matches
|
||||||
if (matches.size() == 0)
|
if (matches.size() == 0)
|
||||||
return (std::string) s;
|
return std::string(s);
|
||||||
|
|
||||||
std::sort(matches.begin(), matches.end(), [](const auto & a, const auto & b) {
|
std::sort(matches.begin(), matches.end(), [](const auto & a, const auto & b) {
|
||||||
return a.position() < b.position();
|
return a.position() < b.position();
|
||||||
|
|
|
@ -1093,7 +1093,7 @@ static int main_nix_store(int argc, char * * argv)
|
||||||
if (op != opDump && op != opRestore) /* !!! hack */
|
if (op != opDump && op != opRestore) /* !!! hack */
|
||||||
store = openStore();
|
store = openStore();
|
||||||
|
|
||||||
op(opFlags, opArgs);
|
op(std::move(opFlags), std::move(opArgs));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ convert-secret-to-public` to get the corresponding public key for
|
||||||
verifying signed store paths.
|
verifying signed store paths.
|
||||||
|
|
||||||
The mandatory argument `--key-name` specifies a key name (such as
|
The mandatory argument `--key-name` specifies a key name (such as
|
||||||
`cache.example.org-1). It is used to look up keys on the client when
|
`cache.example.org-1`). It is used to look up keys on the client when
|
||||||
it verifies signatures. It can be anything, but it’s suggested to use
|
it verifies signatures. It can be anything, but it’s suggested to use
|
||||||
the host name of your cache (e.g. `cache.example.org`) with a suffix
|
the host name of your cache (e.g. `cache.example.org`) with a suffix
|
||||||
denoting the number of the key (to be incremented every time you need
|
denoting the number of the key (to be incremented every time you need
|
||||||
|
|
|
@ -18,16 +18,24 @@ using namespace nix;
|
||||||
|
|
||||||
std::string wrap(std::string prefix, std::string s)
|
std::string wrap(std::string prefix, std::string s)
|
||||||
{
|
{
|
||||||
return prefix + s + ANSI_NORMAL;
|
return concatStrings(prefix, s, ANSI_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CmdSearch : InstallableCommand, MixJSON
|
struct CmdSearch : InstallableCommand, MixJSON
|
||||||
{
|
{
|
||||||
std::vector<std::string> res;
|
std::vector<std::string> res;
|
||||||
|
std::vector<std::string> excludeRes;
|
||||||
|
|
||||||
CmdSearch()
|
CmdSearch()
|
||||||
{
|
{
|
||||||
expectArgs("regex", &res);
|
expectArgs("regex", &res);
|
||||||
|
addFlag(Flag {
|
||||||
|
.longName = "exclude",
|
||||||
|
.shortName = 'e',
|
||||||
|
.description = "Hide packages whose attribute path, name or description contain *regex*.",
|
||||||
|
.labels = {"regex"},
|
||||||
|
.handler = Handler(&excludeRes),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string description() override
|
std::string description() override
|
||||||
|
@ -62,11 +70,16 @@ struct CmdSearch : InstallableCommand, MixJSON
|
||||||
res.push_back("^");
|
res.push_back("^");
|
||||||
|
|
||||||
std::vector<std::regex> regexes;
|
std::vector<std::regex> regexes;
|
||||||
|
std::vector<std::regex> excludeRegexes;
|
||||||
regexes.reserve(res.size());
|
regexes.reserve(res.size());
|
||||||
|
excludeRegexes.reserve(excludeRes.size());
|
||||||
|
|
||||||
for (auto & re : res)
|
for (auto & re : res)
|
||||||
regexes.push_back(std::regex(re, std::regex::extended | std::regex::icase));
|
regexes.push_back(std::regex(re, std::regex::extended | std::regex::icase));
|
||||||
|
|
||||||
|
for (auto & re : excludeRes)
|
||||||
|
excludeRegexes.emplace_back(re, std::regex::extended | std::regex::icase);
|
||||||
|
|
||||||
auto state = getEvalState();
|
auto state = getEvalState();
|
||||||
|
|
||||||
auto jsonOut = json ? std::make_unique<JSONObject>(std::cout) : nullptr;
|
auto jsonOut = json ? std::make_unique<JSONObject>(std::cout) : nullptr;
|
||||||
|
@ -106,6 +119,14 @@ struct CmdSearch : InstallableCommand, MixJSON
|
||||||
std::vector<std::smatch> nameMatches;
|
std::vector<std::smatch> nameMatches;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
|
for (auto & regex : excludeRegexes) {
|
||||||
|
if (
|
||||||
|
std::regex_search(attrPath2, regex)
|
||||||
|
|| std::regex_search(name.name, regex)
|
||||||
|
|| std::regex_search(description, regex))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto & regex : regexes) {
|
for (auto & regex : regexes) {
|
||||||
found = false;
|
found = false;
|
||||||
auto addAll = [&found](std::sregex_iterator it, std::vector<std::smatch> & vec) {
|
auto addAll = [&found](std::sregex_iterator it, std::vector<std::smatch> & vec) {
|
||||||
|
@ -133,15 +154,15 @@ struct CmdSearch : InstallableCommand, MixJSON
|
||||||
jsonElem.attr("version", name.version);
|
jsonElem.attr("version", name.version);
|
||||||
jsonElem.attr("description", description);
|
jsonElem.attr("description", description);
|
||||||
} else {
|
} else {
|
||||||
auto name2 = hiliteMatches(name.name, std::move(nameMatches), ANSI_GREEN, "\e[0;2m");
|
auto name2 = hiliteMatches(name.name, nameMatches, ANSI_GREEN, "\e[0;2m");
|
||||||
if (results > 1) logger->cout("");
|
if (results > 1) logger->cout("");
|
||||||
logger->cout(
|
logger->cout(
|
||||||
"* %s%s",
|
"* %s%s",
|
||||||
wrap("\e[0;1m", hiliteMatches(attrPath2, std::move(attrPathMatches), ANSI_GREEN, "\e[0;1m")),
|
wrap("\e[0;1m", hiliteMatches(attrPath2, attrPathMatches, ANSI_GREEN, "\e[0;1m")),
|
||||||
name.version != "" ? " (" + name.version + ")" : "");
|
name.version != "" ? " (" + name.version + ")" : "");
|
||||||
if (description != "")
|
if (description != "")
|
||||||
logger->cout(
|
logger->cout(
|
||||||
" %s", hiliteMatches(description, std::move(descriptionMatches), ANSI_GREEN, ANSI_NORMAL));
|
" %s", hiliteMatches(description, descriptionMatches, ANSI_GREEN, ANSI_NORMAL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,12 +43,23 @@ R""(
|
||||||
# nix search nixpkgs 'firefox|chromium'
|
# nix search nixpkgs 'firefox|chromium'
|
||||||
```
|
```
|
||||||
|
|
||||||
* Search for packages containing `git'`and either `frontend` or `gui`:
|
* Search for packages containing `git` and either `frontend` or `gui`:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
# nix search nixpkgs git 'frontend|gui'
|
# nix search nixpkgs git 'frontend|gui'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* Search for packages containing `neovim` but hide ones containing either `gui` or `python`:
|
||||||
|
|
||||||
|
```console
|
||||||
|
# nix search nixpkgs neovim -e 'python|gui'
|
||||||
|
```
|
||||||
|
or
|
||||||
|
|
||||||
|
```console
|
||||||
|
# nix search nixpkgs neovim -e 'python' -e 'gui'
|
||||||
|
```
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
`nix search` searches *installable* (which must be evaluatable, e.g. a
|
`nix search` searches *installable* (which must be evaluatable, e.g. a
|
||||||
|
|
|
@ -34,7 +34,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
|
||||||
|
|
||||||
std::string description() override
|
std::string description() override
|
||||||
{
|
{
|
||||||
return "upgrade Nix to the latest stable version";
|
return "upgrade Nix to the stable version declared in Nixpkgs";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string doc() override
|
std::string doc() override
|
||||||
|
|
|
@ -2,7 +2,7 @@ R""(
|
||||||
|
|
||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
* Upgrade Nix to the latest stable version:
|
* Upgrade Nix to the stable version declared in Nixpkgs:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
# nix upgrade-nix
|
# nix upgrade-nix
|
||||||
|
@ -16,8 +16,11 @@ R""(
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
This command upgrades Nix to the latest version. By default, it
|
This command upgrades Nix to the stable version declared in Nixpkgs.
|
||||||
locates the directory containing the `nix` binary in the `$PATH`
|
This stable version is defined in [nix-fallback-paths.nix](https://github.com/NixOS/nixpkgs/raw/master/nixos/modules/installer/tools/nix-fallback-paths.nix)
|
||||||
|
and updated manually. It may not always be the latest tagged release.
|
||||||
|
|
||||||
|
By default, it locates the directory containing the `nix` binary in the `$PATH`
|
||||||
environment variable. If that directory is a Nix profile, it will
|
environment variable. If that directory is a Nix profile, it will
|
||||||
upgrade the `nix` package in that profile to the latest stable binary
|
upgrade the `nix` package in that profile to the latest stable binary
|
||||||
release.
|
release.
|
||||||
|
|
|
@ -103,7 +103,7 @@ makeTest (
|
||||||
{ config, lib, pkgs, nodes, ... }:
|
{ config, lib, pkgs, nodes, ... }:
|
||||||
{ virtualisation.writableStore = true;
|
{ virtualisation.writableStore = true;
|
||||||
virtualisation.diskSize = 2048;
|
virtualisation.diskSize = 2048;
|
||||||
virtualisation.pathsInNixDB = [ pkgs.hello pkgs.fuse ];
|
virtualisation.additionalPaths = [ pkgs.hello pkgs.fuse ];
|
||||||
virtualisation.memorySize = 4096;
|
virtualisation.memorySize = 4096;
|
||||||
nix.binaryCaches = lib.mkForce [ ];
|
nix.binaryCaches = lib.mkForce [ ];
|
||||||
nix.extraOptions = "experimental-features = nix-command flakes";
|
nix.extraOptions = "experimental-features = nix-command flakes";
|
||||||
|
|
|
@ -14,7 +14,7 @@ makeTest (let pkgA = pkgs.cowsay; pkgB = pkgs.wget; pkgC = pkgs.hello; pkgD = pk
|
||||||
{ client =
|
{ client =
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
{ virtualisation.writableStore = true;
|
{ virtualisation.writableStore = true;
|
||||||
virtualisation.pathsInNixDB = [ pkgA pkgD.drvPath ];
|
virtualisation.additionalPaths = [ pkgA pkgD.drvPath ];
|
||||||
nix.binaryCaches = lib.mkForce [ ];
|
nix.binaryCaches = lib.mkForce [ ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ makeTest (let pkgA = pkgs.cowsay; pkgB = pkgs.wget; pkgC = pkgs.hello; pkgD = pk
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{ services.openssh.enable = true;
|
{ services.openssh.enable = true;
|
||||||
virtualisation.writableStore = true;
|
virtualisation.writableStore = true;
|
||||||
virtualisation.pathsInNixDB = [ pkgB pkgC ];
|
virtualisation.additionalPaths = [ pkgB pkgC ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,42 @@ with import (nixpkgs + "/nixos/lib/testing-python.nix") {
|
||||||
extraConfigurations = [ { nixpkgs.overlays = [ overlay ]; } ];
|
extraConfigurations = [ { nixpkgs.overlays = [ overlay ]; } ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let
|
||||||
|
nix-fetch = pkgs.writeText "fetch.nix" ''
|
||||||
|
derivation {
|
||||||
|
# This derivation is an copy from what is available over at
|
||||||
|
# nix.git:corepkgs/fetchurl.nix
|
||||||
|
builder = "builtin:fetchurl";
|
||||||
|
|
||||||
|
# We're going to fetch data from the http_dns instance created before
|
||||||
|
# we expect the content to be the same as the content available there.
|
||||||
|
# ```
|
||||||
|
# $ nix-hash --type sha256 --to-base32 $(echo "hello world" | sha256sum | cut -d " " -f 1)
|
||||||
|
# 0ix4jahrkll5zg01wandq78jw3ab30q4nscph67rniqg5x7r0j59
|
||||||
|
# ```
|
||||||
|
outputHash = "0ix4jahrkll5zg01wandq78jw3ab30q4nscph67rniqg5x7r0j59";
|
||||||
|
outputHashAlgo = "sha256";
|
||||||
|
outputHashMode = "flat";
|
||||||
|
|
||||||
|
name = "example.com";
|
||||||
|
url = "http://example.com";
|
||||||
|
|
||||||
|
unpack = false;
|
||||||
|
executable = false;
|
||||||
|
|
||||||
|
system = "builtin";
|
||||||
|
|
||||||
|
preferLocalBuild = true;
|
||||||
|
|
||||||
|
impureEnvVars = [
|
||||||
|
"http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
|
||||||
|
];
|
||||||
|
|
||||||
|
urls = [ "http://example.com" ];
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
|
||||||
makeTest (
|
makeTest (
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
|
@ -68,40 +104,6 @@ rec {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nix-fetch = pkgs.writeText "fetch.nix" ''
|
|
||||||
derivation {
|
|
||||||
# This derivation is an copy from what is available over at
|
|
||||||
# nix.git:corepkgs/fetchurl.nix
|
|
||||||
builder = "builtin:fetchurl";
|
|
||||||
|
|
||||||
# We're going to fetch data from the http_dns instance created before
|
|
||||||
# we expect the content to be the same as the content available there.
|
|
||||||
# ```
|
|
||||||
# $ nix-hash --type sha256 --to-base32 $(echo "hello world" | sha256sum | cut -d " " -f 1)
|
|
||||||
# 0ix4jahrkll5zg01wandq78jw3ab30q4nscph67rniqg5x7r0j59
|
|
||||||
# ```
|
|
||||||
outputHash = "0ix4jahrkll5zg01wandq78jw3ab30q4nscph67rniqg5x7r0j59";
|
|
||||||
outputHashAlgo = "sha256";
|
|
||||||
outputHashMode = "flat";
|
|
||||||
|
|
||||||
name = "example.com";
|
|
||||||
url = "http://example.com";
|
|
||||||
|
|
||||||
unpack = false;
|
|
||||||
executable = false;
|
|
||||||
|
|
||||||
system = "builtin";
|
|
||||||
|
|
||||||
preferLocalBuild = true;
|
|
||||||
|
|
||||||
impureEnvVars = [
|
|
||||||
"http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
|
|
||||||
];
|
|
||||||
|
|
||||||
urls = [ "http://example.com" ];
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
|
|
||||||
testScript = { nodes, ... }: ''
|
testScript = { nodes, ... }: ''
|
||||||
http_dns.wait_for_unit("nginx")
|
http_dns.wait_for_unit("nginx")
|
||||||
http_dns.wait_for_open_port(80)
|
http_dns.wait_for_open_port(80)
|
||||||
|
|
|
@ -61,7 +61,7 @@ in
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
virtualisation.writableStore = true;
|
virtualisation.writableStore = true;
|
||||||
virtualisation.pathsInNixDB = [ config.system.build.extraUtils ];
|
virtualisation.additionalPaths = [ config.system.build.extraUtils ];
|
||||||
nix.binaryCaches = lib.mkForce [ ];
|
nix.binaryCaches = lib.mkForce [ ];
|
||||||
programs.ssh.extraConfig = "ConnectTimeout 30";
|
programs.ssh.extraConfig = "ConnectTimeout 30";
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,11 +28,18 @@ nix search -f search.nix '' |grep -q hello
|
||||||
|
|
||||||
e=$'\x1b' # grep doesn't support \e, \033 or even \x1b
|
e=$'\x1b' # grep doesn't support \e, \033 or even \x1b
|
||||||
# Multiple overlapping regexes
|
# Multiple overlapping regexes
|
||||||
(( $(nix search -f search.nix '' 'oo' 'foo' 'oo' | grep "$e\[32;1mfoo$e\\[0;1m" | wc -l) == 1 ))
|
(( $(nix search -f search.nix '' 'oo' 'foo' 'oo' | grep -c "$e\[32;1mfoo$e\\[0;1m") == 1 ))
|
||||||
(( $(nix search -f search.nix '' 'broken b' 'en bar' | grep "$e\[32;1mbroken bar$e\\[0m" | wc -l) == 1 ))
|
(( $(nix search -f search.nix '' 'broken b' 'en bar' | grep -c "$e\[32;1mbroken bar$e\\[0m") == 1 ))
|
||||||
|
|
||||||
# Multiple matches
|
# Multiple matches
|
||||||
# Searching for 'o' should yield the 'o' in 'broken bar', the 'oo' in foo and 'o' in hello
|
# Searching for 'o' should yield the 'o' in 'broken bar', the 'oo' in foo and 'o' in hello
|
||||||
(( $(nix search -f search.nix '' 'o' | grep -Eo "$e\[32;1mo{1,2}$e\[(0|0;1)m" | wc -l) == 3 ))
|
(( $(nix search -f search.nix '' 'o' | grep -Eoc "$e\[32;1mo{1,2}$e\[(0|0;1)m") == 3 ))
|
||||||
# Searching for 'b' should yield the 'b' in bar and the two 'b's in 'broken bar'
|
# Searching for 'b' should yield the 'b' in bar and the two 'b's in 'broken bar'
|
||||||
|
# NOTE: This does not work with `grep -c` because it counts the two 'b's in 'broken bar' as one matched line
|
||||||
(( $(nix search -f search.nix '' 'b' | grep -Eo "$e\[32;1mb$e\[(0|0;1)m" | wc -l) == 3 ))
|
(( $(nix search -f search.nix '' 'b' | grep -Eo "$e\[32;1mb$e\[(0|0;1)m" | wc -l) == 3 ))
|
||||||
|
|
||||||
|
## Tests for --exclude
|
||||||
|
(( $(nix search -f search.nix -e hello | grep -c hello) == 0 ))
|
||||||
|
|
||||||
|
(( $(nix search -f search.nix foo --exclude 'foo|bar' | grep -Ec 'foo|bar') == 0 ))
|
||||||
|
(( $(nix search -f search.nix foo -e foo --exclude bar | grep -Ec 'foo|bar') == 0 ))
|
||||||
|
|
|
@ -10,12 +10,12 @@ with import (nixpkgs + "/nixos/lib/testing-python.nix") {
|
||||||
makeTest {
|
makeTest {
|
||||||
name = "setuid";
|
name = "setuid";
|
||||||
|
|
||||||
machine =
|
nodes.machine =
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
{ virtualisation.writableStore = true;
|
{ virtualisation.writableStore = true;
|
||||||
nix.binaryCaches = lib.mkForce [ ];
|
nix.binaryCaches = lib.mkForce [ ];
|
||||||
nix.nixPath = [ "nixpkgs=${lib.cleanSource pkgs.path}" ];
|
nix.nixPath = [ "nixpkgs=${lib.cleanSource pkgs.path}" ];
|
||||||
virtualisation.pathsInNixDB = [ pkgs.stdenv pkgs.pkgsi686Linux.stdenv ];
|
virtualisation.additionalPaths = [ pkgs.stdenv pkgs.pkgsi686Linux.stdenv ];
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = { nodes }: ''
|
testScript = { nodes }: ''
|
||||||
|
|
|
@ -106,7 +106,7 @@ makeTest (
|
||||||
{
|
{
|
||||||
virtualisation.writableStore = true;
|
virtualisation.writableStore = true;
|
||||||
virtualisation.diskSize = 2048;
|
virtualisation.diskSize = 2048;
|
||||||
virtualisation.pathsInNixDB = [ pkgs.hello pkgs.fuse ];
|
virtualisation.additionalPaths = [ pkgs.hello pkgs.fuse ];
|
||||||
virtualisation.memorySize = 4096;
|
virtualisation.memorySize = 4096;
|
||||||
nix.binaryCaches = lib.mkForce [ ];
|
nix.binaryCaches = lib.mkForce [ ];
|
||||||
nix.extraOptions = ''
|
nix.extraOptions = ''
|
||||||
|
|
Loading…
Reference in a new issue