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 (lib) mkIf;
inherit (config.vars) neovimIde; inherit (config.vars) neovimIde;
inherit (import "${self}/lib" {inherit pkgs;}) buildPlugin; inherit (self.lib.${pkgs.system}) buildPlugin;
in in
mkIf neovimIde { mkIf neovimIde {
programs = { programs = {

View file

@ -9,7 +9,7 @@
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (config.vars) neovimIde; inherit (config.vars) neovimIde;
inherit (import "${self}/lib" {inherit pkgs;}) buildPlugin; inherit (self.lib.${pkgs.system}) buildPlugin;
in in
mkIf neovimIde { mkIf neovimIde {
programs = { programs = {

View file

@ -9,7 +9,7 @@ self: {
firefox-gx = pkgs.callPackage ./gx-theme.nix { firefox-gx = pkgs.callPackage ./gx-theme.nix {
inherit (self.inputs) firefox-gx-src; inherit (self.inputs) firefox-gx-src;
inherit (import "${self}/lib" {}) mkVersion; inherit (self.lib) mkVersion;
}; };
in { in {
config = { config = {

View file

@ -1,20 +1,13 @@
{ {
inputs ? {}, perSystem,
pkgs ? {}, inputs,
self ? {},
}: let }: let
lock = builtins.fromJSON (builtins.readFile ../flake.lock); inherit (inputs.nixpkgs.lib) concatStringsSep stringToCharacters substring tail toUpper;
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;
mkVersion = src: "0.0.0+" + src.shortRev; mkVersion = src: "0.0.0+" + src.shortRev;
capitalise = str: (toUpper (substring 0 1 str) + (concatStringsSep "" (tail (stringToCharacters str)))); capitalise = str: (toUpper (substring 0 1 str) + (concatStringsSep "" (tail (stringToCharacters str))));
in in
{inherit lib mkVersion capitalise;} {inherit mkVersion capitalise;}
// optionalAttrs (inputs != {}) (import ./flake-lib.nix inputs) // (import ./flake-lib.nix inputs)
// optionalAttrs (pkgs != {}) (import ./pkgs.nix {inherit pkgs mkVersion capitalise self;}) // perSystem (pkgs:
import ./pkgs.nix {inherit pkgs mkVersion capitalise inputs;})

View file

@ -45,7 +45,7 @@ inputs: rec {
++ extraModules; ++ extraModules;
}; };
mkNixOnDroid = mods: let mkNixOnDroid = extraModules: let
system = "aarch64-linux"; system = "aarch64-linux";
in in
inputs.nix-on-droid.lib.nixOnDroidConfiguration rec { inputs.nix-on-droid.lib.nixOnDroidConfiguration rec {
@ -88,6 +88,6 @@ inputs: rec {
../common/nix-on-droid.nix ../common/nix-on-droid.nix
] ]
++ mods; ++ extraModules;
}; };
} }

View file

@ -2,7 +2,7 @@
capitalise, capitalise,
mkVersion, mkVersion,
pkgs, pkgs,
self, inputs,
}: { }: {
buildPlugin = pname: src: buildPlugin = pname: src:
pkgs.vimUtils.buildVimPlugin { pkgs.vimUtils.buildVimPlugin {
@ -51,7 +51,7 @@
"${configPath}${optionalString (length packages == 1) "/${toLower (elemAt withGirNames 0).girName}"}".source = "${configPath}${optionalString (length packages == 1) "/${toLower (elemAt withGirNames 0).girName}"}".source =
pkgs.callPackage pkgs.callPackage
./mk-types { ./mk-types {
inherit (self.inputs) ts-for-gir-src; inherit (inputs) ts-for-gir-src;
inherit pname withGirNames; inherit pname withGirNames;
}; };
}; };

View file

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

View file

@ -48,12 +48,14 @@
systems, systems,
... ...
}: let }: let
inherit (import ./lib {inherit inputs;}) mkVersion mkNixOS mkNixOnDroid mkPkgs; inherit (self.lib) mkVersion mkNixOS mkNixOnDroid mkPkgs;
perSystem = attrs: perSystem = attrs:
nixpkgs.lib.genAttrs (import systems) (system: nixpkgs.lib.genAttrs (import systems) (system:
attrs (mkPkgs {inherit system nixpkgs;})); attrs (mkPkgs {inherit system nixpkgs;}));
in { in {
lib = import ./lib {inherit inputs perSystem;};
nixosModules = import ./nixosModules self; nixosModules = import ./nixosModules self;
homeManagerModules = import ./homeManagerModules self; homeManagerModules = import ./homeManagerModules self;