Refactor flake.nix: reorganize nativeBuildInputs and enhance subtree management script

This commit is contained in:
Chris Toph 2025-03-22 20:33:18 -04:00
parent 5f4b9622d9
commit c9fa10ccbd

View file

@ -19,15 +19,28 @@
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
extraPkgs = with pkgs; [
nativeBuildInputs = with pkgs; [
blueprint-compiler
dart-sass
esbuild
fzf
gobject-introspection
libgtop
meson
ninja
pkg-config
wrapGAppsHook4
gtk4
gjs
];
agsPkgs = with inputs.ags.packages.${pkgs.system}; [
apps
astal4
bluetooth
greet
hyprland
io
mpris
network
notifd
@ -37,6 +50,7 @@
in
{
packages.${system} = {
default = inputs.ags.lib.bundle {
inherit pkgs;
src = ./.;
@ -45,27 +59,73 @@
gtk4 = true;
# additional libraries and executables to add to gjs' runtime
extraPackages = extraPkgs ++ agsPkgs;
extraPackages = nativeBuildInputs ++ agsPkgs;
};
# TO GEN TYPES, ags types is FUCKED
# npx -y @ts-for-gir/cli generate --ignoreVersionConflicts --outdir ./@girs -g /nix/store/gq0k2imad3ijd0ih87aiinj617wyh34f-gir-dirs/share/gir-1.0
# subtree script to manage git subtree pushes and pulls. Personal use feel free to remove
subtree = pkgs.writeScriptBin "subtree" ''
#!/usr/bin/env fish
if test (count $argv) -ne 1
echo "Usage: $argv0 push|pull"
exit 1
end
set action $argv[1]
set subtree_path "ags"
set remote "yash-origin"
set branch "main"
cd (git rev-parse --show-toplevel)
switch $action
case push
set changes (git status --porcelain "$subtree_path")
if test -n "$changes"
set_color yellow; echo " Cannot push. There are uncommitted changes in $subtree_path."
exit 1
end
git subtree push --prefix="$subtree_path" $remote $branch
case pull
git subtree pull --prefix="$subtree_path" $remote $branch
case commit
set changes (git status --porcelain "$subtree_path")
if test -z "$changes"
echo "No changes to commit in $subtree_path."
exit 0
end
echo " Enter commit message:"
read commit_message
if test -z "$commit_message"
echo "Commit message cannot be empty."
exit 1
end
git add "$subtree_path"
git commit -m "$commit_message"
case '*'
echo "Unknown argument. Use push or pull."
exit 1
end
'';
};
devShells.${system} = {
default = pkgs.mkShell {
nativeBuildInputs = [
pkgs.wrapGAppsHook
pkgs.gobject-introspection
(inputs.ags.packages.${system}.agsFull.override {
extraPackages = [
# include extra libs here to add to the gjs runtime environment
pkgs.libgtop
];
extraPackages = nativeBuildInputs;
})
] ++ extraPkgs;
buildInputs = [
inputs.astal.packages.${system}.default
pkgs.pnpm
];
packages = [
pkgs.gjs
pkgs.pnpm
pkgs.nodejs
self.packages.${system}.subtree
inputs.ags.packages.${system}.agsFull
inputs.astal.packages.${system}.default
] ++ nativeBuildInputs;
};
};
};