Upgraded the Nix install to work with Astal (#587)

* Upgraded the Nix install to work with Astal

* Removed pkgs.esbuild

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

* Removed pkgs.bun

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

* Added new dependencies to flake.nix

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

* Update tsconfig.json

---------

Co-authored-by: orangc <orangc@proton.me>
Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
This commit is contained in:
Thomas Carey
2024-12-22 07:44:45 +00:00
committed by GitHub
parent 48faf52e59
commit 3e2f641237
5 changed files with 134 additions and 160 deletions

103
flake.lock generated
View File

@@ -2,34 +2,73 @@
"nodes": {
"ags": {
"inputs": {
"nixpkgs": "nixpkgs",
"systems": "systems"
"astal": "astal",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1728326430,
"narHash": "sha256-tV1ABHuA1HItMdCTuNdA8fMB+qw7LpjvI945VwMSABI=",
"owner": "Aylur",
"lastModified": 1734091628,
"narHash": "sha256-8O3i8zESjHVsGzyXb8gEpLztvANq3Ot5bwo60YKJc7k=",
"owner": "aylur",
"repo": "ags",
"rev": "60180a184cfb32b61a1d871c058b31a3b9b0743d",
"rev": "27cd93147aba09142fa585fd16f13c56268b696c",
"type": "github"
},
"original": {
"owner": "Aylur",
"owner": "aylur",
"repo": "ags",
"type": "github"
}
},
"astal": {
"inputs": {
"nixpkgs": [
"ags",
"nixpkgs"
]
},
"locked": {
"lastModified": 1733520119,
"narHash": "sha256-6K07ZJTnFu1xASBCMtVc9cFTbBEauwSc7gGBmjLkLSk=",
"owner": "aylur",
"repo": "astal",
"rev": "4c19d8d06fa25cc6389f37abe8839b4d8be5c0d6",
"type": "github"
},
"original": {
"owner": "aylur",
"repo": "astal",
"type": "github"
}
},
"astal_2": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1734814417,
"narHash": "sha256-R+tLGIxlaqsOmV52TdXHP0u33q5PdJ77gtiUPK5BbMg=",
"owner": "aylur",
"repo": "astal",
"rev": "3468763d51d389c67ec7b1a390ffa8a5328bddb6",
"type": "github"
},
"original": {
"owner": "aylur",
"repo": "astal",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1725634671,
"narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=",
"owner": "NixOS",
"lastModified": 1733581040,
"narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c",
"rev": "22c3f2cf41a0e70184334a958e6b124fb0ce3e01",
"type": "github"
},
"original": {
"owner": "NixOS",
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
@@ -37,11 +76,27 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1732758367,
"narHash": "sha256-RzaI1RO0UXqLjydtz3GAXSTzHkpb/lLD1JD8a0W4Wpo=",
"lastModified": 1734424634,
"narHash": "sha256-cHar1vqHOOyC7f1+tVycPoWTfKIaqkoe1Q6TnKzuti4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "fa42b5a5f401aab8a32bd33c9a4de0738180dc59",
"rev": "d3c42f187194c26d9f0309a8ecc469d6c878ce33",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1734649271,
"narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d70bd19e0a38ad4790d3913bf08fcbfc9eeca507",
"type": "github"
},
"original": {
@@ -54,22 +109,8 @@
"root": {
"inputs": {
"ags": "ags",
"nixpkgs": "nixpkgs_2"
}
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
"astal": "astal_2",
"nixpkgs": "nixpkgs_3"
}
}
},

124
flake.nix
View File

@@ -1,78 +1,76 @@
{
description = "A Bar/Panel for Hyprland with extensive customizability.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
ags.url = "github:Aylur/ags";
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
ags.url = "github:aylur/ags";
astal.url = "github:aylur/astal";
};
outputs = inputs: let
outputs = { self, nixpkgs, ags, astal }: let
systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
"aarch64-linux"
];
forEachSystem = inputs.nixpkgs.lib.genAttrs systems;
pkgsFor = forEachSystem (
system:
import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
}
);
devShellFor = system:
inputs.nixpkgs.lib.genAttrs ["default"] (
_:
inputs.nixpkgs.legacyPackages.${system}.mkShell {
buildInputs = [
pkgsFor.${system}.esbuild
pkgsFor.${system}.fish
pkgsFor.${system}.typescript
pkgsFor.${system}.bun
pkgsFor.${system}.libnotify
pkgsFor.${system}.dart-sass
pkgsFor.${system}.fd
pkgsFor.${system}.btop
pkgsFor.${system}.bluez
pkgsFor.${system}.libgtop
pkgsFor.${system}.gobject-introspection
pkgsFor.${system}.glib
pkgsFor.${system}.bluez-tools
pkgsFor.${system}.grimblast
pkgsFor.${system}.gpu-screen-recorder
pkgsFor.${system}.brightnessctl
pkgsFor.${system}.gnome-bluetooth
pkgsFor.${system}.python3
pkgsFor.${system}.matugen
inputs.ags.packages.${system}.agsWithTypes
];
nativeBuildInputs = with pkgsFor.${system}; [
nixfmt-rfc-style
nil
];
shellHook = ''
export GDK_BACKEND=wayland
export GI_TYPELIB_PATH=${pkgsFor.${system}.libgtop}/lib/girepository-1.0:${pkgsFor.${system}.glib}/lib/girepository-1.0:$GI_TYPELIB_PATH
'';
}
);
forEachSystem = nixpkgs.lib.genAttrs systems;
in {
devShells = forEachSystem devShellFor;
packages = forEachSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = ags.lib.bundle {
inherit pkgs;
src = ./.;
name = "hyprpanel"; # name of executable
entry = "app.ts";
overlay = final: prev: {
hyprpanel =
if final ? callPackage
then (final.callPackage ./nix {inherit inputs;}).desktop.script
else inputs.self.packages.${prev.stdenv.system}.default;
# additional libraries and executables to add to gjs' runtime
extraPackages = [
ags.packages.${system}.agsFull
astal.packages.${system}.tray
astal.packages.${system}.hyprland
astal.packages.${system}.io
astal.packages.${system}.apps
astal.packages.${system}.battery
astal.packages.${system}.bluetooth
astal.packages.${system}.mpris
astal.packages.${system}.network
astal.packages.${system}.notifd
astal.packages.${system}.powerprofiles
astal.packages.${system}.wireplumber
pkgs.fish
pkgs.typescript
pkgs.libnotify
pkgs.dart-sass
pkgs.fd
pkgs.btop
pkgs.bluez
pkgs.libgtop
pkgs.gobject-introspection
pkgs.glib
pkgs.bluez-tools
pkgs.grimblast
pkgs.gpu-screen-recorder
pkgs.brightnessctl
pkgs.gnome-bluetooth
pkgs.python3
pkgs.matugen
pkgs.python312Packages.gpustat
pkgs.hyprpicker
pkgs.hyprsunset
pkgs.hypridle
pkgs.wireplumber
pkgs.networkmanager
pkgs.upower
pkgs.gvfs
pkgs.swww
pkgs.pywal
];
};
});
# Define .overlay to expose the package as pkgs.hyprpanel based on the system
overlay = final: prev: {
hyprpanel = self.packages.${prev.stdenv.system}.default;
};
packages = forEachSystem (
system: let
pkgs = pkgsFor.${system};
in {
default = (pkgs.callPackage ./nix {inherit inputs;}).desktop.script;
}
);
};
}

View File

@@ -1,65 +0,0 @@
{
inputs,
pkgs,
system,
stdenv,
lib,
writeShellScriptBin,
bun,
dart-sass,
fd,
accountsservice,
btop,
pipewire,
bluez,
bluez-tools,
grimblast,
gpu-screen-recorder,
networkmanager,
brightnessctl,
gnome-bluetooth,
matugen,
swww,
python3,
libgtop,
gobject-introspection,
glib,
}: 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 -r themes $out
cp -r scripts $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 networkmanager matugen swww grimblast gpu-screen-recorder brightnessctl gnome-bluetooth python3]}
export GI_TYPELIB_PATH=${libgtop}/lib/girepository-1.0:${glib}/lib/girepository-1.0:$GI_TYPELIB_PATH
${ags}/bin/ags -b hyprpanel -c ${config}/config.js $@
'';
};
}

View File

@@ -1,6 +1,6 @@
import GLib from 'gi://GLib?version=2.0';
import options from '../options';
import Wallpaper from '../services/Wallpaper';
import Wallpaper from 'src/services/Wallpaper';
const { EXISTS, IS_REGULAR } = GLib.FileTest;
const { enable: enableWallpaper, image } = options.wallpaper;

View File

@@ -1,7 +1,7 @@
import icons from '../lib/icons/icons';
import { bash, dependencies, Notify, isAnImage } from '../lib/utils';
import options from '../options';
import Wallpaper from '../services/Wallpaper';
import Wallpaper from 'src/services/Wallpaper';
const { matugen } = options.theme;