Skip to content

Commit

Permalink
nix-serve-ng: fix build against nix 2.24
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 committed Nov 30, 2024
1 parent 5132296 commit 65036e0
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 13 deletions.
6 changes: 0 additions & 6 deletions pkgs/development/haskell-modules/configuration-common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2900,12 +2900,6 @@ self: super: {
# 2024-03-17: broken
vaultenv = dontDistribute super.vaultenv;

# Support base16 1.0
nix-serve-ng = appendPatch (fetchpatch {
url = "https://github.com/aristanetworks/nix-serve-ng/commit/4d9eacfcf753acbcfa0f513bec725e9017076270.patch";
hash = "sha256-zugyUpEq/iVkxghrvguL95+lJDEpE8MLvZivken0p24=";
}) super.nix-serve-ng;

# 2024-01-24: support optparse-applicative 0.18
niv = appendPatches [
(fetchpatch {
Expand Down
20 changes: 13 additions & 7 deletions pkgs/development/haskell-modules/configuration-nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -350,17 +350,23 @@ self: super: builtins.intersectAttrs super {
# Add necessary reference to gtk3 package
gi-dbusmenugtk3 = addPkgconfigDepend pkgs.gtk3 super.gi-dbusmenugtk3;

# Doesn't declare boost dependency
nix-serve-ng = (overrideSrc {
version = "1.0.0-unstable-2023-12-18";
nix-serve-ng = (overrideCabal (old: {
src = pkgs.fetchFromGitHub {
repo = "nix-serve-ng";
owner = "aristanetworks";
rev = "21e65cb4c62b5c9e3acc11c3c5e8197248fa46a4";
hash = "sha256-qseX+/8drgwxOb1I3LKqBYMkmyeI5d5gmHqbZccR660=";
rev = "578ad85b3096d99b25cae0a73c03df4e82f587c7";
hash = "sha256-2LPx4iRJonX4gtd3r73DBM/ZhN/hKu1lb/MHOav8c5s=";
};
} (addPkgconfigDepend pkgs.boost.dev super.nix-serve-ng)).override {
nix = pkgs.nixVersions.nix_2_18;
version = "1.0.0-unstable-2024-10-01";
#editedCabalFile = null;
# Doesn't declare boost dependency
pkg-configDepends = (old.pkg-configDepends or []) ++ [ pkgs.boost.dev ];
patches = (old.patches or []) ++ [
# Part of https://github.com/aristanetworks/nix-serve-ng/pull/40
./patches/nix-serve-ng-nix.2.24.patch
];
}) super.nix-serve-ng).override {
nix = pkgs.nixVersions.nix_2_24;
};

# These packages try to access the network.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
From 97cb18bee646a23bd08e3959d6544e703e0bb862 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <[email protected]>
Date: Tue, 26 Nov 2024 08:39:30 +0100
Subject: [PATCH] fix build against nix 2.24

---
cbits/nix.cpp | 6 +++---
nix-serve-ng.cabal | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cbits/nix.cpp b/cbits/nix.cpp
index 8872af1..6305001 100644
--- a/cbits/nix.cpp
+++ b/cbits/nix.cpp
@@ -1,6 +1,7 @@
#include <cstddef>
#include <cstdlib>
#include <nix/store-api.hh>
+#include <nix/shared.hh>
#include <nix/log-store.hh>
#include "nix.hh"

@@ -14,8 +15,7 @@ static ref<Store> getStore()
static std::shared_ptr<Store> _store;

if (!_store) {
- initLibStore();
- loadConfFile();
+ initLibStore(true);

_store = openStore();
}
@@ -120,7 +120,7 @@ void queryPathInfo
output->deriver = emptyString;
};

- copyString(validPathInfo->narHash.to_string(Base32, true), &output->narHash);
+ copyString(validPathInfo->narHash.to_string(nix::HashFormat::Nix32, true), &output->narHash);

output->narSize = validPathInfo->narSize;

diff --git a/nix-serve-ng.cabal b/nix-serve-ng.cabal
index 9298f9a..8443b04 100644
--- a/nix-serve-ng.cabal
+++ b/nix-serve-ng.cabal
@@ -36,7 +36,7 @@ executable nix-serve
cxx-sources: cbits/nix.cpp
, cbits/nix.hh

- cxx-options: -std=c++17
+ cxx-options: -std=c++20

build-depends: base < 5
, base16 >= 1.0

0 comments on commit 65036e0

Please sign in to comment.