mirror of
https://github.com/RGBCube/Site
synced 2025-08-02 14:07:47 +00:00
Switch to crane
This commit is contained in:
parent
80b2066222
commit
3950f840ad
5 changed files with 119 additions and 2806 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -1 +0,0 @@
|
|||
Cargo.nix linguist-language=GeneratedFileInvalidLanguageName
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,7 +2,6 @@
|
|||
|
||||
!src/
|
||||
|
||||
!.gitattributes
|
||||
!.gitignore
|
||||
|
||||
!*.css
|
||||
|
|
134
flake.lock
generated
134
flake.lock
generated
|
@ -1,59 +1,59 @@
|
|||
{
|
||||
"nodes": {
|
||||
"cargo2nix": {
|
||||
"advisory-db": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1703184318,
|
||||
"narHash": "sha256-vx2/goSpegxiFc7e1jKNHzBkhnsIQjriV4GZLaVe17M=",
|
||||
"owner": "rustsec",
|
||||
"repo": "advisory-db",
|
||||
"rev": "a5fb72de318a74eb69a2c241c0e46705684a35d0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rustsec",
|
||||
"repo": "advisory-db",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"crane": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703439018,
|
||||
"narHash": "sha256-VT+06ft/x3eMZ1MJxWzQP3zXFGcrxGo5VR2rB7t88hs=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "afdcd41180e3dfe4dac46b5ee396e3b12ccc967a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"fenix": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-overlay": "rust-overlay"
|
||||
"rust-analyzer-src": []
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1699033427,
|
||||
"narHash": "sha256-OVtd5IPbb4NvHibN+QvMrMxq7aZN5GFoINZSAXKjUdA=",
|
||||
"owner": "cargo2nix",
|
||||
"repo": "cargo2nix",
|
||||
"rev": "c6f33051f412352f293e738cc8da6fd4c457080f",
|
||||
"lastModified": 1703917281,
|
||||
"narHash": "sha256-fmhKbANx4PLG/Rt/QvKBsAdmyl8vAGQfROtccenMonw=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "8ad4353759945bec3a5f4bfc53efe818bb41e12a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cargo2nix",
|
||||
"repo": "cargo2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"flake-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",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
|
@ -75,51 +75,13 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"cargo2nix": "cargo2nix",
|
||||
"advisory-db": "advisory-db",
|
||||
"crane": "crane",
|
||||
"fenix": "fenix",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"tools": "tools"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"cargo2nix",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"cargo2nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1697336027,
|
||||
"narHash": "sha256-ctmmw7j4liyfSh63v9rdFZeIoNYCkCvgqvtEOB7KhX8=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "e494404d36a41247987eeb1bfc2f1ca903e97764",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"tools": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
|
86
flake.nix
86
flake.nix
|
@ -16,32 +16,86 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
cargo2nix = {
|
||||
url = "github:cargo2nix/cargo2nix";
|
||||
crane = {
|
||||
url = "github:ipetkov/crane";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
fenix = {
|
||||
url = "github:nix-community/fenix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.rust-analyzer-src.follows = "";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, tools, cargo2nix } @ inputs: tools.eachDefaultLinuxArch (system: let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
|
||||
overlays = [ cargo2nix.overlays.default ];
|
||||
advisory-db = {
|
||||
url = "github:rustsec/advisory-db";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
rustPackages = pkgs.rustBuilder.makePackageSet {
|
||||
rustVersion = "1.76.0";
|
||||
rustChannel = "nightly";
|
||||
rustProfile = "minimal";
|
||||
packageFun = import ./Cargo.nix;
|
||||
outputs = { self, nixpkgs, tools, fenix, advisory-db, ... } @ inputs: tools.eachDefaultLinuxArch (system: let
|
||||
lib = nixpkgs.lib;
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
toolchain = fenix.packages.${system}.complete.withComponents [
|
||||
"cargo"
|
||||
"clippy"
|
||||
"rust-src"
|
||||
"rustc"
|
||||
"rustfmt"
|
||||
];
|
||||
|
||||
crane = inputs.crane.lib.${system}.overrideToolchain toolchain;
|
||||
|
||||
cssFilter = path: type: builtins.match ".*css$" path != null;
|
||||
jsFilter = path: type: builtins.match ".*js$" path != null;
|
||||
assetFilter = path: type: type == "directory" && builtins.match "^assets.*" path != null;
|
||||
|
||||
src = lib.cleanSourceWith {
|
||||
src = crane.path ./.;
|
||||
filter = path: type: (crane.filterCargoSources path type)
|
||||
|| (cssFilter path type)
|
||||
|| (jsFilter path type)
|
||||
|| (assetFilter path type);
|
||||
};
|
||||
|
||||
srcArgs = {
|
||||
inherit src;
|
||||
};
|
||||
|
||||
commonArgs = srcArgs // {
|
||||
strictDeps = true;
|
||||
};
|
||||
|
||||
cargoArtifacts = crane.buildDepsOnly commonArgs;
|
||||
|
||||
site = crane.buildPackage (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
});
|
||||
in {
|
||||
devShells.${system}.default = rustPackages.workspaceShell {
|
||||
packages = [ cargo2nix.packages.${system}.default ];
|
||||
devShells.${system}.default = crane.devShell {};
|
||||
|
||||
checks.${system} = {
|
||||
inherit site;
|
||||
|
||||
clippy = crane.cargoClippy (commonArgs // {
|
||||
inherit cargoArtifacts;
|
||||
|
||||
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
||||
});
|
||||
|
||||
fmt = crane.cargoFmt srcArgs;
|
||||
|
||||
audit = crane.cargoAudit (srcArgs // {
|
||||
inherit advisory-db;
|
||||
});
|
||||
|
||||
deny = crane.cargoDeny srcArgs;
|
||||
};
|
||||
|
||||
packages = rec {
|
||||
site = rustPackages.workspace.site {};
|
||||
packages.${system} = {
|
||||
inherit site;
|
||||
|
||||
default = site;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue