diff --git a/common/home/neovim/langs/markdown.nix b/common/home/neovim/langs/markdown.nix index e0128396..b451c59f 100644 --- a/common/home/neovim/langs/markdown.nix +++ b/common/home/neovim/langs/markdown.nix @@ -9,7 +9,7 @@ inherit (lib) mkIf; inherit (config.vars) neovimIde; - inherit (import "${self}/lib" {inherit pkgs;}) buildPlugin; + inherit (self.lib.${pkgs.system}) buildPlugin; in mkIf neovimIde { programs = { diff --git a/common/home/neovim/langs/web.nix b/common/home/neovim/langs/web.nix index 786bafcc..aee5fc71 100644 --- a/common/home/neovim/langs/web.nix +++ b/common/home/neovim/langs/web.nix @@ -9,7 +9,7 @@ inherit (lib) mkIf; inherit (config.vars) neovimIde; - inherit (import "${self}/lib" {inherit pkgs;}) buildPlugin; + inherit (self.lib.${pkgs.system}) buildPlugin; in mkIf neovimIde { programs = { diff --git a/homeManagerModules/firefox/default.nix b/homeManagerModules/firefox/default.nix index d904d920..7e475038 100644 --- a/homeManagerModules/firefox/default.nix +++ b/homeManagerModules/firefox/default.nix @@ -9,7 +9,7 @@ self: { firefox-gx = pkgs.callPackage ./gx-theme.nix { inherit (self.inputs) firefox-gx-src; - inherit (import "${self}/lib" {}) mkVersion; + inherit (self.lib) mkVersion; }; in { config = { diff --git a/lib/default.nix b/lib/default.nix index 16d4ffcc..a99e88c1 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,20 +1,13 @@ { - inputs ? {}, - pkgs ? {}, - self ? {}, + perSystem, + inputs, }: let - lock = builtins.fromJSON (builtins.readFile ../flake.lock); - - lib = import "${builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/${lock.nodes.nixpkgs.locked.rev}.tar.gz"; - sha256 = lock.nodes.nixpkgs.locked.narHash; - }}/lib"; - - inherit (lib) concatStringsSep optionalAttrs stringToCharacters substring tail toUpper; + inherit (inputs.nixpkgs.lib) concatStringsSep stringToCharacters substring tail toUpper; mkVersion = src: "0.0.0+" + src.shortRev; capitalise = str: (toUpper (substring 0 1 str) + (concatStringsSep "" (tail (stringToCharacters str)))); in - {inherit lib mkVersion capitalise;} - // optionalAttrs (inputs != {}) (import ./flake-lib.nix inputs) - // optionalAttrs (pkgs != {}) (import ./pkgs.nix {inherit pkgs mkVersion capitalise self;}) + {inherit mkVersion capitalise;} + // (import ./flake-lib.nix inputs) + // perSystem (pkgs: + import ./pkgs.nix {inherit pkgs mkVersion capitalise inputs;}) diff --git a/lib/flake-lib.nix b/lib/flake-lib.nix index bbe111cb..0e283ac6 100644 --- a/lib/flake-lib.nix +++ b/lib/flake-lib.nix @@ -45,7 +45,7 @@ inputs: rec { ++ extraModules; }; - mkNixOnDroid = mods: let + mkNixOnDroid = extraModules: let system = "aarch64-linux"; in inputs.nix-on-droid.lib.nixOnDroidConfiguration rec { @@ -88,6 +88,6 @@ inputs: rec { ../common/nix-on-droid.nix ] - ++ mods; + ++ extraModules; }; } diff --git a/lib/pkgs.nix b/lib/pkgs.nix index 2ca5e338..c85cd1eb 100644 --- a/lib/pkgs.nix +++ b/lib/pkgs.nix @@ -2,7 +2,7 @@ capitalise, mkVersion, pkgs, - self, + inputs, }: { buildPlugin = pname: src: pkgs.vimUtils.buildVimPlugin { @@ -51,7 +51,7 @@ "${configPath}${optionalString (length packages == 1) "/${toLower (elemAt withGirNames 0).girName}"}".source = pkgs.callPackage ./mk-types { - inherit (self.inputs) ts-for-gir-src; + inherit (inputs) ts-for-gir-src; inherit pname withGirNames; }; }; diff --git a/nixosModules/ags/packages.nix b/nixosModules/ags/packages.nix index ed872ee7..f64f5597 100644 --- a/nixosModules/ags/packages.nix +++ b/nixosModules/ags/packages.nix @@ -86,7 +86,7 @@ in { file = let inherit - (import "${self}/lib" {inherit pkgs self;}) + (self.lib.${pkgs.system}) buildNodeModules buildGirTypes ; diff --git a/outputs.nix b/outputs.nix index a7ad1c1b..a20a1b61 100644 --- a/outputs.nix +++ b/outputs.nix @@ -48,12 +48,14 @@ systems, ... }: let - inherit (import ./lib {inherit inputs;}) mkVersion mkNixOS mkNixOnDroid mkPkgs; + inherit (self.lib) mkVersion mkNixOS mkNixOnDroid mkPkgs; perSystem = attrs: nixpkgs.lib.genAttrs (import systems) (system: attrs (mkPkgs {inherit system nixpkgs;})); in { + lib = import ./lib {inherit inputs perSystem;}; + nixosModules = import ./nixosModules self; homeManagerModules = import ./homeManagerModules self;