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;
config = {};
style = "";
package = inputs.ironbar.packageBuilder ["feature" "another_feature"];
};
}
];

View File

@ -31,6 +31,15 @@
];
};
mkRustToolchain = pkgs: pkgs.rust-bin.stable.latest.default;
# defaultFeatures = [
# "http"
# "config+all"
# "clock"
# "music+all"
# "sys_info"
# "tray"
# "workspaces+all"
# ];
in {
overlays.default = final: prev: let
rust = mkRustToolchain final;
@ -40,26 +49,33 @@
rustc = rust;
};
in {
ironbar = rustPlatform.buildRustPackage {
pname = "ironbar";
version = self.rev or "dirty";
src = builtins.path {
name = "ironbar";
path = prev.lib.cleanSource ./.;
ironbar = features:
rustPlatform.buildRustPackage {
pname = "ironbar";
version = self.rev or "dirty";
src = builtins.path {
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 (
system: let
pkgs = pkgsFor system;
in
(self.overlays.default pkgs pkgs)
// {
default = self.packages.${system}.ironbar;
default = self.packages.${system}.ironbar [];
}
);
devShells = genSystems (system: let
@ -87,7 +103,7 @@
...
}: let
cfg = config.programs.ironbar;
defaultIronbarPackage = self.packages.${pkgs.hostPlatform.system}.default;
defaultIronbarPackage = self.packages.${pkgs.hostPlatform.system}.default [];
jsonFormat = pkgs.formats.json {};
in {
options.programs.ironbar = {