refactor: expose custom libs through self flake
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-11-20 16:13:12 -05:00
parent 838df34dfb
commit a5fdb3e5d4
8 changed files with 18 additions and 23 deletions

View file

@ -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 = {

View file

@ -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 = {

View file

@ -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 = {

View file

@ -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;})

View file

@ -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;
};
}

View file

@ -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;
};
};

View file

@ -86,7 +86,7 @@ in {
file = let
inherit
(import "${self}/lib" {inherit pkgs self;})
(self.lib.${pkgs.system})
buildNodeModules
buildGirTypes
;

View file

@ -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;