diff --git a/.github/workflows/qc/action.yml b/.github/workflows/qc/action.yml index f450fc9..ae06b07 100644 --- a/.github/workflows/qc/action.yml +++ b/.github/workflows/qc/action.yml @@ -8,13 +8,17 @@ inputs: runs: using: "composite" steps: - - name: Install Dependencies + - name: Install nix + uses: cachix/install-nix-action@v27 + + - name: Nix Formatting shell: bash run: | set -ex - sudo apt-get update - sudo apt-get install --yes clang-format-13 - pip install cmake_format==0.6.9 aqtinstall + nix develop --ignore-environment --command nixfmt --version + nix develop --ignore-environment --command find . -type f -regex '.*\.nix' -exec nixfmt {} + + git diff + git diff --quiet - name: Check Conventional Commits # Ensure that the PR title fits the conventional commits framework @@ -28,8 +32,8 @@ runs: shell: bash run: | set -ex - clang-format-13 --version - find src/ -type f -regex '.*\.\(c\|cpp\|h\|hpp\|hui\)' -exec clang-format-13 -i {} + + nix develop --ignore-environment --command clang-format --version + nix develop --ignore-environment --command find src/ -type f -regex '.*\.\(c\|cpp\|h\|hpp\|hui\)' -exec clang-format -i {} + git diff git diff --quiet @@ -37,40 +41,17 @@ runs: shell: bash run: | set -ex - cmake-format --version - find src/ -type f -name CMakeLists.txt -exec cmake-format -i '{}' \; + nix develop --ignore-environment --command cmake-format --version + nix develop --ignore-environment --command find src/ -type f -name CMakeLists.txt -exec cmake-format -i '{}' \; git diff git diff --quiet - - name: Retrieve Qt Cache - id: cache-qt - uses: actions/cache@v4 - with: - key: linux-qt-${{ inputs.qtVersion }} - path: ${{ runner.temp }}/qt - - - name: Install Qt - if: ${{ steps.cache-qt.outputs.cache-hit != 'true' }} - shell: bash - run: | - export PATH="$(python3 -m site --user-base)/bin:$PATH" - aqt install-qt --outputdir ${{ runner.temp }}/qt linux desktop ${{ inputs.qtVersion }} - - - name: Install Qt - uses: jurplel/install-qt-action@v4 - with: - version: ${{ inputs.qtVersion }} - host: linux - target: desktop - dir: ${{ runner.temp }}/qt - cache: true - - name: QML Formatting shell: bash run: | set -ex - ${{ runner.temp }}/qt/${{ inputs.qtVersion }}/gcc_64/bin/qmlformat --version - find . -type f -regex '.*\.qml' -exec ${{ runner.temp }}/qt/${{ inputs.qtVersion }}/gcc_64/bin/qmlformat -inw 4 '{}' \; + nix develop --ignore-environment --command qmlformat --version + nix develop --ignore-environment --command find . -type f -regex '.*\.qml' -exec qmlformat -inw 4 '{}' \; git diff git diff --quiet diff --git a/flake.nix b/flake.nix index 6492f17..85fba23 100644 --- a/flake.nix +++ b/flake.nix @@ -6,8 +6,7 @@ nixGL-src.url = "github:guibou/nixGL"; nixGL-src.flake = false; }; - outputs = - { self, nixpkgs, future, flake-utils, bundlers, nixGL-src }: + outputs = { self, nixpkgs, future, flake-utils, bundlers, nixGL-src }: let version = "0.1"; @@ -27,80 +26,95 @@ ]; check_libs = pkgs: with pkgs; [ gtest ]; - in - flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system: + in flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system: - let - pkgs = import nixpkgs { inherit system; }; - next = import future { inherit system; }; - nixGL = import nixGL-src { inherit pkgs; }; - qt = pkgs.qt6; # qt-idaaas.packages.${system}; - in - { - devShells.default = pkgs.stdenv.mkDerivation { - name = "mildred-shell"; - buildInputs = base_libs pkgs ++ gui_libs {inherit pkgs; q=qt;} ++ check_libs pkgs - ++ (with pkgs; [ - (pkgs.clang-tools.override { - llvmPackages = pkgs.llvmPackages_13; - }) - ccache - ccls - cmake-format - cmake-language-server - distcc - gdb - next.git-cliff - valgrind - ]); - shellHook = '' - export XDG_DATA_DIRS=$GSETTINGS_SCHEMAS_PATH:$XDG_DATA_DIRS - export LIBGL_DRIVERS_PATH=${pkgs.lib.makeSearchPathOutput "lib" "lib/dri" [pkgs.mesa.drivers]} - export LIBVA_DRIVERS_PATH=${pkgs.lib.makeSearchPathOutput "out" "lib/dri" [pkgs.mesa.drivers]} - export __EGL_VENDOR_LIBRARY_FILENAMES=${pkgs.mesa.drivers}/share/glvnd/egl_vendor.d/50_mesa.json - export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [pkgs.mesa.drivers]}:${pkgs.lib.makeSearchPathOutput "lib" "lib/vdpau" [pkgs.libvdpau]}:${pkgs.lib.makeLibraryPath [pkgs.libglvnd]}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - export QT_PLUGIN_PATH="${qt.qt3d}/lib/qt-6/plugins:${qt.qtsvg}/lib/qt-6/plugins:$QT_PLUGIN_PATH" - ''; - QML_IMPORT_PATH = "${qt.qtdeclarative}/lib/qt-6/qml/:${qt.qt3d}/lib/qt-6/qml/:${qt.qtquick3d}/lib/qt-6/qml/"; - }; + let + pkgs = import nixpkgs { inherit system; }; + next = import future { inherit system; }; + nixGL = import nixGL-src { inherit pkgs; }; + qt = pkgs.qt6; # qt-idaaas.packages.${system}; + in { + devShells.default = pkgs.stdenv.mkDerivation { + name = "mildred-shell"; + buildInputs = base_libs pkgs ++ gui_libs { + inherit pkgs; + q = qt; + } ++ check_libs pkgs ++ (with pkgs; [ + (pkgs.clang-tools.override { llvmPackages = pkgs.llvmPackages_13; }) + ccache + ccls + cmake-format + cmake-language-server + distcc + gdb + next.git-cliff + nixfmt + valgrind + ]); + shellHook = '' + export XDG_DATA_DIRS=$GSETTINGS_SCHEMAS_PATH:$XDG_DATA_DIRS + export LIBGL_DRIVERS_PATH=${ + pkgs.lib.makeSearchPathOutput "lib" "lib/dri" + [ pkgs.mesa.drivers ] + } + export LIBVA_DRIVERS_PATH=${ + pkgs.lib.makeSearchPathOutput "out" "lib/dri" + [ pkgs.mesa.drivers ] + } + export __EGL_VENDOR_LIBRARY_FILENAMES=${pkgs.mesa.drivers}/share/glvnd/egl_vendor.d/50_mesa.json + export LD_LIBRARY_PATH=${ + pkgs.lib.makeLibraryPath [ pkgs.mesa.drivers ] + }:${ + pkgs.lib.makeSearchPathOutput "lib" "lib/vdpau" [ pkgs.libvdpau ] + }:${ + pkgs.lib.makeLibraryPath [ pkgs.libglvnd ] + }"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + export QT_PLUGIN_PATH="${qt.qt3d}/lib/qt-6/plugins:${qt.qtsvg}/lib/qt-6/plugins:$QT_PLUGIN_PATH" + ''; + QML_IMPORT_PATH = + "${qt.qtdeclarative}/lib/qt-6/qml/:${qt.qt3d}/lib/qt-6/qml/:${qt.qtquick3d}/lib/qt-6/qml/"; + }; - apps = { - default = - flake-utils.lib.mkApp { drv = self.packages.${system}.library; }; - }; + apps = { + default = + flake-utils.lib.mkApp { drv = self.packages.${system}.library; }; + }; - packages = { - library = pkgs.stdenv.mkDerivation ({ - inherit version; - pname = "mildred"; - src = ./.; - buildInputs = base_libs pkgs ++ (gui_libs {inherit pkgs; q=qt;}); - nativeBuildInputs = [ pkgs.wrapGAppsHook ]; + packages = { + library = pkgs.stdenv.mkDerivation ({ + inherit version; + pname = "mildred"; + src = ./.; + buildInputs = base_libs pkgs ++ (gui_libs { + inherit pkgs; + q = qt; + }); + nativeBuildInputs = [ pkgs.wrapGAppsHook ]; - cmakeFlags = [ "-G Ninja -DBUILD_EXAMPLES:bool=true"]; - installPhase = '' - mkdir -p $out/bin - mv ./$out/bin/groups $out/bin/ - ''; + cmakeFlags = [ "-G Ninja -DBUILD_EXAMPLES:bool=true" ]; + installPhase = '' + mkdir -p $out/bin + mv ./$out/bin/groups $out/bin/ + ''; - meta = with pkgs.lib; { - description = "Plot lib for 2D/3D"; - homepage = "https://github.com/disorderedmaterials/plot"; - license = licenses.gpl3; - maintainers = with maintainers; [ rprospero ]; - }; - }); + meta = with pkgs.lib; { + description = "Plot lib for 2D/3D"; + homepage = "https://github.com/disorderedmaterials/plot"; + license = licenses.gpl3; + maintainers = with maintainers; [ rprospero ]; + }; + }); - singularity = - nixpkgs.legacyPackages.${system}.singularity-tools.buildImage { - name = "mildred-${version}"; - diskSize = 1024 * 250; - memSize = 1024 * 2; - contents = [ - self.packages.${system}.library - ]; - runScript = "${nixGL.nixGLIntel}/bin/nixGLIntel ${self.packages.${system}.library}/bin/groups $@"; - }; - }; - }); + singularity = + nixpkgs.legacyPackages.${system}.singularity-tools.buildImage { + name = "mildred-${version}"; + diskSize = 1024 * 250; + memSize = 1024 * 2; + contents = [ self.packages.${system}.library ]; + runScript = "${nixGL.nixGLIntel}/bin/nixGLIntel ${ + self.packages.${system}.library + }/bin/groups $@"; + }; + }; + }); }