@ifunny/ifunny-api-types 1.0.4 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devenv/bootstrap/bootstrapLib.nix +650 -0
- package/.devenv/bootstrap/default.nix +22 -0
- package/.devenv/bootstrap/lock-sources.nix +123 -0
- package/.devenv/bootstrap/resolve-input-paths.nix +34 -0
- package/.devenv/bootstrap/resolve-lock.nix +116 -0
- package/.devenv/changelog-cache.json +13 -0
- package/.devenv/devenv.fish +252 -0
- package/.devenv/imports.txt +0 -0
- package/.devenv/input-paths.txt +8 -0
- package/.devenv/load-exports +1 -0
- package/.devenv/nix-eval-cache.db +0 -0
- package/.devenv/nix-eval-cache.db.init.lock +0 -0
- package/.devenv/nixpkgs-config-99f33fda17d41bc9.nix +17 -0
- package/.devenv/nixpkgs-config-c46eff8321b73149.nix +29 -0
- package/.devenv/profiles/nix/bootstrap/bootstrapLib.nix +571 -0
- package/.devenv/profiles/nix/bootstrap/default.nix +19 -0
- package/.devenv/profiles/nix/bootstrap/resolve-lock.nix +157 -0
- package/.devenv/profiles/nix/imports.txt +0 -0
- package/.devenv/profiles/nix/input-paths.txt +4 -0
- package/.devenv/profiles/nix/load-exports +1 -0
- package/.devenv/profiles/nix/nix-eval-cache.db +0 -0
- package/.devenv/profiles/nix/nix-eval-cache.db-shm +0 -0
- package/.devenv/profiles/nix/nix-eval-cache.db-wal +0 -0
- package/.devenv/profiles/nix/nixpkgs-config-99f33fda17d41bc9.nix +17 -0
- package/.devenv/profiles/nix/shell-0d722b4fe4724c8e.sh +2270 -0
- package/.devenv/profiles/nix/shell-314b72302fb2c916.sh +2270 -0
- package/.devenv/profiles/nix/shell-6a4b00b5ca837a3b.sh +2270 -0
- package/.devenv/profiles/nix/shell-956adc1e664f64c3.sh +2270 -0
- package/.devenv/profiles/nix/shell-9dbff87fad44e8d9.sh +2270 -0
- package/.devenv/profiles/nix/shell-b1e9e1f82076662f.sh +2270 -0
- package/.devenv/profiles/nix/shell-b4f4bbfa36797bee.sh +2270 -0
- package/.devenv/profiles/nix/shell-c4b190d331c48d67.sh +2270 -0
- package/.devenv/profiles/nix/state/files.json +1 -0
- package/.devenv/profiles/nix/state/tasks.db +0 -0
- package/.devenv/profiles/nix/state/tasks.db-shm +0 -0
- package/.devenv/profiles/nix/state/tasks.db-wal +0 -0
- package/.devenv/profiles/nix/task-names.txt +5 -0
- package/.devenv/shell-086ca2c39799e6a6.sh +2270 -0
- package/.devenv/shell-2c06a35dd99be3d1.sh +2270 -0
- package/.devenv/shell-36f1fe0faec08873.sh +2270 -0
- package/.devenv/shell-676361065bda5b43.sh +2270 -0
- package/.devenv/shell-9f6cb513d1721fef.sh +2270 -0
- package/.devenv/shell-c0e4459b4f5922d7.sh +2270 -0
- package/.devenv/shell-c862a0db6e9ad5f4.sh +2270 -0
- package/.devenv/shell-d71ade933a43e837.sh +2270 -0
- package/.devenv/shell-dd73aac05b182946.sh +2270 -0
- package/.devenv/shell-e39d0b30a7e0eb13.sh +2270 -0
- package/.devenv/shell-env.sh +2275 -0
- package/.devenv/shell-f924d749ff8c17ee.sh +2270 -0
- package/.devenv/shell-rcfile.sh +152 -0
- package/.devenv/state/files.json +5 -0
- package/.devenv/state/git-hooks-install/hooks +1 -0
- package/.devenv/state/git-hooks-install/key +4 -0
- package/.devenv/state/prek/.lock +0 -0
- package/.devenv/state/prek/README +2 -0
- package/.devenv/state/prek/config-tracking.json +3 -0
- package/.devenv/state/prek/patches/1793595918715-562072.patch +26 -0
- package/.devenv/state/prek/patches/1793596283854-574354.patch +22881 -0
- package/.devenv/state/prek/patches/1793596332255-574728.patch +22870 -0
- package/.devenv/state/prek/patches/1793597557669-617911.patch +284 -0
- package/.devenv/state/prek/patches/1793856046749-331249.patch +2906 -0
- package/.devenv/state/prek/patches/1793856096552-331868.patch +2998 -0
- package/.devenv/state/prek/patches/1793856146786-332328.patch +3009 -0
- package/.devenv/state/prek/patches/1793856181490-332981.patch +11401 -0
- package/.devenv/state/prek/patches/1793856203087-333510.patch +11388 -0
- package/.devenv/state/prek/patches/1793856277935-334258.patch +11372 -0
- package/.devenv/state/prek/patches/1793856646955-337912.patch +8488 -0
- package/.devenv/state/prek/patches/1793856682905-338572.patch +8260 -0
- package/.devenv/state/prek/patches/1793857035751-356215.patch +8295 -0
- package/.devenv/state/tasks.db +0 -0
- package/.devenv/state/tasks.db.init.lock +0 -0
- package/.devenv/task-names.txt +7 -0
- package/.github/workflows/codeql.yml +72 -72
- package/.github/workflows/test.yml +31 -31
- package/.prettierignore +9 -0
- package/CHANGELOG.md +609 -427
- package/LICENSE +121 -121
- package/README.md +2 -2
- package/devenv.lock +103 -0
- package/devenv.nix +35 -0
- package/devenv.yaml +23 -0
- package/dist/errors/bad_request.js +7 -7
- package/dist/errors/bad_request.js.map +1 -1
- package/dist/errors/captcha_required.js +18 -18
- package/dist/errors/captcha_required.js.map +1 -1
- package/dist/errors/email_exists.js +7 -7
- package/dist/errors/email_exists.js.map +1 -1
- package/dist/errors/error.js +2 -2
- package/dist/errors/error_base.js +42 -42
- package/dist/errors/error_base.js.map +1 -1
- package/dist/errors/index.js +28 -28
- package/dist/errors/invalid_client.js +7 -7
- package/dist/errors/invalid_client.js.map +1 -1
- package/dist/errors/invalid_email.js +7 -7
- package/dist/errors/invalid_email.js.map +1 -1
- package/dist/errors/invalid_grant.js +7 -7
- package/dist/errors/invalid_grant.js.map +1 -1
- package/dist/errors/not_found.js +2 -2
- package/dist/errors/permission_denied.js +7 -7
- package/dist/errors/permission_denied.js.map +1 -1
- package/dist/errors/unauthorized.js +7 -7
- package/dist/errors/unauthorized.js.map +1 -1
- package/dist/errors/wrong_params.js +7 -7
- package/dist/errors/wrong_params.js.map +1 -1
- package/dist/index.js +20 -20
- package/dist/payloads/activity.js +49 -49
- package/dist/payloads/activity.js.map +1 -1
- package/dist/payloads/app.js +2 -2
- package/dist/payloads/appeal.js +13 -13
- package/dist/payloads/appeal.js.map +1 -1
- package/dist/payloads/ban.js +35 -35
- package/dist/payloads/ban.js.map +1 -1
- package/dist/payloads/base.js +2 -2
- package/dist/payloads/chat.js +37 -0
- package/dist/payloads/chat.js.map +1 -0
- package/dist/payloads/client.js +12 -12
- package/dist/payloads/client.js.map +1 -1
- package/dist/payloads/comment.js +41 -41
- package/dist/payloads/comment.js.map +1 -1
- package/dist/payloads/content.js +175 -175
- package/dist/payloads/content.js.map +1 -1
- package/dist/payloads/index.js +28 -26
- package/dist/payloads/index.js.map +1 -1
- package/dist/payloads/strike.js +2 -2
- package/dist/payloads/topics.js +72 -0
- package/dist/payloads/topics.js.map +1 -0
- package/dist/payloads/user.js +214 -214
- package/dist/payloads/user.js.map +1 -1
- package/dist/rest/account.js +2 -2
- package/dist/rest/content.js +53 -53
- package/dist/rest/content.js.map +1 -1
- package/dist/rest/counters.js +2 -2
- package/dist/rest/endpoints.js +198 -198
- package/dist/rest/endpoints.js.map +1 -1
- package/dist/rest/explore.js +81 -81
- package/dist/rest/explore.js.map +1 -1
- package/dist/rest/feeds.js +2 -2
- package/dist/rest/index.js +24 -24
- package/dist/rest/issues.js +2 -2
- package/dist/rest/oauth2.js +8 -8
- package/dist/rest/oauth2.js.map +1 -1
- package/dist/utils/index.js +18 -18
- package/dist/utils/rest.js +2 -2
- package/dist/utils/util.js +2 -2
- package/eslint.config.mjs +18 -0
- package/package.json +66 -50
- package/prettier.config.js +15 -0
- package/tag-check.sh +111 -0
- package/types/errors/bad_request.d.ts +11 -11
- package/types/errors/bad_request.d.ts.map +1 -1
- package/types/errors/captcha_required.d.ts +32 -32
- package/types/errors/captcha_required.d.ts.map +1 -1
- package/types/errors/email_exists.d.ts +14 -14
- package/types/errors/email_exists.d.ts.map +1 -1
- package/types/errors/error.d.ts +28 -28
- package/types/errors/error.d.ts.map +1 -1
- package/types/errors/error_base.d.ts +60 -60
- package/types/errors/error_base.d.ts.map +1 -1
- package/types/errors/index.d.ts +12 -12
- package/types/errors/invalid_client.d.ts +14 -14
- package/types/errors/invalid_client.d.ts.map +1 -1
- package/types/errors/invalid_email.d.ts +14 -14
- package/types/errors/invalid_email.d.ts.map +1 -1
- package/types/errors/invalid_grant.d.ts +11 -11
- package/types/errors/invalid_grant.d.ts.map +1 -1
- package/types/errors/not_found.d.ts +7 -7
- package/types/errors/permission_denied.d.ts +11 -11
- package/types/errors/permission_denied.d.ts.map +1 -1
- package/types/errors/unauthorized.d.ts +11 -11
- package/types/errors/unauthorized.d.ts.map +1 -1
- package/types/errors/wrong_params.d.ts +10 -10
- package/types/errors/wrong_params.d.ts.map +1 -1
- package/types/index.d.ts +4 -4
- package/types/payloads/activity.d.ts +113 -113
- package/types/payloads/activity.d.ts.map +1 -1
- package/types/payloads/app.d.ts +265 -265
- package/types/payloads/appeal.d.ts +21 -21
- package/types/payloads/appeal.d.ts.map +1 -1
- package/types/payloads/ban.d.ts +84 -84
- package/types/payloads/ban.d.ts.map +1 -1
- package/types/payloads/base.d.ts +4 -4
- package/types/payloads/chat.d.ts +117 -0
- package/types/payloads/chat.d.ts.map +1 -0
- package/types/payloads/client.d.ts +107 -107
- package/types/payloads/client.d.ts.map +1 -1
- package/types/payloads/comment.d.ts +123 -123
- package/types/payloads/comment.d.ts.map +1 -1
- package/types/payloads/content.d.ts +676 -677
- package/types/payloads/content.d.ts.map +1 -1
- package/types/payloads/index.d.ts +12 -10
- package/types/payloads/index.d.ts.map +1 -1
- package/types/payloads/strike.d.ts +14 -14
- package/types/payloads/topics.d.ts +45 -0
- package/types/payloads/topics.d.ts.map +1 -0
- package/types/payloads/user.d.ts +522 -522
- package/types/payloads/user.d.ts.map +1 -1
- package/types/rest/account.d.ts +3 -3
- package/types/rest/account.d.ts.map +1 -1
- package/types/rest/content.d.ts +95 -95
- package/types/rest/content.d.ts.map +1 -1
- package/types/rest/counters.d.ts +9 -9
- package/types/rest/counters.d.ts.map +1 -1
- package/types/rest/endpoints.d.ts +152 -152
- package/types/rest/explore.d.ts +112 -112
- package/types/rest/explore.d.ts.map +1 -1
- package/types/rest/feeds.d.ts +16 -16
- package/types/rest/index.d.ts +8 -8
- package/types/rest/issues.d.ts +15 -15
- package/types/rest/oauth2.d.ts +36 -36
- package/types/rest/oauth2.d.ts.map +1 -1
- package/types/utils/index.d.ts +2 -2
- package/types/utils/rest.d.ts +49 -49
- package/types/utils/rest.d.ts.map +1 -1
- package/types/utils/util.d.ts +79 -79
- package/types/utils/util.d.ts.map +1 -1
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Source resolution shared by YAML discovery and full flake evaluation.
|
|
2
|
+
{
|
|
3
|
+
src,
|
|
4
|
+
lockFile,
|
|
5
|
+
rootSrc ? {
|
|
6
|
+
outPath = src;
|
|
7
|
+
},
|
|
8
|
+
}:
|
|
9
|
+
let
|
|
10
|
+
sourceInfo =
|
|
11
|
+
key: node:
|
|
12
|
+
if key == lockFile.root then
|
|
13
|
+
rootSrc
|
|
14
|
+
# Path inputs pointing to project root (path = ".") should use rootSrc
|
|
15
|
+
# to avoid fetchTree hashing the entire project directory
|
|
16
|
+
else if node.locked.type or null == "path" && node.locked.path or null == "." then
|
|
17
|
+
rootSrc
|
|
18
|
+
else
|
|
19
|
+
let
|
|
20
|
+
locked = node.locked;
|
|
21
|
+
isRelativePath =
|
|
22
|
+
p: p != null && (builtins.substring 0 2 p == "./" || builtins.substring 0 3 p == "../");
|
|
23
|
+
# Resolve relative paths against src
|
|
24
|
+
resolvedLocked =
|
|
25
|
+
locked
|
|
26
|
+
// (
|
|
27
|
+
if locked.type or null == "path" && isRelativePath (locked.path or null) then
|
|
28
|
+
{ path = toString src + "/${locked.path}"; }
|
|
29
|
+
else
|
|
30
|
+
{ }
|
|
31
|
+
)
|
|
32
|
+
// (
|
|
33
|
+
if locked.type or null == "git" && isRelativePath (locked.url or null) then
|
|
34
|
+
{ url = toString src + "/${locked.url}"; }
|
|
35
|
+
else
|
|
36
|
+
{ }
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
# Local path inputs without a pinned narHash resolve to the live
|
|
40
|
+
# filesystem path instead of a fetchTree store copy. The lock file
|
|
41
|
+
# never carries a narHash for them (Nix strips volatile attributes
|
|
42
|
+
# from local inputs), so a store copy would hide edits from the
|
|
43
|
+
# eval cache: nothing in the cache key changes when the directory
|
|
44
|
+
# content changes. Evaluating from the live path makes the eval
|
|
45
|
+
# cache track every file that is read, so edits invalidate it.
|
|
46
|
+
isLivePath =
|
|
47
|
+
locked.type or null == "path"
|
|
48
|
+
&& !(locked ? narHash)
|
|
49
|
+
&& builtins.substring 0 1 (resolvedLocked.path or "") == "/";
|
|
50
|
+
|
|
51
|
+
sourceAttrs = node.info or { } // removeAttrs resolvedLocked [ "dir" ];
|
|
52
|
+
# Final fetches trust the lock's metadata and can substitute the
|
|
53
|
+
# source from a binary cache. Keep ordinary fetches for inputs
|
|
54
|
+
# whose missing metadata still needs to be supplied by the fetcher.
|
|
55
|
+
hasLockedMetadata =
|
|
56
|
+
sourceAttrs ? narHash
|
|
57
|
+
&& (
|
|
58
|
+
sourceAttrs.type == "file"
|
|
59
|
+
|| (
|
|
60
|
+
builtins.elem sourceAttrs.type [
|
|
61
|
+
"git"
|
|
62
|
+
"github"
|
|
63
|
+
"gitlab"
|
|
64
|
+
"sourcehut"
|
|
65
|
+
"tarball"
|
|
66
|
+
]
|
|
67
|
+
&& sourceAttrs ? lastModified
|
|
68
|
+
&& (sourceAttrs.type == "tarball" || sourceAttrs ? rev)
|
|
69
|
+
&& (sourceAttrs.type != "git" || (sourceAttrs.shallow or true) || sourceAttrs ? revCount)
|
|
70
|
+
)
|
|
71
|
+
);
|
|
72
|
+
fetchTree =
|
|
73
|
+
if hasLockedMetadata then builtins.fetchFinalTree or builtins.fetchTree else builtins.fetchTree;
|
|
74
|
+
fetchedSource = fetchTree sourceAttrs;
|
|
75
|
+
in
|
|
76
|
+
if isLivePath then
|
|
77
|
+
{
|
|
78
|
+
# Keep fetchTree's public metadata available to flakes that use
|
|
79
|
+
# self.narHash or self.lastModified. These inherited values stay
|
|
80
|
+
# lazy, so the live input is only hashed if metadata is read.
|
|
81
|
+
inherit (fetchedSource) lastModified lastModifiedDate narHash;
|
|
82
|
+
outPath = /. + resolvedLocked.path;
|
|
83
|
+
}
|
|
84
|
+
else
|
|
85
|
+
fetchedSource;
|
|
86
|
+
|
|
87
|
+
# Resolve a input spec into a node name. An input spec is
|
|
88
|
+
# either a node name, or a 'follows' path from the root
|
|
89
|
+
# node.
|
|
90
|
+
resolveInput =
|
|
91
|
+
inputSpec: if builtins.isList inputSpec then getInputByPath lockFile.root inputSpec else inputSpec;
|
|
92
|
+
|
|
93
|
+
# Follow an input path (e.g. ["dwarffs" "nixpkgs"]) from the
|
|
94
|
+
# root node, returning the final node.
|
|
95
|
+
getInputByPath =
|
|
96
|
+
nodeName: path:
|
|
97
|
+
if path == [ ] then
|
|
98
|
+
nodeName
|
|
99
|
+
else
|
|
100
|
+
getInputByPath
|
|
101
|
+
# Since this could be a 'follows' input, call resolveInput.
|
|
102
|
+
(resolveInput lockFile.nodes.${nodeName}.inputs.${builtins.head path})
|
|
103
|
+
(builtins.tail path);
|
|
104
|
+
|
|
105
|
+
nodeSource =
|
|
106
|
+
key:
|
|
107
|
+
let
|
|
108
|
+
node = lockFile.nodes.${key};
|
|
109
|
+
in
|
|
110
|
+
{
|
|
111
|
+
repository_root = (sourceInfo key node).outPath;
|
|
112
|
+
dir = if key == lockFile.root then "" else node.locked.dir or "";
|
|
113
|
+
};
|
|
114
|
+
in
|
|
115
|
+
{
|
|
116
|
+
inherit sourceInfo resolveInput nodeSource;
|
|
117
|
+
nodePath =
|
|
118
|
+
key:
|
|
119
|
+
let
|
|
120
|
+
source = nodeSource key;
|
|
121
|
+
in
|
|
122
|
+
source.repository_root + (if source.dir == "" then "" else "/${source.dir}");
|
|
123
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
src,
|
|
3
|
+
names,
|
|
4
|
+
lockFileJSON,
|
|
5
|
+
sourceResolver ? import ./lock-sources.nix,
|
|
6
|
+
}:
|
|
7
|
+
let
|
|
8
|
+
lockFilePath = src + "/devenv.lock";
|
|
9
|
+
lockFile = builtins.fromJSON lockFileJSON;
|
|
10
|
+
sources = sourceResolver { inherit src lockFile; };
|
|
11
|
+
rootInputs = lockFile.nodes.${lockFile.root}.inputs or { };
|
|
12
|
+
in
|
|
13
|
+
if lockFile.version < 5 || lockFile.version > 7 then
|
|
14
|
+
throw "lock file '${lockFilePath}' has unsupported version ${toString lockFile.version}"
|
|
15
|
+
else
|
|
16
|
+
builtins.listToAttrs (
|
|
17
|
+
map (
|
|
18
|
+
name:
|
|
19
|
+
if !(builtins.hasAttr name rootInputs) then
|
|
20
|
+
throw "input '${name}' is missing from ${lockFilePath}"
|
|
21
|
+
else
|
|
22
|
+
{
|
|
23
|
+
inherit name;
|
|
24
|
+
value =
|
|
25
|
+
let
|
|
26
|
+
source = sources.nodeSource (sources.resolveInput rootInputs.${name});
|
|
27
|
+
in
|
|
28
|
+
{
|
|
29
|
+
repository_root = toString source.repository_root;
|
|
30
|
+
inherit (source) dir;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
) names
|
|
34
|
+
)
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Adapted from https://git.lix.systems/lix-project/flake-compat/src/branch/main/default.nix
|
|
2
|
+
{
|
|
3
|
+
src,
|
|
4
|
+
lockFilePath,
|
|
5
|
+
system ? builtins.currentSystem or "unknown-system",
|
|
6
|
+
}:
|
|
7
|
+
|
|
8
|
+
let
|
|
9
|
+
lockFile = builtins.fromJSON (builtins.readFile lockFilePath);
|
|
10
|
+
|
|
11
|
+
rootSrc = {
|
|
12
|
+
lastModified = 0;
|
|
13
|
+
lastModifiedDate = formatSecondsSinceEpoch 0;
|
|
14
|
+
# *hacker voice*: it's definitely a store path, I promise (actually a
|
|
15
|
+
# nixlang path value, likely not pointing at the store).
|
|
16
|
+
outPath = src;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
# Format number of seconds in the Unix epoch as %Y%m%d%H%M%S.
|
|
20
|
+
formatSecondsSinceEpoch =
|
|
21
|
+
t:
|
|
22
|
+
let
|
|
23
|
+
rem = x: y: x - x / y * y;
|
|
24
|
+
days = t / 86400;
|
|
25
|
+
secondsInDay = rem t 86400;
|
|
26
|
+
hours = secondsInDay / 3600;
|
|
27
|
+
minutes = (rem secondsInDay 3600) / 60;
|
|
28
|
+
seconds = rem t 60;
|
|
29
|
+
|
|
30
|
+
# Courtesy of https://stackoverflow.com/a/32158604.
|
|
31
|
+
z = days + 719468;
|
|
32
|
+
era = (if z >= 0 then z else z - 146096) / 146097;
|
|
33
|
+
doe = z - era * 146097;
|
|
34
|
+
yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365;
|
|
35
|
+
y = yoe + era * 400;
|
|
36
|
+
doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
|
|
37
|
+
mp = (5 * doy + 2) / 153;
|
|
38
|
+
d = doy - (153 * mp + 2) / 5 + 1;
|
|
39
|
+
m = mp + (if mp < 10 then 3 else -9);
|
|
40
|
+
y' = y + (if m <= 2 then 1 else 0);
|
|
41
|
+
|
|
42
|
+
pad = s: if builtins.stringLength s < 2 then "0" + s else s;
|
|
43
|
+
in
|
|
44
|
+
"${toString y'}${pad (toString m)}${pad (toString d)}${pad (toString hours)}${pad (toString minutes)}${pad (toString seconds)}";
|
|
45
|
+
|
|
46
|
+
sources = import ./lock-sources.nix { inherit src lockFile rootSrc; };
|
|
47
|
+
|
|
48
|
+
allNodes = builtins.mapAttrs (
|
|
49
|
+
key: node:
|
|
50
|
+
let
|
|
51
|
+
sourceInfo = sources.sourceInfo key node;
|
|
52
|
+
outPath = sources.nodePath key;
|
|
53
|
+
inherit (sources) resolveInput;
|
|
54
|
+
|
|
55
|
+
inputs = builtins.mapAttrs (inputName: inputSpec: allNodes.${resolveInput inputSpec}) (
|
|
56
|
+
node.inputs or { }
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
# Only import flake.nix for non-root nodes (root doesn't need it)
|
|
60
|
+
flake = if key == lockFile.root then null else import (outPath + "/flake.nix");
|
|
61
|
+
|
|
62
|
+
outputs = if key == lockFile.root then { } else flake.outputs (inputs // { self = result; });
|
|
63
|
+
|
|
64
|
+
# Lazy devenv evaluation for this input
|
|
65
|
+
devenvEval =
|
|
66
|
+
let
|
|
67
|
+
bootstrapLib = import ./bootstrapLib.nix { inputs = inputs; };
|
|
68
|
+
in
|
|
69
|
+
bootstrapLib.mkDevenvForInput {
|
|
70
|
+
input = { inherit outPath sourceInfo; };
|
|
71
|
+
allInputs = inputs;
|
|
72
|
+
inherit system;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
result =
|
|
76
|
+
outputs
|
|
77
|
+
// sourceInfo
|
|
78
|
+
// {
|
|
79
|
+
inherit outPath;
|
|
80
|
+
inherit inputs;
|
|
81
|
+
inherit outputs;
|
|
82
|
+
inherit sourceInfo;
|
|
83
|
+
_type = "flake";
|
|
84
|
+
devenv = devenvEval;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
nonFlakeResult = sourceInfo // {
|
|
88
|
+
inherit outPath;
|
|
89
|
+
inherit inputs;
|
|
90
|
+
inherit sourceInfo;
|
|
91
|
+
_type = "flake";
|
|
92
|
+
devenv = devenvEval;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
in
|
|
96
|
+
if node.flake or true && key != lockFile.root then
|
|
97
|
+
assert builtins.isFunction flake.outputs;
|
|
98
|
+
result
|
|
99
|
+
else
|
|
100
|
+
nonFlakeResult
|
|
101
|
+
) lockFile.nodes;
|
|
102
|
+
|
|
103
|
+
result =
|
|
104
|
+
if !(builtins.pathExists lockFilePath) then
|
|
105
|
+
throw "${lockFilePath} does not exist"
|
|
106
|
+
else if lockFile.version >= 5 && lockFile.version <= 7 then
|
|
107
|
+
allNodes.${lockFile.root}
|
|
108
|
+
else
|
|
109
|
+
throw "lock file '${lockFilePath}' has unsupported version ${toString lockFile.version}";
|
|
110
|
+
|
|
111
|
+
in
|
|
112
|
+
{
|
|
113
|
+
inputs = result.inputs or { } // {
|
|
114
|
+
self = result;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"shown_hashes": [
|
|
3
|
+
"c40a016aca4dd81dcdca91ff004d81492328aa4b5c49912d6b83a945c2feff84",
|
|
4
|
+
"8839032c01350edeedfc4b3a2a745aa492e52c72f312cea40001db7ddd425a0c",
|
|
5
|
+
"e6825d4a5422d776d0eb3054f874bf73d8e32e9259f2d7be3a633cbce6bccdcd",
|
|
6
|
+
"97c8d967408d5e8dbaefb984ff368930aa96af9c3655e6d867154992052f5881",
|
|
7
|
+
"c676d28e6e161c0158c0f01f391da5d29a407d0a84fca705572b092ef839ee04",
|
|
8
|
+
"053d92e6228a113aaf85e8f544485eb3f64cc8b4ed6ec52abf21847cbc637b53",
|
|
9
|
+
"7e644d0388477d89d10f791e1509430c333b9585ad4215f913f292e10e248575",
|
|
10
|
+
"5a589290b7df7d37070a19af3adb407d66ebcfeaa9cd6b628ea0c1998d7a6cde",
|
|
11
|
+
"b81b889e24497f586305db7e9d9f0a4cfc0f802a8ef0a4c72b367ae6a70e5047"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# devenv fish init
|
|
2
|
+
|
|
3
|
+
# If this shell was spawned by the devenv hook, `exit` when the user `cd`s
|
|
4
|
+
# outside the project so the parent shell can follow. The user's config.fish
|
|
5
|
+
# may already have moved `_DEVENV_HOOK_DIR` to the non-exported
|
|
6
|
+
# `_devenv_hook_dir` before this init file runs. Accept either marker so the
|
|
7
|
+
# exit happens on PWD change, before prompt handlers can query the terminal.
|
|
8
|
+
# Erase the exported marker so it cannot leak into further descendants.
|
|
9
|
+
if set -q _DEVENV_HOOK_DIR; or set -q _devenv_hook_dir
|
|
10
|
+
set -e _DEVENV_HOOK_DIR
|
|
11
|
+
function _devenv_shell_exit_on_cd_out --on-variable PWD
|
|
12
|
+
switch $PWD
|
|
13
|
+
case "$DEVENV_ROOT" "$DEVENV_ROOT/*"
|
|
14
|
+
case '*'
|
|
15
|
+
printf '%s' $PWD > "$DEVENV_ROOT/.devenv/exit-dir"
|
|
16
|
+
exit
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Restore devenv PATH after user config may have modified it.
|
|
22
|
+
# _DEVENV_PATH is a colon-separated string from bash; split into fish list.
|
|
23
|
+
set -gx PATH (string split ":" -- $_DEVENV_PATH)
|
|
24
|
+
|
|
25
|
+
# Wrap fish_prompt for devenv reload hooks and prompt prefix.
|
|
26
|
+
if functions -q fish_prompt
|
|
27
|
+
functions -c fish_prompt __devenv_user_fish_prompt
|
|
28
|
+
function fish_prompt
|
|
29
|
+
__devenv_user_fish_prompt
|
|
30
|
+
__devenv_reload_apply
|
|
31
|
+
__devenv_restore_path
|
|
32
|
+
end
|
|
33
|
+
else
|
|
34
|
+
function fish_prompt
|
|
35
|
+
__devenv_reload_apply
|
|
36
|
+
__devenv_restore_path
|
|
37
|
+
echo -n "(devenv) > "
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Hot-reload hook
|
|
42
|
+
|
|
43
|
+
function __devenv_reload_apply
|
|
44
|
+
# Source new environment if a reload is pending
|
|
45
|
+
if test -f "/tmp/devenv-reload-283714.sh"
|
|
46
|
+
# Shell out to bash to handle the env diff (bash syntax).
|
|
47
|
+
# The bash subprocess inherits our current environment, reverses
|
|
48
|
+
# the previous diff, sources the new devenv env, computes a new
|
|
49
|
+
# diff, and outputs the resulting environment via export -p.
|
|
50
|
+
set -l reload_output (bash -c '
|
|
51
|
+
|
|
52
|
+
# Environment diff helpers (inspired by direnv)
|
|
53
|
+
# Diff is stored in _DEVENV_DIFF env var (not a file) so each shell has its own state
|
|
54
|
+
# Uses gzip+base64 encoding for compact storage
|
|
55
|
+
|
|
56
|
+
# Variables to ignore in diff (shell internals that change dynamically)
|
|
57
|
+
__devenv_ignored_var() {
|
|
58
|
+
case "$1" in
|
|
59
|
+
_*|PWD|OLDPWD|SHLVL|SHELL|SHELLOPTS|BASHOPTS|BASH_*|HISTCMD|HISTFILE)
|
|
60
|
+
return 0 ;;
|
|
61
|
+
PS1|PS2|PS3|PS4|PROMPT|PROMPT_COMMAND|PROMPT_DIRTRIM)
|
|
62
|
+
return 0 ;;
|
|
63
|
+
COMP_*|READLINE_*|MAILCHECK|COLUMNS|LINES|RANDOM|SECONDS|LINENO|EPOCHSECONDS|EPOCHREALTIME|SRANDOM)
|
|
64
|
+
return 0 ;;
|
|
65
|
+
STARSHIP_*|__fish*|DIRENV_*|nix_saved_*)
|
|
66
|
+
return 0 ;;
|
|
67
|
+
*)
|
|
68
|
+
return 1 ;;
|
|
69
|
+
esac
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
__devenv_capture_env() {
|
|
73
|
+
# Capture exported variables using declare -p for proper escaping
|
|
74
|
+
declare -p -x 2>/dev/null | LC_ALL=C sort
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
__devenv_serialize_diff() {
|
|
78
|
+
# Serialize diff (stdin) to base64-encoded gzip
|
|
79
|
+
gzip -c | base64 -w0
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
__devenv_deserialize_diff() {
|
|
83
|
+
# Deserialize diff from base64-encoded gzip to stdout
|
|
84
|
+
echo "$1" | base64 -d | gzip -d 2>/dev/null
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
__devenv_compute_diff() {
|
|
88
|
+
# Compare before ($1) and current env, return diff via _DEVENV_DIFF env var
|
|
89
|
+
local before_file="$1"
|
|
90
|
+
|
|
91
|
+
# Create temp files
|
|
92
|
+
local after_file diff_content
|
|
93
|
+
after_file=$(mktemp)
|
|
94
|
+
diff_content=$(mktemp)
|
|
95
|
+
__devenv_capture_env > "$after_file"
|
|
96
|
+
|
|
97
|
+
# Build associative arrays for before/after
|
|
98
|
+
local -A before_vars after_vars
|
|
99
|
+
while IFS= read -r line; do
|
|
100
|
+
[[ "$line" != declare\ -x\ * ]] && continue
|
|
101
|
+
local vardef="${line#declare -x }"
|
|
102
|
+
local var="${vardef%%=*}"
|
|
103
|
+
[[ -z "$var" ]] && continue
|
|
104
|
+
__devenv_ignored_var "$var" && continue
|
|
105
|
+
before_vars["$var"]="$line"
|
|
106
|
+
done < "$before_file"
|
|
107
|
+
|
|
108
|
+
while IFS= read -r line; do
|
|
109
|
+
[[ "$line" != declare\ -x\ * ]] && continue
|
|
110
|
+
local vardef="${line#declare -x }"
|
|
111
|
+
local var="${vardef%%=*}"
|
|
112
|
+
[[ -z "$var" ]] && continue
|
|
113
|
+
__devenv_ignored_var "$var" && continue
|
|
114
|
+
after_vars["$var"]="$line"
|
|
115
|
+
done < "$after_file"
|
|
116
|
+
|
|
117
|
+
# Find PREV entries (vars that were modified or removed)
|
|
118
|
+
for var in "${!before_vars[@]}"; do
|
|
119
|
+
if [[ "${after_vars[$var]}" != "${before_vars[$var]}" ]]; then
|
|
120
|
+
echo "P:${before_vars[$var]}" >> "$diff_content"
|
|
121
|
+
fi
|
|
122
|
+
done
|
|
123
|
+
|
|
124
|
+
# Find NEXT entries (vars that were added or modified)
|
|
125
|
+
for var in "${!after_vars[@]}"; do
|
|
126
|
+
if [[ -z "${before_vars[$var]+x}" ]]; then
|
|
127
|
+
echo "N:$var" >> "$diff_content"
|
|
128
|
+
elif [[ "${after_vars[$var]}" != "${before_vars[$var]}" ]]; then
|
|
129
|
+
echo "N:$var" >> "$diff_content"
|
|
130
|
+
fi
|
|
131
|
+
done
|
|
132
|
+
|
|
133
|
+
# Serialize and store in env var
|
|
134
|
+
_DEVENV_DIFF=$(__devenv_serialize_diff < "$diff_content")
|
|
135
|
+
export _DEVENV_DIFF
|
|
136
|
+
|
|
137
|
+
rm -f "$after_file" "$diff_content"
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
__devenv_apply_reverse_diff() {
|
|
141
|
+
# Reverse the diff: restore PREV values, unset NEXT-only vars
|
|
142
|
+
[[ -z "$_DEVENV_DIFF" ]] && return
|
|
143
|
+
|
|
144
|
+
local -A prev_vars
|
|
145
|
+
local diff_content
|
|
146
|
+
diff_content=$(__devenv_deserialize_diff "$_DEVENV_DIFF")
|
|
147
|
+
|
|
148
|
+
# First pass: collect and restore PREV declarations
|
|
149
|
+
while IFS= read -r line; do
|
|
150
|
+
if [[ "$line" == P:declare\ * ]]; then
|
|
151
|
+
local decl="${line#P:}"
|
|
152
|
+
local var="${decl#declare -x }"
|
|
153
|
+
var="${var%%=*}"
|
|
154
|
+
prev_vars["$var"]=1
|
|
155
|
+
# Use export instead of evaluating the declare statement directly,
|
|
156
|
+
# because declare -x inside a function creates a local variable
|
|
157
|
+
# in bash 5.0+.
|
|
158
|
+
eval "export ${decl#declare -x }" 2>/dev/null
|
|
159
|
+
fi
|
|
160
|
+
done <<< "$diff_content"
|
|
161
|
+
|
|
162
|
+
# Second pass: unset NEXT vars that were not in PREV (added vars)
|
|
163
|
+
while IFS= read -r line; do
|
|
164
|
+
if [[ "$line" == N:* ]]; then
|
|
165
|
+
local var="${line#N:}"
|
|
166
|
+
if [[ -z "${prev_vars[$var]+x}" ]]; then
|
|
167
|
+
unset "$var"
|
|
168
|
+
fi
|
|
169
|
+
fi
|
|
170
|
+
done <<< "$diff_content"
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
# Reverse previous diff
|
|
177
|
+
__devenv_apply_reverse_diff
|
|
178
|
+
|
|
179
|
+
# Capture env before sourcing new devenv
|
|
180
|
+
_before=$(mktemp)
|
|
181
|
+
__devenv_capture_env > "$_before"
|
|
182
|
+
|
|
183
|
+
# Send enterShell output to the terminal instead of the captured stdout.
|
|
184
|
+
# Probe by actually opening /dev/tty: it can exist with writable permission
|
|
185
|
+
# bits yet fail to open (ENXIO) when there is no controlling terminal.
|
|
186
|
+
if { : >/dev/tty; } 2>/dev/null; then
|
|
187
|
+
_devenv_reload_out=/dev/tty
|
|
188
|
+
else
|
|
189
|
+
_devenv_reload_out=/dev/null
|
|
190
|
+
fi
|
|
191
|
+
|
|
192
|
+
# Source new devenv environment
|
|
193
|
+
source "/tmp/devenv-reload-283714.sh" >"$_devenv_reload_out" 2>"$_devenv_reload_out"
|
|
194
|
+
rm -f "/tmp/devenv-reload-283714.sh"
|
|
195
|
+
unset _devenv_reload_out
|
|
196
|
+
|
|
197
|
+
# Compute new diff
|
|
198
|
+
__devenv_compute_diff "$_before"
|
|
199
|
+
rm -f "$_before"
|
|
200
|
+
|
|
201
|
+
# Output environment data for the calling shell to apply
|
|
202
|
+
export -p
|
|
203
|
+
' 2>/dev/null)
|
|
204
|
+
|
|
205
|
+
# Parse bash export -p output (declare -x VAR="value") and apply
|
|
206
|
+
# each variable to the fish environment via set -gx.
|
|
207
|
+
for line in $reload_output
|
|
208
|
+
# Match lines of the form: declare -x VAR="value"
|
|
209
|
+
set -l parts (string match -r '^declare -x ([^=]+)="(.*)"$' -- $line)
|
|
210
|
+
if test (count $parts) -gt 0
|
|
211
|
+
set -l var $parts[2]
|
|
212
|
+
set -l val $parts[3]
|
|
213
|
+
# Skip fish read-only electric variables that bash exports.
|
|
214
|
+
# PWD and SHLVL are managed by fish; assigning to them errors.
|
|
215
|
+
if test "$var" = PWD -o "$var" = SHLVL
|
|
216
|
+
continue
|
|
217
|
+
end
|
|
218
|
+
# PATH, MANPATH, CDPATH are list variables in fish;
|
|
219
|
+
# split colon-separated values into proper lists.
|
|
220
|
+
if test "$var" = PATH -o "$var" = MANPATH -o "$var" = CDPATH
|
|
221
|
+
set -gx $var (string split ":" -- $val)
|
|
222
|
+
else
|
|
223
|
+
set -gx $var $val
|
|
224
|
+
end
|
|
225
|
+
else
|
|
226
|
+
# Variable exported without a value: declare -x VAR
|
|
227
|
+
set -l noval (string match -r '^declare -x ([^=]+)$' -- $line)
|
|
228
|
+
if test (count $noval) -gt 0
|
|
229
|
+
set -gx $noval[2] ""
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Update saved PATH
|
|
235
|
+
set -gx _DEVENV_PATH (string join ":" -- $PATH)
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
function __devenv_restore_path
|
|
240
|
+
# Restore devenv PATH (in case direnv or other tools modified it).
|
|
241
|
+
# _DEVENV_PATH is a colon-separated string; split into a list for fish.
|
|
242
|
+
set -gx PATH (string split ":" -- $_DEVENV_PATH)
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# Keybinding for manual reload (Ctrl+Alt+R by default)
|
|
246
|
+
function __devenv_reload_keybind_handler
|
|
247
|
+
__devenv_reload_apply
|
|
248
|
+
commandline -f repaint
|
|
249
|
+
end
|
|
250
|
+
bind (string unescape '\x1b\x12') __devenv_reload_keybind_handler
|
|
251
|
+
|
|
252
|
+
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/home/shift/.config/nixpkgs/overlays
|
|
2
|
+
/home/shift/.config/nixpkgs/overlays.nix
|
|
3
|
+
/media/Code/@Open-iFunny/ifunny-api-types/.env
|
|
4
|
+
/media/Code/@Open-iFunny/ifunny-api-types/devenv.local.nix
|
|
5
|
+
/media/Code/@Open-iFunny/ifunny-api-types/devenv.lock
|
|
6
|
+
/media/Code/@Open-iFunny/ifunny-api-types/devenv.nix
|
|
7
|
+
/media/Code/@Open-iFunny/ifunny-api-types/devenv.yaml
|
|
8
|
+
/run/user/1000/devenv-02bb315/processes/native-manager.pid
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
let
|
|
2
|
+
cfg = {};
|
|
3
|
+
getName = pkg: (builtins.parseDrvName (pkg.name or pkg.pname or "")).name;
|
|
4
|
+
in cfg // {
|
|
5
|
+
allowUnfreePredicate =
|
|
6
|
+
if cfg.allowUnfree or false then
|
|
7
|
+
(_: true)
|
|
8
|
+
else if (cfg.permittedUnfreePackages or []) != [] then
|
|
9
|
+
(pkg: builtins.elem (getName pkg) (cfg.permittedUnfreePackages or []))
|
|
10
|
+
else
|
|
11
|
+
(_: false);
|
|
12
|
+
allowInsecurePredicate =
|
|
13
|
+
if (cfg.permittedInsecurePackages or []) != [] then
|
|
14
|
+
(pkg: builtins.elem (getName pkg) (cfg.permittedInsecurePackages or []))
|
|
15
|
+
else
|
|
16
|
+
(_: false);
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
let
|
|
2
|
+
cfg = {};
|
|
3
|
+
getName = pkg: (builtins.parseDrvName (pkg.name or pkg.pname or "")).name;
|
|
4
|
+
unfreePackageError = pkg:
|
|
5
|
+
let
|
|
6
|
+
name = getName pkg;
|
|
7
|
+
in
|
|
8
|
+
throw ''
|
|
9
|
+
devenv: package '${name}' has an unfree license.
|
|
10
|
+
|
|
11
|
+
To allow all unfree packages, add this to devenv.yaml:
|
|
12
|
+
|
|
13
|
+
allow_unfree: true
|
|
14
|
+
|
|
15
|
+
To allow only this package, add this to devenv.yaml:
|
|
16
|
+
|
|
17
|
+
nixpkgs:
|
|
18
|
+
permitted_unfree_packages:
|
|
19
|
+
- ${name}
|
|
20
|
+
'';
|
|
21
|
+
in cfg // {
|
|
22
|
+
allowUnfreePredicate =
|
|
23
|
+
if cfg.allowUnfree or false then
|
|
24
|
+
(_: true)
|
|
25
|
+
else if (cfg.permittedUnfreePackages or []) != [] then
|
|
26
|
+
(pkg: builtins.elem (getName pkg) (cfg.permittedUnfreePackages or []) || unfreePackageError pkg)
|
|
27
|
+
else
|
|
28
|
+
unfreePackageError;
|
|
29
|
+
}
|