From 0145d45806b1f60e9c7221a1f063a1b336a98eb4 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Sun, 7 Apr 2024 16:16:21 -0700 Subject: [PATCH] nix-doc -> lix-doc, make self-contained in package.nix package.nix previously needed this callPackage'd externally, which didn't make a lot of sense to us since this is an internal dependency. Thus we changed it to make it more self contained. Change-Id: I4935bc0bc80e1a132bc9b1519e917791da95037c --- Makefile.config.in | 2 +- flake.nix | 3 --- {nix-doc => lix-doc}/.gitignore | 0 {nix-doc => lix-doc}/Cargo.lock | 2 +- {nix-doc => lix-doc}/Cargo.toml | 5 +++-- lix-doc/README.md | 6 ++++++ {nix-doc => lix-doc}/package.nix | 4 ++-- {nix-doc => lix-doc}/src/lib.rs | 0 {nix-doc => lix-doc}/src/pprint.rs | 0 meson.build | 9 ++++++--- package.nix | 7 +++++-- src/libcmd/meson.build | 2 +- 12 files changed, 25 insertions(+), 15 deletions(-) rename {nix-doc => lix-doc}/.gitignore (100%) rename {nix-doc => lix-doc}/Cargo.lock (99%) rename {nix-doc => lix-doc}/Cargo.toml (70%) create mode 100644 lix-doc/README.md rename {nix-doc => lix-doc}/package.nix (50%) rename {nix-doc => lix-doc}/src/lib.rs (100%) rename {nix-doc => lix-doc}/src/pprint.rs (100%) diff --git a/Makefile.config.in b/Makefile.config.in index de1ace921..7367d0a3f 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -19,7 +19,7 @@ LIBBROTLI_LIBS = @LIBBROTLI_LIBS@ LIBCURL_LIBS = @LIBCURL_LIBS@ LIBSECCOMP_LIBS = @LIBSECCOMP_LIBS@ LOWDOWN_LIBS = @LOWDOWN_LIBS@ -NIXDOC_LIBS = -lnix_doc +NIXDOC_LIBS = -llix_doc OPENSSL_LIBS = @OPENSSL_LIBS@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ diff --git a/flake.nix b/flake.nix index 74d321c61..26540a995 100644 --- a/flake.nix +++ b/flake.nix @@ -148,13 +148,10 @@ ''; }; - nix-doc = final.callPackage ./nix-doc/package.nix {}; - nix = final.callPackage ./package.nix { inherit versionSuffix; stdenv = currentStdenv; busybox-sandbox-shell = final.busybox-sandbox-shell or final.default-busybox-sandbox-shell; - nix-doc = final.nix-doc; }; # Export the patched version of boehmgc that Lix uses into the overlay diff --git a/nix-doc/.gitignore b/lix-doc/.gitignore similarity index 100% rename from nix-doc/.gitignore rename to lix-doc/.gitignore diff --git a/nix-doc/Cargo.lock b/lix-doc/Cargo.lock similarity index 99% rename from nix-doc/Cargo.lock rename to lix-doc/Cargo.lock index 6fc63004a..d5028edfe 100644 --- a/nix-doc/Cargo.lock +++ b/lix-doc/Cargo.lock @@ -34,7 +34,7 @@ dependencies = [ ] [[package]] -name = "nix-doc" +name = "lix-doc" version = "0.0.1" dependencies = [ "expect-test", diff --git a/nix-doc/Cargo.toml b/lix-doc/Cargo.toml similarity index 70% rename from nix-doc/Cargo.toml rename to lix-doc/Cargo.toml index 21dc54d1b..df4eed932 100644 --- a/nix-doc/Cargo.toml +++ b/lix-doc/Cargo.toml @@ -1,9 +1,10 @@ [package] -description = "Nix documentation grepping tool" +description = "Nix function documentation tool, stripped down into a library" edition = "2018" -name = "nix-doc" +name = "lix-doc" version = "0.0.1" license = "BSD-2-Clause OR MIT" +# upstream details homepage = "https://github.com/lf-/nix-doc" repository = "https://github.com/lf-/nix-doc" diff --git a/lix-doc/README.md b/lix-doc/README.md new file mode 100644 index 000000000..26049ebd7 --- /dev/null +++ b/lix-doc/README.md @@ -0,0 +1,6 @@ +# lix-doc + +This is a stripped down fork of `nix-doc`, used for `:doc` in `nix repl` in +Lix. It will be replaced in the future with proper support when we get the new +parser working, but it exists today as a low-risk implementation of an +important usability feature. diff --git a/nix-doc/package.nix b/lix-doc/package.nix similarity index 50% rename from nix-doc/package.nix rename to lix-doc/package.nix index 70a49b9a0..86ab7501e 100644 --- a/nix-doc/package.nix +++ b/lix-doc/package.nix @@ -4,8 +4,8 @@ }: rustPlatform.buildRustPackage { - name = "nix-doc"; + name = "lix-doc"; - cargoHash = "sha256-HXL235loBJnRje7KaMCCCTighv6WNYRrZ/jgkAQbEY0="; + cargoLock.lockFile = ./Cargo.lock; src = lib.cleanSource ./.; } diff --git a/nix-doc/src/lib.rs b/lix-doc/src/lib.rs similarity index 100% rename from nix-doc/src/lib.rs rename to lix-doc/src/lib.rs diff --git a/nix-doc/src/pprint.rs b/lix-doc/src/pprint.rs similarity index 100% rename from nix-doc/src/pprint.rs rename to lix-doc/src/pprint.rs diff --git a/meson.build b/meson.build index 89881e190..2cedabad5 100644 --- a/meson.build +++ b/meson.build @@ -233,10 +233,13 @@ deps += toml11 nlohmann_json = dependency('nlohmann_json', required : true) deps += nlohmann_json -# nix-doc is a Rust project provided via buildInputs and unfortunately doesn't have any way to be detected. +# lix-doc is a Rust project provided via buildInputs and unfortunately doesn't have any way to be detected. # Just declare it manually to resolve this. -nix_doc = declare_dependency(link_args : [ '-lnix_doc' ]) -deps += nix_doc +# +# FIXME: build this with meson in the future after we drop Make (with which we +# *absolutely* are not going to make it work) +lix_doc = declare_dependency(link_args : [ '-llix_doc' ]) +deps += lix_doc # # Build-time tools diff --git a/package.nix b/package.nix index b972407f1..d096b5c73 100644 --- a/package.nix +++ b/package.nix @@ -48,7 +48,8 @@ busybox-sandbox-shell, - nix-doc, + # internal fork of nix-doc providing :doc in the repl + lix-doc ? __forDefaults.lix-doc, pname ? "nix", versionSuffix ? "", @@ -81,6 +82,8 @@ ./boehmgc-traceable_allocator-public.diff ]; }; + + lix-doc = pkgs.callPackage ./lix-doc/package.nix { }; }, }: let inherit (__forDefaults) canRunInstalled; @@ -209,7 +212,7 @@ in stdenv.mkDerivation (finalAttrs: { lowdown libsodium toml11 - nix-doc + lix-doc ] ++ lib.optionals stdenv.hostPlatform.isLinux [ libseccomp busybox-sandbox-shell ] ++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid diff --git a/src/libcmd/meson.build b/src/libcmd/meson.build index 167cb0f06..867508926 100644 --- a/src/libcmd/meson.build +++ b/src/libcmd/meson.build @@ -45,7 +45,7 @@ libcmd = library( editline, lowdown, nlohmann_json, - nix_doc + lix_doc ], install : true, # FIXME(Qyriad): is this right?