From 77cf9d439602e4f93f686a5998eb4f26678da9f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikodem=20Rabuli=C5=84ski?= Date: Tue, 2 Jan 2024 14:07:17 +0100 Subject: [PATCH] Compile Conduit ourselves no more IFD --- flake.lock | 153 +++++++-------------------------------- flake.nix | 12 ++- hosts/kazuki/conduit.nix | 2 +- pkgs/conduit/default.nix | 25 +++++++ pkgs/default.nix | 14 ++++ 5 files changed, 76 insertions(+), 130 deletions(-) create mode 100644 pkgs/conduit/default.nix create mode 100644 pkgs/default.nix diff --git a/flake.lock b/flake.lock index 8589e18..b24f11d 100644 --- a/flake.lock +++ b/flake.lock @@ -43,13 +43,8 @@ "type": "gitlab" } }, - "conduit": { - "inputs": { - "crane": "crane", - "fenix": "fenix", - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - }, + "conduit-src": { + "flake": false, "locked": { "lastModified": 1703432212, "narHash": "sha256-v/wpbH/xuh9SJjLeCQIDiCeEbyui2WuWvIjOIH+lx80=", @@ -67,23 +62,16 @@ }, "crane": { "inputs": { - "flake-compat": "flake-compat", - "flake-utils": [ - "conduit", - "flake-utils" - ], "nixpkgs": [ - "conduit", "nixpkgs" - ], - "rust-overlay": "rust-overlay" + ] }, "locked": { - "lastModified": 1688772518, - "narHash": "sha256-ol7gZxwvgLnxNSZwFTDJJ49xVY5teaSvF7lzlo3YQfM=", + "lastModified": 1703439018, + "narHash": "sha256-VT+06ft/x3eMZ1MJxWzQP3zXFGcrxGo5VR2rB7t88hs=", "owner": "ipetkov", "repo": "crane", - "rev": "8b08e96c9af8c6e3a2b69af5a7fa168750fcf88e", + "rev": "afdcd41180e3dfe4dac46b5ee396e3b12ccc967a", "type": "github" }, "original": { @@ -135,17 +123,16 @@ "fenix": { "inputs": { "nixpkgs": [ - "conduit", "nixpkgs" ], "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1689488573, - "narHash": "sha256-diVASflKCCryTYv0djvMnP2444mFsIG0ge5pa7ahauQ=", + "lastModified": 1704176544, + "narHash": "sha256-A6PfA1DB6cF3cQerysGK8zIumGTrXucdHoFRU+8H7Lc=", "owner": "nix-community", "repo": "fenix", - "rev": "39096fe3f379036ff4a5fa198950b8e79defe939", + "rev": "54df821cae7bd492a049ef213336810247128110", "type": "github" }, "original": { @@ -171,22 +158,6 @@ } }, "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_2": { "flake": false, "locked": { "lastModified": 1668681692, @@ -262,24 +233,6 @@ "type": "indirect" } }, - "flake-utils": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1689068808, - "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "flakelib": { "inputs": { "fl-config": "fl-config", @@ -319,7 +272,7 @@ "inputs": { "flake-parts": "flake-parts_2", "haskell-flake": "haskell-flake", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" }, "locked": { "lastModified": 1703653834, @@ -338,7 +291,7 @@ "hercules-ci-effects": { "inputs": { "flake-parts": "flake-parts_3", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1704029560, @@ -377,7 +330,7 @@ "mailserver": { "inputs": { "blobs": "blobs", - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat", "nixpkgs": [ "nixpkgs" ], @@ -401,7 +354,7 @@ }, "nh": { "inputs": { - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1703024852, @@ -434,11 +387,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1689444953, - "narHash": "sha256-0o56bfb2LC38wrinPdCGLDScd77LVcr7CrH1zK7qvDg=", + "lastModified": 1703255338, + "narHash": "sha256-Z6wfYJQKmDN9xciTwU3cOiOk+NElxdZwy/FiHctCzjU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8acef304efe70152463a6399f73e636bcc363813", + "rev": "6df37dc6a77654682fe9f071c62b4242b5342e04", "type": "github" }, "original": { @@ -479,22 +432,6 @@ } }, "nixpkgs_2": { - "locked": { - "lastModified": 1703255338, - "narHash": "sha256-Z6wfYJQKmDN9xciTwU3cOiOk+NElxdZwy/FiHctCzjU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "6df37dc6a77654682fe9f071c62b4242b5342e04", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1703637592, "narHash": "sha256-8MXjxU0RfFfzl57Zy3OfXCITS0qWDNLzlBAdwxGZwfY=", @@ -510,7 +447,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_3": { "locked": { "lastModified": 1703992652, "narHash": "sha256-C0o8AUyu8xYgJ36kOxJfXIroy9if/G6aJbNOpA5W0+M=", @@ -526,7 +463,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_4": { "locked": { "lastModified": 1704008649, "narHash": "sha256-rGPSWjXTXTurQN9beuHdyJhB8O761w1Zc5BqSSmHvoM=", @@ -603,16 +540,18 @@ "root": { "inputs": { "agenix": "agenix", - "conduit": "conduit", + "conduit-src": "conduit-src", + "crane": "crane", "darwin": "darwin", "disko": "disko", + "fenix": "fenix", "flake-parts": "flake-parts", "hercules-ci-agent": "hercules-ci-agent", "hercules-ci-effects": "hercules-ci-effects", "home-manager": "home-manager", "mailserver": "mailserver", "nh": "nh", - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_4", "nvidia-patch": "nvidia-patch", "racket": "racket", "wrapper-manager": "wrapper-manager", @@ -622,11 +561,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1689441253, - "narHash": "sha256-4MSDZaFI4DOfsLIZYPMBl0snzWhX1/OqR/QHir382CY=", + "lastModified": 1704114818, + "narHash": "sha256-/0gMZ32JaUTQ0THA/S9rcQSAmEKfL3hGorX5En8lG98=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "996e054f1eb1dbfc8455ecabff0f6ff22ba7f7c8", + "rev": "a8d935eedc80df8b453d90539cbe78b7e2c75e3c", "type": "github" }, "original": { @@ -636,33 +575,6 @@ "type": "github" } }, - "rust-overlay": { - "inputs": { - "flake-utils": [ - "conduit", - "crane", - "flake-utils" - ], - "nixpkgs": [ - "conduit", - "crane", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1688351637, - "narHash": "sha256-CLTufJ29VxNOIZ8UTg0lepsn3X03AmopmaLTTeHDCL4=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "f9b92316727af9e6c7fee4a761242f7f46880329", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, "std": { "inputs": { "nix-std": "nix-std" @@ -696,21 +608,6 @@ "type": "github" } }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "utils": { "locked": { "lastModified": 1605370193, diff --git a/flake.nix b/flake.nix index dc8d1de..372b7d7 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,7 @@ ./modules ./wrappers ./effects.nix + ./pkgs ]; perSystem = { @@ -86,13 +87,22 @@ nh = { url = "github:viperML/nh"; }; - conduit = { + conduit-src = { url = "gitlab:famedly/conduit?ref=next"; + flake = false; }; nvidia-patch = { url = "github:arcnmx/nvidia-patch.nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + crane = { + url = "github:ipetkov/crane"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; nixConfig = { diff --git a/hosts/kazuki/conduit.nix b/hosts/kazuki/conduit.nix index 4478787..923017d 100644 --- a/hosts/kazuki/conduit.nix +++ b/hosts/kazuki/conduit.nix @@ -8,7 +8,7 @@ in { services.matrix-conduit = { enable = true; - package = inputs'.conduit.packages.default; + package = inputs'.settei.packages.conduit-next; settings.global = { server_name = "nrab.lol"; database_backend = "rocksdb"; diff --git a/pkgs/conduit/default.nix b/pkgs/conduit/default.nix new file mode 100644 index 0000000..91926c5 --- /dev/null +++ b/pkgs/conduit/default.nix @@ -0,0 +1,25 @@ +{ + lib, + stdenv, + fenix, + crane, + src, + libiconv, + rocksdb, + darwin, + rustPlatform, +}: let + crane' = crane.overrideToolchain fenix.stable.toolchain; +in + crane'.buildPackage { + inherit src; + strictDeps = true; + + nativeBuildInputs = [rustPlatform.bindgenHook]; + + buildInputs = lib.optionals stdenv.isDarwin [libiconv darwin.apple_sdk.frameworks.Security]; + + # Use system RocksDB + ROCKSDB_INCLUDE_DIR = "${rocksdb}/include"; + ROCKSDB_LIB_DIR = "${rocksdb}/lib"; + } diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..6a1b539 --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,14 @@ +{inputs, ...}: { + perSystem = { + pkgs, + system, + inputs', + ... + }: { + packages.conduit-next = pkgs.callPackage ./conduit { + src = inputs.conduit-src; + crane = inputs.crane.lib.${system}; + fenix = inputs'.fenix.packages; + }; + }; +}