commit
ef40bb2caf
1465
Cargo.lock
generated
1465
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
45
flake.lock
45
flake.lock
|
@ -1,5 +1,24 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"crane": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1714842444,
|
||||||
|
"narHash": "sha256-z4HeSYtEdYxKurrbxCMb8v/I1LYDHR/aFrZtGtgUgHw=",
|
||||||
|
"rev": "c5ee4371eea1728ef04bb09c79577c84d5e67a48",
|
||||||
|
"revCount": 557,
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://api.flakehub.com/f/pinned/ipetkov/crane/0.16.6/018f4495-627e-7385-b537-81f1c1d4003b/source.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://flakehub.com/f/ipetkov/crane/0.16.3.tar.gz"
|
||||||
|
}
|
||||||
|
},
|
||||||
"fenix": {
|
"fenix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
@ -17,7 +36,7 @@
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://flakehub.com/f/nix-community/fenix/0.1.1584.tar.gz"
|
"url": "https://flakehub.com/f/nix-community/fenix/0.1.1727.tar.gz"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
|
@ -102,26 +121,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"naersk": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1721727458,
|
|
||||||
"narHash": "sha256-r/xppY958gmZ4oTfLiHN0ZGuQ+RSTijDblVgVLFi1mw=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "naersk",
|
|
||||||
"rev": "3fb418eaf352498f6b6c30592e3beb63df42ef11",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "naersk",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nix": {
|
"nix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat_2",
|
"flake-compat": "flake-compat_2",
|
||||||
|
@ -141,7 +140,7 @@
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://flakehub.com/f/NixOS/nix/~2.22.1.tar.gz"
|
"url": "https://flakehub.com/f/NixOS/nix/%3D2.22.1.tar.gz"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
|
@ -224,9 +223,9 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"crane": "crane",
|
||||||
"fenix": "fenix",
|
"fenix": "fenix",
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"naersk": "naersk",
|
|
||||||
"nix": "nix",
|
"nix": "nix",
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2"
|
||||||
}
|
}
|
||||||
|
|
126
flake.nix
126
flake.nix
|
@ -5,21 +5,21 @@
|
||||||
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2311.tar.gz";
|
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2311.tar.gz";
|
||||||
|
|
||||||
fenix = {
|
fenix = {
|
||||||
url = "https://flakehub.com/f/nix-community/fenix/0.1.1584.tar.gz";
|
url = "https://flakehub.com/f/nix-community/fenix/0.1.1727.tar.gz";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
naersk = {
|
crane = {
|
||||||
url = "github:nix-community/naersk";
|
url = "https://flakehub.com/f/ipetkov/crane/0.16.3.tar.gz";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.0.1.tar.gz";
|
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.0.1.tar.gz";
|
||||||
|
|
||||||
nix.url = "https://flakehub.com/f/NixOS/nix/~2.22.1.tar.gz";
|
nix.url = "https://flakehub.com/f/NixOS/nix/=2.22.1.tar.gz";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, fenix, naersk, nix, ... }@inputs:
|
outputs = { self, nixpkgs, fenix, crane, ... }@inputs:
|
||||||
let
|
let
|
||||||
supportedSystems = [
|
supportedSystems = [
|
||||||
"aarch64-linux"
|
"aarch64-linux"
|
||||||
|
@ -28,13 +28,17 @@
|
||||||
"x86_64-darwin"
|
"x86_64-darwin"
|
||||||
];
|
];
|
||||||
|
|
||||||
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: (forSystem system f));
|
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f rec {
|
||||||
|
pkgs = import nixpkgs {
|
||||||
forSystem = system: f: f rec {
|
inherit system;
|
||||||
|
overlays = [
|
||||||
|
inputs.nix.overlays.default
|
||||||
|
self.overlays.default
|
||||||
|
];
|
||||||
|
};
|
||||||
|
inherit (pkgs) lib;
|
||||||
inherit system;
|
inherit system;
|
||||||
pkgs = import nixpkgs { inherit system; overlays = [ /* self.overlays.default */ nix.overlays.default ]; };
|
});
|
||||||
lib = pkgs.lib;
|
|
||||||
};
|
|
||||||
|
|
||||||
fenixToolchain = system: with fenix.packages.${system};
|
fenixToolchain = system: with fenix.packages.${system};
|
||||||
combine ([
|
combine ([
|
||||||
|
@ -50,35 +54,47 @@
|
||||||
]);
|
]);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages = forAllSystems ({ lib, system, pkgs, ... }: let
|
|
||||||
toolchain = fenixToolchain pkgs.stdenv.system;
|
overlays.default = final: prev:
|
||||||
naerskLib = pkgs.callPackage naersk {
|
let
|
||||||
cargo = toolchain;
|
toolchain = fenixToolchain final.hostPlatform.system;
|
||||||
rustc = toolchain;
|
craneLib = (crane.mkLib final).overrideToolchain toolchain;
|
||||||
};
|
crateName = craneLib.crateNameFromCargoToml {
|
||||||
in {
|
cargoToml = ./magic-nix-cache/Cargo.toml;
|
||||||
magic-nix-cache = naerskLib.buildPackage {
|
|
||||||
pname = "magic-nix-cache";
|
|
||||||
version = (builtins.fromTOML (builtins.readFile ./magic-nix-cache/Cargo.toml)).package.version;
|
|
||||||
src = builtins.path {
|
|
||||||
name = "magic-nix-cache-source";
|
|
||||||
path = self;
|
|
||||||
filter = (path: type: baseNameOf path != "nix" && baseNameOf path != ".github");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgs.pkg-config ];
|
commonArgs = {
|
||||||
buildInputs = [ pkgs.nix
|
inherit (crateName) pname version;
|
||||||
pkgs.boost # needed for clippy
|
src = self;
|
||||||
]
|
|
||||||
++ lib.optionals pkgs.stdenv.isDarwin [
|
|
||||||
pkgs.darwin.apple_sdk.frameworks.Security
|
|
||||||
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
|
|
||||||
(pkgs.libiconv.override { enableStatic = true; enableShared = false; })
|
|
||||||
];
|
|
||||||
|
|
||||||
NIX_CFLAGS_LINK = lib.optionalString pkgs.stdenv.isDarwin "-lc++abi";
|
nativeBuildInputs = with final; [
|
||||||
};
|
pkg-config
|
||||||
default = self.packages.${system}.magic-nix-cache;
|
];
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
final.nix
|
||||||
|
final.boost
|
||||||
|
] ++ final.lib.optionals final.stdenv.isDarwin [
|
||||||
|
final.darwin.apple_sdk.frameworks.SystemConfiguration
|
||||||
|
(final.libiconv.override { enableStatic = true; enableShared = false; })
|
||||||
|
];
|
||||||
|
|
||||||
|
NIX_CFLAGS_LINK = final.lib.optionalString final.stdenv.isDarwin "-lc++abi";
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||||
|
in
|
||||||
|
rec {
|
||||||
|
magic-nix-cache = craneLib.buildPackage (commonArgs // {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
});
|
||||||
|
|
||||||
|
default = magic-nix-cache;
|
||||||
|
};
|
||||||
|
|
||||||
|
packages = forEachSupportedSystem ({ pkgs, ... }: rec {
|
||||||
|
magic-nix-cache = pkgs.magic-nix-cache;
|
||||||
|
default = magic-nix-cache;
|
||||||
|
|
||||||
veryLongChain =
|
veryLongChain =
|
||||||
let
|
let
|
||||||
|
@ -110,12 +126,36 @@
|
||||||
# Starting point of the chain
|
# Starting point of the chain
|
||||||
createChain 200 startFile;
|
createChain 200 startFile;
|
||||||
});
|
});
|
||||||
devShells = forAllSystems ({ lib, system, pkgs, ... }: let
|
|
||||||
pkg = self.packages.${system}.default;
|
devShells = forEachSupportedSystem ({ system, pkgs, lib }:
|
||||||
in {
|
let
|
||||||
|
toolchain = fenixToolchain system;
|
||||||
|
in
|
||||||
|
{
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
inherit (pkg) buildInputs nativeBuildInputs NIX_CFLAGS_LINK;
|
packages = with pkgs; [
|
||||||
};
|
toolchain
|
||||||
});
|
|
||||||
|
nix # for linking attic
|
||||||
|
boost # for linking attic
|
||||||
|
bashInteractive
|
||||||
|
pkg-config
|
||||||
|
|
||||||
|
cargo-bloat
|
||||||
|
cargo-edit
|
||||||
|
cargo-udeps
|
||||||
|
cargo-watch
|
||||||
|
bacon
|
||||||
|
|
||||||
|
age
|
||||||
|
] ++ lib.optionals pkgs.stdenv.isDarwin [
|
||||||
|
libiconv
|
||||||
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
||||||
|
];
|
||||||
|
|
||||||
|
NIX_CFLAGS_LINK = lib.optionalString pkgs.stdenv.isDarwin "-lc++abi";
|
||||||
|
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
||||||
|
};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
58
package.nix
58
package.nix
|
@ -1,58 +0,0 @@
|
||||||
{ lib
|
|
||||||
, stdenv
|
|
||||||
, rustPlatform
|
|
||||||
, pkg-config
|
|
||||||
, installShellFiles
|
|
||||||
, nix
|
|
||||||
, boost
|
|
||||||
, darwin
|
|
||||||
, rust-analyzer
|
|
||||||
, clippy
|
|
||||||
, rustfmt
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
ignoredPaths = [ ".github" "target" "book" ];
|
|
||||||
version = (builtins.fromTOML (builtins.readFile ./magic-nix-cache/Cargo.toml)).package.version;
|
|
||||||
in
|
|
||||||
rustPlatform.buildRustPackage rec {
|
|
||||||
pname = "magic-nix-cache";
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
src = lib.cleanSourceWith {
|
|
||||||
filter = name: type: !(type == "directory" && builtins.elem (baseNameOf name) ignoredPaths);
|
|
||||||
src = lib.cleanSource ./.;
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
|
||||||
pkg-config
|
|
||||||
installShellFiles
|
|
||||||
rust-analyzer
|
|
||||||
clippy
|
|
||||||
rustfmt
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = [
|
|
||||||
nix
|
|
||||||
boost
|
|
||||||
] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
|
|
||||||
SystemConfiguration
|
|
||||||
]);
|
|
||||||
|
|
||||||
cargoLock = {
|
|
||||||
lockFile = ./Cargo.lock;
|
|
||||||
allowBuiltinFetchGit = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
ATTIC_DISTRIBUTOR = "attic";
|
|
||||||
|
|
||||||
# Hack to fix linking on macOS.
|
|
||||||
NIX_CFLAGS_LINK = lib.optionalString stdenv.isDarwin "-lc++abi";
|
|
||||||
|
|
||||||
# Recursive Nix is not stable yet
|
|
||||||
doCheck = false;
|
|
||||||
|
|
||||||
postFixup = ''
|
|
||||||
rm -f $out/nix-support/propagated-build-inputs
|
|
||||||
'';
|
|
||||||
}
|
|
Loading…
Reference in a new issue