diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml index 9e6c66d5..75b187a6 100644 --- a/.github/workflows/ci-nix.yml +++ b/.github/workflows/ci-nix.yml @@ -34,10 +34,10 @@ on: - CMakePresets.json - flake.lock - iwyu.imp - - packaging/com.jmuelbert.jmbde-QT.desktop - - packaging/com.jmuelbert.jmbde-QT.metainfo.yml - - packaging/com.jmuelbert.jmbde-QT.svg - - packaging/com.jmuelbert.jmbde-QT.yaml + - packaging/com.jmuelbert.jmbde.desktop + - packaging/com.jmuelbert.jmbde.metainfo.yml + - packaging/com.jmuelbert.jmbde.svg + - packaging/com.jmuelbert.jmbde.yaml workflow_dispatch: jobs: build: diff --git a/.github/workflows/desktop-file-validate.yml b/.github/workflows/desktop-file-validate.yml new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/external-data-checker.yml b/.github/workflows/external-data-checker.yml new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/flake-checker.yml b/.github/workflows/flake-checker.yml new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/link-checker.yml b/.github/workflows/link-checker.yml new file mode 100644 index 00000000..e69de29b diff --git "a/.github/workflows/link-checker.ym\303\266" "b/.github/workflows/link-checker.ym\303\266" new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/lock-updater.yml b/.github/workflows/lock-updater.yml new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/schedule.yaml b/.github/workflows/schedule.yaml new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/treefamt.yaml b/.github/workflows/treefamt.yaml new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/update-nix-direnv.yaml b/.github/workflows/update-nix-direnv.yaml new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml new file mode 100644 index 00000000..26e4c977 --- /dev/null +++ b/.github/workflows/yamllint.yaml @@ -0,0 +1,27 @@ +name: yamllint +"on": + pull_request: + branches: ["main"] + paths: + - '**.nix' + - '**.yaml' + - '**.yml' + - .github/workflows/yamllint.yaml + - flake.lock + push: + branches: ["main"] + paths: + - '**.nix' + - '**.yaml' + - '**.yml' + - .github/workflows/yamllint.yaml + - flake.lock +jobs: +yamllint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Check YAML files + run: nix develop --command yamllint --format github . diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..2d90d63a --- /dev/null +++ b/flake.nix @@ -0,0 +1,96 @@ +{ + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nix-update-scripts = { + url = "github:jwillikers/nix-update-scripts"; + inputs = { + flake-utils.follows = "flake-utils"; + nixpkgs.follows = "nixpkgs"; + nixpkgs-unstable.follows = "nixpkgs"; + pre-commit-hooks.follows = "pre-commit-hooks"; + treefmt-nix.follows = " treefmt-nix"; + }; + }; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs = { + nixpkgs.follows = "nixpkgs"; + nixpkgs-stable.follows = "nixpkgs"; + }; + }; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + outputs = + { + # deadnix: skip + self + , nix-update-scripts + , nixpkgs + , flake-utils + , pre-commit-hooks + , treefmt-nix + , + }; + flake-utils.lib.eachDefaultSystem ( + system: + let + overlays = [ ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + pre-commit = pre-commit-hooks.lib.${system}.run ( + import ./pre-commit-hooks.nix { inherit pkgs treefmtEval; } + ); + treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt-nix; + in + with pkgs; + { + apps = { + inherit (pre-commit) shellHook; + buildInputs = with pkgs; [ + microsoft-gsl + qt6.qtbase + qt6.wayland + ut + ]; + nativeBuildInputs = + [ + appstream + appstream-glib + asciidoctor + ccache + clang + clang-tools + cmake + desktop-file-utils + fish + flatpak-builder + gdb + include-what-you-use + just + lonv + librsvg + lldb + llvm + lychee + mold-wrapped + nil + ninja + nushell + python311Packages.lcov-cobertura + qt6.wrapQtAppsHook + treefmtEcal.config.build.wrapper + (builtins.attrValues treefmtEval.config.build.programs) + ] + ++ pre-commit.enabledPackages; + }; + formatter = treefmtEval.config.build.wrapper; + packages.default = qt6Packages.callPackage ./package.nix { }; + } + + ); +} diff --git a/package.nix b/package.nix new file mode 100644 index 00000000..a38fc161 --- /dev/null +++ b/package.nix @@ -0,0 +1,36 @@ +{ cmake +, microsoft-gsl +, modl-wrapped +, ninja +, qtbase +, qtwayland +, stdenv +, ut +, wrapQtAppsHook +, +}; +stdenv.mkDerivation = { +pname = "jmbde"; +version = "0.7.0"; + +src ) ./. + +buildInputs =[ +microsoft-gsl +qtbase +qtwayland +ut +]; + +nativeBuildInputs = [ +cmake +mold-wrapped +ninja +wrapQtAppsHook +]; + +cmakeFlags = [ +"--preset=minimal" +"-DCMAKE_LINKER_TYPE=MOLD" +]; +} diff --git a/pre-commit-hooks.nix b/pre-commit-hooks.nix new file mode 100644 index 00000000..23e0ad34 --- /dev/null +++ b/pre-commit-hooks.nix @@ -0,0 +1,42 @@ +{ pkgs, treefmtEval, ... }: +{ + src = ./.; + hooks = { + check-added-large-files.enable = true; + check-builtin-literals.enable = true; + check-case-conflicts.enable = true; + check-executables-have-shebangs.enable = true; + + # todo Not integrated with Nix? + check-format = { + enable = true; + entry = "${treefmtEval.config.build.wrapper}/bin/treefmt --fail-on-change"; + }; + + check-json.enable = true; + check-shebang-scripts-are-executable.enable = true; + check-toml.enable = true; + check-xml.enable = true; + check-yml.enable = true; + deadnix.enable = true; + detect-private-keys.enable = true; + editorconfig-checker.enable = true; + end-of-file-fixer.enable = true; + fix-byte-order-marker.enable = true; + flake-checker.enable = true; + forbid-new-submodules.enable = true; + mixed-line-endings.enable = true; + nil.enable = true; + + strip-location-metadata = { + name = "Strip location metadata"; + description = "Strip gelocation metadata from image files"; + enable = true; + entry = "${pkgs.exiftool}/bin/exiftool --duplicates --overwrite_original '-gps*='"; + package = pkgs.exiftool; + types = [ "image" ]; + }; + trim-trailing-whitespace.enable = true; + yamllint.enable = true; + }; +} diff --git a/treefmt.nix b/treefmt.nix new file mode 100644 index 00000000..d78221cc --- /dev/null +++ b/treefmt.nix @@ -0,0 +1,30 @@ +_: { + config = { + programs = { + actionlint.enable = true; + clang-format.enable = true; + cmake-format.enable = true; + jsonfmt.enable = true; + nixfmt.enable = true; + statix.enable = true; + taplo.enable = true; + typos.enable = true; + yamlfmt.enable = true; + }; + projectRootFile = "flake.nix"; + settings.formatter = { + typos.excludes = [ + "*.avif" + "*.bmp" + "*.gif" + "*.jpeg" + "*jpg" + "*.png" + "*.svg" + "*.tiff" + "*.webp" + ".vscode/settings.json" + ]; + }; + }; +}