From e7366f95106a387c7383bb1e45c3203f08f7e029 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Mon, 24 Feb 2025 21:14:38 -0500 Subject: [PATCH] fix infinite recursion by namespacing new pkgs --- apps/format-root.nix | 2 +- apps/loadkey.nix | 2 +- overlays/pkgs.nix | 13 +++++++++++-- pkgs/applications/misc/volnoti/package.nix | 2 +- .../modules/nmasur/presets/programs/fish.nix | 3 ++- .../modules/nmasur/presets/programs/github.nix | 2 +- .../nmasur/presets/programs/rofi/default.nix | 2 +- .../modules/nmasur/presets/services/i3.nix | 2 +- .../modules/nmasur/presets/services/polybar.nix | 4 ++-- .../modules/nmasur/presets/services/volnoti.nix | 8 ++++---- .../modules/nmasur/profiles/linux-gui.nix | 1 + .../modules/nmasur/profiles/power-user.nix | 3 ++- .../home-manager/modules/nmasur/profiles/work.nix | 6 +++--- 13 files changed, 31 insertions(+), 19 deletions(-) diff --git a/apps/format-root.nix b/apps/format-root.nix index 3859dc0..acf7afd 100644 --- a/apps/format-root.nix +++ b/apps/format-root.nix @@ -5,5 +5,5 @@ type = "app"; - program = pkgs.lib.getExe pkgs.format-root; + program = pkgs.lib.getExe pkgs.nmasur.format-root; } diff --git a/apps/loadkey.nix b/apps/loadkey.nix index 9aaa0f7..b83376d 100644 --- a/apps/loadkey.nix +++ b/apps/loadkey.nix @@ -5,5 +5,5 @@ type = "app"; - program = "${pkgs.loadkey}/bin/loadkey"; + program = "${pkgs.nmasur.loadkey}/bin/loadkey"; } diff --git a/overlays/pkgs.nix b/overlays/pkgs.nix index 62dadb3..0a88cd4 100644 --- a/overlays/pkgs.nix +++ b/overlays/pkgs.nix @@ -14,20 +14,29 @@ let list: builtins.listToAttrs ( map (v: { - name = v."pname" ? v."name"; + name = v."pname" or v."name"; value = v; }) list ); lib = prev.lib; # packagesDirectory = lib.filesystem.listFilesRecursive ../pkgs; + # [ package1/package.nix package2/package.nix package2/hello.sh ] packages = lib.pipe (lib.filesystem.listFilesRecursive ../pkgs) [ # Get only files called package.nix + # [ package1/package.nix package2/package.nix ] (builtins.filter (name: lib.hasSuffix "package.nix" name)) + # Apply callPackage to create a derivation + # Must use final.callPackage to avoid infinite recursion + # [ package1.drv package2.drv ] (builtins.map (name: prev.callPackage name { })) + # Convert the list to an attrset + # { package1 = package1.drv, package2 = package2.drv } listToAttrsByPnameOrName ]; in -packages +{ + nmasur = packages; +} diff --git a/pkgs/applications/misc/volnoti/package.nix b/pkgs/applications/misc/volnoti/package.nix index 0244b12..2efd0b7 100644 --- a/pkgs/applications/misc/volnoti/package.nix +++ b/pkgs/applications/misc/volnoti/package.nix @@ -2,7 +2,7 @@ { pkgs, lib, ... }: pkgs.stdenv.mkDerivation { - pname = "volnoti-unstable"; + pname = "volnoti"; version = "2013-09-23"; src = pkgs.fetchFromGitHub { owner = "davidbrazdil"; diff --git a/platforms/home-manager/modules/nmasur/presets/programs/fish.nix b/platforms/home-manager/modules/nmasur/presets/programs/fish.nix index 1e6a7c8..f8c9184 100644 --- a/platforms/home-manager/modules/nmasur/presets/programs/fish.nix +++ b/platforms/home-manager/modules/nmasur/presets/programs/fish.nix @@ -1,5 +1,6 @@ { config, + pkgs, lib, ... }: @@ -43,7 +44,7 @@ in body = builtins.readFile ./functions/fish_user_key_bindings.fish; }; ip = { - body = builtins.readFile ./functions/ip.fish; + body = lib.getExe pkgs.nmasur.ip-check; }; json = { description = "Tidy up JSON using jq"; diff --git a/platforms/home-manager/modules/nmasur/presets/programs/github.nix b/platforms/home-manager/modules/nmasur/presets/programs/github.nix index e112123..07f3fc6 100644 --- a/platforms/home-manager/modules/nmasur/presets/programs/github.nix +++ b/platforms/home-manager/modules/nmasur/presets/programs/github.nix @@ -20,7 +20,7 @@ in gitCredentialHelper.enable = true; settings.git_protocol = "https"; extensions = [ - pkgs.gh-collaborators + pkgs.nmasur.gh-collaborators pkgs.gh-dash pkgs.gh-copilot ]; diff --git a/platforms/home-manager/modules/nmasur/presets/programs/rofi/default.nix b/platforms/home-manager/modules/nmasur/presets/programs/rofi/default.nix index 457d3d7..a760f89 100644 --- a/platforms/home-manager/modules/nmasur/presets/programs/rofi/default.nix +++ b/platforms/home-manager/modules/nmasur/presets/programs/rofi/default.nix @@ -47,7 +47,7 @@ in pkgs.ponymix rofi ]; - text = builtins.readFile ./rofi/pulse-sink.sh; + text = builtins.readFile ./pulse-sink.sh; } ); }; diff --git a/platforms/home-manager/modules/nmasur/presets/services/i3.nix b/platforms/home-manager/modules/nmasur/presets/services/i3.nix index 0f922d0..f5bfec2 100644 --- a/platforms/home-manager/modules/nmasur/presets/services/i3.nix +++ b/platforms/home-manager/modules/nmasur/presets/services/i3.nix @@ -20,7 +20,7 @@ in wallpaper = lib.mkOption { type = lib.types.path; description = "Wallpaper background image file"; - default = "${pkgs.wallpapers}/gruvbox/road.jpg"; + default = "${pkgs.nmasur.wallpapers}/gruvbox/road.jpg"; }; commands = { launcher = lib.mkOption { diff --git a/platforms/home-manager/modules/nmasur/presets/services/polybar.nix b/platforms/home-manager/modules/nmasur/presets/services/polybar.nix index 898f01b..4967e18 100644 --- a/platforms/home-manager/modules/nmasur/presets/services/polybar.nix +++ b/platforms/home-manager/modules/nmasur/presets/services/polybar.nix @@ -162,7 +162,7 @@ in ramp-volume-0 = ""; ramp-volume-1 = "󰕾"; ramp-volume-2 = ""; - click-right = config.audioSwitchCommand; + click-right = config.nmasur.presets.services.i3.commands.audioSwitch; }; # "module/xkeyboard" = { # type = "internal/xkeyboard"; @@ -217,7 +217,7 @@ in "module/power" = { type = "custom/text"; content = "  "; - click-left = config.powerCommand; + click-left = config.nmasur.presets.services.i3.commands.toggleBar; click-right = "polybar-msg cmd restart"; content-foreground = config.theme.colors.base04; }; diff --git a/platforms/home-manager/modules/nmasur/presets/services/volnoti.nix b/platforms/home-manager/modules/nmasur/presets/services/volnoti.nix index 41e409c..19f07ed 100644 --- a/platforms/home-manager/modules/nmasur/presets/services/volnoti.nix +++ b/platforms/home-manager/modules/nmasur/presets/services/volnoti.nix @@ -14,23 +14,23 @@ let increaseVolume = pkgs.writeShellScriptBin "increaseVolume" '' ${pkgs.pamixer}/bin/pamixer -i 2 volume=$(${pkgs.pamixer}/bin/pamixer --get-volume) - ${pkgs.volnoti}/bin/volnoti-show $volume + ${pkgs.nmasur.volnoti}/bin/volnoti-show $volume ''; decreaseVolume = pkgs.writeShellScriptBin "decreaseVolume" '' ${pkgs.pamixer}/bin/pamixer -d 2 volume=$(${pkgs.pamixer}/bin/pamixer --get-volume) - ${pkgs.volnoti}/bin/volnoti-show $volume + ${pkgs.nmasur.volnoti}/bin/volnoti-show $volume ''; toggleMute = pkgs.writeShellScriptBin "toggleMute" '' ${pkgs.pamixer}/bin/pamixer --toggle-mute mute=$(${pkgs.pamixer}/bin/pamixer --get-mute) if [ "$mute" == "true" ]; then - ${pkgs.volnoti}/bin/volnoti-show --mute + ${pkgs.nmasur.volnoti}/bin/volnoti-show --mute else volume=$(${pkgs.pamixer}/bin/pamixer --get-volume) - ${pkgs.volnoti}/bin/volnoti-show $volume + ${pkgs.nmasur.volnoti}/bin/volnoti-show $volume fi ''; in diff --git a/platforms/home-manager/modules/nmasur/profiles/linux-gui.nix b/platforms/home-manager/modules/nmasur/profiles/linux-gui.nix index 9b76477..8d74aa4 100644 --- a/platforms/home-manager/modules/nmasur/profiles/linux-gui.nix +++ b/platforms/home-manager/modules/nmasur/profiles/linux-gui.nix @@ -26,6 +26,7 @@ in nautilus.enable = lib.mkDefault true; nsxiv.enable = lib.mkDefault true; obsidian.enable = lib.mkDefault true; + rofi.enable = lib.mkDefault true; xclip.enable = lib.mkDefault true; wezterm.enable = lib.mkDefault true; zathura.enable = lib.mkDefault true; diff --git a/platforms/home-manager/modules/nmasur/profiles/power-user.nix b/platforms/home-manager/modules/nmasur/profiles/power-user.nix index f98e811..2a2bda8 100644 --- a/platforms/home-manager/modules/nmasur/profiles/power-user.nix +++ b/platforms/home-manager/modules/nmasur/profiles/power-user.nix @@ -19,7 +19,7 @@ in pkgs.difftastic # Other fancy diffs pkgs.jless # JSON viewer pkgs.jo # JSON output - pkgs.osc # Clipboard over SSH + pkgs.nmasur.osc # Clipboard over SSH pkgs.qrencode # Generate qr codes pkgs.ren # Rename files pkgs.rep # Replace text in files @@ -33,6 +33,7 @@ in pkgs.mpd # TUI slideshows pkgs.doggo # DNS client (dig) pkgs.bottom # System monitor (top) + pkgs.nmasur.jqr # FZF fq JSON tool ]; programs.fish.shellAliases = { diff --git a/platforms/home-manager/modules/nmasur/profiles/work.nix b/platforms/home-manager/modules/nmasur/profiles/work.nix index 7f578e5..cb89682 100644 --- a/platforms/home-manager/modules/nmasur/profiles/work.nix +++ b/platforms/home-manager/modules/nmasur/profiles/work.nix @@ -34,9 +34,9 @@ in pkgs.ipcalc # Make IP network calculations pkgs.cloudflared # Allow connecting to Cloudflare tunnels pkgs.monitorcontrol # Allows adjusting external displays - pkgs.ocr # Converts images to text - pkgs.aws-ec2 # Browse EC2 instances - pkgs.terraform-init # Quick shortcut for initializing Terraform backend + pkgs.nmasur.ocr # Converts images to text + pkgs.nmasur.aws-ec2 # Browse EC2 instances + pkgs.nmasur.terraform-init # Quick shortcut for initializing Terraform backend ]; nmasur.presets = {