Merge pull request #66 from yavko/add-nix-flags

Add initial nix flags impl
This commit is contained in:
Jake Stanger 2023-03-01 12:55:25 +00:00 committed by GitHub
commit 1d37e010c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 13 deletions

View File

@ -70,6 +70,7 @@ Here is an example nix flake that uses Ironbar.
enable = true; enable = true;
config = {}; config = {};
style = ""; style = "";
package = inputs.ironbar.packageBuilder ["feature" "another_feature"];
}; };
} }
]; ];

View File

@ -31,6 +31,15 @@
]; ];
}; };
mkRustToolchain = pkgs: pkgs.rust-bin.stable.latest.default; mkRustToolchain = pkgs: pkgs.rust-bin.stable.latest.default;
# defaultFeatures = [
# "http"
# "config+all"
# "clock"
# "music+all"
# "sys_info"
# "tray"
# "workspaces+all"
# ];
in { in {
overlays.default = final: prev: let overlays.default = final: prev: let
rust = mkRustToolchain final; rust = mkRustToolchain final;
@ -40,26 +49,33 @@
rustc = rust; rustc = rust;
}; };
in { in {
ironbar = rustPlatform.buildRustPackage { ironbar = features:
pname = "ironbar"; rustPlatform.buildRustPackage {
version = self.rev or "dirty"; pname = "ironbar";
src = builtins.path { version = self.rev or "dirty";
name = "ironbar"; src = builtins.path {
path = prev.lib.cleanSource ./.; name = "ironbar";
path = prev.lib.cleanSource ./.;
};
buildNoDefaultFeatures =
if features == []
then false
else true;
buildFeatures = features;
cargoDeps = rustPlatform.importCargoLock {lockFile = ./Cargo.lock;};
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = with prev; [pkg-config];
buildInputs = with prev; [gtk3 gdk-pixbuf gtk-layer-shell libxkbcommon openssl];
}; };
cargoDeps = rustPlatform.importCargoLock {lockFile = ./Cargo.lock;};
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = with prev; [pkg-config];
buildInputs = with prev; [gtk3 gdk-pixbuf gtk-layer-shell libxkbcommon openssl];
};
}; };
packageBuilder = genSystems (system: self.packages.${system}.ironbar);
packages = genSystems ( packages = genSystems (
system: let system: let
pkgs = pkgsFor system; pkgs = pkgsFor system;
in in
(self.overlays.default pkgs pkgs) (self.overlays.default pkgs pkgs)
// { // {
default = self.packages.${system}.ironbar; default = self.packages.${system}.ironbar [];
} }
); );
devShells = genSystems (system: let devShells = genSystems (system: let
@ -87,7 +103,7 @@
... ...
}: let }: let
cfg = config.programs.ironbar; cfg = config.programs.ironbar;
defaultIronbarPackage = self.packages.${pkgs.hostPlatform.system}.default; defaultIronbarPackage = self.packages.${pkgs.hostPlatform.system}.default [];
jsonFormat = pkgs.formats.json {}; jsonFormat = pkgs.formats.json {};
in { in {
options.programs.ironbar = { options.programs.ironbar = {