Compare commits

..

5 commits

Author SHA1 Message Date
Shuroii
5dba10af21
fix: musl builds 2025-07-01 22:12:19 +02:00
Shuroii
647f4c9167
fix: Spelling error causing CI to fail 2025-07-01 20:39:54 +02:00
Shuroii
e9bc416b29 feat: Use rocksdb fork 2025-07-01 18:02:29 +00:00
Shuroii
9f37686b99 fix: rocksdb shenanigans 2025-07-01 18:02:29 +00:00
Shuroii
54c1e3bb33 chore: Clean up the nix elements
* Removes unused nix assets
* Cleans up flake inputs
* Makes the flake actually build
* Use correct formatters for nix assets
2025-07-01 18:02:29 +00:00
5 changed files with 134 additions and 149 deletions

View file

@ -1,10 +1,11 @@
(import (import (
( let
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball { fetchTarball {
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; url =
lock.nodes.flake-compat.locked.url
or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash; sha256 = lock.nodes.flake-compat.locked.narHash;
} }
) ) { src = ./.; }).defaultNix
{ src = ./.; }
).defaultNix

46
flake.lock generated
View file

@ -10,11 +10,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1751403276, "lastModified": 1748532342,
"narHash": "sha256-V0EPQNsQko1a8OqIWc2lLviLnMpR1m08Ej00z5RVTfs=", "narHash": "sha256-CvaKOUq8G10sghKpZhEB2UYjJoWhEkrDFggDgi7piUI=",
"owner": "zhaofengli", "owner": "zhaofengli",
"repo": "attic", "repo": "attic",
"rev": "896ad88fa57ad5dbcd267c0ac51f1b71ccfcb4dd", "rev": "ce9373715fe3fac7a174a65a7e6d6baeba8cb4f9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -147,17 +147,15 @@
}, },
"fenix": { "fenix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": "nixpkgs_5",
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src" "rust-analyzer-src": "rust-analyzer-src"
}, },
"locked": { "locked": {
"lastModified": 1751525020, "lastModified": 1751352216,
"narHash": "sha256-oDO6lCYS5Bf4jUITChj9XV7k3TP38DE0Ckz5n5ORCME=", "narHash": "sha256-dJj8TUoZGj55Ttro37vvFGF2L+xlYNfspQ9u4BfqTFw=",
"owner": "nix-community", "owner": "nix-community",
"repo": "fenix", "repo": "fenix",
"rev": "a1a5f92f47787e7df9f30e5e5ac13e679215aa1e", "rev": "61b4f1e21bd631da91981f1ed74c959d6993f554",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -499,11 +497,27 @@
}, },
"nixpkgs_5": { "nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1751498133, "lastModified": 1751271578,
"narHash": "sha256-QWJ+NQbMU+NcU2xiyo7SNox1fAuwksGlQhpzBl76g1I=", "narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_6": {
"locked": {
"lastModified": 1751285371,
"narHash": "sha256-/hDU+2AUeFFu5qGHO/UyFMc4UG/x5Cw5uXO36KGTk6c=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d55716bb59b91ae9d1ced4b1ccdea7a442ecbfdb", "rev": "b9c03fbbaf84d85bb28eee530c7e9edc4021ca1b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -539,18 +553,18 @@
"flake-compat": "flake-compat_3", "flake-compat": "flake-compat_3",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nix-filter": "nix-filter", "nix-filter": "nix-filter",
"nixpkgs": "nixpkgs_5", "nixpkgs": "nixpkgs_6",
"rocksdb": "rocksdb" "rocksdb": "rocksdb"
} }
}, },
"rust-analyzer-src": { "rust-analyzer-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1751433876, "lastModified": 1751296293,
"narHash": "sha256-IsdwOcvLLDDlkFNwhdD5BZy20okIQL01+UQ7Kxbqh8s=", "narHash": "sha256-oaGMVdCcI32y6jQ7RE0+CqshZngfI19XnY31eYjdinI=",
"owner": "rust-lang", "owner": "rust-lang",
"repo": "rust-analyzer", "repo": "rust-analyzer",
"rev": "11d45c881389dae90b0da5a94cde52c79d0fc7ef", "rev": "eaf37e2c98b66ff7f7a0ac04e4cada39e51fde4b",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -7,7 +7,6 @@
}; };
fenix = { fenix = {
url = "github:nix-community/fenix?ref=main"; url = "github:nix-community/fenix?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
}; };
flake-compat = { flake-compat = {
url = "github:edolstra/flake-compat?ref=master"; url = "github:edolstra/flake-compat?ref=master";
@ -31,7 +30,6 @@
inherit system; inherit system;
}; };
# The Rust toolchain to use
toolchain = inputs.fenix.packages.${system}.fromToolchainFile { toolchain = inputs.fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml; file = ./rust-toolchain.toml;
@ -54,15 +52,10 @@
]; ];
buildFlags = [ "library" ]; buildFlags = [ "library" ];
}; };
rocksdb = rocksdb-custom = pkgs.rocksdb_9_10.overrideAttrs (oldAttrs: {
(pkgs.rocksdb_9_10.override {
# Override the liburing input for the build with our own so
# we have it built with the library flag
inherit (self) liburing;
}).overrideAttrs
(old: {
src = inputs.rocksdb;
version = "v9.11.1"; version = "v9.11.1";
src = inputs.rocksdb;
cmakeFlags = cmakeFlags =
pkgs.lib.subtractLists [ pkgs.lib.subtractLists [
# No real reason to have snappy or zlib, no one uses this # No real reason to have snappy or zlib, no one uses this
@ -80,7 +73,7 @@
"-DFORCE_SSE42=1" "-DFORCE_SSE42=1"
# PORTABLE will get set in main/default.nix # PORTABLE will get set in main/default.nix
"-DPORTABLE=1" "-DPORTABLE=1"
] old.cmakeFlags ] oldAttrs.cmakeFlags
++ [ ++ [
# No real reason to have snappy, no one uses this # No real reason to have snappy, no one uses this
"-DWITH_SNAPPY=0" "-DWITH_SNAPPY=0"
@ -96,16 +89,20 @@
"-DUSE_RTTI=0" "-DUSE_RTTI=0"
]; ];
# outputs has "tools" which we don't need or use propagatedBuildInputs = with pkgs; [
bzip2
lz4
zstd
];
# Has "tools" which we don't need or use
outputs = [ "out" ]; outputs = [ "out" ];
# preInstall hooks has stuff for messing with ldb/sst_dump which we don't need or use # preInstall hooks has stuff for messing with ldb/sst_dump which we don't need or use
preInstall = ""; preInstall = "";
# We have this already at https://forgejo.ellis.link/continuwuation/rocksdb/commit/a935c0273e1ba44eacf88ce3685a9b9831486155 # We have this already at https://forgejo.ellis.link/continuwuation/rocksdb/commit/a935c0273e1ba44eacf88ce3685a9b9831486155
# Unsetting this so we don't have to revert it and make this nix exclusive
patches = [ ]; patches = [ ];
postPatch = '' postPatch = ''
# Fix gcc-13 build failures due to missing <cstdint> and # Fix gcc-13 build failures due to missing <cstdint> and
# <system_error> includes, fixed upstream since 8.x # <system_error> includes, fixed upstream since 8.x
@ -130,20 +127,19 @@
}).pkgsStatic; }).pkgsStatic;
in in
mkScope pkgsCrossStatic; mkScope pkgsCrossStatic;
in in
{ {
packages = packages =
{ {
default = scopeHost.main.override { default = scopeHost.main.override {
disable_features = [ disable_features = [
# Don't include experimental features # dont include experimental features
"experimental" "experimental"
# jemalloc profiling/stats features are expensive and shouldn't # jemalloc profiling/stats features are expensive and shouldn't
# be expected on non-debug builds. # be expected on non-debug builds.
"jemalloc_prof" "jemalloc_prof"
"jemalloc_stats" "jemalloc_stats"
# This is non-functional on nix for some reason # this is non-functional on nix for some reason
"hardened_malloc" "hardened_malloc"
# conduwuit_mods is a development-only hot reload feature # conduwuit_mods is a development-only hot reload feature
"conduwuit_mods" "conduwuit_mods"
@ -151,23 +147,10 @@
}; };
default-debug = scopeHost.main.override { default-debug = scopeHost.main.override {
profile = "dev"; profile = "dev";
# Debug build users expect full logs # debug build users expect full logs
disable_release_max_log_level = true; disable_release_max_log_level = true;
disable_features = [ disable_features = [
# Don't include experimental features # dont include experimental features
"experimental"
# This is non-functional on nix for some reason
"hardened_malloc"
# conduwuit_mods is a development-only hot reload feature
"conduwuit_mods"
];
};
# Just a test profile used for things like CI and complement
default-test = scopeHost.main.override {
profile = "test";
disable_release_max_log_level = true;
disable_features = [
# Don't include experimental features
"experimental" "experimental"
# this is non-functional on nix for some reason # this is non-functional on nix for some reason
"hardened_malloc" "hardened_malloc"
@ -178,13 +161,13 @@
all-features = scopeHost.main.override { all-features = scopeHost.main.override {
all_features = true; all_features = true;
disable_features = [ disable_features = [
# Don't include experimental features # dont include experimental features
"experimental" "experimental"
# jemalloc profiling/stats features are expensive and shouldn't # jemalloc profiling/stats features are expensive and shouldn't
# be expected on non-debug builds. # be expected on non-debug builds.
"jemalloc_prof" "jemalloc_prof"
"jemalloc_stats" "jemalloc_stats"
# This is non-functional on nix for some reason # this is non-functional on nix for some reason
"hardened_malloc" "hardened_malloc"
# conduwuit_mods is a development-only hot reload feature # conduwuit_mods is a development-only hot reload feature
"conduwuit_mods" "conduwuit_mods"
@ -193,12 +176,12 @@
all-features-debug = scopeHost.main.override { all-features-debug = scopeHost.main.override {
profile = "dev"; profile = "dev";
all_features = true; all_features = true;
# Debug build users expect full logs # debug build users expect full logs
disable_release_max_log_level = true; disable_release_max_log_level = true;
disable_features = [ disable_features = [
# Don't include experimental features # dont include experimental features
"experimental" "experimental"
# This is non-functional on nix for some reason # this is non-functional on nix for some reason
"hardened_malloc" "hardened_malloc"
# conduwuit_mods is a development-only hot reload feature # conduwuit_mods is a development-only hot reload feature
"conduwuit_mods" "conduwuit_mods"
@ -250,9 +233,9 @@
profile = "test"; profile = "test";
disable_release_max_log_level = true; disable_release_max_log_level = true;
disable_features = [ disable_features = [
# dont include experimental features # Don't include experimental features
"experimental" "experimental"
# this is non-functional on nix for some reason # This is non-functional on nix for some reason
"hardened_malloc" "hardened_malloc"
# conduwuit_mods is a development-only hot reload feature # conduwuit_mods is a development-only hot reload feature
"conduwuit_mods" "conduwuit_mods"
@ -266,13 +249,13 @@
value = scopeCrossStatic.main.override { value = scopeCrossStatic.main.override {
all_features = true; all_features = true;
disable_features = [ disable_features = [
# dont include experimental features # Don't include experimental features
"experimental" "experimental"
# jemalloc profiling/stats features are expensive and shouldn't # jemalloc profiling/stats features are expensive and shouldn't
# be expected on non-debug builds. # be expected on non-debug builds.
"jemalloc_prof" "jemalloc_prof"
"jemalloc_stats" "jemalloc_stats"
# this is non-functional on nix for some reason # This is non-functional on nix for some reason
"hardened_malloc" "hardened_malloc"
# conduwuit_mods is a development-only hot reload feature # conduwuit_mods is a development-only hot reload feature
"conduwuit_mods" "conduwuit_mods"
@ -287,13 +270,13 @@
value = scopeCrossStatic.main.override { value = scopeCrossStatic.main.override {
all_features = true; all_features = true;
disable_features = [ disable_features = [
# dont include experimental features # Don't include experimental features
"experimental" "experimental"
# jemalloc profiling/stats features are expensive and shouldn't # jemalloc profiling/stats features are expensive and shouldn't
# be expected on non-debug builds. # be expected on non-debug builds.
"jemalloc_prof" "jemalloc_prof"
"jemalloc_stats" "jemalloc_stats"
# this is non-functional on nix for some reason # This is non-functional on nix for some reason
"hardened_malloc" "hardened_malloc"
# conduwuit_mods is a development-only hot reload feature # conduwuit_mods is a development-only hot reload feature
"conduwuit_mods" "conduwuit_mods"
@ -312,9 +295,9 @@
# debug build users expect full logs # debug build users expect full logs
disable_release_max_log_level = true; disable_release_max_log_level = true;
disable_features = [ disable_features = [
# dont include experimental features # Don't include experimental features
"experimental" "experimental"
# this is non-functional on nix for some reason # This is non-functional on nix for some reason
"hardened_malloc" "hardened_malloc"
# conduwuit_mods is a development-only hot reload feature # conduwuit_mods is a development-only hot reload feature
"conduwuit_mods" "conduwuit_mods"
@ -332,8 +315,6 @@
] ]
) )
[ [
#"x86_64-apple-darwin"
#"aarch64-apple-darwin"
"x86_64-linux-gnu" "x86_64-linux-gnu"
"x86_64-linux-musl" "x86_64-linux-musl"
"aarch64-linux-musl" "aarch64-linux-musl"

View file

@ -2,23 +2,20 @@
, pkgsBuildHost , pkgsBuildHost
, rust , rust
, stdenv , stdenv
,
}: }:
lib.optionalAttrs stdenv.hostPlatform.isStatic lib.optionalAttrs stdenv.hostPlatform.isStatic
{ {
ROCKSDB_STATIC = ""; ROCKSDB_STATIC = "";
} }
// // {
{ CARGO_BUILD_RUSTFLAGS = lib.concatStringsSep " " (
CARGO_BUILD_RUSTFLAGS = lib.optionals stdenv.hostPlatform.isStatic [
lib.concatStringsSep "-C"
" " "relocation-model=static"
(lib.optionals ]
stdenv.hostPlatform.isStatic ++ lib.optionals (stdenv.buildPlatform.config != stdenv.hostPlatform.config) [
[ "-C" "relocation-model=static" ]
++ lib.optionals
(stdenv.buildPlatform.config != stdenv.hostPlatform.config)
[
"-l" "-l"
"c" "c"
@ -37,14 +34,11 @@ lib.optionalAttrs stdenv.hostPlatform.isStatic
# run on the build platform (I think). # run on the build platform (I think).
# #
# [0]: https://github.com/NixOS/nixpkgs/blob/nixpkgs-unstable/pkgs/build-support/rust/lib/default.nix#L48-L68 # [0]: https://github.com/NixOS/nixpkgs/blob/nixpkgs-unstable/pkgs/build-support/rust/lib/default.nix#L48-L68
// // (
(
let let
inherit (rust.lib) envVars; inherit (rust.lib) envVars;
in in
lib.optionalAttrs lib.optionalAttrs (stdenv.targetPlatform.rust.rustcTarget != stdenv.hostPlatform.rust.rustcTarget)
(stdenv.targetPlatform.rust.rustcTarget
!= stdenv.hostPlatform.rust.rustcTarget)
( (
let let
inherit (stdenv.targetPlatform.rust) cargoEnvVarTarget; inherit (stdenv.targetPlatform.rust) cargoEnvVarTarget;
@ -55,8 +49,7 @@ lib.optionalAttrs stdenv.hostPlatform.isStatic
"CARGO_TARGET_${cargoEnvVarTarget}_LINKER" = envVars.ccForTarget; "CARGO_TARGET_${cargoEnvVarTarget}_LINKER" = envVars.ccForTarget;
} }
) )
// // (
(
let let
inherit (stdenv.hostPlatform.rust) cargoEnvVarTarget rustcTarget; inherit (stdenv.hostPlatform.rust) cargoEnvVarTarget rustcTarget;
in in
@ -67,8 +60,7 @@ lib.optionalAttrs stdenv.hostPlatform.isStatic
CARGO_BUILD_TARGET = rustcTarget; CARGO_BUILD_TARGET = rustcTarget;
} }
) )
// // (
(
let let
inherit (stdenv.buildPlatform.rust) cargoEnvVarTarget; inherit (stdenv.buildPlatform.rust) cargoEnvVarTarget;
in in

View file

@ -7,7 +7,6 @@
, liburing , liburing
, pkgsBuildHost , pkgsBuildHost
, rocksdb , rocksdb
, removeReferencesTo
, rust , rust
, rust-jemalloc-sys , rust-jemalloc-sys
, stdenv , stdenv
@ -143,8 +142,6 @@ let
" -Ctarget-cpu=haswell"; " -Ctarget-cpu=haswell";
}; };
commonAttrs = { commonAttrs = {
inherit inherit
(craneLib.crateNameFromCargoToml { (craneLib.crateNameFromCargoToml {