mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-04-16 06:19:11 +00:00
lib: init formats subset
This commit is contained in:
parent
ffafbe1b94
commit
ba9e3c3066
@ -15,6 +15,10 @@ in pkgs.lib.makeExtensible (self:
|
||||
math = callLib ./math.nix;
|
||||
xdg = callLib ./xdg.nix;
|
||||
|
||||
# Just like from its inspiration, this contains Nix-representable data
|
||||
# formats and won't have any attributes exported at the top-level.
|
||||
formats = callLib ./formats.nix;
|
||||
|
||||
# For future references, these are the only attributes that are going to be
|
||||
# exported as part of nixpkgs overlay.
|
||||
fetchers = callLib ./fetchers;
|
||||
|
21
lib/formats.nix
Normal file
21
lib/formats.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{ lib, pkgs, self }:
|
||||
|
||||
{
|
||||
# The gnome-session config files uses one from GLib. See the following link
|
||||
# at <https://docs.gtk.org/glib/struct.KeyFile.html> for details about the
|
||||
# keyfile formatting and possibly the Desktop Entry specification at
|
||||
# <https://freedesktop.org/wiki/Specifications/desktop-entry-spec>.
|
||||
glibKeyfile = {}: {
|
||||
type = with lib.types;
|
||||
let
|
||||
valueType = oneOf [ bool float int str (listOf valueType) ] // {
|
||||
description =
|
||||
"GLib keyfile atom (bool, int, float, string, or a list of the previous atoms)";
|
||||
};
|
||||
in attrsOf (attrsOf valueType);
|
||||
|
||||
generate = name: value:
|
||||
pkgs.callPackage
|
||||
({ lib, writeText }: writeText name (lib.generators.toDconfINI value));
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user