Add custom packages support through pkgs directory

This commit is contained in:
Jo 2025-08-27 00:19:31 +02:00
parent f6058e8547
commit 6c0cc52a3c
10 changed files with 46 additions and 32 deletions

View file

@ -15,5 +15,6 @@ in
@import "onebar/onebar.css"; @import "onebar/onebar.css";
''; '';
home.file.".mozilla/firefox/default/chrome/onebar/onebar.css".source = ./onebar.css; home.file.".mozilla/firefox/default/chrome/onebar/onebar.css".source =
mkIf config.programs.firefox.enable ./onebar.css;
} }

View file

@ -1,6 +0,0 @@
/* frappe */
@import url("https://youtubemusic.catppuccin.com/src/frappe.css");
html:not(.style-scope) {
--ctp-accent: var(--ctp-blue) !important;
}

View file

@ -1,6 +0,0 @@
/* latte */
@import url("https://youtubemusic.catppuccin.com/src/latte.css");
html:not(.style-scope) {
--ctp-accent: var(--ctp-blue) !important;
}

View file

@ -1,6 +0,0 @@
/* macchiato */
@import url("https://youtubemusic.catppuccin.com/src/macchiato.css");
html:not(.style-scope) {
--ctp-accent: var(--ctp-blue) !important;
}

View file

@ -1,6 +0,0 @@
/* mocha */
@import url("https://youtubemusic.catppuccin.com/src/mocha.css");
html:not(.style-scope) {
--ctp-accent: var(--ctp-blue) !important;
}

View file

@ -1,6 +0,0 @@
{
...
}:
{
}

View file

@ -7,7 +7,6 @@
imports = [ imports = [
./apps/discord ./apps/discord
./apps/firefox ./apps/firefox
./apps/youtube-music
]; ];
puzzlevision = { puzzlevision = {
@ -34,6 +33,10 @@
path = "${config.home.homeDirectory}/.wakatime.cfg"; path = "${config.home.homeDirectory}/.wakatime.cfg";
}; };
programs.git = {
enable = true;
};
home.packages = with pkgs; [ home.packages = with pkgs; [
## GENERAL ## GENERAL
ghostty ghostty
@ -53,6 +56,7 @@
## RUNTIMES and CLIs for development ## RUNTIMES and CLIs for development
bun bun
git git
git-credential-oauth
attic-client attic-client
]; ];

View file

@ -5,5 +5,8 @@
# Automagically imports systems from "/systems/arch-classname/system-name". # Automagically imports systems from "/systems/arch-classname/system-name".
./systems.nix ./systems.nix
# Automagically import custom packages defined in "/pkgs/pkg-name/default.nix"
./packages.nix
]; ];
} }

View file

@ -26,6 +26,18 @@ let
else else
[ ]; [ ];
filesystemEntityToPackage =
directory: pkgs: pkgArgs: name: type:
if type == "directory" then
dirToPkgAttrSet "${directory}/${name}" pkgs pkgArgs
else if name == "default.nix" then
{
${builtins.unsafeDiscardStringContext (builtins.baseNameOf directory)} =
pkgs.callPackage "${directory}/${name}" pkgArgs;
}
else
{ };
dirToModuleList = dirToModuleList =
directory: directory:
let let
@ -50,12 +62,25 @@ let
acc // (filesystemEntityToAttrSet directory importArgs name (builtins.getAttr name readDir)) acc // (filesystemEntityToAttrSet directory importArgs name (builtins.getAttr name readDir))
) { } (builtins.attrNames readDir); ) { } (builtins.attrNames readDir);
dirToPkgAttrSet =
directory: pkgs: pkgArgs:
let
# Read provided directory only once at the very start and save the result.
readDir = readDirectory directory;
in
builtins.foldl' (
acc: name:
acc // (filesystemEntityToPackage directory pkgs pkgArgs name (builtins.getAttr name readDir))
) { } (builtins.attrNames readDir);
puzzlelib = dirToAttrSet ../../lib { inherit lib self; } // { puzzlelib = dirToAttrSet ../../lib { inherit lib self; } // {
inherit inherit
dirToAttrSet dirToAttrSet
dirToPkgAttrSet
dirToModuleList dirToModuleList
filesystemEntityToList filesystemEntityToList
filesystemEntityToAttrSet filesystemEntityToAttrSet
filesystemEntityToPackage
; ;
}; };
in in

View file

@ -0,0 +1,11 @@
{
self,
...
}:
{
perSystem =
{ pkgs, ... }:
{
packages = self.lib.dirToPkgAttrSet ../../pkgs pkgs { };
};
}