Код: Выделить всё
{ stdenv, pkgs, system }:
stdenv.mkDerivation rec {
name = "myapp";
src = ./.;
enableShared = true;
cmakePreset = {
"x86_64-linux" = "linux";
"x86_64-darwin" = "linux";
"aarch64-darwin" = "osx";
}."${system}";
cmakeFlags = [
"--preset ${cmakePreset}"
];
cmakeBuildType = "Release";
nativeBuildInputs = with pkgs; [ cmake git ninja ];
buildInputs = (with pkgs; [
...
]);
}
Код: Выделить всё
{
"version": 9,
"cmakeMinimumRequired": {
"major": 3,
"minor": 30,
"patch": 0
},
"configurePresets": [
{
"name": "common-configure-settings",
"description": "Options and CMake settings common to all configure presets",
"binaryDir": "${sourceDir}/build/${presetName}",
"hidden": true
},
{
"name": "ninja",
"hidden": true,
"generator": "Ninja"
},
{
"name": "linux",
"hidden": false,
"inherits": ["ninja"],
"description": "Build preset for Linux",
"environment": {
"CXX_WARNINGS": "-Wall -Wextra -Werror -pedantic",
"PLATFORM": "POSIX64"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
}
]
}
Код: Выделить всё
name: build-linux
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
packages: read
jobs:
build:
runs-on: ubuntu-latest
if: github.ref_name == 'main'
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/install-nix-action@v27
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GH_TOKEN }}
- name: Build
working-directory: ${{github.workspace}}
run: nix build
env:
NIX_CONFIG: "access-tokens = github.com=${{ secrets.GH_TOKEN }}"
Код: Выделить всё
error: builder for '/nix/store/vj6wfq1lafh59wk7wkfa02q19hwfchkz-myapp.drv' failed with exit code 1;
last 25 log lines:
> * USE_CERES, Use the non-linear least squares optimizer from Ceres solver to tune model coefficients (if OFF, Eigen::LevenbergMarquardt will be used instead).
>
> -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
> -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
> -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
> -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
> -- Performing Test COMPILER_HAS_DEPRECATED_ATTR
> -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
> -- Performing Test COMPILER_HAS_DEPRECATED
> -- Performing Test COMPILER_HAS_DEPRECATED - Failed
> -- Configuring done (1.7s)
> -- Generating done (0.0s)
> CMake Warning:
> Manually-specified variables were not used by the project:
>
> CMAKE_EXPORT_NO_PACKAGE_REGISTRY
> CMAKE_POLICY_DEFAULT_CMP0025
>
>
> -- Build files have been written to: /build/a75cv3clh1z9k7cg9hrnhi5m2z3hcgcm-source/build/linux
> cmake: enabled parallel building
> cmake: enabled parallel installing
> Running phase: buildPhase
> build flags: -j2
> ninja: error: loading 'build.ninja': No such file or directory
For full logs, run 'nix log /nix/store/vj6wfq1lafh59wk7wkfa02q19hwfchkz-myapp.drv'.
Подробнее здесь: https://stackoverflow.com/questions/792 ... s-expected
Мобильная версия