Work on adding some basic CI

This commit is contained in:
Daniel Flanagan 2024-07-30 10:06:09 -05:00
parent f9bedc374e
commit a4ed3b922f
5 changed files with 1073 additions and 888 deletions

View file

@ -0,0 +1,9 @@
on: [push]
jobs:
check:
runs-on: beefcake
steps:
- name: Checkout
uses: actions/checkout@v3
- name: nix flake check
run: 'nix flake check'

1769
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -3,12 +3,32 @@ name = "kodotag-rs"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
# bevy = { version = "0.13.2", features = ["wav"] }
bevy = { version = "0.13.2", features = ["wayland", "wav"] }
# bevy = { version = "0.12.1", features = ["wayland", "file_watcher", "trace"] }
bevy = { version = "0.14.0", default-features = false, features = [
"bevy_asset",
"bevy_audio",
"bevy_color",
"bevy_core_pipeline",
"bevy_gizmos",
"bevy_render",
"bevy_sprite",
"bevy_text",
"bevy_ui",
"bevy_winit",
"multi_threaded",
"png",
"sysinfo_plugin",
"x11",
"file_watcher",
"trace",
# "track_change_detection",
# "serialize"
# "bevy_dev_tools",
# "detailed_trace",
"dynamic_linking",
"wayland",
"wav",
] }
[profile.dev]
opt-level = 1

View file

@ -1,12 +1,72 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1721042469,
"narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "f451c19376071a90d8c58ab1a953c6e9840527fd",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1715787315,
"narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=",
"lastModified": 1722185531,
"narHash": "sha256-veKR07psFoJjINLC8RK4DiLniGGMgF3QMlS4tb74S6k=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5",
"rev": "52ec9ac3b12395ad677e8b62106f0b98c1f8569d",
"type": "github"
},
"original": {
@ -16,8 +76,25 @@
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1720386169,
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"git-hooks": "git-hooks",
"nixpkgs": "nixpkgs"
}
}

View file

@ -1,46 +1,74 @@
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
git-hooks.url = "github:cachix/git-hooks.nix";
git-hooks.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
self,
git-hooks,
nixpkgs,
}: let
inherit (self) outputs;
supportedSystems = ["x86_64-linux"];
forEachSupportedSystem = nixpkgs.lib.genAttrs supportedSystems;
inherit (outputs) overlays;
systems = ["aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
forSystems = nixpkgs.lib.genAttrs systems;
pkgsFor = system: (import nixpkgs {inherit system;}).extend overlays.default;
genPkgs = func: (forSystems (system: func (pkgsFor system)));
in {
devShells = forEachSupportedSystem (system: let
pkgs = import nixpkgs {inherit system;};
in {
# TODO: maybe use nightly?
# https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/rust.section.md#using-rust-nightly-with-nix-shell-using-rust-nightly-with-nix-shell
# TODO: packages
# TODO: checks
rust-dev = pkgs.mkShell rec {
nativeBuildInputs = with pkgs; [pkg-config];
checks = genPkgs ({system, ...}: {
git-hooks = git-hooks.lib.${system}.run {
src = ./.;
hooks = {
alejandra.enable = true;
cargo-check.enable = true;
clippy.enable = true;
rustfmt.enable = true;
};
};
});
packages = genPkgs (pkgs: {
kodotag = pkgs.rustPlatform.buildRustPackage {
pname = "kodotag";
version = "0.1.0";
nativeBuildInputs = with pkgs; [
pkg-config
];
buildInputs = with pkgs; [
clang
cargo
rustc
rustfmt
rustPackages.clippy
rust-analyzer
mold
# source: https://github.com/bevyengine/bevy/blob/main/docs/linux_dependencies.md#nix
udev
alsa-lib
vulkan-loader
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
rust-analyzer
mold
udev
alsa-lib
vulkan-loader
libxkbcommon
wayland
];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
src = ./.;
hash = pkgs.lib.fakeHash;
cargoHash = "sha256-W7VQlMktGsRPQL9VGVmxYV6C5u2eJ48S7eTpOM+3n8U=";
};
default = outputs.devShells.${system}.rust-dev;
default = outputs.packages.${pkgs.system}.kodotag;
});
overlays = {
default = final: prev: {};
};
formatter = genPkgs (p: p.alejandra);
};
}