refactor: split up lib in multiple folders
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
a5fdb3e5d4
commit
318ccef645
8 changed files with 39 additions and 20 deletions
|
@ -2,12 +2,22 @@
|
||||||
perSystem,
|
perSystem,
|
||||||
inputs,
|
inputs,
|
||||||
}: let
|
}: let
|
||||||
inherit (inputs.nixpkgs.lib) concatStringsSep stringToCharacters substring tail toUpper;
|
flake = import ./flake inputs;
|
||||||
|
strings = import ./strings inputs.nixpkgs.lib;
|
||||||
|
|
||||||
mkVersion = src: "0.0.0+" + src.shortRev;
|
lib = flake // strings;
|
||||||
capitalise = str: (toUpper (substring 0 1 str) + (concatStringsSep "" (tail (stringToCharacters str))));
|
|
||||||
in
|
in
|
||||||
{inherit mkVersion capitalise;}
|
# Expose main attrs
|
||||||
// (import ./flake-lib.nix inputs)
|
lib
|
||||||
// perSystem (pkgs:
|
# Expose all funcs
|
||||||
import ./pkgs.nix {inherit pkgs mkVersion capitalise inputs;})
|
// strings
|
||||||
|
// flake
|
||||||
|
# Expose funcs that require pkgs
|
||||||
|
// perSystem (
|
||||||
|
pkgs:
|
||||||
|
(import ./pkgs {
|
||||||
|
inherit pkgs;
|
||||||
|
inherit (inputs) self;
|
||||||
|
})
|
||||||
|
// lib
|
||||||
|
)
|
||||||
|
|
|
@ -40,7 +40,7 @@ inputs: rec {
|
||||||
[
|
[
|
||||||
(allowModularOverrides {inherit system cudaSupport;})
|
(allowModularOverrides {inherit system cudaSupport;})
|
||||||
{home-manager.extraSpecialArgs = specialArgs;}
|
{home-manager.extraSpecialArgs = specialArgs;}
|
||||||
../common
|
../../common
|
||||||
]
|
]
|
||||||
++ extraModules;
|
++ extraModules;
|
||||||
};
|
};
|
||||||
|
@ -86,7 +86,7 @@ inputs: rec {
|
||||||
|
|
||||||
{home-manager = {inherit extraSpecialArgs;};}
|
{home-manager = {inherit extraSpecialArgs;};}
|
||||||
|
|
||||||
../common/nix-on-droid.nix
|
../../common/nix-on-droid.nix
|
||||||
]
|
]
|
||||||
++ extraModules;
|
++ extraModules;
|
||||||
};
|
};
|
|
@ -1,9 +1,11 @@
|
||||||
{
|
{
|
||||||
capitalise,
|
|
||||||
mkVersion,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
inputs,
|
self,
|
||||||
}: {
|
}: let
|
||||||
|
inherit (builtins) readFile fromJSON;
|
||||||
|
inherit (self.lib) capitalise mkVersion;
|
||||||
|
inherit (pkgs.lib) concatMapStrings elemAt length map optionalString splitString toLower;
|
||||||
|
in {
|
||||||
buildPlugin = pname: src:
|
buildPlugin = pname: src:
|
||||||
pkgs.vimUtils.buildVimPlugin {
|
pkgs.vimUtils.buildVimPlugin {
|
||||||
inherit pname src;
|
inherit pname src;
|
||||||
|
@ -11,11 +13,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
buildNodeModules = dir: npmDepsHash: let
|
buildNodeModules = dir: npmDepsHash: let
|
||||||
pkg = pkgs.callPackage ({buildNpmPackage, ...}: let
|
|
||||||
inherit (builtins) readFile fromJSON;
|
|
||||||
|
|
||||||
packageJSON = fromJSON (readFile (dir + /package.json));
|
packageJSON = fromJSON (readFile (dir + /package.json));
|
||||||
in
|
|
||||||
|
pkg = pkgs.callPackage ({buildNpmPackage, ...}:
|
||||||
buildNpmPackage {
|
buildNpmPackage {
|
||||||
pname = packageJSON.name;
|
pname = packageJSON.name;
|
||||||
inherit (packageJSON) version;
|
inherit (packageJSON) version;
|
||||||
|
@ -32,8 +32,6 @@
|
||||||
packages,
|
packages,
|
||||||
pname,
|
pname,
|
||||||
}: let
|
}: let
|
||||||
inherit (pkgs.lib) concatMapStrings elemAt length map optionalString splitString toLower;
|
|
||||||
|
|
||||||
withGirNames =
|
withGirNames =
|
||||||
map (package: {
|
map (package: {
|
||||||
inherit package;
|
inherit package;
|
||||||
|
@ -51,7 +49,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 (inputs) ts-for-gir-src;
|
inherit (self.inputs) ts-for-gir-src;
|
||||||
inherit pname withGirNames;
|
inherit pname withGirNames;
|
||||||
};
|
};
|
||||||
};
|
};
|
11
lib/strings/default.nix
Normal file
11
lib/strings/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
concatStringsSep,
|
||||||
|
stringToCharacters,
|
||||||
|
substring,
|
||||||
|
tail,
|
||||||
|
toUpper,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
mkVersion = src: "0.0.0+" + src.shortRev;
|
||||||
|
capitalise = str: (toUpper (substring 0 1 str) + (concatStringsSep "" (tail (stringToCharacters str))));
|
||||||
|
}
|
Loading…
Reference in a new issue