Skip to content

Commit

Permalink
Merge pull request #82 from chanman3388/fix/update-flake-with-rust-ov…
Browse files Browse the repository at this point in the history
…erlay

Add Rust Overlay to flake to allow for latest stable Rust toolchain
  • Loading branch information
danyspin97 authored Sep 3, 2024
2 parents b6677e8 + 3895f67 commit 62af439
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
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

0 comments on commit 62af439

Please sign in to comment.