flake reorg

This commit is contained in:
Robin Appelman 2025-02-25 19:54:59 +01:00
commit 2ccd57d27e
4 changed files with 82 additions and 212 deletions

View file

@ -1,64 +1,16 @@
name: "CI"
on:
pull_request:
push:
on: [push, pull_request]
name: Continuous integration
jobs:
check:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#check
clippy:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#clippy
test:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#test
semver:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v3
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
msrv:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#msrv
authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix flake check --keep-going

View file

@ -12,22 +12,22 @@ This crate implements a deserializer for serde, but because VDF doesn't map that
- Because the boolean values `0` and `1` can't be distinguished from numbers, it is not possible to use booleans in untagged enums.
- When deserializing arrays by settings the same key multiple times, the keys have to be consecutive.
```vdf
key: 1
key: 2
other: 3
```
will work, but
```vdf
key: 1
other: 3
key: 2
```
will not.
```vdf
key: 1
key: 2
other: 3
```
will work, but
```vdf
key: 1
other: 3
key: 2
```
will not.
### Tagged enum root
@ -48,6 +48,7 @@ or
```
can be deserialized into a
```rust
enum Data {
Variant1 {
@ -57,4 +58,4 @@ enum Data {
other: String,
}
}
```
```

108
flake.lock generated
View file

@ -1,63 +1,98 @@
{
"nodes": {
"naersk": {
"crane": {
"locked": {
"lastModified": 1739936662,
"narHash": "sha256-x4syUjNUuRblR07nDPeLDP7DpphaBVbUaSoeZkFbGSk=",
"owner": "ipetkov",
"repo": "crane",
"rev": "19de14aaeb869287647d9461cbd389187d8ecdb7",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flakelight": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1698420672,
"narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=",
"lastModified": 1740400913,
"narHash": "sha256-LjY3VwJ9+jK+LpqDkZE+PVVcXItLD9JJUEHwlW/+9+8=",
"owner": "nix-community",
"repo": "naersk",
"rev": "aeb58d5e8faead8980a807c840232697982d47b9",
"repo": "flakelight",
"rev": "134d3e81c01f37417178c8746340d8d2ccb62ff7",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "naersk",
"repo": "flakelight",
"type": "github"
}
},
"mill-scale": {
"inputs": {
"crane": "crane",
"flakelight": [
"flakelight"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1740345481,
"narHash": "sha256-1lAgc6UhpYTHwKm88BUNSnC9nlT4a00rc6UmaE2n0LY=",
"owner": "icewind1991",
"repo": "mill-scale",
"rev": "582f15f238322a7f9c129aa5adef12dde3f0a5ce",
"type": "github"
},
"original": {
"owner": "icewind1991",
"repo": "mill-scale",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1702346276,
"narHash": "sha256-eAQgwIWApFQ40ipeOjVSoK4TEHVd6nbSd9fApiHIw5A=",
"lastModified": 1740339700,
"narHash": "sha256-cbrw7EgQhcdFnu6iS3vane53bEagZQy/xyIkDWpCgVE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "cf28ee258fd5f9a52de6b9865cdb93a1f96d09b7",
"rev": "04ef94c4c1582fd485bbfdb8c4a8ba250e359195",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-23.11",
"ref": "nixos-24.11",
"type": "indirect"
}
},
"root": {
"inputs": {
"naersk": "naersk",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"utils": "utils"
"flakelight": "flakelight",
"mill-scale": "mill-scale",
"nixpkgs": "nixpkgs"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": [
"utils"
],
"nixpkgs": [
"mill-scale",
"flakelight",
"nixpkgs"
]
},
"locked": {
"lastModified": 1702520151,
"narHash": "sha256-jxJWosN7hgcW+dFT8V3EBDCYUOjv5tpjEBRmlakS7tU=",
"lastModified": 1740277845,
"narHash": "sha256-NNU0CdiaSbAeZ8tpDG4aFi9qtcdlItRvk8Xns9oBrVU=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "d6a1d8f80dbcda4c13993b859a3574c3dde61072",
"rev": "f933070c29f9c1c5457447a51903f27f76ebb519",
"type": "github"
},
"original": {
@ -65,39 +100,6 @@
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",

111
flake.nix
View file

@ -1,102 +1,17 @@
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
naersk.inputs.nixpkgs.follows = "nixpkgs";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
rust-overlay.inputs.flake-utils.follows = "utils";
nixpkgs.url = "nixpkgs/nixos-24.11";
flakelight = {
url = "github:nix-community/flakelight";
inputs.nixpkgs.follows = "nixpkgs";
};
mill-scale = {
url = "github:icewind1991/mill-scale";
inputs.flakelight.follows = "flakelight";
};
};
outputs = {
self,
nixpkgs,
utils,
naersk,
rust-overlay,
}:
utils.lib.eachDefaultSystem (system: let
overlays = [(import rust-overlay)];
pkgs = (import nixpkgs) {
inherit system overlays;
};
inherit (pkgs) lib callPackage rust-bin mkShell;
inherit (lib.sources) sourceByRegex;
msrv = (fromTOML (readFile ./Cargo.toml)).package.rust-version;
inherit (builtins) fromTOML readFile;
toolchain = rust-bin.stable.latest.default;
msrvToolchain = rust-bin.stable."${msrv}".default;
naersk' = callPackage naersk {
rustc = toolchain;
cargo = toolchain;
};
msrvNaersk = callPackage naersk {
rustc = msrvToolchain;
cargo = msrvToolchain;
};
src = sourceByRegex ./. ["Cargo.*" "(src|derive|benches|tests|examples|koth_bagel.*)(/.*)?"];
nearskOpt = {
pname = "vbsp";
root = src;
};
in rec {
packages = {
check = naersk'.buildPackage (nearskOpt
// {
mode = "check";
});
clippy = naersk'.buildPackage (nearskOpt
// {
mode = "clippy";
});
test = naersk'.buildPackage (nearskOpt
// {
release = false;
mode = "test";
});
msrv = msrvNaersk.buildPackage (nearskOpt
// {
mode = "check";
});
};
devShells = let
tools = with pkgs; [
bacon
cargo-edit
cargo-outdated
cargo-audit
cargo-msrv
cargo-semver-checks
cargo-insta
(writeShellApplication {
name = "cargo-fuzz";
runtimeInputs = [cargo-fuzz toolchain];
text = ''
# shellcheck disable=SC2068
RUSTC_BOOTSTRAP=1 cargo-fuzz $@
'';
})
(writeShellApplication {
name = "cargo-expand";
runtimeInputs = [cargo-expand toolchain];
text = ''
# shellcheck disable=SC2068
RUSTC_BOOTSTRAP=1 cargo-expand $@
'';
})
];
in {
default = mkShell {
nativeBuildInputs = [toolchain] ++ tools;
};
msrv = mkShell {
nativeBuildInputs = [msrvToolchain] ++ tools;
};
};
});
outputs = {mill-scale, ...}:
mill-scale ./. {
extraPaths = [./tests];
};
}