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,
|
||||
inputs,
|
||||
}: 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;
|
||||
capitalise = str: (toUpper (substring 0 1 str) + (concatStringsSep "" (tail (stringToCharacters str))));
|
||||
lib = flake // strings;
|
||||
in
|
||||
{inherit mkVersion capitalise;}
|
||||
// (import ./flake-lib.nix inputs)
|
||||
// perSystem (pkgs:
|
||||
import ./pkgs.nix {inherit pkgs mkVersion capitalise inputs;})
|
||||
# Expose main attrs
|
||||
lib
|
||||
# Expose all funcs
|
||||
// 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;})
|
||||
{home-manager.extraSpecialArgs = specialArgs;}
|
||||
../common
|
||||
../../common
|
||||
]
|
||||
++ extraModules;
|
||||
};
|
||||
|
@ -86,7 +86,7 @@ inputs: rec {
|
|||
|
||||
{home-manager = {inherit extraSpecialArgs;};}
|
||||
|
||||
../common/nix-on-droid.nix
|
||||
../../common/nix-on-droid.nix
|
||||
]
|
||||
++ extraModules;
|
||||
};
|
|
@ -1,9 +1,11 @@
|
|||
{
|
||||
capitalise,
|
||||
mkVersion,
|
||||
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:
|
||||
pkgs.vimUtils.buildVimPlugin {
|
||||
inherit pname src;
|
||||
|
@ -11,11 +13,9 @@
|
|||
};
|
||||
|
||||
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 {
|
||||
pname = packageJSON.name;
|
||||
inherit (packageJSON) version;
|
||||
|
@ -32,8 +32,6 @@
|
|||
packages,
|
||||
pname,
|
||||
}: let
|
||||
inherit (pkgs.lib) concatMapStrings elemAt length map optionalString splitString toLower;
|
||||
|
||||
withGirNames =
|
||||
map (package: {
|
||||
inherit package;
|
||||
|
@ -51,7 +49,7 @@
|
|||
"${configPath}${optionalString (length packages == 1) "/${toLower (elemAt withGirNames 0).girName}"}".source =
|
||||
pkgs.callPackage
|
||||
./mk-types {
|
||||
inherit (inputs) ts-for-gir-src;
|
||||
inherit (self.inputs) ts-for-gir-src;
|
||||
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