Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Rust Overlay to flake to allow for latest stable Rust toolchain #82

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,28 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default-linux";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = {
self,
nixpkgs,
systems,
rust-overlay,
...
}: let
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs (import systems);
pkgsFor = eachSystem (system:
import nixpkgs {
inherit system;
overlays = [self.overlays.default];
overlays = [self.overlays.default (import rust-overlay)];
});
in {
overlays = import ./nix/overlays.nix {inherit self lib;};
overlays = import ./nix/overlays.nix {inherit self lib pkgsFor;};

packages = eachSystem (system: {
default = self.packages.${system}.wpaperd;
Expand All @@ -34,6 +39,9 @@
devShells = eachSystem (system:
with pkgsFor.${system}; {
default = mkShell {
buildInputs = [
rust-bin.stable.latest.default
];
packages = [
pkg-config
wayland
Expand Down
9 changes: 8 additions & 1 deletion nix/overlays.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
self,
lib,
pkgsFor
}: let
inherit ((builtins.fromTOML (builtins.readFile ../daemon/Cargo.toml)).package) version;
inherit ((builtins.fromTOML (builtins.readFile ../daemon/Cargo.toml)).package) version rust-overlay;

mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
Expand All @@ -16,6 +17,12 @@ in {
in {
wpaperd = final.callPackage ./default.nix {
version = "${version}+date=${date}_${self.shortRev or "dirty"}";
rustPlatform = let
toolchain = pkgsFor.${final.system}.rust-bin.stable.latest.default;
in (final.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
});
};
})
];
Expand Down