diff options
| author | Chris Wells <chris@mathematicaster.org> | 2024-09-10 11:52:55 -0500 |
|---|---|---|
| committer | Chris Wells <chris@mathematicaster.org> | 2024-09-10 11:53:30 -0500 |
| commit | 5cb16c34a8c5b803ec723934c1dc828c0e8e3bad (patch) | |
| tree | 082671e90b6da26a0c06c1a5abc7a4571e0dcc84 /modules/lib/file-type.nix | |
| parent | 8eae39e8e670f228e9675fb3bc432ce512560396 (diff) | |
| download | kobo-manager-5cb16c34a8c5b803ec723934c1dc828c0e8e3bad.tar kobo-manager-5cb16c34a8c5b803ec723934c1dc828c0e8e3bad.tar.gz kobo-manager-5cb16c34a8c5b803ec723934c1dc828c0e8e3bad.tar.bz2 kobo-manager-5cb16c34a8c5b803ec723934c1dc828c0e8e3bad.tar.lz kobo-manager-5cb16c34a8c5b803ec723934c1dc828c0e8e3bad.tar.xz kobo-manager-5cb16c34a8c5b803ec723934c1dc828c0e8e3bad.tar.zst kobo-manager-5cb16c34a8c5b803ec723934c1dc828c0e8e3bad.zip | |
Trying to get everything to actually work
Diffstat (limited to 'modules/lib/file-type.nix')
| -rw-r--r-- | modules/lib/file-type.nix | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/modules/lib/file-type.nix b/modules/lib/file-type.nix index c95c0d4..f02daa1 100644 --- a/modules/lib/file-type.nix +++ b/modules/lib/file-type.nix @@ -1,4 +1,4 @@ -{ writeTextFile, lib, ... }: +{ writeTextFile, linkFarm, lib, ... }: { name, config, ... }: with builtins // lib; let @@ -6,7 +6,7 @@ let let safeChars = [ "+" "." "_" "?" "=" ] ++ lowerChars ++ upperChars ++ stringToCharacters "0123456789"; empties = l: genList (_: "") (length l); - unsafeInName = stringToCharacters (replaceStrings safeChars (empties safeChars) p; + unsafeInName = stringToCharacters (replaceStrings safeChars (empties safeChars) p); in "kobo_" + replaceStrings unsafeInName (empties unsafeInName) p; in { options = { @@ -17,7 +17,7 @@ in { target = mkOption { type = types.str; default = name; - apply = x: if isPrefix "/" x then x else "/${x}"; + apply = x: if hasPrefix "/" x then x else "/${x}"; }; executable = mkOption { type = with types; nullOr bool; @@ -30,12 +30,24 @@ in { source = mkOption { type = types.path; }; + _package = mkOption { + type = types.path; + readOnly = true; + internal = true; + default = linkFarm (sanitize name) [{ + name = removePrefix "/" config.target; + # let + # t = config.target; + # in if + path = config.source; + }]; + }; }; config = { - source = mkIf (cfg.text != null) (mkDefault (writeTextFile { + source = mkIf (config.text != null) (mkDefault (writeTextFile { inherit (config) text; - name = sanitieze name; + name = sanitize name; executable = config.executable == true; })); }; |
