mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-22 06:00:45 -06:00
refactoring
This commit is contained in:
parent
506e9abcee
commit
02d34a6aae
3 changed files with 25 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
|||
inputs:
|
||||
let
|
||||
inherit (inputs) nixpkgs self zig2nix;
|
||||
inherit (inputs) nixpkgs self;
|
||||
lib = nixpkgs.lib.extend (import ./extended.nix);
|
||||
|
||||
inherit (builtins)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
final: prev:
|
||||
let
|
||||
inherit (builtins) listToAttrs substring;
|
||||
inherit (final)
|
||||
concatStringsSep
|
||||
hasSuffix
|
||||
|
@ -8,9 +9,8 @@ let
|
|||
mkOption
|
||||
types
|
||||
;
|
||||
inherit (builtins) listToAttrs substring;
|
||||
in
|
||||
rec {
|
||||
let
|
||||
enabled = {
|
||||
enable = true;
|
||||
};
|
||||
|
@ -37,13 +37,13 @@ rec {
|
|||
}) attrs
|
||||
);
|
||||
|
||||
isNixFile = path: hasSuffix ".nix" path;
|
||||
mkIfIn = name: list: prev.mkIf (builtins.elem name list);
|
||||
|
||||
mkOizysModule = config: attr: content: {
|
||||
options.oizys.${attr}.enable = mkEnableOption "enable ${attr} support";
|
||||
config = mkIf config.oizys.${attr}.enable content;
|
||||
};
|
||||
|
||||
mkDefaultOizysModule = config: attr: content: {
|
||||
options.oizys.${attr}.enable = mkOption {
|
||||
default = true;
|
||||
|
@ -61,4 +61,19 @@ rec {
|
|||
(substring 4 2 longDate)
|
||||
(substring 6 2 longDate)
|
||||
]);
|
||||
isNixFile = path: hasSuffix ".nix" path;
|
||||
|
||||
in
|
||||
{
|
||||
inherit
|
||||
enabled
|
||||
disabled
|
||||
enableAttrs
|
||||
disableAttrs
|
||||
mkOizysModule
|
||||
mkDefaultOizysModule
|
||||
mkDate
|
||||
isNixFile
|
||||
mkIfIn
|
||||
;
|
||||
}
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (builtins) filter;
|
||||
inherit (lib)
|
||||
isNixFile
|
||||
mkOption
|
||||
types
|
||||
isNixFile
|
||||
literalExpression
|
||||
mdDoc
|
||||
;
|
||||
inherit (lib.filesystem) listFilesRecursive;
|
||||
inherit (builtins) filter;
|
||||
|
||||
listNixFilesRecursive =
|
||||
dir: filter (f: (f != ./default.nix) && (isNixFile f)) (listFilesRecursive dir);
|
||||
in
|
||||
{
|
||||
imports = filter (f: (f != ./default.nix) && (isNixFile f)) (listFilesRecursive ./.);
|
||||
|
||||
imports = listNixFilesRecursive ./.;
|
||||
options.oizys.languages = mkOption {
|
||||
type = with types; (listOf str);
|
||||
description = mdDoc ''
|
||||
|
|
Loading…
Reference in a new issue