From 36d63a667cfe481d5b85130b1d2d196aa885d638 Mon Sep 17 00:00:00 2001 From: imxyy_soope_ Date: Sat, 3 May 2025 14:13:53 +0800 Subject: [PATCH] feat: infuse --- flake.nix | 35 ++++++++++++++++++++++------------- overlays/default.nix | 14 ++++++-------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/flake.nix b/flake.nix index 8ce6161..553bd9e 100644 --- a/flake.nix +++ b/flake.nix @@ -55,13 +55,15 @@ fenix.url = "github:nix-community/fenix"; fenix.inputs.nixpkgs.follows = "nixpkgs"; + + infuse.url = "git+https://codeberg.org/amjoseph/infuse.nix"; + infuse.flake = false; }; outputs = { self, nixpkgs, - nixos-wsl, ... }@inputs: let @@ -75,6 +77,15 @@ ${hostname} = mkSystem hostname; }) (builtins.attrNames (builtins.readDir ./config/hosts)) ); + + lib = nixpkgs.lib.extend ( + final: prev: { + inherit (inputs.home-manager.lib) hm; + inherit infuse; + my = import ./lib { lib = final; }; + } + ); + infuse = (import inputs.infuse { inherit (nixpkgs) lib; }).v1.infuse; in { packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); @@ -99,18 +110,11 @@ } ); - overlays = import ./overlays { inherit inputs; }; + overlays = import ./overlays { inherit inputs infuse; }; nixosConfigurations = forAllHosts ( hostname: let - lib = import ./lib/stdlib-extended.nix ( - nixpkgs.lib.extend ( - final: prev: { - inherit (inputs.home-manager.lib) hm; - } - ) - ); overlays = builtins.attrValues self.overlays ++ [ inputs.go-musicfox.overlays.default inputs.omz.overlays.default @@ -131,6 +135,9 @@ withHyprland = false; }; }) + (final: prev: { + inherit lib; + }) ]; home = { home-manager = { @@ -140,9 +147,12 @@ inputs.stylix.homeManagerModules.stylix inputs.niri.homeModules.niri # workaround for annoying stylix - { - nixpkgs.overlays = lib.mkForce null; - } + ( + { lib, ... }: + { + nixpkgs.overlays = lib.mkForce null; + } + ) ]; useGlobalPkgs = true; }; @@ -157,7 +167,6 @@ inherit inputs outputs - nixos-wsl hostname ; diff --git a/overlays/default.nix b/overlays/default.nix index 1768e9e..d5422dd 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,19 +1,17 @@ -{ inputs, ... }: +{ inputs, infuse, ... }: { additions = final: prev: import ../pkgs prev; - modifications = final: prev: { - cage = prev.cage.overrideAttrs { - patches = [ ./cage-specify-output-name.patch ]; - }; - qq = prev.qq.overrideAttrs { - preInstall = '' + modifications = + final: prev: + infuse prev { + cage.__output.patches.__append = [ ./cage-specify-output-name.patch ]; + qq.__output.preInstall.__append = '' gappsWrapperArgs+=( --prefix GTK_IM_MODULE : fcitx ) ''; }; - }; # this allows us to access specific version of nixpkgs # by `pkgs.unstable`, `pkgs.stable` and `pkgs.master`