chore: Apply nixfmt
(cherry picked from commit d11c2029c5a33ec522f46dd3e00fec8db2c3729b)
This commit is contained in:
parent
eba8c06c9d
commit
83dece62b2
3 changed files with 184 additions and 138 deletions
|
|
@ -1,9 +1,17 @@
|
||||||
{ lib, inputs, withSystem, ... }: {
|
{
|
||||||
|
lib,
|
||||||
|
inputs,
|
||||||
|
withSystem,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
inputs.pre-commit-hooks-nix.flakeModule
|
inputs.pre-commit-hooks-nix.flakeModule
|
||||||
inputs.hercules-ci-effects.flakeModule
|
inputs.hercules-ci-effects.flakeModule
|
||||||
];
|
];
|
||||||
perSystem = { config, pkgs, ... }: {
|
perSystem =
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
|
||||||
pre-commit.settings.hooks.nixfmt-rfc-style.enable = true;
|
pre-commit.settings.hooks.nixfmt-rfc-style.enable = true;
|
||||||
# Temporarily disable rustfmt due to configuration issues
|
# Temporarily disable rustfmt due to configuration issues
|
||||||
|
|
@ -41,10 +49,14 @@
|
||||||
NIX_DEBUG_INFO_DIRS =
|
NIX_DEBUG_INFO_DIRS =
|
||||||
let
|
let
|
||||||
# TODO: add to Nixpkgs lib
|
# TODO: add to Nixpkgs lib
|
||||||
getDebug = pkg:
|
getDebug =
|
||||||
if pkg?debug then pkg.debug
|
pkg:
|
||||||
else if pkg?lib then pkg.lib
|
if pkg ? debug then
|
||||||
else pkg;
|
pkg.debug
|
||||||
|
else if pkg ? lib then
|
||||||
|
pkg.lib
|
||||||
|
else
|
||||||
|
pkg;
|
||||||
in
|
in
|
||||||
"${getDebug config.packages.nix}/lib/debug";
|
"${getDebug config.packages.nix}/lib/debug";
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
|
@ -73,7 +85,9 @@
|
||||||
NIX_PATH = "nixpkgs=${inputs.nixpkgs}";
|
NIX_PATH = "nixpkgs=${inputs.nixpkgs}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
herculesCI = hci@{ config, ... }: {
|
herculesCI =
|
||||||
|
hci@{ config, ... }:
|
||||||
|
{
|
||||||
ciSystems = [ "x86_64-linux" ];
|
ciSystems = [ "x86_64-linux" ];
|
||||||
};
|
};
|
||||||
flake = { };
|
flake = { };
|
||||||
|
|
|
||||||
32
flake.nix
32
flake.nix
|
|
@ -10,17 +10,34 @@
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs@{ self, flake-parts, ... }:
|
outputs =
|
||||||
flake-parts.lib.mkFlake
|
inputs@{ self, flake-parts, ... }:
|
||||||
{ inherit inputs; }
|
flake-parts.lib.mkFlake { inherit inputs; } (
|
||||||
({ lib, ... }: {
|
{
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
inputs.nix-cargo-integration.flakeModule
|
inputs.nix-cargo-integration.flakeModule
|
||||||
inputs.flake-parts.flakeModules.partitions
|
inputs.flake-parts.flakeModules.partitions
|
||||||
./rust/nci.nix
|
./rust/nci.nix
|
||||||
];
|
];
|
||||||
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
systems = [
|
||||||
perSystem = { config, self', inputs', pkgs, ... }: {
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
perSystem =
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
self',
|
||||||
|
inputs',
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
packages.nix = inputs'.nix.packages.nix;
|
packages.nix = inputs'.nix.packages.nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -31,5 +48,6 @@
|
||||||
partitions.dev.module = {
|
partitions.dev.module = {
|
||||||
imports = [ ./dev/flake-module.nix ];
|
imports = [ ./dev/flake-module.nix ];
|
||||||
};
|
};
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
36
rust/nci.nix
36
rust/nci.nix
|
|
@ -1,5 +1,12 @@
|
||||||
{
|
{
|
||||||
perSystem = { lib, config, pkgs, ... }: {
|
perSystem =
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
# https://flake.parts/options/nix-cargo-integration
|
# https://flake.parts/options/nix-cargo-integration
|
||||||
nci.projects.nix-bindings = {
|
nci.projects.nix-bindings = {
|
||||||
path = ./.;
|
path = ./.;
|
||||||
|
|
@ -8,16 +15,21 @@
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
# stdbool.h
|
# stdbool.h
|
||||||
pkgs.stdenv.cc
|
pkgs.stdenv.cc
|
||||||
] ++
|
]
|
||||||
(if config.packages.nix?libs
|
++ (
|
||||||
then
|
if config.packages.nix ? libs then
|
||||||
let l = config.packages.nix.libs; in [
|
let
|
||||||
|
l = config.packages.nix.libs;
|
||||||
|
in
|
||||||
|
[
|
||||||
l.nix-expr-c
|
l.nix-expr-c
|
||||||
l.nix-store-c
|
l.nix-store-c
|
||||||
l.nix-util-c
|
l.nix-util-c
|
||||||
l.nix-flake-c
|
l.nix-flake-c
|
||||||
]
|
]
|
||||||
else [ config.packages.nix ]);
|
else
|
||||||
|
[ config.packages.nix ]
|
||||||
|
);
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
pkgs.pkg-config
|
pkgs.pkg-config
|
||||||
];
|
];
|
||||||
|
|
@ -45,21 +57,23 @@
|
||||||
echo "Configuring relocated store at $NIX_REMOTE..."
|
echo "Configuring relocated store at $NIX_REMOTE..."
|
||||||
|
|
||||||
# Init ahead of time, because concurrent initialization is flaky
|
# Init ahead of time, because concurrent initialization is flaky
|
||||||
${# Not using nativeBuildInputs because this should (hopefully) be
|
${
|
||||||
|
# Not using nativeBuildInputs because this should (hopefully) be
|
||||||
# the only place where we need a nix binary. Let's stay in control.
|
# the only place where we need a nix binary. Let's stay in control.
|
||||||
pkgs.buildPackages.nix}/bin/nix-store --init
|
pkgs.buildPackages.nix
|
||||||
|
}/bin/nix-store --init
|
||||||
|
|
||||||
echo "Store initialized."
|
echo "Store initialized."
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
# NOTE: duplicated in flake.nix devShell
|
# NOTE: duplicated in flake.nix devShell
|
||||||
env = {
|
env = {
|
||||||
LIBCLANG_PATH =
|
LIBCLANG_PATH = lib.makeLibraryPath [ pkgs.buildPackages.llvmPackages.clang-unwrapped ];
|
||||||
lib.makeLibraryPath [ pkgs.buildPackages.llvmPackages.clang-unwrapped ];
|
|
||||||
BINDGEN_EXTRA_CLANG_ARGS =
|
BINDGEN_EXTRA_CLANG_ARGS =
|
||||||
# Work around missing [[deprecated]] in clang
|
# Work around missing [[deprecated]] in clang
|
||||||
"-x c++ -std=c++2a";
|
"-x c++ -std=c++2a";
|
||||||
} // lib.optionalAttrs pkgs.stdenv.cc.isGNU {
|
}
|
||||||
|
// lib.optionalAttrs pkgs.stdenv.cc.isGNU {
|
||||||
# Avoid cc wrapper, because we only need to add the compiler/"system" dirs
|
# Avoid cc wrapper, because we only need to add the compiler/"system" dirs
|
||||||
NIX_CC_UNWRAPPED = "${pkgs.stdenv.cc.cc}/bin/gcc";
|
NIX_CC_UNWRAPPED = "${pkgs.stdenv.cc.cc}/bin/gcc";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue