Skip to content

Nix 2.28 + format #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
(import (fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
src = builtins.fetchGit ./.;
}).defaultNix
102 changes: 61 additions & 41 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,57 @@

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11-small";

outputs = { self, nixpkgs }:
outputs =
{ self, nixpkgs }:
{
overlays.default = final: prev: {
nixos-channel-native-programs = with final; stdenv.mkDerivation {
nixos-channel-native-programs = final.stdenv.mkDerivation {
name = "nixos-channel-native-programs";
buildInputs = [
nix
pkg-config
boehmgc
nlohmann_json
boost
sqlite

strictDeps = true;

nativeBuildInputs = with final.buildPackages; [
pkg-config
];

buildCommand = let
nixHasSignalsHh = nixpkgs.lib.strings.versionAtLeast nix.version "2.19";
in ''
buildInputs = with final; [
nixVersions.nix_2_28
nlohmann_json
boost
];

buildCommand = ''
mkdir -p $out/bin

g++ -Os -g ${./index-debuginfo.cc} -Wall -std=c++14 -o $out/bin/index-debuginfo -I . \
$(pkg-config --cflags nix-main) \
$(pkg-config --libs nix-main) \
$(pkg-config --libs nix-store) \
-lsqlite3 \
${nixpkgs.lib.optionalString nixHasSignalsHh "-DHAS_SIGNALS_HH"}
$CXX \
-Os -g -Wall \
-std=c++14 \
$(pkg-config --libs --cflags nix-store) \
$(pkg-config --libs --cflags nix-main) \
-I . \
${./index-debuginfo.cc} \
-o $out/bin/index-debuginfo
'';
};

nixos-channel-scripts = with final; stdenv.mkDerivation {
nixos-channel-scripts = final.stdenv.mkDerivation {
name = "nixos-channel-scripts";

buildInputs = with perlPackages;
[ nix
sqlite
makeWrapper
perl
FileSlurp
LWP
LWPProtocolHttps
ListMoreUtils
DBDSQLite
NetAmazonS3
brotli
jq
nixos-channel-native-programs
nix-index
];
strictDeps = true;

nativeBuildInputs = with final.buildPackages; [
makeWrapper
];

buildInputs = with final.perlPackages; [
final.perl
FileSlurp
LWP
LWPProtocolHttps
ListMoreUtils
DBDSQLite
NetAmazonS3
];

buildCommand = ''
mkdir -p $out/bin
Expand All @@ -58,19 +62,35 @@
wrapProgram $out/bin/mirror-nixos-branch \
--set PERL5LIB $PERL5LIB \
--set XZ_OPT "-T0" \
--prefix PATH : ${lib.makeBinPath [ wget git nix gnutar xz rsync openssh nix-index nixos-channel-native-programs ]}
--prefix PATH : ${
final.lib.makeBinPath (
with final;
[
wget
git
nix
gnutar
xz
rsync
openssh
nix-index
nixos-channel-native-programs
]
)
}

patchShebangs $out/bin
'';
};

};

packages.default.x86_64-linux = (import nixpkgs {
system = "x86_64-linux";
overlays = [ self.overlays.default ];
}).nixos-channel-scripts;
packages.x86_64-linux.default =
(import nixpkgs {
system = "x86_64-linux";
overlays = [ self.overlays.default ];
}).nixos-channel-scripts;

checks.x86_64-linux.default = self.packages.default.x86_64-linux;
checks.x86_64-linux.default = self.packages.x86_64-linux.default;
};
}
20 changes: 8 additions & 12 deletions index-debuginfo.cc
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
#include <nix/config.h>

#include <regex>

#include "shared.hh"
#include "sqlite.hh"
#include "s3-binary-cache-store.hh"
#include "thread-pool.hh"
#include "nar-info.hh"
#include <nlohmann/json.hpp>

#include <nix/util/signals.hh>
#include <nix/util/thread-pool.hh>

// https://github.com/NixOS/nix/commit/ac89bb064aeea85a62b82a6daf0ecca7190a28b7
#ifdef HAS_SIGNALS_HH
#include "signals.hh"
#endif
#include <nix/store/nar-info.hh>
#include <nix/store/s3-binary-cache-store.hh>
#include <nix/store/sqlite.hh>

#include <nlohmann/json.hpp>
#include <nix/main/shared.hh>

// cache.nixos.org/debuginfo/<build-id>
// => redirect to NAR
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
(import (fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz") {
src = builtins.fetchGit ./.;
}).shellNix