From 4a1b0a5502981a8299851da1f5ab39ce2979dcb6 Mon Sep 17 00:00:00 2001 From: NullBite Date: Thu, 14 Mar 2024 20:42:15 +0000 Subject: [PATCH] Create nixfiles lib and define flake type --- lib/nixfiles/default.nix | 7 +++++++ lib/nixfiles/types.nix | 13 +++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 lib/nixfiles/default.nix create mode 100644 lib/nixfiles/types.nix diff --git a/lib/nixfiles/default.nix b/lib/nixfiles/default.nix new file mode 100644 index 0000000..3551628 --- /dev/null +++ b/lib/nixfiles/default.nix @@ -0,0 +1,7 @@ +pkgs: +let + inherit (pkgs) lib; +in +{ + types = (import ./types.nix) pkgs; +} diff --git a/lib/nixfiles/types.nix b/lib/nixfiles/types.nix new file mode 100644 index 0000000..263d457 --- /dev/null +++ b/lib/nixfiles/types.nix @@ -0,0 +1,13 @@ +pkgs: +let + inherit (pkgs) lib; + inherit (lib.types) mkOptionType; + inherit (lib.options) mergeEqualOption; +in +{ + flake = mkOptionType { + name="flake"; + description="Nix flake"; + descriptionClass = "noun"; + merge = mergeEqualOption; check = (value: value._type or "" == "flake"); }; +}