Nix refactor (#93)

* default.nix -> nix/default.nix (to consolidate nix files)

* add esbuild to devShell

* nixpkgs-fmt -> nixfmt-rfc-style

nixpkgs-fmt is being deprecated

* format flake.nix and nix/default.nix w nixfmt-rfc-style

* have overlay and default callPackage on ./nix/default.nix

* Update flake.nix

Co-authored-by: orangc <orangc@proton.me>

* remove exports from shellHooks

* refactor overlay

* update BinPath in nix/default.nix

---------

Co-authored-by: orangc <orangc@proton.me>
This commit is contained in:
nebu
2024-08-18 16:22:00 -04:00
committed by GitHub
parent 6c8615c278
commit 05a7f130ef
2 changed files with 75 additions and 70 deletions

60
nix/default.nix Normal file
View File

@@ -0,0 +1,60 @@
{ inputs
, pkgs
, system
, stdenv
, lib
, writeShellScriptBin
, bun
, dart-sass
, fd
, accountsservice
, btop
, pipewire
, bluez
, bluez-tools
, grimblast
, gpu-screen-recorder
, networkmanager
, brightnessctl
, matugen
, swww
, python3
, gnome
}:
let
ags = inputs.ags.packages.${system}.default.override {
extraPackages = [ accountsservice ];
};
pname = "hyprpanel";
config = stdenv.mkDerivation {
inherit pname;
version = "latest";
src = ./.;
buildPhase = ''
${bun}/bin/bun build ./main.ts \
--outfile main.js \
--external "resource://*" \
--external "gi://*"
'';
installPhase = ''
mkdir $out
cp -r assets $out
cp -r scss $out
cp -r widget $out
cp -r services $out
cp -f main.js $out/config.js
'';
};
in
{
desktop = {
inherit config;
script = writeShellScriptBin pname ''
export PATH=$PATH:${lib.makeBinPath [dart-sass fd btop pipewire bluez bluez-tools grimblast gpu-screen-recorder brightnessctl gnome.gnome-bluetooth python3]}
${ags}/bin/ags -b hyprpanel -c ${config}/config.js $@
'';
};
}