Sprinkles is widgets for our Niri desktop. Currently we're working on a notification daemon, and we plan to move our clock out from PacketMix into sprinkles as well...
···77*Patisserie* is a [monorepo](https://en.wikipedia.org/wiki/Monorepo), which means
88there are multiple projects hosted here. Here's a list!
991010-| Project | Description |
1111-| ----------- | ------------------------------------------------------------------------------------------- |
1212-| *packetmix* | Our [*NixOS*](https://nixos.org) configurations ("All you need to bake a delicious system") |
1010+| Project | Description |
1111+| ----------- | ------------------------------------------------------------------------------------------------- |
1212+| *packetmix* | Our [*NixOS*](https://nixos.org) configurations ("All you need to bake a delicious system") |
1313+| *sprinkles* | Our [*Niri*](https://github.com/YaLTeR/niri) widgets ("Add some decoration to your Niri desktop") |
13141415## Cloning a single project
1516
···11+/*
22+ This file is provided under the MIT licence:
33+44+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
55+66+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
77+88+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
99+*/
1010+# Generated by npins. Do not modify; will be overwritten regularly
1111+let
1212+ data = builtins.fromJSON (builtins.readFile ./sources.json);
1313+ version = data.version;
1414+1515+ # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
1616+ range =
1717+ first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1);
1818+1919+ # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
2020+ stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
2121+2222+ # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
2323+ stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
2424+ concatMapStrings = f: list: concatStrings (map f list);
2525+ concatStrings = builtins.concatStringsSep "";
2626+2727+ # If the environment variable NPINS_OVERRIDE_${name} is set, then use
2828+ # the path directly as opposed to the fetched source.
2929+ # (Taken from Niv for compatibility)
3030+ mayOverride =
3131+ name: path:
3232+ let
3333+ envVarName = "NPINS_OVERRIDE_${saneName}";
3434+ saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name;
3535+ ersatz = builtins.getEnv envVarName;
3636+ in
3737+ if ersatz == "" then
3838+ path
3939+ else
4040+ # this turns the string into an actual Nix path (for both absolute and
4141+ # relative paths)
4242+ builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" (
4343+ if builtins.substring 0 1 ersatz == "/" then
4444+ /. + ersatz
4545+ else
4646+ /. + builtins.getEnv "PWD" + "/${ersatz}"
4747+ );
4848+4949+ mkSource =
5050+ name: spec:
5151+ assert spec ? type;
5252+ let
5353+ path =
5454+ if spec.type == "Git" then
5555+ mkGitSource spec
5656+ else if spec.type == "GitRelease" then
5757+ mkGitSource spec
5858+ else if spec.type == "PyPi" then
5959+ mkPyPiSource spec
6060+ else if spec.type == "Channel" then
6161+ mkChannelSource spec
6262+ else if spec.type == "Tarball" then
6363+ mkTarballSource spec
6464+ else
6565+ builtins.throw "Unknown source type ${spec.type}";
6666+ in
6767+ spec // { outPath = mayOverride name path; };
6868+6969+ mkGitSource =
7070+ {
7171+ repository,
7272+ revision,
7373+ url ? null,
7474+ submodules,
7575+ hash,
7676+ branch ? null,
7777+ ...
7878+ }:
7979+ assert repository ? type;
8080+ # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
8181+ # In the latter case, there we will always be an url to the tarball
8282+ if url != null && !submodules then
8383+ builtins.fetchTarball {
8484+ inherit url;
8585+ sha256 = hash;
8686+ }
8787+ else
8888+ let
8989+ url =
9090+ if repository.type == "Git" then
9191+ repository.url
9292+ else if repository.type == "GitHub" then
9393+ "https://github.com/${repository.owner}/${repository.repo}.git"
9494+ else if repository.type == "GitLab" then
9595+ "${repository.server}/${repository.repo_path}.git"
9696+ else
9797+ throw "Unrecognized repository type ${repository.type}";
9898+ urlToName =
9999+ url: rev:
100100+ let
101101+ matched = builtins.match "^.*/([^/]*)(\\.git)?$" url;
102102+103103+ short = builtins.substring 0 7 rev;
104104+105105+ appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else "";
106106+ in
107107+ "${if matched == null then "source" else builtins.head matched}${appendShort}";
108108+ name = urlToName url revision;
109109+ in
110110+ builtins.fetchGit {
111111+ rev = revision;
112112+ narHash = hash;
113113+114114+ inherit name submodules url;
115115+ };
116116+117117+ mkPyPiSource =
118118+ { url, hash, ... }:
119119+ builtins.fetchurl {
120120+ inherit url;
121121+ sha256 = hash;
122122+ };
123123+124124+ mkChannelSource =
125125+ { url, hash, ... }:
126126+ builtins.fetchTarball {
127127+ inherit url;
128128+ sha256 = hash;
129129+ };
130130+131131+ mkTarballSource =
132132+ {
133133+ url,
134134+ locked_url ? url,
135135+ hash,
136136+ ...
137137+ }:
138138+ builtins.fetchTarball {
139139+ url = locked_url;
140140+ sha256 = hash;
141141+ };
142142+in
143143+if version == 6 then
144144+ builtins.mapAttrs mkSource data.pins
145145+else
146146+ throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
···11+WITH nid AS (
22+ SELECT id, dbus_notification_id, closed
33+ FROM notifications
44+ WHERE id = ?
55+),
66+current AS (
77+ SELECT c.*, c.id AS raw_id
88+ FROM dbus_notifications c
99+ JOIN nid ON c.id = nid.dbus_notification_id
1010+),
1111+actions AS (
1212+ SELECT action
1313+ FROM notification_actions
1414+ WHERE dbus_notification_id = (SELECT dbus_notification_id FROM nid)
1515+ ORDER BY action
1616+),
1717+hints AS (
1818+ SELECT k, value
1919+ FROM notification_hints
2020+ WHERE dbus_notification_id = (SELECT dbus_notification_id FROM nid)
2121+),
2222+history AS (
2323+ SELECT
2424+ h.*,
2525+ p.idx,
2626+ (
2727+ SELECT json_group_array(action ORDER BY action)
2828+ FROM notification_actions na
2929+ WHERE na.dbus_notification_id = h.id
3030+ ) AS actions,
3131+ (
3232+ SELECT json_group_object(k, value)
3333+ FROM notification_hints nh
3434+ WHERE nh.dbus_notification_id = h.id
3535+ ) AS hints
3636+ FROM previous_dbus_notifications p
3737+ JOIN dbus_notifications h ON h.id = p.dbus_notification_id
3838+ WHERE p.notification_id = (SELECT id FROM nid)
3939+ ORDER BY p.idx ASC
4040+)
4141+SELECT
4242+ (SELECT id FROM nid) AS id,
4343+ (SELECT closed FROM nid) AS closed,
4444+ (SELECT CAST(json_object(
4545+ 'id', lower(substr(hex(current.id),1,8)||'-'||substr(hex(current.id),9,4)||'-'||substr(hex(current.id),13,4)||'-'||substr(hex(current.id),17,4)||'-'||substr(hex(current.id),21)),
4646+ 'app_name', current.app_name,
4747+ 'replaces_id', COALESCE(current.replaces_id, 0),
4848+ 'app_icon', current.app_icon,
4949+ 'summary', current.summary,
5050+ 'body', current.body,
5151+ 'expire_timeout',current.expire_timeout,
5252+ 'actions', (SELECT json_group_array(action) FROM actions),
5353+ 'hints', (SELECT json_group_object(k,value) FROM hints)
5454+ ) AS TEXT) FROM current) AS dbus_notification,
5555+ (SELECT CAST(json_group_array(
5656+ json_object(
5757+ 'id', lower(substr(hex(history.id),1,8)||'-'||substr(hex(history.id),9,4)||'-'||substr(hex(history.id),13,4)||'-'||substr(hex(history.id),17,4)||'-'||substr(hex(history.id),21)),
5858+ 'app_name', history.app_name,
5959+ 'replaces_id', COALESCE(history.replaces_id, 0),
6060+ 'app_icon', history.app_icon,
6161+ 'summary', history.summary,
6262+ 'body', history.body,
6363+ 'expire_timeout',history.expire_timeout,
6464+ 'actions', history.actions,
6565+ 'hints', history.hints
6666+ )
6767+ ORDER BY idx
6868+ ) AS TEXT) FROM history) AS history
6969+;