Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
e489d9f812 |
|||
|
9b308d6b54 |
|||
|
4d21ca0e6f |
|||
|
459eac3fff |
|||
|
e9847f58c7 |
|||
|
8ead7e6eb0 |
|||
|
9c3419782b |
|||
|
27f6371c2c |
|||
|
0095d05e80 |
2 changed files with 37 additions and 74 deletions
16
flake.lock
generated
16
flake.lock
generated
|
|
@ -1,20 +1,5 @@
|
|||
{
|
||||
"nodes": {
|
||||
"crane": {
|
||||
"locked": {
|
||||
"lastModified": 1785782307,
|
||||
"narHash": "sha256-MPaRdVkf6zZP5fCPxYCi8Dr4pZzgmXzg8T9nVEbp3Mw=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "2c71e194474d13de031d729b729c968ddbe3507f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
|
|
@ -48,7 +33,6 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
|
|
|
|||
75
flake.nix
75
flake.nix
|
|
@ -2,8 +2,6 @@
|
|||
inputs = {
|
||||
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";
|
||||
|
||||
crane.url = "github:ipetkov/crane";
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
|
|
@ -14,7 +12,6 @@
|
|||
let
|
||||
pkgs = import inputs.nixpkgs { inherit system; };
|
||||
lib = pkgs.lib;
|
||||
craneLib = inputs.crane.mkLib pkgs;
|
||||
|
||||
cargoToml = fromTOML (builtins.readFile ./Cargo.toml);
|
||||
name = cargoToml.package.name;
|
||||
|
|
@ -36,26 +33,6 @@
|
|||
wayland
|
||||
];
|
||||
|
||||
commonArgs = {
|
||||
# all that's needed for artifacts and checks
|
||||
nativeBuildInputs = with pkgs; [
|
||||
# pkg-config
|
||||
];
|
||||
buildInputs = with pkgs; [
|
||||
];
|
||||
|
||||
strictDeps = true;
|
||||
__structuredAttrs = true;
|
||||
|
||||
src = ./.;
|
||||
};
|
||||
|
||||
# Build *just* the cargo dependencies,
|
||||
# to reuse them for build and test derivations.
|
||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||
|
||||
# Build the actual crate itself,
|
||||
# reusing the dependency artifacts from above.
|
||||
crate =
|
||||
let
|
||||
desktopItem = pkgs.makeDesktopItem {
|
||||
|
|
@ -64,48 +41,50 @@
|
|||
exec = name;
|
||||
};
|
||||
in
|
||||
craneLib.buildPackage (
|
||||
commonArgs
|
||||
// {
|
||||
inherit cargoArtifacts;
|
||||
pkgs.rustPlatform.buildRustPackage rec {
|
||||
inherit name;
|
||||
|
||||
nativeBuildInputs = commonArgs.nativeBuildInputs ++ [
|
||||
pkgs.autoPatchelfHook
|
||||
src = lib.sourceFilesBySuffices ./. [
|
||||
"Cargo.toml"
|
||||
"Cargo.lock"
|
||||
".rs"
|
||||
];
|
||||
cargoLock.lockFile = "${src}/Cargo.lock";
|
||||
|
||||
buildInputs = commonArgs.buildInputs ++ [
|
||||
pkgs.libgcc
|
||||
nativeBuildInputs = with pkgs; [
|
||||
autoPatchelfHook
|
||||
];
|
||||
buildInputs = with pkgs; [
|
||||
libgcc
|
||||
];
|
||||
|
||||
runtimeDependencies = dlDeps;
|
||||
|
||||
doCheck = false;
|
||||
|
||||
postFixup = ''
|
||||
cp -rs "${desktopItem}"/* "$out"
|
||||
'';
|
||||
}
|
||||
);
|
||||
|
||||
doCheck = false;
|
||||
|
||||
strictDeps = true;
|
||||
__structuredAttrs = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
packages.default = crate;
|
||||
|
||||
checks = {
|
||||
crate-clippy = craneLib.cargoClippy (
|
||||
commonArgs
|
||||
// {
|
||||
inherit cargoArtifacts;
|
||||
|
||||
cargoClippyExtraArgs = "-- --deny warnings";
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
devShells.default = craneLib.devShell {
|
||||
devShells.default = pkgs.mkShell {
|
||||
env.LD_LIBRARY_PATH = lib.makeLibraryPath dlDeps;
|
||||
|
||||
inputsFrom = [ crate ];
|
||||
packages = [ pkgs.rust-analyzer ];
|
||||
|
||||
packages = with pkgs; [
|
||||
rustc
|
||||
cargo
|
||||
clippy
|
||||
rustfmt
|
||||
rust-analyzer
|
||||
];
|
||||
|
||||
strictDeps = true;
|
||||
__structuredAttrs = true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue