chore: reformat codebase
Some checks failed
Check test suite / Check outputs (push) Has been cancelled
Deploy documentation site / Build website (push) Has been cancelled
Deploy documentation site / Deploy website (push) Has been cancelled
Update Nix dependencies / update-nix-deps (push) Has been cancelled

This commit is contained in:
Gabriel Arazas 2025-01-12 17:58:39 +08:00
parent 2bb1dc66c7
commit c2625afbff
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
17 changed files with 458 additions and 269 deletions

View File

@ -30,9 +30,8 @@ let
class = "wrapperManager"; class = "wrapperManager";
}).options; }).options;
# Based from nixpkgs' and home-manager's code. # Based from nixpkgs' and home-manager's code.
gitHubDeclaration = user: repo: subpath: gitHubDeclaration = user: repo: subpath: {
{
url = "https://github.com/${user}/${repo}/blob/master/${subpath}"; url = "https://github.com/${user}/${repo}/blob/master/${subpath}";
name = "<${repo}/${subpath}>"; name = "<${repo}/${subpath}>";
}; };
@ -42,16 +41,21 @@ let
{ {
options = options =
if includeModuleSystemOptions then options else builtins.removeAttrs options [ "_module" ]; if includeModuleSystemOptions then options else builtins.removeAttrs options [ "_module" ];
transformOptions = opt: transformOptions =
opt // { opt:
declarations = map (decl: opt
// {
declarations = map (
decl:
if lib.hasPrefix src (toString decl) then if lib.hasPrefix src (toString decl) then
gitHubDeclaration "foo-dogsquared" "nix-module-wrapper-manager-fds" gitHubDeclaration "foo-dogsquared" "nix-module-wrapper-manager-fds" (
(lib.removePrefix "/" (lib.removePrefix src (toString decl))) lib.removePrefix "/" (lib.removePrefix src (toString decl))
)
else if decl == "lib/modules.nix" then else if decl == "lib/modules.nix" then
gitHubDeclaration "NixOS" "nixpkgs" decl gitHubDeclaration "NixOS" "nixpkgs" decl
else else
decl) opt.declarations; decl
) opt.declarations;
}; };
} }
// builtins.removeAttrs args [ // builtins.removeAttrs args [
@ -106,7 +110,9 @@ in
]; ];
}; };
in in
{ baseUrl ? "https://foo-dogsquared.github.io/nix-module-wrapper-manager-fds" }: {
baseUrl ? "https://foo-dogsquared.github.io/nix-module-wrapper-manager-fds",
}:
buildHugoSite { buildHugoSite {
pname = "wrapper-manager-docs"; pname = "wrapper-manager-docs";
@ -126,7 +132,10 @@ in
vendorHash = "sha256-UDDCYQB/kdYT63vRlRzL6lOePl9F7j3eUIHX/m6rwEs="; vendorHash = "sha256-UDDCYQB/kdYT63vRlRzL6lOePl9F7j3eUIHX/m6rwEs=";
buildFlags = [ "--baseURL" baseUrl ]; buildFlags = [
"--baseURL"
baseUrl
];
nativeBuildInputs = [ nativeBuildInputs = [
asciidoctorWrapped asciidoctorWrapped

View File

@ -1,339 +1,421 @@
{ {
asciidoctor = { asciidoctor = {
groups = ["default"]; groups = [ "default" ];
platforms = []; platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "1wyxgwmnz9bw377r3lba26b090hbsq9qnbw8575a1prpy83qh82j"; sha256 = "1wyxgwmnz9bw377r3lba26b090hbsq9qnbw8575a1prpy83qh82j";
type = "gem"; type = "gem";
}; };
version = "2.0.23"; version = "2.0.23";
}; };
asciidoctor-diagram = { asciidoctor-diagram = {
dependencies = ["asciidoctor" "asciidoctor-diagram-ditaamini" "asciidoctor-diagram-plantuml" "rexml"]; dependencies = [
groups = ["default"]; "asciidoctor"
platforms = []; "asciidoctor-diagram-ditaamini"
"asciidoctor-diagram-plantuml"
"rexml"
];
groups = [ "default" ];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "1214scxm36k409gfy3wilfqx3akrm52r530zmra6cmmf6d22c5q4"; sha256 = "1214scxm36k409gfy3wilfqx3akrm52r530zmra6cmmf6d22c5q4";
type = "gem"; type = "gem";
}; };
version = "2.3.1"; version = "2.3.1";
}; };
asciidoctor-diagram-batik = { asciidoctor-diagram-batik = {
groups = ["default"]; groups = [ "default" ];
platforms = []; platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "0220xqxmkmimxmhsqhlbr0hslijvnhzdds3s6h6fxbxqrrmm0jrl"; sha256 = "0220xqxmkmimxmhsqhlbr0hslijvnhzdds3s6h6fxbxqrrmm0jrl";
type = "gem"; type = "gem";
}; };
version = "1.17"; version = "1.17";
}; };
asciidoctor-diagram-ditaamini = { asciidoctor-diagram-ditaamini = {
groups = ["default"]; groups = [ "default" ];
platforms = []; platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "13h65bfbq7hc7z3kqn0m28w9c6ap7fikpjcvsdga6jg01slb4c56"; sha256 = "13h65bfbq7hc7z3kqn0m28w9c6ap7fikpjcvsdga6jg01slb4c56";
type = "gem"; type = "gem";
}; };
version = "1.0.3"; version = "1.0.3";
}; };
asciidoctor-diagram-plantuml = { asciidoctor-diagram-plantuml = {
dependencies = ["asciidoctor-diagram-batik"]; dependencies = [ "asciidoctor-diagram-batik" ];
groups = ["default"]; groups = [ "default" ];
platforms = []; platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "1ppl5nsq40x11731ciahi89k5yvszlm12pml1pqaj0lwbi7ww6x0"; sha256 = "1ppl5nsq40x11731ciahi89k5yvszlm12pml1pqaj0lwbi7ww6x0";
type = "gem"; type = "gem";
}; };
version = "1.2024.5"; version = "1.2024.5";
}; };
asciidoctor-foodogsquared-extensions = { asciidoctor-foodogsquared-extensions = {
dependencies = ["asciidoctor" "rugged"]; dependencies = [
groups = ["default"]; "asciidoctor"
platforms = []; "rugged"
];
groups = [ "default" ];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "0fm6shyysj51wi4s7nnb643j2mphp68fh44gmr83x8n613hg9a4l"; sha256 = "0fm6shyysj51wi4s7nnb643j2mphp68fh44gmr83x8n613hg9a4l";
type = "gem"; type = "gem";
}; };
version = "1.2.1"; version = "1.2.1";
}; };
ast = { ast = {
groups = ["default" "lint"]; groups = [
platforms = []; "default"
"lint"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "04nc8x27hlzlrr5c2gn7mar4vdr0apw5xg22wp6m8dx3wqr04a0y"; sha256 = "04nc8x27hlzlrr5c2gn7mar4vdr0apw5xg22wp6m8dx3wqr04a0y";
type = "gem"; type = "gem";
}; };
version = "2.4.2"; version = "2.4.2";
}; };
concurrent-ruby = { concurrent-ruby = {
groups = ["default"]; groups = [ "default" ];
platforms = []; platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "0skwdasxq7mnlcccn6aqabl7n9r3jd7k19ryzlzzip64cn4x572g"; sha256 = "0skwdasxq7mnlcccn6aqabl7n9r3jd7k19ryzlzzip64cn4x572g";
type = "gem"; type = "gem";
}; };
version = "1.3.3"; version = "1.3.3";
}; };
json = { json = {
groups = ["default" "lint"]; groups = [
platforms = []; "default"
"lint"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "0b4qsi8gay7ncmigr0pnbxyb17y3h8kavdyhsh7nrlqwr35vb60q"; sha256 = "0b4qsi8gay7ncmigr0pnbxyb17y3h8kavdyhsh7nrlqwr35vb60q";
type = "gem"; type = "gem";
}; };
version = "2.7.2"; version = "2.7.2";
}; };
language_server-protocol = { language_server-protocol = {
groups = ["default" "development" "lint"]; groups = [
platforms = []; "default"
"development"
"lint"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "0gvb1j8xsqxms9mww01rmdl78zkd72zgxaap56bhv8j45z05hp1x"; sha256 = "0gvb1j8xsqxms9mww01rmdl78zkd72zgxaap56bhv8j45z05hp1x";
type = "gem"; type = "gem";
}; };
version = "3.17.0.3"; version = "3.17.0.3";
}; };
logger = { logger = {
groups = ["default" "development"]; groups = [
platforms = []; "default"
"development"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "0gpg8gzi0xwymw4aaq2iafcbx31i3xzkg3fb30mdxn1d4qhc3dqa"; sha256 = "0gpg8gzi0xwymw4aaq2iafcbx31i3xzkg3fb30mdxn1d4qhc3dqa";
type = "gem"; type = "gem";
}; };
version = "1.6.0"; version = "1.6.0";
}; };
open-uri-cached = { open-uri-cached = {
groups = ["default"]; groups = [ "default" ];
platforms = []; platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "03v0if3jlvbclnd6jgjk94fbhf0h2fq1wxr0mbx7018sxzm0biwr"; sha256 = "03v0if3jlvbclnd6jgjk94fbhf0h2fq1wxr0mbx7018sxzm0biwr";
type = "gem"; type = "gem";
}; };
version = "1.0.0"; version = "1.0.0";
}; };
parallel = { parallel = {
groups = ["default" "lint"]; groups = [
platforms = []; "default"
"lint"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "145bn5q7ysnjj02jdf1x4nc1f0xxrv7ihgz9yr1j7sinmawqkq0j"; sha256 = "145bn5q7ysnjj02jdf1x4nc1f0xxrv7ihgz9yr1j7sinmawqkq0j";
type = "gem"; type = "gem";
}; };
version = "1.25.1"; version = "1.25.1";
}; };
parser = { parser = {
dependencies = ["ast" "racc"]; dependencies = [
groups = ["default" "lint"]; "ast"
platforms = []; "racc"
];
groups = [
"default"
"lint"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "10ly2wind06nylyqa5724ld2l0l46d3ag4fm04ifjgw7qdlpf94d"; sha256 = "10ly2wind06nylyqa5724ld2l0l46d3ag4fm04ifjgw7qdlpf94d";
type = "gem"; type = "gem";
}; };
version = "3.3.4.0"; version = "3.3.4.0";
}; };
prism = { prism = {
groups = ["default" "development"]; groups = [
platforms = []; "default"
"development"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "05j9bcxdz6wfnrjn32zvdwj1qsbp88mwx3rv7g256gziya6avc2r"; sha256 = "05j9bcxdz6wfnrjn32zvdwj1qsbp88mwx3rv7g256gziya6avc2r";
type = "gem"; type = "gem";
}; };
version = "0.30.0"; version = "0.30.0";
}; };
racc = { racc = {
groups = ["default" "lint"]; groups = [
platforms = []; "default"
"lint"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "021s7maw0c4d9a6s07vbmllrzqsj2sgmrwimlh8ffkvwqdjrld09"; sha256 = "021s7maw0c4d9a6s07vbmllrzqsj2sgmrwimlh8ffkvwqdjrld09";
type = "gem"; type = "gem";
}; };
version = "1.8.0"; version = "1.8.0";
}; };
rainbow = { rainbow = {
groups = ["default" "lint"]; groups = [
platforms = []; "default"
"lint"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "0smwg4mii0fm38pyb5fddbmrdpifwv22zv3d3px2xx497am93503"; sha256 = "0smwg4mii0fm38pyb5fddbmrdpifwv22zv3d3px2xx497am93503";
type = "gem"; type = "gem";
}; };
version = "3.1.1"; version = "3.1.1";
}; };
rake = { rake = {
groups = ["development"]; groups = [ "development" ];
platforms = []; platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "17850wcwkgi30p7yqh60960ypn7yibacjjha0av78zaxwvd3ijs6"; sha256 = "17850wcwkgi30p7yqh60960ypn7yibacjjha0av78zaxwvd3ijs6";
type = "gem"; type = "gem";
}; };
version = "13.2.1"; version = "13.2.1";
}; };
rbs = { rbs = {
dependencies = ["logger"]; dependencies = [ "logger" ];
groups = ["default" "development"]; groups = [
platforms = []; "default"
"development"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "1fzk0a3d68fglnkwpaz07npi929y1kh2hh1j63y04943vvshyjmc"; sha256 = "1fzk0a3d68fglnkwpaz07npi929y1kh2hh1j63y04943vvshyjmc";
type = "gem"; type = "gem";
}; };
version = "3.5.2"; version = "3.5.2";
}; };
regexp_parser = { regexp_parser = {
groups = ["default" "lint"]; groups = [
platforms = []; "default"
"lint"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "0ik40vcv7mqigsfpqpca36hpmnx0536xa825ai5qlkv3mmkyf9ss"; sha256 = "0ik40vcv7mqigsfpqpca36hpmnx0536xa825ai5qlkv3mmkyf9ss";
type = "gem"; type = "gem";
}; };
version = "2.9.2"; version = "2.9.2";
}; };
rexml = { rexml = {
dependencies = ["strscan"]; dependencies = [ "strscan" ];
groups = ["default" "lint"]; groups = [
platforms = []; "default"
"lint"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "09f3sw7f846fpcpwdm362ylqldwqxpym6z0qpld4av7zisrrzbrl"; sha256 = "09f3sw7f846fpcpwdm362ylqldwqxpym6z0qpld4av7zisrrzbrl";
type = "gem"; type = "gem";
}; };
version = "3.3.1"; version = "3.3.1";
}; };
rouge = { rouge = {
groups = ["default"]; groups = [ "default" ];
platforms = []; platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "072qvvrcqj0yfr3b0j932mlhvn41i38bq37z7z07i3ikagndkqwy"; sha256 = "072qvvrcqj0yfr3b0j932mlhvn41i38bq37z7z07i3ikagndkqwy";
type = "gem"; type = "gem";
}; };
version = "4.3.0"; version = "4.3.0";
}; };
rubocop = { rubocop = {
dependencies = ["json" "language_server-protocol" "parallel" "parser" "rainbow" "regexp_parser" "rexml" "rubocop-ast" "ruby-progressbar" "unicode-display_width"]; dependencies = [
groups = ["lint"]; "json"
platforms = []; "language_server-protocol"
"parallel"
"parser"
"rainbow"
"regexp_parser"
"rexml"
"rubocop-ast"
"ruby-progressbar"
"unicode-display_width"
];
groups = [ "lint" ];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "18g462bccr0rvszc7kirr89laggdf6254p7pqsckk3izg901chv2"; sha256 = "18g462bccr0rvszc7kirr89laggdf6254p7pqsckk3izg901chv2";
type = "gem"; type = "gem";
}; };
version = "1.65.0"; version = "1.65.0";
}; };
rubocop-ast = { rubocop-ast = {
dependencies = ["parser"]; dependencies = [ "parser" ];
groups = ["default" "lint"]; groups = [
platforms = []; "default"
"lint"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "063qgvqbyv354icl2sgx758z22wzq38hd9skc3n96sbpv0cdc1qv"; sha256 = "063qgvqbyv354icl2sgx758z22wzq38hd9skc3n96sbpv0cdc1qv";
type = "gem"; type = "gem";
}; };
version = "1.31.3"; version = "1.31.3";
}; };
ruby-lsp = { ruby-lsp = {
dependencies = ["language_server-protocol" "prism" "rbs" "sorbet-runtime"]; dependencies = [
groups = ["development"]; "language_server-protocol"
platforms = []; "prism"
"rbs"
"sorbet-runtime"
];
groups = [ "development" ];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "1kvyk0cald1cw6fqxy5w68la1gnc1nv2mqx8myijjsbcf9npjbp8"; sha256 = "1kvyk0cald1cw6fqxy5w68la1gnc1nv2mqx8myijjsbcf9npjbp8";
type = "gem"; type = "gem";
}; };
version = "0.17.7"; version = "0.17.7";
}; };
ruby-progressbar = { ruby-progressbar = {
groups = ["default" "lint"]; groups = [
platforms = []; "default"
"lint"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "0cwvyb7j47m7wihpfaq7rc47zwwx9k4v7iqd9s1xch5nm53rrz40"; sha256 = "0cwvyb7j47m7wihpfaq7rc47zwwx9k4v7iqd9s1xch5nm53rrz40";
type = "gem"; type = "gem";
}; };
version = "1.13.0"; version = "1.13.0";
}; };
rugged = { rugged = {
groups = ["default"]; groups = [ "default" ];
platforms = []; platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "1sccng15h8h3mcjxfgvxy85lfpswbj0nhmzwwsqdffbzqgsb2jch"; sha256 = "1sccng15h8h3mcjxfgvxy85lfpswbj0nhmzwwsqdffbzqgsb2jch";
type = "gem"; type = "gem";
}; };
version = "1.7.2"; version = "1.7.2";
}; };
slim = { slim = {
dependencies = ["temple" "tilt"]; dependencies = [
groups = ["default"]; "temple"
platforms = []; "tilt"
];
groups = [ "default" ];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "1rqk7jn66wgx50b18ndhbppjq55rbcwgqg1rbhnhxwiggvzisdbj"; sha256 = "1rqk7jn66wgx50b18ndhbppjq55rbcwgqg1rbhnhxwiggvzisdbj";
type = "gem"; type = "gem";
}; };
version = "5.2.1"; version = "5.2.1";
}; };
sorbet-runtime = { sorbet-runtime = {
groups = ["default" "development"]; groups = [
platforms = []; "default"
"development"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "122702d5cmrbaydcqfjksh1d78g0mq69h77zd4yljwjrc50jz70b"; sha256 = "122702d5cmrbaydcqfjksh1d78g0mq69h77zd4yljwjrc50jz70b";
type = "gem"; type = "gem";
}; };
version = "0.5.11481"; version = "0.5.11481";
}; };
strscan = { strscan = {
groups = ["default" "lint"]; groups = [
platforms = []; "default"
"lint"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "0mamrl7pxacbc79ny5hzmakc9grbjysm3yy6119ppgsg44fsif01"; sha256 = "0mamrl7pxacbc79ny5hzmakc9grbjysm3yy6119ppgsg44fsif01";
type = "gem"; type = "gem";
}; };
version = "3.1.0"; version = "3.1.0";
}; };
temple = { temple = {
groups = ["default"]; groups = [ "default" ];
platforms = []; platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "0fwia5hvc1xz9w7vprzjnsym3v9j5l9ggdvy70jixbvpcpz4acfz"; sha256 = "0fwia5hvc1xz9w7vprzjnsym3v9j5l9ggdvy70jixbvpcpz4acfz";
type = "gem"; type = "gem";
}; };
version = "0.10.3"; version = "0.10.3";
}; };
tilt = { tilt = {
groups = ["default"]; groups = [ "default" ];
platforms = []; platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "0kds7wkxmb038cwp6ravnwn8k65ixc68wpm8j5jx5bhx8ndg4x6z"; sha256 = "0kds7wkxmb038cwp6ravnwn8k65ixc68wpm8j5jx5bhx8ndg4x6z";
type = "gem"; type = "gem";
}; };
version = "2.4.0"; version = "2.4.0";
}; };
unicode-display_width = { unicode-display_width = {
groups = ["default" "lint"]; groups = [
platforms = []; "default"
"lint"
];
platforms = [ ];
source = { source = {
remotes = ["https://rubygems.org"]; remotes = [ "https://rubygems.org" ];
sha256 = "1d0azx233nags5jx3fqyr23qa2rhgzbhv8pxp46dgbg1mpf82xky"; sha256 = "1d0azx233nags5jx3fqyr23qa2rhgzbhv8pxp46dgbg1mpf82xky";
type = "gem"; type = "gem";
}; };

View File

@ -61,9 +61,9 @@
website = docs.website { }; website = docs.website { };
}; };
checks = checks = {
{ inherit (tests) lib; } inherit (tests) lib;
// lib.mapAttrs' (n: v: lib.nameValuePair "config-test-${n}" v) tests.configs; } // lib.mapAttrs' (n: v: lib.nameValuePair "config-test-${n}" v) tests.configs;
} }
)); ));
} }

View File

@ -25,7 +25,12 @@ pkgs.lib.makeExtensible (
modules = callLibs ./modules.nix; modules = callLibs ./modules.nix;
inherit (self.env) build eval; inherit (self.env) build eval;
inherit (self.utils) getBin getLibexec getXdgDataDirs getXdgConfigDirs; inherit (self.utils)
getBin
getLibexec
getXdgDataDirs
getXdgConfigDirs
;
inherit (self.modules) makeWraparound; inherit (self.modules) makeWraparound;
} }
) )

View File

@ -16,37 +16,36 @@ rec {
another program. Several examples of this includes sudo, Bubblewrap, and another program. Several examples of this includes sudo, Bubblewrap, and
Gamescope. Gamescope.
*/ */
makeWraparound = { makeWraparound =
arg0, {
under, arg0,
underFlags ? [ ], under,
underSeparator ? "", underFlags ? [ ],
... underSeparator ? "",
}@module: ...
}@module:
let let
# These are the attrnames that would be overtaken with the function and # These are the attrnames that would be overtaken with the function and
# will be merged anyways so... # will be merged anyways so...
functionArgs = builtins.functionArgs makeWraparound; functionArgs = builtins.functionArgs makeWraparound;
module' = lib.removeAttrs module (lib.attrNames functionArgs); module' = lib.removeAttrs module (lib.attrNames functionArgs);
in in
lib.mkMerge [ lib.mkMerge [
{ {
arg0 = under; arg0 = under;
# This should be the very first things to be in the arguments so # This should be the very first things to be in the arguments so
# we're just making sure that it is the case. The priority is chosen # we're just making sure that it is the case. The priority is chosen
# arbitrarily just in case the user already has `prependArgs` values # arbitrarily just in case the user already has `prependArgs` values
# with `lib.mkBefore` for the original arg0. # with `lib.mkBefore` for the original arg0.
prependArgs = lib.mkOrder 250 ( prependArgs = lib.mkOrder 250 (
underFlags underFlags ++ lib.optionals (underSeparator != "") [ underSeparator ] ++ [ arg0 ]
++ lib.optionals (underSeparator != "") [ underSeparator ] );
++ [ arg0 ] }
);
}
# It's constructed like this to make it ergonomic to use. The user can # It's constructed like this to make it ergonomic to use. The user can
# simply delete the makeWraparound exclusive arguments and still work # simply delete the makeWraparound exclusive arguments and still work
# normally. # normally.
module' module'
]; ];
} }

View File

@ -23,7 +23,8 @@ let
) )
( (
{ lib, ... }: { { lib, ... }:
{
options.enableInstall = lib.mkOption { options.enableInstall = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = cfg.enableInstall; default = cfg.enableInstall;

View File

@ -7,7 +7,10 @@
let let
cfg = config.wrapper-manager; cfg = config.wrapper-manager;
wmDocs = import ../../../docs { inherit pkgs; inherit (cfg.documentation) extraModules; }; wmDocs = import ../../../docs {
inherit pkgs;
inherit (cfg.documentation) extraModules;
};
in in
{ {
imports = [ ../common.nix ]; imports = [ ../common.nix ];
@ -39,7 +42,7 @@ in
let let
validPackages = lib.filterAttrs (_: wrapper: wrapper.enableInstall) cfg.packages; validPackages = lib.filterAttrs (_: wrapper: wrapper.enableInstall) cfg.packages;
in in
lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) validPackages; lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) validPackages;
}) })
]; ];
} }

View File

@ -7,7 +7,10 @@
let let
cfg = config.wrapper-manager; cfg = config.wrapper-manager;
wmDocs = import ../../../docs { inherit pkgs; inherit (cfg.documentation) extraModules; }; wmDocs = import ../../../docs {
inherit pkgs;
inherit (cfg.documentation) extraModules;
};
in in
{ {
imports = [ ../common.nix ]; imports = [ ../common.nix ];
@ -37,7 +40,7 @@ in
let let
validPackages = lib.filterAttrs (_: wrapper: wrapper.enableInstall) cfg.packages; validPackages = lib.filterAttrs (_: wrapper: wrapper.enableInstall) cfg.packages;
in in
lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) validPackages; lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) validPackages;
}) })
]; ];
} }

View File

@ -8,9 +8,20 @@
let let
envConfig = config; envConfig = config;
toStringType = (with lib.types; coercedTo (oneOf [str path int float bool]) (x: "${x}") str) // { toStringType =
description = "string and select types (numbers, boolean, and path) convertible to it"; (
}; with lib.types;
coercedTo (oneOf [
str
path
int
float
bool
]) (x: "${x}") str
)
// {
description = "string and select types (numbers, boolean, and path) convertible to it";
};
envSubmodule = envSubmodule =
{ {
config, config,
@ -174,7 +185,12 @@ let
n: v: n: v:
if v.action == "unset" then if v.action == "unset" then
"--${v.action} ${lib.escapeShellArg n}" "--${v.action} ${lib.escapeShellArg n}"
else if lib.elem v.action [ "prefix" "suffix" ] then else if
lib.elem v.action [
"prefix"
"suffix"
]
then
"--${v.action} ${lib.escapeShellArg n} ${lib.escapeShellArg v.separator} ${lib.escapeShellArg (lib.concatStringsSep v.separator v.value)}" "--${v.action} ${lib.escapeShellArg n} ${lib.escapeShellArg v.separator} ${lib.escapeShellArg (lib.concatStringsSep v.separator v.value)}"
else else
"--${v.action} ${lib.escapeShellArg n} ${lib.escapeShellArg v.value}" "--${v.action} ${lib.escapeShellArg n} ${lib.escapeShellArg v.value}"

View File

@ -8,7 +8,10 @@
{ {
options.build = { options.build = {
variant = lib.mkOption { variant = lib.mkOption {
type = lib.types.enum [ "binary" "shell" ]; type = lib.types.enum [
"binary"
"shell"
];
description = '' description = ''
Indicates the type of wrapper to be made. By default, wrapper-manager Indicates the type of wrapper to be made. By default, wrapper-manager
sets this to `binary`. sets this to `binary`.
@ -48,9 +51,12 @@
let let
inherit (config.build) variant; inherit (config.build) variant;
makeWrapperArg0 = makeWrapperArg0 =
if variant == "binary" then "makeBinaryWrapper" if variant == "binary" then
else if variant == "shell" then "makeShellWrapper" "makeBinaryWrapper"
else "makeWrapper"; else if variant == "shell" then
"makeShellWrapper"
else
"makeWrapper";
mkWrapBuild = mkWrapBuild =
wrappers: wrappers:
@ -62,28 +68,35 @@
desktopEntries = mkDesktopEntries (lib.attrValues config.xdg.desktopEntries); desktopEntries = mkDesktopEntries (lib.attrValues config.xdg.desktopEntries);
in in
if lib.isList config.basePackages then if lib.isList config.basePackages then
pkgs.symlinkJoin { pkgs.symlinkJoin {
passthru = config.build.extraPassthru; passthru = config.build.extraPassthru;
name = "wrapper-manager-fds-wrapped-package"; name = "wrapper-manager-fds-wrapped-package";
paths = desktopEntries ++ config.basePackages; paths = desktopEntries ++ config.basePackages;
nativeBuildInputs = nativeBuildInputs =
if variant == "binary" then [ pkgs.makeBinaryWrapper ] if variant == "binary" then
else if variant == "shell" then [ pkgs.makeShellWrapper ] [ pkgs.makeBinaryWrapper ]
else [ ]; else if variant == "shell" then
postBuild = '' [ pkgs.makeShellWrapper ]
${config.build.extraSetup} else
${mkWrapBuild (lib.attrValues config.wrappers)} [ ];
''; postBuild = ''
} ${config.build.extraSetup}
else ${mkWrapBuild (lib.attrValues config.wrappers)}
config.basePackages.overrideAttrs (final: prev: { '';
}
else
config.basePackages.overrideAttrs (
final: prev: {
nativeBuildInputs = nativeBuildInputs =
(prev.nativeBuildInputs or [ ]) (prev.nativeBuildInputs or [ ])
++ ( ++ (
if variant == "binary" then [ pkgs.makeBinaryWrapper ] if variant == "binary" then
else if variant == "shell" then [ pkgs.makeShellWrapper ] [ pkgs.makeBinaryWrapper ]
else [ ] else if variant == "shell" then
[ pkgs.makeShellWrapper ]
else
[ ]
) )
++ lib.optionals (config.xdg.desktopEntries != { }) [ pkgs.copyDesktopItems ]; ++ lib.optionals (config.xdg.desktopEntries != { }) [ pkgs.copyDesktopItems ];
desktopItems = (prev.desktopItems or [ ]) ++ desktopEntries; desktopItems = (prev.desktopItems or [ ]) ++ desktopEntries;
@ -91,10 +104,14 @@
${prev.postFixup or ""} ${prev.postFixup or ""}
${mkWrapBuild (lib.attrValues config.wrappers)} ${mkWrapBuild (lib.attrValues config.wrappers)}
''; '';
passthru = lib.recursiveUpdate (prev.passthru or { }) (config.build.extraPassthru // { passthru = lib.recursiveUpdate (prev.passthru or { }) (
unwrapped = config.basePackages; config.build.extraPassthru
}); // {
}); unwrapped = config.basePackages;
}
);
}
);
}; };
}; };
} }

View File

@ -1,55 +1,69 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
cfg = config.files; cfg = config.files;
filesModule = { name, lib, config, options, ... }: { filesModule =
options = { {
target = lib.mkOption { name,
type = lib.types.nonEmptyStr; lib,
description = '' config,
Path of the file relative to the derivation output path. options,
''; ...
default = name; }:
example = "share/applications/org.example.App1.desktop"; {
options = {
target = lib.mkOption {
type = lib.types.nonEmptyStr;
description = ''
Path of the file relative to the derivation output path.
'';
default = name;
example = "share/applications/org.example.App1.desktop";
};
source = lib.mkOption {
type = lib.types.path;
description = "Path of the file to be linked.";
};
text = lib.mkOption {
type = with lib.types; nullOr lines;
description = ''
Text content of the given filesystem path.
'';
default = null;
example = ''
key=value
hello=world
'';
};
mode = lib.mkOption {
type = lib.types.strMatching "[0-7]{0,4}";
default = "0644";
example = "0600";
description = ''
Permissions to be given to the file. By default, it is given with a
symlink.
'';
};
}; };
source = lib.mkOption { config = {
type = lib.types.path; source = lib.mkIf (config.text != null) (
description = "Path of the file to be linked."; let
}; name' = "wrapper-manager-filesystem-${lib.replaceStrings [ "/" ] [ "-" ] name}";
in
text = lib.mkOption { lib.modules.mkDerivedConfig options.text (pkgs.writeText name')
type = with lib.types; nullOr lines; );
description = ''
Text content of the given filesystem path.
'';
default = null;
example = ''
key=value
hello=world
'';
};
mode = lib.mkOption {
type = lib.types.strMatching "[0-7]{0,4}";
default = "0644";
example = "0600";
description = ''
Permissions to be given to the file. By default, it is given with a
symlink.
'';
}; };
}; };
config = {
source = lib.mkIf (config.text != null) (
let
name' = "wrapper-manager-filesystem-${lib.replaceStrings ["/"] ["-"] name}";
in lib.modules.mkDerivedConfig options.text (pkgs.writeText name')
);
};
};
in in
{ {
options.files = lib.mkOption { options.files = lib.mkOption {
@ -79,27 +93,38 @@ in
}; };
config = lib.mkIf (cfg != { }) { config = lib.mkIf (cfg != { }) {
build.extraSetup = let build.extraSetup =
installFiles = acc: n: v: let let
source = lib.escapeShellArg v.source; installFiles =
target = lib.escapeShellArg v.target; acc: n: v:
target' = "$out/${target}"; let
installFile = let source = lib.escapeShellArg v.source;
type = lib.filesystem.pathType v.source; target = lib.escapeShellArg v.target;
target' = "$out/${target}";
installFile =
let
type = lib.filesystem.pathType v.source;
in
if type == "directory" then
''
mkdir -p $(basename ${target'}) && cp --recursive ${source} ${target'}
''
else if type == "symlink" then
''
ln --symbolic --force ${source} ${target'}
''
else
''
install -D --mode=${v.mode} ${source} ${target'}
'';
in in
if type == "directory" then '' ''
mkdir -p $(basename ${target'}) && cp --recursive ${source} ${target'} ${acc}
'' else if type == "symlink" then '' ${installFile}
ln --symbolic --force ${source} ${target'}
'' else ''
install -D --mode=${v.mode} ${source} ${target'}
''; '';
in '' in
${acc} lib.mkBefore ''
${installFile} ${lib.foldlAttrs installFiles "" cfg}
''; '';
in lib.mkBefore ''
${lib.foldlAttrs installFiles "" cfg}
'';
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, lib, pkgs, wrapperManagerLib, ... }: {
config,
lib,
pkgs,
wrapperManagerLib,
...
}:
let let
inherit (wrapperManagerLib) makeWraparound; inherit (wrapperManagerLib) makeWraparound;
@ -7,7 +13,10 @@ in
build.variant = "shell"; build.variant = "shell";
wrappers.tmux = makeWraparound { wrappers.tmux = makeWraparound {
under = lib.getExe' pkgs.boxxy "boxxy"; under = lib.getExe' pkgs.boxxy "boxxy";
underFlags = [ "--rule" "~/.tmux.conf:~/.config/tmux/tmux.conf" ]; underFlags = [
"--rule"
"~/.tmux.conf:~/.config/tmux/tmux.conf"
];
underSeparator = "--"; underSeparator = "--";
arg0 = lib.getExe' pkgs.tmux "tmux"; arg0 = lib.getExe' pkgs.tmux "tmux";

View File

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
wrappers.neofetch = { wrappers.neofetch = {

View File

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
{ {
basePackages = pkgs.fastfetch; basePackages = pkgs.fastfetch;

View File

@ -19,9 +19,12 @@
xdg.desktopEntry.enable = true; xdg.desktopEntry.enable = true;
}; };
environment.pathAdd = wrapperManagerLib.getBin (with pkgs; [ environment.pathAdd = wrapperManagerLib.getBin (
hello with pkgs;
]); [
hello
]
);
build.extraPassthru.wrapperManagerTests = { build.extraPassthru.wrapperManagerTests = {
actuallyBuilt = actuallyBuilt =

View File

@ -22,19 +22,23 @@
); );
wrappers.xdg-config-dirs-script = { wrappers.xdg-config-dirs-script = {
arg0 = let arg0 =
app = pkgs.writeShellScript "xdg-dirs-script" '' let
echo "$XDG_CONFIG_DIRS" | tr ':' '\n' app = pkgs.writeShellScript "xdg-dirs-script" ''
''; echo "$XDG_CONFIG_DIRS" | tr ':' '\n'
in builtins.toString app; '';
in
builtins.toString app;
}; };
wrappers.xdg-data-dirs-script = { wrappers.xdg-data-dirs-script = {
arg0 = let arg0 =
app = pkgs.writeShellScript "xdg-dirs-script" '' let
echo "$XDG_DATA_DIRS" | tr ':' '\n' app = pkgs.writeShellScript "xdg-dirs-script" ''
''; echo "$XDG_DATA_DIRS" | tr ':' '\n'
in builtins.toString app; '';
in
builtins.toString app;
}; };
build.extraPassthru.wrapperManagerTests = { build.extraPassthru.wrapperManagerTests = {

View File

@ -10,10 +10,13 @@ let
inherit (pkgs) lib; inherit (pkgs) lib;
in in
{ {
configs = let configs =
configs' = import ./configs { inherit pkgs; }; let
updateTestName = configName: package: lib.mapAttrs' (n: v: lib.nameValuePair "${configName}-${n}" v) package.wrapperManagerTests; configs' = import ./configs { inherit pkgs; };
in updateTestName =
configName: package:
lib.mapAttrs' (n: v: lib.nameValuePair "${configName}-${n}" v) package.wrapperManagerTests;
in
lib.concatMapAttrs updateTestName configs'; lib.concatMapAttrs updateTestName configs';
lib = lib =