refactor(flake): move custom packages to overlay

This commit is contained in:
2026-10-12 11:13:20 -04:00
parent 6532a822cd
commit 022e284996
8 changed files with 83 additions and 31 deletions

View File

@@ -21,7 +21,15 @@ let
modules = lib.attrByPath [ config.networking.hostName ] { } config.registry.waybar; modules = lib.attrByPath [ config.networking.hostName ] { } config.registry.waybar;
in in
{ {
options.modules.desktop.session.waybar.enable = lib.mkEnableOption "the Waybar status bar"; options.modules.desktop.session.waybar = {
enable = lib.mkEnableOption "the Waybar status bar";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.alexion.waybar;
description = "Waybar package used by the status bar.";
};
};
config = lib.mkIf config.modules.desktop.session.waybar.enable { config = lib.mkIf config.modules.desktop.session.waybar.enable {
# A symbols font backs the module glyphs, so pango falls back to it for the # A symbols font backs the module glyphs, so pango falls back to it for the
@@ -30,32 +38,7 @@ in
home-manager.users.${config.user.name}.programs.waybar = { home-manager.users.${config.user.name}.programs.waybar = {
enable = true; enable = true;
# Waybar 0.15.0 sends old Hyprland workspace dispatch commands. package = config.modules.desktop.session.waybar.package;
# Use the fix commit until a release includes upstream PR #5013.
package = pkgs.waybar.overrideAttrs {
src = pkgs.fetchFromGitHub {
owner = "Alexays";
repo = "Waybar";
rev = "05945748dccce28bf96d26d8f64a9e69a8dd49ba";
hash = "sha256-51R3mIt8cLNvh/X5qe9vOqeJCj0U9KRyemVE5y+OhiU=";
};
postUnpack =
let
libcava = pkgs.fetchFromGitHub {
owner = "LukashonakV";
repo = "cava";
tag = "0.10.7";
hash = "sha256-zkyj1vBzHtoypX4Bxdh1Vmwh967DKKxN751v79hzmgQ=";
};
in
''
pushd "$sourceRoot"
cp -R --no-preserve=mode,ownership ${libcava} subprojects/cava-0.10.7
patchShebangs .
popd
'';
};
# A user service bound to graphical-session.target, which uwsm activates, # A user service bound to graphical-session.target, which uwsm activates,
# so the bar comes up with the session and no compositor exec-once. # so the bar comes up with the session and no compositor exec-once.

View File

@@ -14,16 +14,19 @@ in
{ {
options.modules.shell.pi = { options.modules.shell.pi = {
enable = lib.mkEnableOption "Pi, a terminal coding agent, configured through home-manager"; enable = lib.mkEnableOption "Pi, a terminal coding agent, configured through home-manager";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.alexion.pi-coding-agent;
description = "Pi package installed for the primary user.";
};
}; };
config = lib.mkIf config.modules.shell.pi.enable { config = lib.mkIf config.modules.shell.pi.enable {
home-manager.users.${user} = { home-manager.users.${user} = {
programs.pi-coding-agent = { programs.pi-coding-agent = {
enable = true; enable = true;
package = pkgs.pi-coding-agent.overrideAttrs { package = config.modules.shell.pi.package;
src = ../../../../../third_party/pi;
patches = [ ];
};
settings = { settings = {
defaultProvider = "openai-codex"; defaultProvider = "openai-codex";

View File

@@ -24,6 +24,10 @@ let
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
inputs.stylix.nixosModules.stylix inputs.stylix.nixosModules.stylix
{
nixpkgs.overlays = [ specialArgs.self.overlays.default ];
}
repositoryModules repositoryModules
guestModules guestModules

View File

@@ -5,7 +5,18 @@
root, root,
system, system,
}: }:
let
overlay = import ./overlay.nix { inherit root; };
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ overlay ];
};
in
{ {
overlays.default = overlay;
packages.${system} = pkgs.alexion;
nixosConfigurations = import ../dotfiles { nixosConfigurations = import ../dotfiles {
inherit inherit
inputs inputs

7
src/flake/overlay.nix Normal file
View File

@@ -0,0 +1,7 @@
{ root }:
final: _prev: {
alexion = import ./packages {
pkgs = final;
inherit root;
};
}

View File

@@ -0,0 +1,8 @@
{ pkgs, root }:
{
pi-coding-agent = pkgs.callPackage ./pi-coding-agent.nix {
inherit root;
};
waybar = pkgs.callPackage ./waybar.nix { };
}

View File

@@ -0,0 +1,8 @@
{
pi-coding-agent,
root,
}:
pi-coding-agent.overrideAttrs {
src = root + "/third_party/pi";
patches = [ ];
}

View File

@@ -0,0 +1,28 @@
{
fetchFromGitHub,
waybar,
}:
waybar.overrideAttrs {
src = fetchFromGitHub {
owner = "Alexays";
repo = "Waybar";
rev = "05945748dccce28bf96d26d8f64a9e69a8dd49ba";
hash = "sha256-51R3mIt8cLNvh/X5qe9vOqeJCj0U9KRyemVE5y+OhiU=";
};
postUnpack =
let
libcava = fetchFromGitHub {
owner = "LukashonakV";
repo = "cava";
tag = "0.10.7";
hash = "sha256-zkyj1vBzHtoypX4Bxdh1Vmwh967DKKxN751v79hzmgQ=";
};
in
''
pushd "$sourceRoot"
cp -R --no-preserve=mode,ownership ${libcava} subprojects/cava-0.10.7
patchShebangs .
popd
'';
}