Merge pull request #6 from Zacharias-Brohn/nix_packaging

Nix packaging
This commit was merged in pull request #6.
This commit is contained in:
Zach
2026-02-08 18:15:15 +01:00
committed by GitHub
8 changed files with 332 additions and 3 deletions
+12 -1
View File
@@ -7,6 +7,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(ENABLE_MODULES "plugin;shell" CACHE STRING "Modules to build/install")
set(INSTALL_LIBDIR "usr/lib/ZShell" CACHE STRING "Library install dir")
set(INSTALL_QMLDIR "usr/lib/qt6/qml" CACHE STRING "QML install dir")
@@ -19,4 +20,14 @@ add_compile_options(
-Wunreachable-code
)
add_subdirectory(Plugins)
if("plugin" IN_LIST ENABLE_MODULES)
add_subdirectory(Plugins)
endif()
if("shell" IN_LIST ENABLE_MODULES)
foreach(dir assets scripts Components Config Modules Daemons Drawers Effects Helpers Paths)
install(DIRECTORY ${dir} DESTINATION "${INSTALL_QSCONFDIR}")
endforeach()
install(FILES shell.qml Bar.qml Wallpaper.qml DESTINATION "${INSTALL_QSCONFDIR}")
endif()
+1 -1
View File
@@ -20,7 +20,7 @@ function(qml_module arg_TARGET)
QMLDIR module_qmldir
TYPEINFO module_typeinfo
)
set(module_dir "/usr/lib/qt6/qml/${module_target_path}")
set(module_dir "${INSTALL_QMLDIR}/${module_target_path}")
install(TARGETS ${arg_TARGET} LIBRARY DESTINATION "${module_dir}" RUNTIME DESTINATION "${module_dir}")
install(TARGETS "${module_plugin_target}" LIBRARY DESTINATION "${module_dir}" RUNTIME DESTINATION "${module_dir}")
install(FILES "${module_qmldir}" DESTINATION "${module_dir}")
+64
View File
@@ -33,6 +33,70 @@ sudo ninja -C build install
This installs the QML plugin to `/usr/lib/qt6/qml`.
### NixOS
In your flake.nix file, add the following in your inputs.
```nix
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
z-bar-qt = {
url = "github:Zacharias-Brohn/z-bar-qt/";
inputs.nixpkgs.follows = "nixpkgs";
};
};
```
Below a full example of what it could look like.
```nix
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
z-bar-qt = {
url = "github:Zacharias-Brohn/z-bar-qt/";
inputs.nixpkgs.follows = "nixpgks";
};
};
outputs =
inputs@{
nixpkgs,
self,
...
}:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
in
{
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs;
inherit system;
};
modules = [
./configuration.nix
];
};
};
}
```
Now you can add z-bar-qt as a nixpkgs in environment.systemPackages (or optionally in your homePackages).
```nix
{ pkgs, inputs, ... }:
{
environment.systemPackages = with pkgs; [
inputs.z-bar-qt.packages.${system}.zshell
];
}
```
You can now run ```zshell``` to run the bar.
## Configuration
Configuration is stored in `~/.config/z-bar/config.json`. Options include:
Generated
+48
View File
@@ -0,0 +1,48 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1770197578,
"narHash": "sha256-AYqlWrX09+HvGs8zM6ebZ1pwUqjkfpnv8mewYwAo+iM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "00c21e4c93d963c50d4c0c89bfa84ed6e0694df2",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"quickshell": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1769593411,
"narHash": "sha256-WW00FaBiUmQyxvSbefvgxIjwf/WmRrEGBbwMHvW/7uQ=",
"ref": "refs/heads/master",
"rev": "1e4d804e7f3fa7465811030e8da2bf10d544426a",
"revCount": 732,
"type": "git",
"url": "https://git.outfoxxed.me/outfoxxed/quickshell"
},
"original": {
"type": "git",
"url": "https://git.outfoxxed.me/outfoxxed/quickshell"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"quickshell": "quickshell"
}
}
},
"root": "root",
"version": 7
}
+57
View File
@@ -0,0 +1,57 @@
{
description = "Flake for zshell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
quickshell = {
url = "git+https://git.outfoxxed.me/outfoxxed/quickshell";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
...
}@inputs:
let
forAllSystems =
fn: nixpkgs.lib.genAttrs nixpkgs.lib.platforms.linux (system: fn nixpkgs.legacyPackages.${system});
in
{
formatter = forAllSystems (pkgs: pkgs.nixfmt);
packages = forAllSystems (pkgs: rec {
zshell = pkgs.callPackage ./nix {
rev = self.rev or self.dirtyRev;
stdenv = pkgs.clangStdenv;
quickshell = inputs.quickshell.packages.${pkgs.stdenv.hostPlatform.system}.default.override {
withX11 = false;
withI3 = false;
};
app2unit = pkgs.callPackage ./nix/app2unit.nix { inherit pkgs; };
};
default = zshell;
});
devShells = forAllSystems (pkgs: {
default =
let
shell = self.packages.${pkgs.stdenv.hostPlatform.system}.zshell;
in
pkgs.mkShell.override { stdenv = shell.stdenv; } {
inputsFrom = [
shell
shell.Plugins
];
packages = with pkgs; [
material-symbols
rubik
nerd-fonts.caskaydia-cove
];
};
});
};
}
+16
View File
@@ -0,0 +1,16 @@
{
pkgs, # To ensure the nixpkgs version of app2unit
fetchFromGitHub,
...
}:
pkgs.app2unit.overrideAttrs (
final: prev: rec {
version = "1.0.3"; # Fix old issue related to missing env var
src = fetchFromGitHub {
owner = "Vladimir-csp";
repo = "app2unit";
tag = "v${version}";
hash = "sha256-7eEVjgs+8k+/NLteSBKgn4gPaPLHC+3Uzlmz6XB0930=";
};
}
)
+133
View File
@@ -0,0 +1,133 @@
{
rev,
lib,
stdenv,
makeWrapper,
makeFontsConf,
app2unit,
networkmanager,
swappy,
wl-clipboard,
libqalculate,
bash,
hyprland,
material-symbols,
rubik,
nerd-fonts,
qt6,
quickshell,
aubio,
pipewire,
cmake,
ninja,
pkg-config,
}:
let
version = "1.0.0";
runtimeDeps = [
app2unit
networkmanager
swappy
wl-clipboard
libqalculate
bash
hyprland
];
fontconfig = makeFontsConf {
fontDirectories = [
material-symbols
rubik
nerd-fonts.caskaydia-cove
];
};
cmakeBuildType = "RelWithDebInfo";
cmakeVersionFlags = [
(lib.cmakeFeature "VERSION" version)
(lib.cmakeFeature "GIT_REVISION" rev)
(lib.cmakeFeature "DISTRIBUTOR" "nix-flake")
];
plugin = stdenv.mkDerivation {
inherit cmakeBuildType;
name = "zshell-qml-plugin";
src = lib.fileset.toSource {
root = ./..;
fileset = lib.fileset.union ./../CMakeLists.txt ./../Plugins;
};
nativeBuildInputs = [
cmake
ninja
pkg-config
];
buildInputs = [
qt6.qtbase
qt6.qtdeclarative
libqalculate
pipewire
aubio
];
dontWrapQtApps = true;
cmakeFlags = [
(lib.cmakeFeature "ENABLE_MODULES" "plugin")
(lib.cmakeFeature "INSTALL_QMLDIR" qt6.qtbase.qtQmlPrefix)
]
++ cmakeVersionFlags;
};
in
stdenv.mkDerivation {
inherit version cmakeBuildType;
pname = "zshell";
src = ./..;
nativeBuildInputs = [
cmake
ninja
makeWrapper
qt6.wrapQtAppsHook
];
buildInputs = [
quickshell
plugin
qt6.qtbase
qt6.qtwayland
];
propagatedBuildInputs = runtimeDeps;
cmakeFlags = [
(lib.cmakeFeature "ENABLE_MODULES" "shell")
(lib.cmakeFeature "INSTALL_QSCONFDIR" "${placeholder "out"}/share/ZShell")
]
++ cmakeVersionFlags;
prePatch = ''
substituteInPlace shell.qml \
--replace-fail 'ShellRoot {' 'ShellRoot { settings.watchFiles: false'
'';
postInstall = ''
makeWrapper ${quickshell}/bin/qs $out/bin/zshell \
--prefix PATH : "${lib.makeBinPath runtimeDeps}" \
--set FONTCONFIG_FILE "${fontconfig}" \
--add-flags "-p $out/share/ZShell"
echo "$out"
mkdir -p $out/lib
'';
passthru = {
inherit plugin;
};
meta = {
description = "A very segsy desktop shell";
homepage = "https://github.com/Zacharias-Brohn/z-bar-qt";
license = lib.licenses.gpl3Only;
mainProgram = "zshell";
};
}
+1 -1
View File
@@ -7,7 +7,7 @@ import qs.Modules.Lock as Lock
import qs.Helpers
import qs.Modules.Polkit
Scope {
ShellRoot {
Bar {}
Wallpaper {}
Launcher {}