diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f79ec88 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..546027a --- /dev/null +++ b/flake.nix @@ -0,0 +1,47 @@ +{ + 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 { + app2unit = pkgs.callPackage ./nix/app2unit.nix { inherit pkgs; }; + }); + + 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 + ]; + }; + }); + }; +} diff --git a/nix/app2unit.nix b/nix/app2unit.nix new file mode 100644 index 0000000..ce5fee2 --- /dev/null +++ b/nix/app2unit.nix @@ -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="; + }; + } +) diff --git a/nix/default.nix b/nix/default.nix new file mode 100644 index 0000000..9c3c27b --- /dev/null +++ b/nix/default.nix @@ -0,0 +1,132 @@ +{ + 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 + ]; + propagatedBuildInputs = runtimeDeps; + + cmakeFlags = [ + (lib.cmakeFeature "ENABLE_MODULES" "shell") + ] + ++ cmakeVersionFlags; + + prePatch = '' + substituteInPlace assets/pam.d/fprint \ + --replace-fail pam_fprintd.so /run/current-system/sw/lib/security/pam_fprintd.so + 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" + + 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"; + }; +}