about summary refs log tree commit diff
path: root/pkgs/tools/package-management/lix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/package-management/lix')
-rw-r--r--pkgs/tools/package-management/lix/common.nix371
-rw-r--r--pkgs/tools/package-management/lix/default.nix8
-rw-r--r--pkgs/tools/package-management/lix/doc/default.nix7
3 files changed, 196 insertions, 190 deletions
diff --git a/pkgs/tools/package-management/lix/common.nix b/pkgs/tools/package-management/lix/common.nix
index a544707b4f355..8c89cf9fefda6 100644
--- a/pkgs/tools/package-management/lix/common.nix
+++ b/pkgs/tools/package-management/lix/common.nix
@@ -11,6 +11,7 @@
     inherit hash;
   },
   docCargoHash ? null,
+  docCargoLock ? null,
   patches ? [ ],
   maintainers ? lib.teams.lix.members,
 }@args:
@@ -65,6 +66,12 @@ assert (hash == null) -> (src != null);
   util-linuxMinimal,
   xz,
   nixosTests,
+  lix-doc ? callPackage ./doc {
+    inherit src;
+    version = "${version}${suffix}";
+    cargoHash = docCargoHash;
+    cargoLock = docCargoLock;
+  },
 
   enableDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform,
   enableStatic ? stdenv.hostPlatform.isStatic,
@@ -78,209 +85,205 @@ assert (hash == null) -> (src != null);
   stateDir,
   storeDir,
 }:
-let
-  lix-doc = callPackage ./doc {
-    inherit src;
-    version = "${version}${suffix}";
-    cargoHash = docCargoHash;
-  };
-  self = stdenv.mkDerivation {
-    pname = "lix";
+assert lib.assertMsg (docCargoHash != null || docCargoLock != null) "Either `lix-doc`'s cargoHash using `docCargoHash` or `lix-doc`'s `cargoLock.lockFile` using `docCargoLock` must be set!";
+stdenv.mkDerivation {
+  pname = "lix";
 
-    version = "${version}${suffix}";
-    VERSION_SUFFIX = suffix;
+  version = "${version}${suffix}";
+  VERSION_SUFFIX = suffix;
 
-    inherit src patches;
+  inherit src patches;
 
-    outputs =
-      [
-        "out"
-        "dev"
-      ]
-      ++ lib.optionals enableDocumentation [
-        "man"
-        "doc"
-      ];
+  outputs =
+    [
+      "out"
+      "dev"
+    ]
+    ++ lib.optionals enableDocumentation [
+      "man"
+      "doc"
+    ];
 
-    strictDeps = true;
+  strictDeps = true;
 
-    nativeBuildInputs =
-      [
-        pkg-config
-        bison
-        flex
-        jq
-        meson
-        ninja
-        cmake
-        python3
-        doxygen
+  nativeBuildInputs =
+    [
+      pkg-config
+      bison
+      flex
+      jq
+      meson
+      ninja
+      cmake
+      python3
+      doxygen
 
-        # Tests
-        git
-        mercurial
-        jq
-        lsof
-      ]
-      ++ lib.optionals (enableDocumentation) [
-        (lib.getBin lowdown)
-        mdbook
-        mdbook-linkcheck
-      ]
-      ++ lib.optionals stdenv.isLinux [ util-linuxMinimal ];
+      # Tests
+      git
+      mercurial
+      jq
+      lsof
+    ]
+    ++ lib.optionals (enableDocumentation) [
+      (lib.getBin lowdown)
+      mdbook
+      mdbook-linkcheck
+    ]
+    ++ lib.optionals stdenv.isLinux [ util-linuxMinimal ];
 
-    buildInputs =
-      [
-        boost
-        brotli
-        bzip2
-        curl
-        editline
-        libsodium
-        openssl
-        sqlite
-        xz
-        gtest
-        libarchive
-        lowdown
-        rapidcheck
-        toml11
-        lix-doc
-      ]
-      ++ lib.optionals stdenv.isDarwin [ Security ]
-      ++ lib.optionals (stdenv.isx86_64) [ libcpuid ]
-      ++ lib.optionals withLibseccomp [ libseccomp ]
-      ++ lib.optionals withAWS [ aws-sdk-cpp ];
+  buildInputs =
+    [
+      boost
+      brotli
+      bzip2
+      curl
+      editline
+      libsodium
+      openssl
+      sqlite
+      xz
+      gtest
+      libarchive
+      lowdown
+      rapidcheck
+      toml11
+      lix-doc
+    ]
+    ++ lib.optionals stdenv.isDarwin [ Security ]
+    ++ lib.optionals (stdenv.isx86_64) [ libcpuid ]
+    ++ lib.optionals withLibseccomp [ libseccomp ]
+    ++ lib.optionals withAWS [ aws-sdk-cpp ];
 
-    propagatedBuildInputs = [
-      boehmgc
-      nlohmann_json
-    ];
+  propagatedBuildInputs = [
+    boehmgc
+    nlohmann_json
+  ];
 
-    postPatch = ''
-      patchShebangs --build tests
-    '';
+  postPatch = ''
+    patchShebangs --build tests
+  '';
 
-    preConfigure =
-      # Copy libboost_context so we don't get all of Boost in our closure.
-      # https://github.com/NixOS/nixpkgs/issues/45462
-      lib.optionalString (!enableStatic) ''
-        mkdir -p $out/lib
-        cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
-        rm -f $out/lib/*.a
-        ${lib.optionalString stdenv.isLinux ''
-          chmod u+w $out/lib/*.so.*
-          patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
-        ''}
-        ${lib.optionalString stdenv.hostPlatform.isDarwin ''
-          for LIB in $out/lib/*.dylib; do
-            chmod u+w $LIB
-            install_name_tool -id $LIB $LIB
-            install_name_tool -delete_rpath ${boost}/lib/ $LIB || true
-          done
-          install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib
-        ''}
-      '';
+  preConfigure =
+    # Copy libboost_context so we don't get all of Boost in our closure.
+    # https://github.com/NixOS/nixpkgs/issues/45462
+    lib.optionalString (!enableStatic) ''
+      mkdir -p $out/lib
+      cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
+      rm -f $out/lib/*.a
+      ${lib.optionalString stdenv.isLinux ''
+        chmod u+w $out/lib/*.so.*
+        patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.*
+      ''}
+      ${lib.optionalString stdenv.hostPlatform.isDarwin ''
+        for LIB in $out/lib/*.dylib; do
+          chmod u+w $LIB
+          install_name_tool -id $LIB $LIB
+          install_name_tool -delete_rpath ${boost}/lib/ $LIB || true
+        done
+        install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib
+      ''}
+    '';
 
-    mesonFlags =
-      [
-        (lib.mesonEnable "gc" true)
-        (lib.mesonBool "enable-tests" true)
-        (lib.mesonBool "enable-docs" enableDocumentation)
-        (lib.mesonBool "enable-embedded-sandbox-shell" (stdenv.isLinux && stdenv.hostPlatform.isStatic))
-        (lib.mesonEnable "seccomp-sandboxing" withLibseccomp)
+  mesonBuildType = "release";
+  mesonFlags =
+    [
+      # LTO optimization
+      (lib.mesonBool "b_lto" (!stdenv.isDarwin))
+      (lib.mesonEnable "gc" true)
+      (lib.mesonBool "enable-tests" true)
+      (lib.mesonBool "enable-docs" enableDocumentation)
+      (lib.mesonBool "enable-embedded-sandbox-shell" (stdenv.isLinux && stdenv.hostPlatform.isStatic))
+      (lib.mesonEnable "seccomp-sandboxing" withLibseccomp)
 
-        (lib.mesonOption "store-dir" storeDir)
-        (lib.mesonOption "state-dir" stateDir)
-        (lib.mesonOption "sysconfdir" confDir)
-      ]
-      ++ lib.optionals stdenv.isLinux [
-        (lib.mesonOption "sandbox-shell" "${busybox-sandbox-shell}/bin/busybox")
-      ];
+      (lib.mesonOption "store-dir" storeDir)
+      (lib.mesonOption "state-dir" stateDir)
+      (lib.mesonOption "sysconfdir" confDir)
+    ]
+    ++ lib.optionals stdenv.isLinux [
+      (lib.mesonOption "sandbox-shell" "${busybox-sandbox-shell}/bin/busybox")
+    ];
 
-    # Needed for Meson to find Boost.
-    # https://github.com/NixOS/nixpkgs/issues/86131.
-    env = {
-      BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
-      BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
-    };
+  # Needed for Meson to find Boost.
+  # https://github.com/NixOS/nixpkgs/issues/86131.
+  env = {
+    BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
+    BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
+  };
 
-    postInstall =
-      ''
-        mkdir -p $doc/nix-support
-        echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products
-      ''
-      + lib.optionalString stdenv.hostPlatform.isStatic ''
-        mkdir -p $out/nix-support
-        echo "file binary-dist $out/bin/nix" >> $out/nix-support/hydra-build-products
-      ''
-      + lib.optionalString stdenv.isDarwin ''
-        for lib in libnixutil.dylib libnixexpr.dylib; do
-          install_name_tool \
-            -change "${lib.getLib boost}/lib/libboost_context.dylib" \
-            "$out/lib/libboost_context.dylib" \
-            "$out/lib/$lib"
-        done
-      '';
+  postInstall =
+    ''
+      mkdir -p $doc/nix-support
+      echo "doc manual $doc/share/doc/nix/manual" >> $doc/nix-support/hydra-build-products
+    ''
+    + lib.optionalString stdenv.hostPlatform.isStatic ''
+      mkdir -p $out/nix-support
+      echo "file binary-dist $out/bin/nix" >> $out/nix-support/hydra-build-products
+    ''
+    + lib.optionalString stdenv.isDarwin ''
+      for lib in liblixutil.dylib liblixexpr.dylib; do
+        install_name_tool \
+          -change "${lib.getLib boost}/lib/libboost_context.dylib" \
+          "$out/lib/libboost_context.dylib" \
+          "$out/lib/$lib"
+      done
+    '';
 
-    doCheck = true;
-    mesonCheckFlags = [ "--suite=check" ];
-    checkInputs = [
-      gtest
-      rapidcheck
-    ];
+  doCheck = true;
+  mesonCheckFlags = [ "--suite=check" ];
+  checkInputs = [
+    gtest
+    rapidcheck
+  ];
 
-    doInstallCheck = true;
-    mesonInstallCheckFlags = [ "--suite=installcheck" ];
+  doInstallCheck = true;
+  mesonInstallCheckFlags = [ "--suite=installcheck" ];
 
-    preInstallCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
-      # socket path becomes too long otherwise
-      export TMPDIR=$NIX_BUILD_TOP
-      # Prevent crashes in libcurl due to invoking Objective-C `+initialize` methods after `fork`.
-      # See http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html.
-      export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
-    '';
+  preInstallCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
+    # socket path becomes too long otherwise
+    export TMPDIR=$NIX_BUILD_TOP
+    # Prevent crashes in libcurl due to invoking Objective-C `+initialize` methods after `fork`.
+    # See http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html.
+    export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
+  '';
 
-    installCheckPhase = ''
-      runHook preInstallCheck
-      flagsArray=($mesonInstallCheckFlags "''${mesonInstallCheckFlagsArray[@]}")
-      meson test --no-rebuild "''${flagsArray[@]}"
-      runHook postInstallCheck
-    '';
-    # strictoverflow is disabled because we trap on signed overflow instead
-    hardeningDisable = [ "strictoverflow" ] ++ lib.optional stdenv.hostPlatform.isStatic "pie";
-    # hardeningEnable = lib.optionals (!stdenv.isDarwin) [ "pie" ];
-    # hardeningDisable = lib.optional stdenv.hostPlatform.isMusl "fortify";
-    separateDebugInfo = stdenv.isLinux && !enableStatic;
-    enableParallelBuilding = true;
+  installCheckPhase = ''
+    runHook preInstallCheck
+    flagsArray=($mesonInstallCheckFlags "''${mesonInstallCheckFlagsArray[@]}")
+    meson test --no-rebuild "''${flagsArray[@]}"
+    runHook postInstallCheck
+  '';
+  # strictoverflow is disabled because we trap on signed overflow instead
+  hardeningDisable = [ "strictoverflow" ] ++ lib.optional stdenv.hostPlatform.isStatic "pie";
+  # hardeningEnable = lib.optionals (!stdenv.isDarwin) [ "pie" ];
+  # hardeningDisable = lib.optional stdenv.hostPlatform.isMusl "fortify";
+  separateDebugInfo = stdenv.isLinux && !enableStatic;
+  enableParallelBuilding = true;
 
-    passthru = {
-      inherit aws-sdk-cpp boehmgc;
-      tests = {
-        misc = nixosTests.misc.lix.passthru.override { nixPackage = self; };
-      };
+  passthru = {
+    inherit aws-sdk-cpp boehmgc;
+    tests = {
+      misc = nixosTests.nix-misc.lix;
     };
+  };
 
-    # point 'nix edit' and ofborg at the file that defines the attribute,
-    # not this common file.
-    pos = builtins.unsafeGetAttrPos "version" args;
-    meta = with lib; {
-      description = "Powerful package manager that makes package management reliable and reproducible";
-      longDescription = ''
-        Lix (a fork of Nix) is a powerful package manager for Linux and other Unix systems that
-        makes package management reliable and reproducible. It provides atomic
-        upgrades and rollbacks, side-by-side installation of multiple versions of
-        a package, multi-user package management and easy setup of build
-        environments.
-      '';
-      homepage = "https://lix.systems";
-      license = licenses.lgpl21Plus;
-      inherit maintainers;
-      platforms = platforms.unix;
-      outputsToInstall = [ "out" ] ++ optional enableDocumentation "man";
-      mainProgram = "nix";
-      broken = enableStatic;
-    };
+  # point 'nix edit' and ofborg at the file that defines the attribute,
+  # not this common file.
+  pos = builtins.unsafeGetAttrPos "version" args;
+  meta = with lib; {
+    description = "Powerful package manager that makes package management reliable and reproducible";
+    longDescription = ''
+      Lix (a fork of Nix) is a powerful package manager for Linux and other Unix systems that
+      makes package management reliable and reproducible. It provides atomic
+      upgrades and rollbacks, side-by-side installation of multiple versions of
+      a package, multi-user package management and easy setup of build
+      environments.
+    '';
+    homepage = "https://lix.systems";
+    license = licenses.lgpl21Plus;
+    inherit maintainers;
+    platforms = platforms.unix;
+    outputsToInstall = [ "out" ] ++ optional enableDocumentation "man";
+    mainProgram = "nix";
+    broken = enableStatic;
   };
-in
-self
+}
diff --git a/pkgs/tools/package-management/lix/default.nix b/pkgs/tools/package-management/lix/default.nix
index 9a03e64f8b8fc..c262bbac48c26 100644
--- a/pkgs/tools/package-management/lix/default.nix
+++ b/pkgs/tools/package-management/lix/default.nix
@@ -47,11 +47,13 @@ let
     };
 in
 lib.makeExtensible (self: ({
+  buildLix = common;
+
   lix_2_90 = (
     common {
-      version = "2.90-beta.1";
-      hash = "sha256-REWlo2RYHfJkxnmZTEJu3Cd/2VM+wjjpPy7Xi4BdDTQ=";
-      docCargoHash = "sha256-oH248kR4Of0MhcY2DYxNX0A+/XJ3L+UuIpBKn3sJt54=";
+      version = "2.90.0-rc1";
+      hash = "sha256-WY7BGnu5PnbK4O8cKKv9kvxwzZIGbIQUQLGPHFXitI0=";
+      docCargoHash = "sha256-V/MEC2aRlVrt/IKozyYZvZTXENrtDS/wsV08/ao4TCw=";
     }
   );
 
diff --git a/pkgs/tools/package-management/lix/doc/default.nix b/pkgs/tools/package-management/lix/doc/default.nix
index a3c1d7d9ccc5a..b19f3bd2a170d 100644
--- a/pkgs/tools/package-management/lix/doc/default.nix
+++ b/pkgs/tools/package-management/lix/doc/default.nix
@@ -2,11 +2,12 @@
   src,
   rustPlatform,
   version,
-  cargoHash,
+  cargoHash ? null,
+  cargoLock ? null
 }:
 
 rustPlatform.buildRustPackage {
   pname = "lix-doc";
-  sourceRoot = "${src.name}/lix-doc";
-  inherit version src cargoHash;
+  sourceRoot = "${src.name or src}/lix-doc";
+  inherit version src cargoHash cargoLock;
 }