fix: refactor and fix flake (#1038)

* fix: refactor flake

* chore: update flake.lock

* chore: update changelog

* chore: update flake.lock

* chore: update changelog
This commit is contained in:
Wölfchen 2024-04-21 20:09:14 +00:00 committed by GitHub
parent 8397744f40
commit acf57a8396
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 43 additions and 49 deletions

View file

@ -4,6 +4,9 @@ All notable changes to eww will be listed here, starting at changes since versio
## Unreleased ## Unreleased
### Fixes
- Fix and refactor nix flake (By: w-lfchen)
## [0.6.0] (21.04.2024) ## [0.6.0] (21.04.2024)
### Fixes ### Fixes

12
flake.lock generated
View file

@ -36,11 +36,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1708407374, "lastModified": 1709038661,
"narHash": "sha256-EECzarm+uqnNDCwaGg/ppXCO11qibZ1iigORShkkDf0=", "narHash": "sha256-Ys611iT6pChGv954aa4f8oKoDKJG3IXjJjPhnj6uaLY=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f33dd27a47ebdf11dc8a5eb05e7c8fbdaf89e73f", "rev": "8520c158aee718c6e87b56881105fc4223c3c723",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -65,11 +65,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1708395022, "lastModified": 1708999822,
"narHash": "sha256-pxHZbfDsLAAcyWz+snbudxhQPlAnK2nWGAqRx11veac=", "narHash": "sha256-X55GxqI3oDEfqy38Pt7xyypYNly4bkd/RajFE+FGn+A=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "b4ae18c03af976549a0b6e396b2b5be56d275f8b", "rev": "1a618c62479a6896ac497aaa0d969c6bd8e24911",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -13,46 +13,49 @@
outputs = { self, nixpkgs, rust-overlay, flake-compat }: outputs = { self, nixpkgs, rust-overlay, flake-compat }:
let let
pkgsFor = system: overlays = [ (import rust-overlay) self.overlays.default ];
import nixpkgs { pkgsFor = system: import nixpkgs { inherit system overlays; };
inherit system;
overlays = [ self.overlays.default rust-overlay.overlays.default ];
};
targetSystems = [ "aarch64-linux" "x86_64-linux" ]; targetSystems = [ "aarch64-linux" "x86_64-linux" ];
mkRustToolchain = pkgs: mkRustToolchain = pkgs:
pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
in { in {
overlays.default = final: prev: overlays.default = final: prev: {
let inherit (self.packages.${prev.system}) eww eww-wayland;
rust = mkRustToolchain final; };
rustPlatform = prev.makeRustPlatform { packages = nixpkgs.lib.genAttrs targetSystems (system:
let
pkgs = pkgsFor system;
rust = mkRustToolchain pkgs;
rustPlatform = pkgs.makeRustPlatform {
cargo = rust; cargo = rust;
rustc = rust; rustc = rust;
}; };
in { version = (builtins.fromTOML
eww = (prev.eww.override { inherit rustPlatform; }).overrideAttrs (builtins.readFile ./crates/eww/Cargo.toml)).package.version;
(old: { in rec {
version = self.rev or "dirty"; eww = rustPlatform.buildRustPackage {
src = builtins.path { version = "${version}-dirty";
name = "eww"; pname = "eww";
path = prev.lib.cleanSource ./.;
};
cargoDeps =
rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
patches = [ ];
# remove this when nixpkgs includes it
buildInputs = old.buildInputs ++ [ final.libdbusmenu-gtk3 ];
});
eww-wayland = final.eww; src = ./.;
}; cargoLock.lockFile = ./Cargo.lock;
cargoBuildFlags = [ "--bin" "eww" ];
packages = nixpkgs.lib.genAttrs targetSystems (system: nativeBuildInputs = with pkgs; [ pkg-config wrapGAppsHook ];
let pkgs = pkgsFor system; buildInputs = with pkgs; [
in (self.overlays.default pkgs pkgs) // { gtk3
default = self.packages.${system}.eww; librsvg
gtk-layer-shell
libdbusmenu-gtk3
];
};
eww-wayland = nixpkgs.lib.warn
"`eww-wayland` is deprecated due to eww building with both X11 and wayland support by default. Use `eww` instead."
eww;
default = eww;
}); });
devShells = nixpkgs.lib.genAttrs targetSystems (system: devShells = nixpkgs.lib.genAttrs targetSystems (system:
@ -61,20 +64,8 @@
rust = mkRustToolchain pkgs; rust = mkRustToolchain pkgs;
in { in {
default = pkgs.mkShell { default = pkgs.mkShell {
packages = with pkgs; [ inputsFrom = [ self.packages.${system}.eww ];
rust packages = with pkgs; [ deno mdbook ];
rust-analyzer-unwrapped
gcc
glib
gdk-pixbuf
librsvg
libdbusmenu-gtk3
gtk3
gtk-layer-shell
pkg-config
deno
mdbook
];
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library"; RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
}; };