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:
120
flake.nix
120
flake.nix
@@ -6,58 +6,74 @@
|
|||||||
ags.url = "github:Aylur/ags";
|
ags.url = "github:Aylur/ags";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, ... }@inputs:
|
outputs = inputs:
|
||||||
let
|
let
|
||||||
systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];
|
systems = [
|
||||||
forEachSystem = nixpkgs.lib.genAttrs systems;
|
"x86_64-linux"
|
||||||
pkgsFor = forEachSystem (system: import nixpkgs {
|
"x86_64-darwin"
|
||||||
inherit system;
|
"aarch64-darwin"
|
||||||
config.allowUnfree = true;
|
"aarch64-linux"
|
||||||
});
|
];
|
||||||
|
forEachSystem = inputs.nixpkgs.lib.genAttrs systems;
|
||||||
|
pkgsFor = forEachSystem (
|
||||||
|
system:
|
||||||
|
import inputs.nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
devShellFor = system: nixpkgs.lib.genAttrs [ "default" ] (_: nixpkgs.legacyPackages.${system}.mkShell {
|
devShellFor =
|
||||||
buildInputs = [
|
system:
|
||||||
pkgsFor.${system}.fish
|
inputs.nixpkgs.lib.genAttrs [ "default" ] (
|
||||||
pkgsFor.${system}.typescript
|
_:
|
||||||
pkgsFor.${system}.bun
|
inputs.nixpkgs.legacyPackages.${system}.mkShell {
|
||||||
pkgsFor.${system}.libnotify
|
buildInputs = [
|
||||||
pkgsFor.${system}.dart-sass
|
pkgsFor.${system}.esbuild
|
||||||
pkgsFor.${system}.fd
|
pkgsFor.${system}.fish
|
||||||
pkgsFor.${system}.btop
|
pkgsFor.${system}.typescript
|
||||||
pkgsFor.${system}.bluez
|
pkgsFor.${system}.bun
|
||||||
pkgsFor.${system}.bluez-tools
|
pkgsFor.${system}.libnotify
|
||||||
pkgsFor.${system}.grimblast
|
pkgsFor.${system}.dart-sass
|
||||||
pkgsFor.${system}.matugen
|
pkgsFor.${system}.fd
|
||||||
pkgsFor.${system}.swww
|
pkgsFor.${system}.btop
|
||||||
pkgsFor.${system}.gpu-screen-recorder
|
pkgsFor.${system}.bluez
|
||||||
pkgsFor.${system}.brightnessctl
|
pkgsFor.${system}.bluez-tools
|
||||||
pkgsFor.${system}.gnome.gnome-bluetooth
|
pkgsFor.${system}.grimblast
|
||||||
pkgsFor.${system}.python3
|
pkgsFor.${system}.gpu-screen-recorder
|
||||||
inputs.ags.packages.${system}.agsWithTypes
|
pkgsFor.${system}.brightnessctl
|
||||||
];
|
pkgsFor.${system}.gnome.gnome-bluetooth
|
||||||
nativeBuildInputs = with pkgsFor.${system}; [
|
pkgsFor.${system}.python3
|
||||||
nixpkgs-fmt
|
pkgsFor.${system}.matugen
|
||||||
nil
|
inputs.ags.packages.${system}.agsWithTypes
|
||||||
];
|
];
|
||||||
shellHook = ''
|
nativeBuildInputs = with pkgsFor.${system}; [
|
||||||
export GDK_BACKEND=wayland
|
nixfmt-rfc-style
|
||||||
'';
|
nil
|
||||||
});
|
];
|
||||||
in {
|
shellHook = ''
|
||||||
devShells = forEachSystem (system: devShellFor system);
|
export GDK_BACKEND=wayland
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShells = forEachSystem devShellFor;
|
||||||
|
|
||||||
overlay = forEachSystem(system:
|
overlay = final: prev: {
|
||||||
let
|
hyprpanel =
|
||||||
pkgs = pkgsFor.${system};
|
if final ? callPackage
|
||||||
in final: prev: {
|
then (final.callPackage ./nix { inherit inputs; }).desktop.script
|
||||||
hyprpanel = (pkgs.callPackage ./. { inherit inputs; }).desktop.script;
|
else inputs.self.packages.${prev.stdenv.system}.default;
|
||||||
});
|
};
|
||||||
|
packages = forEachSystem (
|
||||||
packages = forEachSystem(system:
|
system:
|
||||||
let
|
let
|
||||||
pkgs = pkgsFor.${system};
|
pkgs = pkgsFor.${system};
|
||||||
in {
|
in
|
||||||
default = (pkgs.callPackage ./. { inherit inputs; }).desktop.script;
|
{
|
||||||
});
|
default = (pkgs.callPackage ./nix { inherit inputs; }).desktop.script;
|
||||||
};
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
, pkgs
|
, pkgs
|
||||||
, system
|
, system
|
||||||
, stdenv
|
, stdenv
|
||||||
|
, lib
|
||||||
, writeShellScriptBin
|
, writeShellScriptBin
|
||||||
, bun
|
, bun
|
||||||
, dart-sass
|
, dart-sass
|
||||||
@@ -18,10 +19,11 @@
|
|||||||
, matugen
|
, matugen
|
||||||
, swww
|
, swww
|
||||||
, python3
|
, python3
|
||||||
|
, gnome
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
ags = inputs.ags.packages.${system}.default.override {
|
ags = inputs.ags.packages.${system}.default.override {
|
||||||
extraPackages = [accountsservice];
|
extraPackages = [ accountsservice ];
|
||||||
};
|
};
|
||||||
|
|
||||||
pname = "hyprpanel";
|
pname = "hyprpanel";
|
||||||
@@ -46,26 +48,13 @@ let
|
|||||||
cp -f main.js $out/config.js
|
cp -f main.js $out/config.js
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
desktop = {
|
desktop = {
|
||||||
inherit config;
|
inherit config;
|
||||||
script = writeShellScriptBin pname ''
|
script = writeShellScriptBin pname ''
|
||||||
export PATH=$PATH:${dart-sass}/bin
|
export PATH=$PATH:${lib.makeBinPath [dart-sass fd btop pipewire bluez bluez-tools grimblast gpu-screen-recorder brightnessctl gnome.gnome-bluetooth python3]}
|
||||||
export PATH=$PATH:${fd}/bin
|
${ags}/bin/ags -b hyprpanel -c ${config}/config.js $@
|
||||||
export PATH=$PATH:${btop}/bin
|
|
||||||
export PATH=$PATH:${pipewire}/bin
|
|
||||||
export PATH=$PATH:${bluez}/bin
|
|
||||||
export PATH=$PATH:${bluez-tools}/bin
|
|
||||||
export PATH=$PATH:${grimblast}/bin
|
|
||||||
export PATH=$PATH:${gpu-screen-recorder}/bin
|
|
||||||
export PATH=$PATH:${networkmanager}/bin
|
|
||||||
export PATH=$PATH:${brightnessctl}/bin
|
|
||||||
export PATH=$PATH:${matugen}/bin
|
|
||||||
export PATH=$PATH:${swww}/bin
|
|
||||||
export PATH=$PATH:${pkgs.gnome.gnome-bluetooth}/bin
|
|
||||||
export PATH=$PATH:${python3}/bin
|
|
||||||
export GDK_BACKEND=wayland
|
|
||||||
${ags}/bin/ags -b hyprpanel -c ${config}/config.js $@
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user