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
### Fixes
- Fix and refactor nix flake (By: w-lfchen)
## [0.6.0] (21.04.2024)
### Fixes

View File

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

View File

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