Skip to content

Commit a334dac

Browse files
committed
Updated flake to crane
1 parent 81b8233 commit a334dac

3 files changed

Lines changed: 61 additions & 122 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/target
1+
/target/
2+
/result/

flake.lock

Lines changed: 23 additions & 83 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,57 @@
11
{
2+
description = "A start menu for Wayland-based window managers";
3+
24
inputs = {
3-
naersk.url = "github:nmattia/naersk/master";
4-
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5-
utils.url = "github:numtide/flake-utils";
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
crane.url = "github:ipetkov/crane";
68
};
79

810
outputs =
911
{
1012
self,
1113
nixpkgs,
12-
utils,
13-
naersk,
14+
crane,
15+
flake-utils,
1416
...
1517
}:
16-
utils.lib.eachDefaultSystem (
18+
flake-utils.lib.eachDefaultSystem (
1719
system:
1820
let
19-
pkgs = import nixpkgs { inherit system; };
20-
naersk-lib = pkgs.callPackage naersk { };
21+
pkgs = nixpkgs.legacyPackages.${system};
22+
craneLib = crane.mkLib pkgs;
2123
libPath = with pkgs; lib.makeLibraryPath [ wayland vulkan-loader ];
22-
in
23-
{
24-
defaultPackage = naersk-lib.buildPackage {
25-
src = ./.;
26-
doCheck = true;
27-
pname = "waystart";
28-
nativeBuildInputs = [ pkgs.makeWrapper ];
29-
buildInputs = with pkgs; [
30-
libxkbcommon
31-
];
32-
postInstall = ''
33-
wrapProgram "$out/bin/sixty-two" --prefix LD_LIBRARY_PATH : "${libPath}"
34-
'';
24+
25+
commonArgs = {
26+
src = craneLib.cleanCargoSource ./.;
27+
strictDeps = true;
28+
29+
buildInputs = with pkgs; [ makeWrapper libxkbcommon ];
3530
};
3631

37-
defaultApp = utils.lib.mkApp {
38-
drv = self.defaultPackage."${system}";
32+
waystart = craneLib.buildPackage (
33+
commonArgs
34+
// {
35+
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
36+
postInstall = ''
37+
wrapProgram "$out/bin/waystart" --prefix LD_LIBRARY_PATH : "${libPath}"
38+
'';
39+
}
40+
);
41+
in
42+
{
43+
checks = { inherit waystart; };
44+
packages.default = waystart;
45+
apps.default = flake-utils.lib.mkApp {
46+
drv = waystart;
3947
};
4048

41-
devShell =
42-
with pkgs;
43-
mkShell {
44-
buildInputs = [
45-
cargo
46-
rust-analyzer
47-
rustc
48-
rustfmt
49-
tokei
50-
libxkbcommon
51-
];
49+
devShells.default = craneLib.devShell {
50+
checks = self.checks.${system};
5251

53-
RUST_SRC_PATH = rustPlatform.rustLibSrc;
54-
LD_LIBRARY_PATH = libPath;
55-
GIT_EXTERNAL_DIFF = "${difftastic}/bin/difft";
56-
};
52+
packages = with pkgs; [ libxkbcommon ];
53+
LD_LIBRARY_PATH = libPath;
54+
};
5755
}
5856
);
5957
}

0 commit comments

Comments
 (0)