Migrate to lix
This commit is contained in:
parent
26b9417bde
commit
0334b8ab2a
|
@ -9,36 +9,28 @@ fn main() {
|
||||||
|
|
||||||
#[cfg(feature = "nix_store")]
|
#[cfg(feature = "nix_store")]
|
||||||
fn build_bridge() {
|
fn build_bridge() {
|
||||||
// Temporary workaround for issue in <https://github.com/NixOS/nix/pull/8484>
|
let libstore = pkg_config::Config::new()
|
||||||
let hacky_include = {
|
.probe("lix-store")
|
||||||
let dir = tempfile::tempdir().expect("Failed to create temporary directory for workaround");
|
.unwrap();
|
||||||
std::fs::write(dir.path().join("uds-remote-store.md"), "\"\"").unwrap();
|
|
||||||
dir
|
let libmain = pkg_config::Config::new()
|
||||||
};
|
.probe("lix-main")
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let libutil = pkg_config::Config::new()
|
||||||
|
.probe("lix-util")
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
cxx_build::bridge("src/nix_store/bindings/mod.rs")
|
cxx_build::bridge("src/nix_store/bindings/mod.rs")
|
||||||
.file("src/nix_store/bindings/nix.cpp")
|
.file("src/nix_store/bindings/nix.cpp")
|
||||||
.flag("-std=c++2a")
|
.flag("-std=c++2a")
|
||||||
.flag("-O2")
|
.flag("-O2")
|
||||||
.flag("-include")
|
.flag("-include")
|
||||||
.flag("nix/config.h")
|
.flag("lix/config.h")
|
||||||
.flag("-idirafter")
|
.includes(&libmain.include_paths)
|
||||||
.flag(hacky_include.path().to_str().unwrap())
|
.includes(&libutil.include_paths)
|
||||||
// In Nix 2.19+, nix/args/root.hh depends on being able to #include "args.hh" (which is in its parent directory), for some reason
|
.includes(&libstore.include_paths)
|
||||||
.flag("-I")
|
|
||||||
.flag(concat!(env!("NIX_INCLUDE_PATH"), "/nix"))
|
|
||||||
.compile("nixbinding");
|
.compile("nixbinding");
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed=src/nix_store/bindings");
|
println!("cargo:rerun-if-changed=src/nix_store/bindings");
|
||||||
|
|
||||||
// the -l flags must be after -lnixbinding
|
|
||||||
pkg_config::Config::new()
|
|
||||||
.atleast_version("2.4")
|
|
||||||
.probe("nix-store")
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
pkg_config::Config::new()
|
|
||||||
.atleast_version("2.4")
|
|
||||||
.probe("nix-main")
|
|
||||||
.unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ void CNixStore::nar_from_path(RVec<unsigned char> base_name, RBox<AsyncWriteSend
|
||||||
nix::StorePath store_path(sv);
|
nix::StorePath store_path(sv);
|
||||||
|
|
||||||
// exceptions will be thrown into Rust
|
// exceptions will be thrown into Rust
|
||||||
this->store->narFromPath(store_path, sink);
|
sink << this->store->narFromPath(store_path);
|
||||||
sink.eof();
|
sink.eof();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <nix/store-api.hh>
|
#include <libstore/store-api.hh>
|
||||||
#include <nix/local-store.hh>
|
#include <libstore/local-store.hh>
|
||||||
#include <nix/remote-store.hh>
|
#include <libstore/remote-store.hh>
|
||||||
#include <nix/uds-remote-store.hh>
|
#include <libstore/uds-remote-store.hh>
|
||||||
#include <nix/hash.hh>
|
#include <libutil/hash.hh>
|
||||||
#include <nix/path.hh>
|
#include <libstore/path.hh>
|
||||||
#include <nix/serialise.hh>
|
#include <libutil/serialise.hh>
|
||||||
#include <nix/shared.hh>
|
#include <libmain/shared.hh>
|
||||||
#include <rust/cxx.h>
|
#include <rust/cxx.h>
|
||||||
|
|
||||||
template<class T> using RVec = rust::Vec<T>;
|
template<class T> using RVec = rust::Vec<T>;
|
||||||
|
|
|
@ -62,9 +62,6 @@ let
|
||||||
|
|
||||||
ATTIC_DISTRIBUTOR = "attic";
|
ATTIC_DISTRIBUTOR = "attic";
|
||||||
|
|
||||||
# See comment in `attic/build.rs`
|
|
||||||
NIX_INCLUDE_PATH = "${lib.getDev nix}/include";
|
|
||||||
|
|
||||||
# See comment in `attic-tests`
|
# See comment in `attic-tests`
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
|
@ -139,9 +136,6 @@ let
|
||||||
checkPhaseCargoCommand = "cargoWithProfile test --no-run --message-format=json >cargo-test.json";
|
checkPhaseCargoCommand = "cargoWithProfile test --no-run --message-format=json >cargo-test.json";
|
||||||
doInstallCargoArtifacts = false;
|
doInstallCargoArtifacts = false;
|
||||||
|
|
||||||
# See comment in `attic/build.rs`
|
|
||||||
NIX_INCLUDE_PATH = "${lib.getDev nix}/include";
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
|
|
152
flake.lock
152
flake.lock
|
@ -7,11 +7,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1717025063,
|
"lastModified": 1721322122,
|
||||||
"narHash": "sha256-dIubLa56W9sNNz0e8jGxrX3CAkPXsq7snuFA/Ie6dn8=",
|
"narHash": "sha256-a0G1NvyXGzdwgu6e1HQpmK5R5yLsfxeBe07nNDyYd+g=",
|
||||||
"owner": "ipetkov",
|
"owner": "ipetkov",
|
||||||
"repo": "crane",
|
"repo": "crane",
|
||||||
"rev": "480dff0be03dac0e51a8dfc26e882b0d123a450e",
|
"rev": "8a68b987c476a33e90f203f0927614a75c3f47ea",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -23,11 +23,11 @@
|
||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1673956053,
|
"lastModified": 1696426674,
|
||||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
"owner": "edolstra",
|
"owner": "edolstra",
|
||||||
"repo": "flake-compat",
|
"repo": "flake-compat",
|
||||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -37,12 +37,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1667395993,
|
"lastModified": 1710146030,
|
||||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -51,13 +54,87 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-utils_2": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1710146030,
|
||||||
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flakey-profile": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1712898590,
|
||||||
|
"narHash": "sha256-FhGIEU93VHAChKEXx905TSiPZKga69bWl1VB37FK//I=",
|
||||||
|
"owner": "lf-",
|
||||||
|
"repo": "flakey-profile",
|
||||||
|
"rev": "243c903fd8eadc0f63d205665a92d4df91d42d9d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "lf-",
|
||||||
|
"repo": "flakey-profile",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lix": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1721371213,
|
||||||
|
"narHash": "sha256-7SdrlNe5DBlK5uLBhPPxVRWI50N1PFz3zMBeDYiX0Qs=",
|
||||||
|
"ref": "refs/heads/main",
|
||||||
|
"rev": "aba5f19680b2f4c29d7ce2ff5e2a89128c1cb26d",
|
||||||
|
"revCount": 15985,
|
||||||
|
"type": "git",
|
||||||
|
"url": "ssh://git@git.lix.systems/lix-project/lix"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "ssh://git@git.lix.systems/lix-project/lix"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lix-module": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils_2",
|
||||||
|
"flakey-profile": "flakey-profile",
|
||||||
|
"lix": [
|
||||||
|
"lix"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1720695775,
|
||||||
|
"narHash": "sha256-8Oqzl9QPjEe/n8y0R2tC6+2v/H6xBgABHXOJwxmnBg0=",
|
||||||
|
"ref": "refs/heads/main",
|
||||||
|
"rev": "d70318fb946a0e720dfdd1fb10b0645c14e2a02a",
|
||||||
|
"revCount": 94,
|
||||||
|
"type": "git",
|
||||||
|
"url": "ssh://git@git.lix.systems/lix-project/nixos-module"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "ssh://git@git.lix.systems/lix-project/nixos-module"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1711401922,
|
"lastModified": 1721373214,
|
||||||
"narHash": "sha256-QoQqXoj8ClGo0sqD/qWKFWezgEwUL0SUh37/vY2jNhc=",
|
"narHash": "sha256-crpGeGQGFlnCsMyCE5eheyjzo3xo03o1FXJ2sAbm7No=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "07262b18b97000d16a4bdb003418bd2fb067a932",
|
"rev": "af9c15bc7a314c226d7d5d85e159f7a73e8d9fae",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -67,29 +144,44 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs-stable": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1711460390,
|
|
||||||
"narHash": "sha256-akSgjDZL6pVHEfSE6sz1DNSXuYX6hq+P/1Z5IoYWs7E=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "44733514b72e732bd49f5511bd0203dea9b9a434",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixos-23.11",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"crane": "crane",
|
"crane": "crane",
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs",
|
"lix": "lix",
|
||||||
"nixpkgs-stable": "nixpkgs-stable"
|
"lix-module": "lix-module",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
39
flake.nix
39
flake.nix
|
@ -3,7 +3,15 @@
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
|
lix = {
|
||||||
|
url = "git+ssh://git@git.lix.systems/lix-project/lix";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
lix-module = {
|
||||||
|
url = "git+ssh://git@git.lix.systems/lix-project/nixos-module";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.lix.follows = "lix";
|
||||||
|
};
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
crane = {
|
crane = {
|
||||||
|
@ -17,7 +25,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, nixpkgs-stable, flake-utils, crane, ... }: let
|
outputs = { self, nixpkgs, lix-module, flake-utils, crane, ... }: let
|
||||||
supportedSystems = flake-utils.lib.defaultSystems ++ [ "riscv64-linux" ];
|
supportedSystems = flake-utils.lib.defaultSystems ++ [ "riscv64-linux" ];
|
||||||
|
|
||||||
makeCranePkgs = pkgs: let
|
makeCranePkgs = pkgs: let
|
||||||
|
@ -26,16 +34,10 @@
|
||||||
in flake-utils.lib.eachSystem supportedSystems (system: let
|
in flake-utils.lib.eachSystem supportedSystems (system: let
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
overlays = [];
|
overlays = [lix-module.overlays.default];
|
||||||
};
|
};
|
||||||
cranePkgs = makeCranePkgs pkgs;
|
cranePkgs = makeCranePkgs pkgs;
|
||||||
|
|
||||||
pkgsStable = import nixpkgs-stable {
|
|
||||||
inherit system;
|
|
||||||
overlays = [];
|
|
||||||
};
|
|
||||||
cranePkgsStable = makeCranePkgs pkgsStable;
|
|
||||||
|
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
in rec {
|
in rec {
|
||||||
packages = {
|
packages = {
|
||||||
|
@ -55,17 +57,7 @@
|
||||||
} // (lib.optionalAttrs (system != "x86_64-darwin") {
|
} // (lib.optionalAttrs (system != "x86_64-darwin") {
|
||||||
# Unfortunately, x86_64-darwin fails to evaluate static builds
|
# Unfortunately, x86_64-darwin fails to evaluate static builds
|
||||||
# TODO: Make this work with Crane
|
# TODO: Make this work with Crane
|
||||||
attic-static = (pkgs.pkgsStatic.callPackage ./package.nix {
|
attic-static = (pkgs.pkgsStatic.callPackage ./package.nix { }).overrideAttrs (old: {
|
||||||
nix = pkgs.pkgsStatic.nix.overrideAttrs (old: {
|
|
||||||
patches = (old.patches or []) ++ [
|
|
||||||
# To be submitted
|
|
||||||
(pkgs.fetchpatch {
|
|
||||||
url = "https://github.com/NixOS/nix/compare/3172c51baff5c81362fcdafa2e28773c2949c660...6b09a02536d5946458b537dfc36b7d268c9ce823.diff";
|
|
||||||
hash = "sha256-LFLq++J2XitEWQ0o57ihuuUlYk2PgUr11h7mMMAEe3c=";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}).overrideAttrs (old: {
|
|
||||||
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [
|
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [
|
||||||
pkgs.nukeReferences
|
pkgs.nukeReferences
|
||||||
];
|
];
|
||||||
|
@ -127,12 +119,8 @@
|
||||||
linuxPackages.perf
|
linuxPackages.perf
|
||||||
]);
|
]);
|
||||||
|
|
||||||
NIX_PATH = "nixpkgs=${pkgs.path}";
|
|
||||||
RUST_SRC_PATH = "${pkgs.rustPlatform.rustcSrc}/library";
|
RUST_SRC_PATH = "${pkgs.rustPlatform.rustcSrc}/library";
|
||||||
|
|
||||||
# See comment in `attic/build.rs`
|
|
||||||
NIX_INCLUDE_PATH = "${lib.getDev pkgs.nix}/include";
|
|
||||||
|
|
||||||
ATTIC_DISTRIBUTOR = "dev";
|
ATTIC_DISTRIBUTOR = "dev";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -163,8 +151,7 @@
|
||||||
flake = self;
|
flake = self;
|
||||||
};
|
};
|
||||||
unstableTests = makeIntegrationTests pkgs;
|
unstableTests = makeIntegrationTests pkgs;
|
||||||
stableTests = lib.mapAttrs' (name: lib.nameValuePair "stable-${name}") (makeIntegrationTests pkgsStable);
|
in lib.optionalAttrs pkgs.stdenv.isLinux unstableTests;
|
||||||
in lib.optionalAttrs pkgs.stdenv.isLinux (unstableTests // stableTests);
|
|
||||||
}) // {
|
}) // {
|
||||||
overlays = {
|
overlays = {
|
||||||
default = final: prev: let
|
default = final: prev: let
|
||||||
|
|
|
@ -33,6 +33,6 @@ let
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}) (lib.cartesianProductOfSets matrix));
|
}) (lib.cartesianProduct matrix));
|
||||||
in {
|
in {
|
||||||
} // basicTests
|
} // basicTests
|
||||||
|
|
|
@ -49,9 +49,6 @@ in rustPlatform.buildRustPackage rec {
|
||||||
|
|
||||||
ATTIC_DISTRIBUTOR = "attic";
|
ATTIC_DISTRIBUTOR = "attic";
|
||||||
|
|
||||||
# See comment in `attic/build.rs`
|
|
||||||
NIX_INCLUDE_PATH = "${lib.getDev nix}/include";
|
|
||||||
|
|
||||||
# Recursive Nix is not stable yet
|
# Recursive Nix is not stable yet
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue