Skip to content

Commit

Permalink
chore: Add packaging files and yamllint workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmuelbert committed Nov 8, 2024
1 parent e338b68 commit 1dbadbc
Show file tree
Hide file tree
Showing 15 changed files with 235 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci-nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added .github/workflows/schedule.yaml
Empty file.
Empty file added .github/workflows/treefamt.yaml
Empty file.
Empty file.
27 changes: 27 additions & 0 deletions .github/workflows/yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: yamllint
"on":
pull_request:
branches: ["main"]

Check warning on line 4 in .github/workflows/yamllint.yaml

View check run for this annotation

Trunk.io / Trunk Check

yamllint(quoted-strings)

[new] string value is redundantly quoted with any quotes
paths:
- '**.nix'
- '**.yaml'
- '**.yml'
- .github/workflows/yamllint.yaml
- flake.lock
push:
branches: ["main"]

Check warning on line 12 in .github/workflows/yamllint.yaml

View check run for this annotation

Trunk.io / Trunk Check

yamllint(quoted-strings)

[new] string value is redundantly quoted with any quotes
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 .

Check failure on line 27 in .github/workflows/yamllint.yaml

View check run for this annotation

Trunk.io / Trunk Check

actionlint(syntax-check)

[new] could not parse as YAML: yaml: line 27: mapping values are not allowed in this context

Check failure on line 27 in .github/workflows/yamllint.yaml

View check run for this annotation

Trunk.io / Trunk Check

yamllint(syntax)

[new] syntax error: mapping values are not allowed here
96 changes: 96 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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 { };
}

);
}
36 changes: 36 additions & 0 deletions package.nix
Original file line number Diff line number Diff line change
@@ -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"
];
}
42 changes: 42 additions & 0 deletions pre-commit-hooks.nix
Original file line number Diff line number Diff line change
@@ -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;
};
}
30 changes: 30 additions & 0 deletions treefmt.nix
Original file line number Diff line number Diff line change
@@ -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"
];
};
};
}

0 comments on commit 1dbadbc

Please sign in to comment.