mirror of
https://github.com/foo-dogsquared/nix-module-wrapper-manager-fds.git
synced 2025-02-07 06:19:02 +00:00
wrapper-manager-fds: reformat codebase
This commit is contained in:
parent
6eed3dbaea
commit
d4a8025d06
113
docs/default.nix
113
docs/default.nix
@ -1,26 +1,42 @@
|
|||||||
let
|
let
|
||||||
sources = import ../npins;
|
sources = import ../npins;
|
||||||
in
|
in
|
||||||
{ pkgs ? import sources.nixos-unstable { } }:
|
{
|
||||||
|
pkgs ? import sources.nixos-unstable { },
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (pkgs) nixosOptionsDoc lib;
|
inherit (pkgs) nixosOptionsDoc lib;
|
||||||
|
|
||||||
# Pretty much inspired from home-manager's documentation build process.
|
# Pretty much inspired from home-manager's documentation build process.
|
||||||
evalDoc = args@{ modules, includeModuleSystemOptions ? false, ... }:
|
evalDoc =
|
||||||
|
args@{
|
||||||
|
modules,
|
||||||
|
includeModuleSystemOptions ? false,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
options = (pkgs.lib.evalModules {
|
|
||||||
modules = modules ++ [ { _module.check = false; _module.args.pkgs = pkgs; } ];
|
|
||||||
class = "wrapperManager";
|
|
||||||
}).options;
|
|
||||||
in
|
|
||||||
nixosOptionsDoc ({
|
|
||||||
options =
|
options =
|
||||||
if includeModuleSystemOptions
|
(pkgs.lib.evalModules {
|
||||||
then options
|
modules = modules ++ [
|
||||||
else builtins.removeAttrs options [ "_module" ];
|
{
|
||||||
|
_module.check = false;
|
||||||
|
_module.args.pkgs = pkgs;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
class = "wrapperManager";
|
||||||
|
}).options;
|
||||||
|
in
|
||||||
|
nixosOptionsDoc (
|
||||||
|
{
|
||||||
|
options =
|
||||||
|
if includeModuleSystemOptions then options else builtins.removeAttrs options [ "_module" ];
|
||||||
}
|
}
|
||||||
// builtins.removeAttrs args [ "modules" "includeModuleSystemOptions" ]);
|
// builtins.removeAttrs args [
|
||||||
|
"modules"
|
||||||
|
"includeModuleSystemOptions"
|
||||||
|
]
|
||||||
|
);
|
||||||
releaseConfig = lib.importJSON ../release.json;
|
releaseConfig = lib.importJSON ../release.json;
|
||||||
|
|
||||||
wrapperManagerLib = (import ../. { }).lib;
|
wrapperManagerLib = (import ../. { }).lib;
|
||||||
@ -48,20 +64,28 @@ in
|
|||||||
buildHugoSite = pkgs.callPackage ./hugo-build-module.nix { };
|
buildHugoSite = pkgs.callPackage ./hugo-build-module.nix { };
|
||||||
|
|
||||||
# Now this is some dogfooding.
|
# Now this is some dogfooding.
|
||||||
asciidoctorWrapped =
|
asciidoctorWrapped = wrapperManagerLib.build {
|
||||||
wrapperManagerLib.build {
|
inherit pkgs;
|
||||||
inherit pkgs;
|
modules = [
|
||||||
modules = [
|
(
|
||||||
({ config, lib, pkgs, ... }: {
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
wrappers.asciidoctor = {
|
wrappers.asciidoctor = {
|
||||||
arg0 = lib.getExe' gems "asciidoctor";
|
arg0 = lib.getExe' gems "asciidoctor";
|
||||||
appendArgs = [
|
appendArgs = [
|
||||||
"-T" "${sources.website}/templates"
|
"-T"
|
||||||
|
"${sources.website}/templates"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
})
|
}
|
||||||
];
|
)
|
||||||
};
|
];
|
||||||
|
};
|
||||||
in
|
in
|
||||||
buildHugoSite {
|
buildHugoSite {
|
||||||
pname = "wrapper-manager-docs";
|
pname = "wrapper-manager-docs";
|
||||||
@ -101,27 +125,40 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
inherit wmOptionsDoc;
|
inherit wmOptionsDoc;
|
||||||
wmNixosDoc = evalDoc { modules = [ ../modules/env/nixos ]; };
|
wmNixosDoc = evalDoc { modules = [ ../modules/env/nixos ]; };
|
||||||
wmHmDoc = evalDoc { modules = [ ../modules/env/home-manager ]; };
|
wmHmDoc = evalDoc { modules = [ ../modules/env/home-manager ]; };
|
||||||
|
|
||||||
inherit releaseConfig;
|
inherit releaseConfig;
|
||||||
outputs = {
|
outputs = {
|
||||||
manpage = pkgs.runCommand "wrapper-manager-reference-manpage" {
|
manpage =
|
||||||
nativeBuildInputs = with pkgs; [ nixos-render-docs gems gems.wrappedRuby ];
|
pkgs.runCommand "wrapper-manager-reference-manpage"
|
||||||
} ''
|
{
|
||||||
mkdir -p $out/share/man/man5
|
nativeBuildInputs = with pkgs; [
|
||||||
asciidoctor --backend manpage ${./manpages/header.adoc} --out-file header.5
|
nixos-render-docs
|
||||||
nixos-render-docs options manpage --revision ${releaseConfig.version} \
|
gems
|
||||||
--header ./header.5 --footer ${./manpages/footer.5} \
|
gems.wrappedRuby
|
||||||
${wmOptionsDoc.optionsJSON}/share/doc/nixos/options.json \
|
];
|
||||||
$out/share/man/man5/wrapper-manager.nix.5
|
}
|
||||||
'';
|
''
|
||||||
|
mkdir -p $out/share/man/man5
|
||||||
|
asciidoctor --backend manpage ${./manpages/header.adoc} --out-file header.5
|
||||||
|
nixos-render-docs options manpage --revision ${releaseConfig.version} \
|
||||||
|
--header ./header.5 --footer ${./manpages/footer.5} \
|
||||||
|
${wmOptionsDoc.optionsJSON}/share/doc/nixos/options.json \
|
||||||
|
$out/share/man/man5/wrapper-manager.nix.5
|
||||||
|
'';
|
||||||
|
|
||||||
html = pkgs.runCommand "wrapper-manager-reference-html" {
|
html =
|
||||||
nativeBuildInputs = [ gems gems.wrappedRuby ];
|
pkgs.runCommand "wrapper-manager-reference-html"
|
||||||
} ''
|
{
|
||||||
mkdir -p $out/share/wrapper-manager
|
nativeBuildInputs = [
|
||||||
asciidoctor --backend html ${wmOptionsDoc.optionsAsciiDoc} --out-file $out/share/wrapper-manager/options-reference.html
|
gems
|
||||||
'';
|
gems.wrappedRuby
|
||||||
|
];
|
||||||
|
}
|
||||||
|
''
|
||||||
|
mkdir -p $out/share/wrapper-manager
|
||||||
|
asciidoctor --backend html ${wmOptionsDoc.optionsAsciiDoc} --out-file $out/share/wrapper-manager/options-reference.html
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
300
docs/gemset.nix
300
docs/gemset.nix
@ -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";
|
||||||
};
|
};
|
||||||
|
@ -1,318 +1,397 @@
|
|||||||
{ hugo, go, cacert, git, lib, stdenv }:
|
{
|
||||||
|
hugo,
|
||||||
|
go,
|
||||||
|
cacert,
|
||||||
|
git,
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
}:
|
||||||
|
|
||||||
{ name ? "${args'.pname}-${args'.version}"
|
{
|
||||||
, src
|
name ? "${args'.pname}-${args'.version}",
|
||||||
, nativeBuildInputs ? [ ]
|
src,
|
||||||
, passthru ? { }
|
nativeBuildInputs ? [ ],
|
||||||
, patches ? [ ]
|
passthru ? { },
|
||||||
|
patches ? [ ],
|
||||||
|
|
||||||
# A function to override the goModules derivation
|
# A function to override the goModules derivation
|
||||||
, overrideModAttrs ? (_oldAttrs: { })
|
overrideModAttrs ? (_oldAttrs: { }),
|
||||||
|
|
||||||
# path to go.mod and go.sum directory
|
# path to go.mod and go.sum directory
|
||||||
, modRoot ? "./"
|
modRoot ? "./",
|
||||||
|
|
||||||
# vendorHash is the SRI hash of the vendored dependencies
|
# vendorHash is the SRI hash of the vendored dependencies
|
||||||
#
|
#
|
||||||
# if vendorHash is null, then we won't fetch any dependencies and
|
# if vendorHash is null, then we won't fetch any dependencies and
|
||||||
# rely on the vendor folder within the source.
|
# rely on the vendor folder within the source.
|
||||||
, vendorHash ? throw (
|
vendorHash ? throw (
|
||||||
if args'?vendorSha256 then
|
if args' ? vendorSha256 then
|
||||||
"buildGoModule: Expect vendorHash instead of vendorSha256"
|
"buildGoModule: Expect vendorHash instead of vendorSha256"
|
||||||
else
|
else
|
||||||
"buildGoModule: vendorHash is missing"
|
"buildGoModule: vendorHash is missing"
|
||||||
)
|
),
|
||||||
# Whether to delete the vendor folder supplied with the source.
|
# Whether to delete the vendor folder supplied with the source.
|
||||||
, deleteVendor ? false
|
deleteVendor ? false,
|
||||||
# Whether to fetch (go mod download) and proxy the vendor directory.
|
# Whether to fetch (go mod download) and proxy the vendor directory.
|
||||||
# This is useful if your code depends on c code and go mod tidy does not
|
# This is useful if your code depends on c code and go mod tidy does not
|
||||||
# include the needed sources to build or if any dependency has case-insensitive
|
# include the needed sources to build or if any dependency has case-insensitive
|
||||||
# conflicts which will produce platform dependant `vendorHash` checksums.
|
# conflicts which will produce platform dependant `vendorHash` checksums.
|
||||||
, proxyVendor ? false
|
proxyVendor ? false,
|
||||||
|
|
||||||
# We want parallel builds by default
|
# We want parallel builds by default
|
||||||
, enableParallelBuilding ? true
|
enableParallelBuilding ? true,
|
||||||
|
|
||||||
# Do not enable this without good reason
|
# Do not enable this without good reason
|
||||||
# IE: programs coupled with the compiler
|
# IE: programs coupled with the compiler
|
||||||
, allowGoReference ? false
|
allowGoReference ? false,
|
||||||
|
|
||||||
, CGO_ENABLED ? go.CGO_ENABLED
|
CGO_ENABLED ? go.CGO_ENABLED,
|
||||||
|
|
||||||
, meta ? { }
|
meta ? { },
|
||||||
|
|
||||||
# Not needed with buildGoModule
|
# Not needed with buildGoModule
|
||||||
, goPackagePath ? ""
|
goPackagePath ? "",
|
||||||
|
|
||||||
, ldflags ? [ ]
|
ldflags ? [ ],
|
||||||
|
|
||||||
, GOFLAGS ? [ ]
|
GOFLAGS ? [ ],
|
||||||
|
|
||||||
# needed for buildFlags{,Array} warning
|
# needed for buildFlags{,Array} warning
|
||||||
, buildFlags ? ""
|
buildFlags ? "",
|
||||||
, buildFlagsArray ? ""
|
buildFlagsArray ? "",
|
||||||
|
|
||||||
, ...
|
...
|
||||||
}@args':
|
}@args':
|
||||||
|
|
||||||
assert goPackagePath != "" -> throw "`goPackagePath` is not needed with `buildGoModule`";
|
assert goPackagePath != "" -> throw "`goPackagePath` is not needed with `buildGoModule`";
|
||||||
|
|
||||||
let
|
let
|
||||||
args = removeAttrs args' [ "overrideModAttrs" "vendorSha256" "vendorHash" ];
|
args = removeAttrs args' [
|
||||||
|
"overrideModAttrs"
|
||||||
|
"vendorSha256"
|
||||||
|
"vendorHash"
|
||||||
|
];
|
||||||
|
|
||||||
GO111MODULE = "on";
|
GO111MODULE = "on";
|
||||||
GOTOOLCHAIN = "local";
|
GOTOOLCHAIN = "local";
|
||||||
|
|
||||||
hugoModules = if (vendorHash == null) then "" else
|
hugoModules =
|
||||||
(stdenv.mkDerivation {
|
if (vendorHash == null) then
|
||||||
name = "${name}-hugo-modules";
|
""
|
||||||
|
else
|
||||||
|
(stdenv.mkDerivation {
|
||||||
|
name = "${name}-hugo-modules";
|
||||||
|
|
||||||
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ hugo go git cacert ];
|
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [
|
||||||
|
hugo
|
||||||
|
go
|
||||||
|
git
|
||||||
|
cacert
|
||||||
|
];
|
||||||
|
|
||||||
inherit (args) src;
|
inherit (args) src;
|
||||||
inherit (go) GOOS GOARCH;
|
inherit (go) GOOS GOARCH;
|
||||||
inherit GO111MODULE GOTOOLCHAIN;
|
inherit GO111MODULE GOTOOLCHAIN;
|
||||||
|
|
||||||
# The following inheritence behavior is not trivial to expect, and some may
|
# The following inheritence behavior is not trivial to expect, and some may
|
||||||
# argue it's not ideal. Changing it may break vendor hashes in Nixpkgs and
|
# argue it's not ideal. Changing it may break vendor hashes in Nixpkgs and
|
||||||
# out in the wild. In anycase, it's documented in:
|
# out in the wild. In anycase, it's documented in:
|
||||||
# doc/languages-frameworks/go.section.md
|
# doc/languages-frameworks/go.section.md
|
||||||
prePatch = args.prePatch or "";
|
prePatch = args.prePatch or "";
|
||||||
patches = args.patches or [ ];
|
patches = args.patches or [ ];
|
||||||
patchFlags = args.patchFlags or [ ];
|
patchFlags = args.patchFlags or [ ];
|
||||||
postPatch = args.postPatch or "";
|
postPatch = args.postPatch or "";
|
||||||
preBuild = args.preBuild or "";
|
preBuild = args.preBuild or "";
|
||||||
postBuild = args.modPostBuild or "";
|
postBuild = args.modPostBuild or "";
|
||||||
sourceRoot = args.sourceRoot or "";
|
sourceRoot = args.sourceRoot or "";
|
||||||
setSourceRoot = args.setSourceRoot or "";
|
setSourceRoot = args.setSourceRoot or "";
|
||||||
env = args.env or { };
|
env = args.env or { };
|
||||||
|
|
||||||
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
|
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
|
||||||
"GIT_PROXY_COMMAND"
|
"GIT_PROXY_COMMAND"
|
||||||
"SOCKS_SERVER"
|
"SOCKS_SERVER"
|
||||||
"GOPROXY"
|
"GOPROXY"
|
||||||
];
|
];
|
||||||
|
|
||||||
configurePhase = args.modConfigurePhase or ''
|
configurePhase =
|
||||||
runHook preConfigure
|
args.modConfigurePhase or ''
|
||||||
export GOCACHE=$TMPDIR/go-cache
|
runHook preConfigure
|
||||||
export GOPATH="$TMPDIR/go"
|
export GOCACHE=$TMPDIR/go-cache
|
||||||
cd "${modRoot}"
|
export GOPATH="$TMPDIR/go"
|
||||||
runHook postConfigure
|
cd "${modRoot}"
|
||||||
'';
|
runHook postConfigure
|
||||||
|
'';
|
||||||
|
|
||||||
buildPhase = args.modBuildPhase or (''
|
buildPhase =
|
||||||
runHook preBuild
|
args.modBuildPhase or (
|
||||||
'' + lib.optionalString deleteVendor ''
|
''
|
||||||
if [ ! -d _vendor ]; then
|
runHook preBuild
|
||||||
echo "_vendor folder does not exist, 'deleteVendor' is not needed"
|
''
|
||||||
exit 10
|
+ lib.optionalString deleteVendor ''
|
||||||
else
|
if [ ! -d _vendor ]; then
|
||||||
rm -rf _vendor
|
echo "_vendor folder does not exist, 'deleteVendor' is not needed"
|
||||||
fi
|
exit 10
|
||||||
'' + ''
|
else
|
||||||
if [ -d _vendor ]; then
|
rm -rf _vendor
|
||||||
echo "_vendor folder exists, please set 'vendorHash = null;' in your expression"
|
fi
|
||||||
exit 10
|
''
|
||||||
fi
|
+ ''
|
||||||
|
if [ -d _vendor ]; then
|
||||||
|
echo "_vendor folder exists, please set 'vendorHash = null;' in your expression"
|
||||||
|
exit 10
|
||||||
|
fi
|
||||||
|
|
||||||
${if proxyVendor then ''
|
${
|
||||||
mkdir -p "''${GOPATH}/pkg/mod/cache/download"
|
if proxyVendor then
|
||||||
hugo mod vendor
|
''
|
||||||
'' else ''
|
mkdir -p "''${GOPATH}/pkg/mod/cache/download"
|
||||||
if (( "''${NIX_DEBUG:-0}" >= 1 )); then
|
hugo mod vendor
|
||||||
hugoModVendorFlags+=(-v)
|
''
|
||||||
fi
|
else
|
||||||
hugo mod vendor "''${hugoModVendorFlags[@]}"
|
''
|
||||||
''}
|
if (( "''${NIX_DEBUG:-0}" >= 1 )); then
|
||||||
|
hugoModVendorFlags+=(-v)
|
||||||
|
fi
|
||||||
|
hugo mod vendor "''${hugoModVendorFlags[@]}"
|
||||||
|
''
|
||||||
|
}
|
||||||
|
|
||||||
mkdir -p _vendor
|
mkdir -p _vendor
|
||||||
|
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
|
|
||||||
installPhase = args.modInstallPhase or ''
|
installPhase =
|
||||||
runHook preInstall
|
args.modInstallPhase or ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
${if proxyVendor then ''
|
${
|
||||||
rm -rf "''${GOPATH}/pkg/mod/cache/download/sumdb"
|
if proxyVendor then
|
||||||
cp -r --reflink=auto "''${GOPATH}/pkg/mod/cache/download" $out
|
''
|
||||||
'' else ''
|
rm -rf "''${GOPATH}/pkg/mod/cache/download/sumdb"
|
||||||
cp -r --reflink=auto _vendor $out
|
cp -r --reflink=auto "''${GOPATH}/pkg/mod/cache/download" $out
|
||||||
''}
|
''
|
||||||
|
else
|
||||||
|
''
|
||||||
|
cp -r --reflink=auto _vendor $out
|
||||||
|
''
|
||||||
|
}
|
||||||
|
|
||||||
if ! [ "$(ls -A $out)" ]; then
|
if ! [ "$(ls -A $out)" ]; then
|
||||||
echo "_vendor folder is empty, please set 'vendorHash = null;' in your expression"
|
echo "_vendor folder is empty, please set 'vendorHash = null;' in your expression"
|
||||||
exit 10
|
exit 10
|
||||||
fi
|
fi
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
dontFixup = true;
|
dontFixup = true;
|
||||||
|
|
||||||
outputHashMode = "recursive";
|
outputHashMode = "recursive";
|
||||||
outputHash = vendorHash;
|
outputHash = vendorHash;
|
||||||
# Handle empty vendorHash; avoid
|
# Handle empty vendorHash; avoid
|
||||||
# error: empty hash requires explicit hash algorithm
|
# error: empty hash requires explicit hash algorithm
|
||||||
outputHashAlgo = if vendorHash == "" then "sha256" else null;
|
outputHashAlgo = if vendorHash == "" then "sha256" else null;
|
||||||
}).overrideAttrs overrideModAttrs;
|
}).overrideAttrs
|
||||||
|
overrideModAttrs;
|
||||||
|
|
||||||
package = stdenv.mkDerivation (args // {
|
package = stdenv.mkDerivation (
|
||||||
nativeBuildInputs = [ hugo git go ] ++ nativeBuildInputs;
|
args
|
||||||
|
// {
|
||||||
|
nativeBuildInputs = [
|
||||||
|
hugo
|
||||||
|
git
|
||||||
|
go
|
||||||
|
] ++ nativeBuildInputs;
|
||||||
|
|
||||||
inherit (go) GOOS GOARCH;
|
inherit (go) GOOS GOARCH;
|
||||||
|
|
||||||
GOFLAGS = GOFLAGS
|
GOFLAGS =
|
||||||
++ lib.warnIf (lib.any (lib.hasPrefix "-mod=") GOFLAGS) "use `proxyVendor` to control Go module/vendor behavior instead of setting `-mod=` in GOFLAGS"
|
GOFLAGS
|
||||||
(lib.optional (!proxyVendor) "-mod=vendor")
|
++
|
||||||
++ lib.warnIf (builtins.elem "-trimpath" GOFLAGS) "`-trimpath` is added by default to GOFLAGS by buildGoModule when allowGoReference isn't set to true"
|
lib.warnIf (lib.any (lib.hasPrefix "-mod=") GOFLAGS)
|
||||||
(lib.optional (!allowGoReference) "-trimpath");
|
"use `proxyVendor` to control Go module/vendor behavior instead of setting `-mod=` in GOFLAGS"
|
||||||
inherit CGO_ENABLED enableParallelBuilding GO111MODULE GOTOOLCHAIN;
|
(lib.optional (!proxyVendor) "-mod=vendor")
|
||||||
|
++
|
||||||
|
lib.warnIf (builtins.elem "-trimpath" GOFLAGS)
|
||||||
|
"`-trimpath` is added by default to GOFLAGS by buildGoModule when allowGoReference isn't set to true"
|
||||||
|
(lib.optional (!allowGoReference) "-trimpath");
|
||||||
|
inherit
|
||||||
|
CGO_ENABLED
|
||||||
|
enableParallelBuilding
|
||||||
|
GO111MODULE
|
||||||
|
GOTOOLCHAIN
|
||||||
|
;
|
||||||
|
|
||||||
# If not set to an explicit value, set the buildid empty for reproducibility.
|
# If not set to an explicit value, set the buildid empty for reproducibility.
|
||||||
ldflags = ldflags ++ lib.optional (!lib.any (lib.hasPrefix "-buildid=") ldflags) "-buildid=";
|
ldflags = ldflags ++ lib.optional (!lib.any (lib.hasPrefix "-buildid=") ldflags) "-buildid=";
|
||||||
|
|
||||||
configurePhase = args.configurePhase or (''
|
configurePhase =
|
||||||
runHook preConfigure
|
args.configurePhase or (
|
||||||
|
''
|
||||||
|
runHook preConfigure
|
||||||
|
|
||||||
export GOCACHE=$TMPDIR/go-cache
|
export GOCACHE=$TMPDIR/go-cache
|
||||||
export GOPATH="$TMPDIR/go"
|
export GOPATH="$TMPDIR/go"
|
||||||
export GOPROXY=off
|
export GOPROXY=off
|
||||||
export GOSUMDB=off
|
export GOSUMDB=off
|
||||||
cd "$modRoot"
|
cd "$modRoot"
|
||||||
'' + lib.optionalString (vendorHash != null) ''
|
''
|
||||||
${if proxyVendor then ''
|
+ lib.optionalString (vendorHash != null) ''
|
||||||
export GOPROXY=file://${hugoModules}
|
${
|
||||||
'' else ''
|
if proxyVendor then
|
||||||
rm -rf _vendor
|
''
|
||||||
cp -r --reflink=auto ${hugoModules} _vendor
|
export GOPROXY=file://${hugoModules}
|
||||||
''}
|
''
|
||||||
'' + ''
|
else
|
||||||
|
''
|
||||||
|
rm -rf _vendor
|
||||||
|
cp -r --reflink=auto ${hugoModules} _vendor
|
||||||
|
''
|
||||||
|
}
|
||||||
|
''
|
||||||
|
+ ''
|
||||||
|
|
||||||
# currently pie is only enabled by default in pkgsMusl
|
# currently pie is only enabled by default in pkgsMusl
|
||||||
# this will respect the `hardening{Disable,Enable}` flags if set
|
# this will respect the `hardening{Disable,Enable}` flags if set
|
||||||
if [[ $NIX_HARDENING_ENABLE =~ "pie" ]]; then
|
if [[ $NIX_HARDENING_ENABLE =~ "pie" ]]; then
|
||||||
export GOFLAGS="-buildmode=pie $GOFLAGS"
|
export GOFLAGS="-buildmode=pie $GOFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
|
|
||||||
buildPhase = args.buildPhase or (
|
buildPhase =
|
||||||
lib.warnIf (buildFlags != "" || buildFlagsArray != "")
|
args.buildPhase or (
|
||||||
"`buildFlags`/`buildFlagsArray` are deprecated and will be removed in the 24.11 release. Use the `ldflags` and/or `tags` attributes instead of `buildFlags`/`buildFlagsArray`"
|
lib.warnIf (buildFlags != "" || buildFlagsArray != "")
|
||||||
lib.warnIf (builtins.elem "-buildid=" ldflags)
|
"`buildFlags`/`buildFlagsArray` are deprecated and will be removed in the 24.11 release. Use the `ldflags` and/or `tags` attributes instead of `buildFlags`/`buildFlagsArray`"
|
||||||
"`-buildid=` is set by default as ldflag by buildGoModule"
|
lib.warnIf
|
||||||
''
|
(builtins.elem "-buildid=" ldflags)
|
||||||
runHook preBuild
|
"`-buildid=` is set by default as ldflag by buildGoModule"
|
||||||
|
''
|
||||||
|
runHook preBuild
|
||||||
|
|
||||||
exclude='\(/_\|examples\|Godeps\|testdata'
|
exclude='\(/_\|examples\|Godeps\|testdata'
|
||||||
if [[ -n "$excludedPackages" ]]; then
|
if [[ -n "$excludedPackages" ]]; then
|
||||||
IFS=' ' read -r -a excludedArr <<<$excludedPackages
|
IFS=' ' read -r -a excludedArr <<<$excludedPackages
|
||||||
printf -v excludedAlternates '%s\\|' "''${excludedArr[@]}"
|
printf -v excludedAlternates '%s\\|' "''${excludedArr[@]}"
|
||||||
excludedAlternates=''${excludedAlternates%\\|} # drop final \| added by printf
|
excludedAlternates=''${excludedAlternates%\\|} # drop final \| added by printf
|
||||||
exclude+='\|'"$excludedAlternates"
|
exclude+='\|'"$excludedAlternates"
|
||||||
fi
|
fi
|
||||||
exclude+='\)'
|
exclude+='\)'
|
||||||
|
|
||||||
buildGoDir() {
|
buildGoDir() {
|
||||||
local cmd="$1" dir="$2"
|
local cmd="$1" dir="$2"
|
||||||
|
|
||||||
declare -ga buildFlagsArray
|
declare -ga buildFlagsArray
|
||||||
declare -a flags
|
declare -a flags
|
||||||
flags+=($buildFlags "''${buildFlagsArray[@]}")
|
flags+=($buildFlags "''${buildFlagsArray[@]}")
|
||||||
flags+=(''${tags:+-tags=''${tags// /,}})
|
flags+=(''${tags:+-tags=''${tags// /,}})
|
||||||
flags+=(''${ldflags:+-ldflags="$ldflags"})
|
flags+=(''${ldflags:+-ldflags="$ldflags"})
|
||||||
flags+=("-p" "$NIX_BUILD_CORES")
|
flags+=("-p" "$NIX_BUILD_CORES")
|
||||||
|
|
||||||
if [ "$cmd" = "test" ]; then
|
if [ "$cmd" = "test" ]; then
|
||||||
flags+=(-vet=off)
|
flags+=(-vet=off)
|
||||||
flags+=($checkFlags)
|
flags+=($checkFlags)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local OUT
|
local OUT
|
||||||
if ! OUT="$(go $cmd "''${flags[@]}" $dir 2>&1)"; then
|
if ! OUT="$(go $cmd "''${flags[@]}" $dir 2>&1)"; then
|
||||||
if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
|
if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
|
||||||
echo "$OUT" >&2
|
echo "$OUT" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -n "$OUT" ]; then
|
if [ -n "$OUT" ]; then
|
||||||
echo "$OUT" >&2
|
echo "$OUT" >&2
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
getGoDirs() {
|
getGoDirs() {
|
||||||
local type;
|
local type;
|
||||||
type="$1"
|
type="$1"
|
||||||
if [ -n "$subPackages" ]; then
|
if [ -n "$subPackages" ]; then
|
||||||
echo "$subPackages" | sed "s,\(^\| \),\1./,g"
|
echo "$subPackages" | sed "s,\(^\| \),\1./,g"
|
||||||
else
|
else
|
||||||
find . -type f -name \*$type.go -exec dirname {} \; | grep -v "/_vendor/" | sort --unique | grep -v "$exclude"
|
find . -type f -name \*$type.go -exec dirname {} \; | grep -v "/_vendor/" | sort --unique | grep -v "$exclude"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if (( "''${NIX_DEBUG:-0}" >= 1 )); then
|
if (( "''${NIX_DEBUG:-0}" >= 1 )); then
|
||||||
buildFlagsArray+=(-x)
|
buildFlagsArray+=(-x)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$enableParallelBuilding" ]; then
|
if [ -z "$enableParallelBuilding" ]; then
|
||||||
export NIX_BUILD_CORES=1
|
export NIX_BUILD_CORES=1
|
||||||
fi
|
fi
|
||||||
for pkg in $(getGoDirs ""); do
|
for pkg in $(getGoDirs ""); do
|
||||||
echo "Building subPackage $pkg"
|
echo "Building subPackage $pkg"
|
||||||
buildGoDir install "$pkg"
|
buildGoDir install "$pkg"
|
||||||
done
|
done
|
||||||
'' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
''
|
||||||
# normalize cross-compiled builds w.r.t. native builds
|
+ lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
||||||
(
|
# normalize cross-compiled builds w.r.t. native builds
|
||||||
dir=$GOPATH/bin/${go.GOOS}_${go.GOARCH}
|
(
|
||||||
if [[ -n "$(shopt -s nullglob; echo $dir/*)" ]]; then
|
dir=$GOPATH/bin/${go.GOOS}_${go.GOARCH}
|
||||||
mv $dir/* $dir/..
|
if [[ -n "$(shopt -s nullglob; echo $dir/*)" ]]; then
|
||||||
fi
|
mv $dir/* $dir/..
|
||||||
if [[ -d $dir ]]; then
|
fi
|
||||||
rmdir $dir
|
if [[ -d $dir ]]; then
|
||||||
fi
|
rmdir $dir
|
||||||
)
|
fi
|
||||||
'' + ''
|
)
|
||||||
runHook postBuild
|
''
|
||||||
'');
|
+ ''
|
||||||
|
runHook postBuild
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
doCheck = args.doCheck or true;
|
doCheck = args.doCheck or true;
|
||||||
checkPhase = args.checkPhase or ''
|
checkPhase =
|
||||||
runHook preCheck
|
args.checkPhase or ''
|
||||||
# We do not set trimpath for tests, in case they reference test assets
|
runHook preCheck
|
||||||
export GOFLAGS=''${GOFLAGS//-trimpath/}
|
# We do not set trimpath for tests, in case they reference test assets
|
||||||
|
export GOFLAGS=''${GOFLAGS//-trimpath/}
|
||||||
|
|
||||||
for pkg in $(getGoDirs test); do
|
for pkg in $(getGoDirs test); do
|
||||||
buildGoDir test "$pkg"
|
buildGoDir test "$pkg"
|
||||||
done
|
done
|
||||||
|
|
||||||
runHook postCheck
|
runHook postCheck
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = args.installPhase or ''
|
installPhase =
|
||||||
runHook preInstall
|
args.installPhase or ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
dir="$GOPATH/bin"
|
dir="$GOPATH/bin"
|
||||||
[ -e "$dir" ] && cp -r $dir $out
|
[ -e "$dir" ] && cp -r $dir $out
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
|
|
||||||
disallowedReferences = lib.optional (!allowGoReference) go;
|
disallowedReferences = lib.optional (!allowGoReference) go;
|
||||||
|
|
||||||
passthru = passthru // { inherit go hugo hugoModules vendorHash; };
|
passthru = passthru // {
|
||||||
|
inherit
|
||||||
|
go
|
||||||
|
hugo
|
||||||
|
hugoModules
|
||||||
|
vendorHash
|
||||||
|
;
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
# Add default meta information
|
# Add default meta information
|
||||||
platforms = go.meta.platforms or lib.platforms.all;
|
platforms = go.meta.platforms or lib.platforms.all;
|
||||||
} // meta;
|
} // meta;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
in
|
in
|
||||||
package
|
package
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
let
|
let
|
||||||
sources = import ../../npins;
|
sources = import ../../npins;
|
||||||
in
|
in
|
||||||
{ pkgs ? import sources.nixos-unstable { } }:
|
{
|
||||||
|
pkgs ? import sources.nixos-unstable { },
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
docs = import ../. { inherit pkgs; };
|
docs = import ../. { inherit pkgs; };
|
||||||
|
98
flake.nix
98
flake.nix
@ -2,49 +2,65 @@
|
|||||||
# We're already using the Nix projects through pinning with npins.
|
# We're already using the Nix projects through pinning with npins.
|
||||||
{
|
{
|
||||||
description = "wrapper-manager-fds flake";
|
description = "wrapper-manager-fds flake";
|
||||||
outputs = { ... }: let
|
outputs =
|
||||||
sources = import ./npins;
|
{ ... }:
|
||||||
systems = [ "x86_64-linux" "aarch64-linux" ];
|
let
|
||||||
eachSystem = systems: f:
|
sources = import ./npins;
|
||||||
|
systems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
];
|
||||||
|
eachSystem =
|
||||||
|
systems: f:
|
||||||
|
let
|
||||||
|
# Merge together the outputs for all systems.
|
||||||
|
op =
|
||||||
|
attrs: system:
|
||||||
|
let
|
||||||
|
ret = f system;
|
||||||
|
op =
|
||||||
|
attrs: key:
|
||||||
|
attrs
|
||||||
|
// {
|
||||||
|
${key} = (attrs.${key} or { }) // {
|
||||||
|
${system} = ret.${key};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
builtins.foldl' op attrs (builtins.attrNames ret);
|
||||||
|
in
|
||||||
|
builtins.foldl' op { } (
|
||||||
|
systems
|
||||||
|
# add the current system if --impure is used
|
||||||
|
++ (
|
||||||
|
if builtins ? currentSystem then
|
||||||
|
if builtins.elem builtins.currentSystem systems then [ ] else [ builtins.currentSystem ]
|
||||||
|
else
|
||||||
|
[ ]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
in
|
||||||
|
import ./. { }
|
||||||
|
// (eachSystem systems (
|
||||||
|
system:
|
||||||
let
|
let
|
||||||
# Merge together the outputs for all systems.
|
pkgs = import sources.nixos-unstable { inherit system; };
|
||||||
op = attrs: system:
|
tests = import ./tests { inherit pkgs; };
|
||||||
let
|
docs = import ./docs { inherit pkgs; };
|
||||||
ret = f system;
|
|
||||||
op = attrs: key: attrs //
|
|
||||||
{
|
|
||||||
${key} = (attrs.${key} or { })
|
|
||||||
// { ${system} = ret.${key}; };
|
|
||||||
}
|
|
||||||
;
|
|
||||||
in
|
|
||||||
builtins.foldl' op attrs (builtins.attrNames ret);
|
|
||||||
in
|
in
|
||||||
builtins.foldl' op { }
|
{
|
||||||
(systems
|
devShells = {
|
||||||
++ # add the current system if --impure is used
|
default = import ./shell.nix { inherit pkgs; };
|
||||||
(if builtins?currentSystem then
|
website = import ./docs/website/shell.nix { inherit pkgs; };
|
||||||
if builtins.elem builtins.currentSystem systems
|
};
|
||||||
then []
|
|
||||||
else [ builtins.currentSystem ]
|
|
||||||
else
|
|
||||||
[]));
|
|
||||||
in import ./. { } // (eachSystem systems (system: let
|
|
||||||
pkgs = import sources.nixos-unstable { inherit system; };
|
|
||||||
tests = import ./tests { inherit pkgs; };
|
|
||||||
docs = import ./docs { inherit pkgs; };
|
|
||||||
in {
|
|
||||||
devShells = {
|
|
||||||
default = import ./shell.nix { inherit pkgs; };
|
|
||||||
website = import ./docs/website/shell.nix { inherit pkgs; };
|
|
||||||
};
|
|
||||||
|
|
||||||
packages = {
|
packages = {
|
||||||
manpage-reference = docs.outputs.manpage;
|
manpage-reference = docs.outputs.manpage;
|
||||||
html-reference = docs.outputs.html;
|
html-reference = docs.outputs.html;
|
||||||
website = docs.website;
|
website = docs.website;
|
||||||
};
|
};
|
||||||
|
|
||||||
checks.wrapperManagerLibrarySetPkg = tests.libTestPkg;
|
checks.wrapperManagerLibrarySetPkg = tests.libTestPkg;
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,15 @@
|
|||||||
# module.
|
# module.
|
||||||
{ pkgs }:
|
{ pkgs }:
|
||||||
|
|
||||||
pkgs.lib.makeExtensible
|
pkgs.lib.makeExtensible (
|
||||||
(self:
|
self:
|
||||||
let
|
let
|
||||||
callLibs = file: import file { inherit (pkgs) lib; inherit pkgs self; };
|
callLibs =
|
||||||
|
file:
|
||||||
|
import file {
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
inherit pkgs self;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
env = import ./env.nix;
|
env = import ./env.nix;
|
||||||
@ -20,5 +25,5 @@ pkgs.lib.makeExtensible
|
|||||||
|
|
||||||
inherit (self.env) build eval;
|
inherit (self.env) build eval;
|
||||||
inherit (self.utils) getBin getLibexec;
|
inherit (self.utils) getBin getLibexec;
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
32
lib/env.nix
32
lib/env.nix
@ -1,17 +1,18 @@
|
|||||||
rec {
|
rec {
|
||||||
/* Given the attrset for evaluating a wrapper-manager module, return a
|
/*
|
||||||
derivation containing the wrapper.
|
Given the attrset for evaluating a wrapper-manager module, return a
|
||||||
|
derivation containing the wrapper.
|
||||||
*/
|
*/
|
||||||
build = args:
|
build = args: (eval args).config.build.toplevel;
|
||||||
(eval args).config.build.toplevel;
|
|
||||||
|
|
||||||
/* Evaluate a wrapper-manager configuration. */
|
# Evaluate a wrapper-manager configuration.
|
||||||
eval = {
|
eval =
|
||||||
pkgs,
|
{
|
||||||
lib ? pkgs.lib,
|
pkgs,
|
||||||
modules ? [ ],
|
lib ? pkgs.lib,
|
||||||
specialArgs ? { },
|
modules ? [ ],
|
||||||
}:
|
specialArgs ? { },
|
||||||
|
}:
|
||||||
lib.evalModules {
|
lib.evalModules {
|
||||||
inherit specialArgs;
|
inherit specialArgs;
|
||||||
modules = [
|
modules = [
|
||||||
@ -20,9 +21,12 @@ rec {
|
|||||||
# Setting pkgs modularly. This would make setting up wrapper-manager
|
# Setting pkgs modularly. This would make setting up wrapper-manager
|
||||||
# with different nixpkgs instances possible but it isn't something that
|
# with different nixpkgs instances possible but it isn't something that
|
||||||
# is explicitly supported.
|
# is explicitly supported.
|
||||||
({ lib, ... }: {
|
(
|
||||||
config._module.args.pkgs = lib.mkDefault pkgs;
|
{ lib, ... }:
|
||||||
})
|
{
|
||||||
|
config._module.args.pkgs = lib.mkDefault pkgs;
|
||||||
|
}
|
||||||
|
)
|
||||||
] ++ modules;
|
] ++ modules;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
{ pkgs, lib, self }:
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
self,
|
||||||
|
}:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
/*
|
/*
|
||||||
Given a list of derivations, return a list of the store path with the `bin`
|
Given a list of derivations, return a list of the store path with the `bin`
|
||||||
output (or at least with "/bin" in each of the paths).
|
output (or at least with "/bin" in each of the paths).
|
||||||
*/
|
*/
|
||||||
getBin = drvs:
|
getBin = drvs: builtins.map (v: lib.getBin v) drvs;
|
||||||
builtins.map (v: lib.getBin v) drvs;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Given a list of derivations, return a list of the store paths with the
|
Given a list of derivations, return a list of the store paths with the
|
||||||
`libexec` appended.
|
`libexec` appended.
|
||||||
*/
|
*/
|
||||||
getLibexec = drvs:
|
getLibexec = drvs: builtins.map (v: "${v}/libexec") drvs;
|
||||||
builtins.map (v: "${v}/libexec") drvs;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Given a list of derivations, return a list of the store paths appended with
|
Given a list of derivations, return a list of the store paths appended with
|
||||||
`/etc/xdg` suitable as part of the XDG_CONFIG_DIRS environment variable.
|
`/etc/xdg` suitable as part of the XDG_CONFIG_DIRS environment variable.
|
||||||
*/
|
*/
|
||||||
getXdgConfigDirs = drvs:
|
getXdgConfigDirs = drvs: builtins.map (v: "${v}/etc/xdg") drvs;
|
||||||
builtins.map (v: "${v}/etc/xdg") drvs;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Given a list of derivations, return a list of store paths appended with
|
Given a list of derivations, return a list of store paths appended with
|
||||||
`/share` suitable as part of the XDG_DATA_DIRS environment variable.
|
`/share` suitable as part of the XDG_DATA_DIRS environment variable.
|
||||||
*/
|
*/
|
||||||
getXdgDataDirs = drvs:
|
getXdgDataDirs = drvs: builtins.map (v: "${v}/share") drvs;
|
||||||
builtins.map (v: "${v}/share") drvs;
|
|
||||||
}
|
}
|
||||||
|
16
modules/env/common.nix
vendored
16
modules/env/common.nix
vendored
@ -1,4 +1,9 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.wrapper-manager;
|
cfg = config.wrapper-manager;
|
||||||
@ -10,9 +15,12 @@ let
|
|||||||
modules = [
|
modules = [
|
||||||
../wrapper-manager
|
../wrapper-manager
|
||||||
|
|
||||||
({ lib, ... }: {
|
(
|
||||||
config._module.args.pkgs = lib.mkDefault pkgs;
|
{ lib, ... }:
|
||||||
})
|
{
|
||||||
|
config._module.args.pkgs = lib.mkDefault pkgs;
|
||||||
|
}
|
||||||
|
)
|
||||||
] ++ cfg.sharedModules;
|
] ++ cfg.sharedModules;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
31
modules/env/home-manager/default.nix
vendored
31
modules/env/home-manager/default.nix
vendored
@ -1,13 +1,16 @@
|
|||||||
{ config, lib, pkgs, ... }@moduleArgs:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}@moduleArgs:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.wrapper-manager;
|
cfg = config.wrapper-manager;
|
||||||
wmDocs = import ../../../docs { inherit pkgs; };
|
wmDocs = import ../../../docs { inherit pkgs; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [ ../common.nix ];
|
||||||
../common.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
{
|
{
|
||||||
@ -20,17 +23,19 @@ in
|
|||||||
|
|
||||||
(lib.mkIf (moduleArgs ? nixosConfig) {
|
(lib.mkIf (moduleArgs ? nixosConfig) {
|
||||||
wrapper-manager.sharedModules = [
|
wrapper-manager.sharedModules = [
|
||||||
({ lib, ... }: {
|
(
|
||||||
# NixOS already has the option to set the locale so we don't need to
|
{ lib, ... }:
|
||||||
# have this.
|
{
|
||||||
config.locale.enable = lib.mkDefault false;
|
# NixOS already has the option to set the locale so we don't need to
|
||||||
})
|
# have this.
|
||||||
|
config.locale.enable = lib.mkDefault false;
|
||||||
|
}
|
||||||
|
)
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
|
||||||
(lib.mkIf (cfg.packages != {}) {
|
(lib.mkIf (cfg.packages != { }) {
|
||||||
home.packages =
|
home.packages = lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) cfg.packages;
|
||||||
lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) cfg.packages;
|
|
||||||
})
|
})
|
||||||
] ;
|
];
|
||||||
}
|
}
|
||||||
|
29
modules/env/nixos/default.nix
vendored
29
modules/env/nixos/default.nix
vendored
@ -1,13 +1,16 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.wrapper-manager;
|
cfg = config.wrapper-manager;
|
||||||
wmDocs = import ../../../docs { inherit pkgs; };
|
wmDocs = import ../../../docs { inherit pkgs; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [ ../common.nix ];
|
||||||
../common.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
{
|
{
|
||||||
@ -18,17 +21,19 @@ in
|
|||||||
wrapper-manager.extraSpecialArgs.nixosConfig = config;
|
wrapper-manager.extraSpecialArgs.nixosConfig = config;
|
||||||
|
|
||||||
wrapper-manager.sharedModules = [
|
wrapper-manager.sharedModules = [
|
||||||
({ lib, ... }: {
|
(
|
||||||
# NixOS already has the option to set the locale so we don't need to
|
{ lib, ... }:
|
||||||
# have this.
|
{
|
||||||
config.locale.enable = lib.mkDefault false;
|
# NixOS already has the option to set the locale so we don't need to
|
||||||
})
|
# have this.
|
||||||
|
config.locale.enable = lib.mkDefault false;
|
||||||
|
}
|
||||||
|
)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
(lib.mkIf (cfg.packages != {}) {
|
(lib.mkIf (cfg.packages != { }) {
|
||||||
environment.systemPackages =
|
environment.systemPackages = lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) cfg.packages;
|
||||||
lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) cfg.packages;
|
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -1,40 +1,63 @@
|
|||||||
{ config, lib, options, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
options,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
envConfig = config;
|
envConfig = config;
|
||||||
|
|
||||||
toStringType = with lib.types; coercedTo anything (x: builtins.toString x) str;
|
toStringType = with lib.types; coercedTo anything (x: builtins.toString x) str;
|
||||||
envSubmodule = { config, lib, name, ... }: {
|
envSubmodule =
|
||||||
options = {
|
{
|
||||||
action = lib.mkOption {
|
config,
|
||||||
type = lib.types.enum [ "unset" "set" "set-default" ];
|
lib,
|
||||||
description = ''
|
name,
|
||||||
Sets the appropriate action for the environment variable.
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
action = lib.mkOption {
|
||||||
|
type = lib.types.enum [
|
||||||
|
"unset"
|
||||||
|
"set"
|
||||||
|
"set-default"
|
||||||
|
];
|
||||||
|
description = ''
|
||||||
|
Sets the appropriate action for the environment variable.
|
||||||
|
|
||||||
* `unset`... unsets the given variable.
|
* `unset`... unsets the given variable.
|
||||||
* `set-default` only sets the variable with the given value if
|
* `set-default` only sets the variable with the given value if
|
||||||
not already set.
|
not already set.
|
||||||
* `set` forcibly sets the variable with given value.
|
* `set` forcibly sets the variable with given value.
|
||||||
'';
|
'';
|
||||||
default = "set";
|
default = "set";
|
||||||
example = "unset";
|
example = "unset";
|
||||||
};
|
};
|
||||||
|
|
||||||
value = lib.mkOption {
|
value = lib.mkOption {
|
||||||
type = toStringType;
|
type = toStringType;
|
||||||
description = ''
|
description = ''
|
||||||
The value of the variable that is holding.
|
The value of the variable that is holding.
|
||||||
'';
|
'';
|
||||||
example = "HELLO THERE";
|
example = "HELLO THERE";
|
||||||
};
|
};
|
||||||
|
|
||||||
isEscaped = lib.mkEnableOption "escaping of the value" // {
|
isEscaped = lib.mkEnableOption "escaping of the value" // {
|
||||||
default = true;
|
default = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
wrapperType = { name, lib, config, pkgs, ... }:
|
wrapperType =
|
||||||
|
{
|
||||||
|
name,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
flagType = with lib.types; listOf toStringType;
|
flagType = with lib.types; listOf toStringType;
|
||||||
in
|
in
|
||||||
@ -118,28 +141,36 @@ let
|
|||||||
env = envConfig.environment.variables;
|
env = envConfig.environment.variables;
|
||||||
pathAdd = envConfig.environment.pathAdd;
|
pathAdd = envConfig.environment.pathAdd;
|
||||||
|
|
||||||
makeWrapperArgs = [
|
makeWrapperArgs =
|
||||||
"--argv0" config.arg0
|
[
|
||||||
]
|
"--argv0"
|
||||||
++ (lib.mapAttrsToList
|
config.arg0
|
||||||
(n: v:
|
]
|
||||||
if v.action == "unset"
|
++ (lib.mapAttrsToList (
|
||||||
then "--${v.action} ${lib.escapeShellArg n}"
|
n: v:
|
||||||
else "--${v.action} ${lib.escapeShellArg n} ${if v.isEscaped then lib.escapeShellArg v.value else v.value}")
|
if v.action == "unset" then
|
||||||
config.env)
|
"--${v.action} ${lib.escapeShellArg n}"
|
||||||
++ (builtins.map (v: "--add-flags ${lib.escapeShellArg v}") config.prependArgs)
|
else
|
||||||
++ (builtins.map (v: "--append-flags ${lib.escapeShellArg v}") config.appendArgs)
|
"--${v.action} ${lib.escapeShellArg n} ${
|
||||||
++ (lib.optionals (!envConfig.build.isBinary && config.preScript != "") (
|
if v.isEscaped then lib.escapeShellArg v.value else v.value
|
||||||
let
|
}"
|
||||||
preScript =
|
) config.env)
|
||||||
pkgs.runCommand "wrapper-script-prescript-${config.executableName}" { } config.preScript;
|
++ (builtins.map (v: "--add-flags ${lib.escapeShellArg v}") config.prependArgs)
|
||||||
in
|
++ (builtins.map (v: "--append-flags ${lib.escapeShellArg v}") config.appendArgs)
|
||||||
[ "--run" preScript ]));
|
++ (lib.optionals (!envConfig.build.isBinary && config.preScript != "") (
|
||||||
|
let
|
||||||
|
preScript =
|
||||||
|
pkgs.runCommand "wrapper-script-prescript-${config.executableName}" { }
|
||||||
|
config.preScript;
|
||||||
|
in
|
||||||
|
[
|
||||||
|
"--run"
|
||||||
|
preScript
|
||||||
|
]
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
(lib.mkIf (config.pathAdd != [ ]) {
|
(lib.mkIf (config.pathAdd != [ ]) { env.PATH.value = lib.concatStringsSep ":" config.pathAdd; })
|
||||||
env.PATH.value = lib.concatStringsSep ":" config.pathAdd;
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
options.build = {
|
options.build = {
|
||||||
@ -48,30 +53,27 @@
|
|||||||
build = {
|
build = {
|
||||||
toplevel =
|
toplevel =
|
||||||
let
|
let
|
||||||
mkWrapBuild = wrappers:
|
mkWrapBuild =
|
||||||
|
wrappers:
|
||||||
lib.concatMapStrings (v: ''
|
lib.concatMapStrings (v: ''
|
||||||
makeWrapper "${v.arg0}" "${builtins.placeholder "out"}/bin/${v.executableName}" ${lib.concatStringsSep " " v.makeWrapperArgs}
|
makeWrapper "${v.arg0}" "${builtins.placeholder "out"}/bin/${v.executableName}" ${lib.concatStringsSep " " v.makeWrapperArgs}
|
||||||
'') wrappers;
|
'') wrappers;
|
||||||
|
|
||||||
mkDesktopEntries = desktopEntries:
|
mkDesktopEntries = desktopEntries: builtins.map (entry: pkgs.makeDesktopItem entry) desktopEntries;
|
||||||
builtins.map (entry: pkgs.makeDesktopItem entry) desktopEntries;
|
|
||||||
|
|
||||||
desktopEntries =
|
desktopEntries = mkDesktopEntries (lib.attrValues config.xdg.desktopEntries);
|
||||||
mkDesktopEntries (lib.attrValues config.xdg.desktopEntries);
|
|
||||||
in
|
in
|
||||||
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 config.build.isBinary
|
if config.build.isBinary then [ pkgs.makeBinaryWrapper ] else [ pkgs.makeWrapper ];
|
||||||
then [ pkgs.makeBinaryWrapper ]
|
postBuild = ''
|
||||||
else [ pkgs.makeWrapper ];
|
${config.build.extraSetup}
|
||||||
postBuild = ''
|
${mkWrapBuild (lib.attrValues config.wrappers)}
|
||||||
${config.build.extraSetup}
|
'';
|
||||||
${mkWrapBuild (lib.attrValues config.wrappers)}
|
};
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,50 +1,66 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.locale;
|
cfg = config.locale;
|
||||||
|
|
||||||
localeModuleFactory = { isGlobal ? false }: {
|
localeModuleFactory =
|
||||||
enable = lib.mkOption {
|
{
|
||||||
type = lib.types.bool;
|
isGlobal ? false,
|
||||||
default = if isGlobal then true else cfg.enable;
|
}:
|
||||||
example = false;
|
{
|
||||||
description = if isGlobal then ''
|
enable = lib.mkOption {
|
||||||
Whether to enable explicit glibc locale support. This is recommended
|
type = lib.types.bool;
|
||||||
for Nix-built applications.
|
default = if isGlobal then true else cfg.enable;
|
||||||
'' else ''
|
example = false;
|
||||||
Whether to enable locale support for this wrapper. Recommended for
|
description =
|
||||||
Nix-built applications.
|
if isGlobal then
|
||||||
'';
|
''
|
||||||
};
|
Whether to enable explicit glibc locale support. This is recommended
|
||||||
|
for Nix-built applications.
|
||||||
|
''
|
||||||
|
else
|
||||||
|
''
|
||||||
|
Whether to enable locale support for this wrapper. Recommended for
|
||||||
|
Nix-built applications.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
package = lib.mkOption {
|
package = lib.mkOption {
|
||||||
type = lib.types.package;
|
type = lib.types.package;
|
||||||
default =
|
default = if isGlobal then (pkgs.glibcLocales.override { allLocales = true; }) else cfg.package;
|
||||||
if isGlobal
|
description = ''
|
||||||
then (pkgs.glibcLocales.override { allLocales = true; })
|
The package containing glibc locales.
|
||||||
else cfg.package;
|
'';
|
||||||
description = ''
|
};
|
||||||
The package containing glibc locales.
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.locale = localeModuleFactory { isGlobal = true; };
|
options.locale = localeModuleFactory { isGlobal = true; };
|
||||||
|
|
||||||
options.wrappers =
|
options.wrappers =
|
||||||
let
|
let
|
||||||
localeSubmodule = { config, lib, name, ... }: let
|
localeSubmodule =
|
||||||
submoduleCfg = config.locale;
|
{
|
||||||
in {
|
config,
|
||||||
options.locale = localeModuleFactory { isGlobal = false; };
|
lib,
|
||||||
|
name,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
submoduleCfg = config.locale;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.locale = localeModuleFactory { isGlobal = false; };
|
||||||
|
|
||||||
config = lib.mkIf submoduleCfg.enable {
|
config = lib.mkIf submoduleCfg.enable {
|
||||||
env.LOCALE_ARCHIVE.value = "${submoduleCfg.package}/lib/locale/locale-archive";
|
env.LOCALE_ARCHIVE.value = "${submoduleCfg.package}/lib/locale/locale-archive";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
in
|
in
|
||||||
lib.mkOption {
|
lib.mkOption { type = with lib.types; attrsOf (submodule localeSubmodule); };
|
||||||
type = with lib.types; attrsOf (submodule localeSubmodule);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -1,63 +1,81 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
# We're only setting up options for the most common keys typically used to
|
# We're only setting up options for the most common keys typically used to
|
||||||
# set up a desktop entry. Everything else is acceptable under a freeform
|
# set up a desktop entry. Everything else is acceptable under a freeform
|
||||||
# module anyways.
|
# module anyways.
|
||||||
xdgDesktopEntry = { name, lib, pkgs, ... }: {
|
xdgDesktopEntry =
|
||||||
freeformType = with lib.types; attrsOf anything;
|
{
|
||||||
|
name,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
freeformType = with lib.types; attrsOf anything;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
name = lib.mkOption {
|
name = lib.mkOption {
|
||||||
type = lib.types.nonEmptyStr;
|
type = lib.types.nonEmptyStr;
|
||||||
description = "The name of the desktop file.";
|
description = "The name of the desktop file.";
|
||||||
default = name;
|
default = name;
|
||||||
example = "firefox";
|
example = "firefox";
|
||||||
};
|
};
|
||||||
|
|
||||||
desktopName = lib.mkOption {
|
desktopName = lib.mkOption {
|
||||||
type = lib.types.nonEmptyStr;
|
type = lib.types.nonEmptyStr;
|
||||||
description = "Specific name of the application.";
|
description = "Specific name of the application.";
|
||||||
default = name;
|
default = name;
|
||||||
example = "Firefox";
|
example = "Firefox";
|
||||||
};
|
};
|
||||||
|
|
||||||
exec = lib.mkOption {
|
exec = lib.mkOption {
|
||||||
type = with lib.types; nullOr nonEmptyStr;
|
type = with lib.types; nullOr nonEmptyStr;
|
||||||
description = "Program with execute along with its arguments.";
|
description = "Program with execute along with its arguments.";
|
||||||
default = null;
|
default = null;
|
||||||
example = "firefox %U";
|
example = "firefox %U";
|
||||||
};
|
};
|
||||||
|
|
||||||
genericName = lib.mkOption {
|
genericName = lib.mkOption {
|
||||||
type = with lib.types; nullOr nonEmptyStr;
|
type = with lib.types; nullOr nonEmptyStr;
|
||||||
description = "Generic name of the application.";
|
description = "Generic name of the application.";
|
||||||
default = null;
|
default = null;
|
||||||
example = "Web browser";
|
example = "Web browser";
|
||||||
};
|
};
|
||||||
|
|
||||||
terminal = lib.mkOption {
|
terminal = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
description = "Whether the program runs in a terminal window.";
|
description = "Whether the program runs in a terminal window.";
|
||||||
default = false;
|
default = false;
|
||||||
example = true;
|
example = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
categories = lib.mkOption {
|
categories = lib.mkOption {
|
||||||
type = with lib.types; listOf nonEmptyStr;
|
type = with lib.types; listOf nonEmptyStr;
|
||||||
description = "List of categories should the application be shown in a menu.";
|
description = "List of categories should the application be shown in a menu.";
|
||||||
default = [ ];
|
default = [ ];
|
||||||
example = [ "Applications" "Network" ];
|
example = [
|
||||||
};
|
"Applications"
|
||||||
|
"Network"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
mimeTypes = lib.mkOption {
|
mimeTypes = lib.mkOption {
|
||||||
type = with lib.types; listOf nonEmptyStr;
|
type = with lib.types; listOf nonEmptyStr;
|
||||||
description = "The MIME types supported by the application.";
|
description = "The MIME types supported by the application.";
|
||||||
default = [ ];
|
default = [ ];
|
||||||
example = [ "text/html" "text/xml" ];
|
example = [
|
||||||
|
"text/html"
|
||||||
|
"text/xml"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.xdg.desktopEntries = lib.mkOption {
|
options.xdg.desktopEntries = lib.mkOption {
|
||||||
@ -89,44 +107,51 @@ in
|
|||||||
options.wrappers = lib.mkOption {
|
options.wrappers = lib.mkOption {
|
||||||
type =
|
type =
|
||||||
let
|
let
|
||||||
xdgDesktopEntryWrapperSubmodule = { name, config, lib, ... }: {
|
xdgDesktopEntryWrapperSubmodule =
|
||||||
options.xdg.desktopEntry = {
|
{
|
||||||
enable =
|
name,
|
||||||
lib.mkEnableOption "automatic creation of a desktop entry for the wrapper";
|
config,
|
||||||
settings = lib.mkOption {
|
lib,
|
||||||
type = lib.types.submodule xdgDesktopEntry;
|
...
|
||||||
description = ''
|
}:
|
||||||
Settings to be passed to the `makeDesktopItem` builder.
|
{
|
||||||
'';
|
options.xdg.desktopEntry = {
|
||||||
example = lib.literalExpression ''
|
enable = lib.mkEnableOption "automatic creation of a desktop entry for the wrapper";
|
||||||
{
|
settings = lib.mkOption {
|
||||||
mimeTypes = [ "text/html" "text/xml" ];
|
type = lib.types.submodule xdgDesktopEntry;
|
||||||
categories = [ "Applications" "Network" ];
|
description = ''
|
||||||
}
|
Settings to be passed to the `makeDesktopItem` builder.
|
||||||
'';
|
'';
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
{
|
||||||
|
mimeTypes = [ "text/html" "text/xml" ];
|
||||||
|
categories = [ "Applications" "Network" ];
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config.xdg.desktopEntry.settings = lib.mkIf config.xdg.desktopEntry.enable {
|
||||||
|
name = lib.mkDefault config.executableName;
|
||||||
|
desktopName = lib.mkDefault name;
|
||||||
|
type = lib.mkDefault "Application";
|
||||||
|
|
||||||
|
# Welp, we could set it to the absolute location of the wrapper
|
||||||
|
# executable in the final output but it's a big pain the ass to do
|
||||||
|
# so we're opting to the executable name instead. This current
|
||||||
|
# way of doing it is simply the next best (and the simplest) thing.
|
||||||
|
# We just have to make sure the build step for the wrapper script
|
||||||
|
# is consistent throughout the entire module environment.
|
||||||
|
#
|
||||||
|
# Besides, if the user wants a desktop entry along with the wrapper
|
||||||
|
# script, it will be included alongside in whatever environment
|
||||||
|
# they are using it for anyways.
|
||||||
|
exec = config.executableName;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config.xdg.desktopEntry.settings = lib.mkIf config.xdg.desktopEntry.enable {
|
|
||||||
name = lib.mkDefault config.executableName;
|
|
||||||
desktopName = lib.mkDefault name;
|
|
||||||
type = lib.mkDefault "Application";
|
|
||||||
|
|
||||||
# Welp, we could set it to the absolute location of the wrapper
|
|
||||||
# executable in the final output but it's a big pain the ass to do
|
|
||||||
# so we're opting to the executable name instead. This current
|
|
||||||
# way of doing it is simply the next best (and the simplest) thing.
|
|
||||||
# We just have to make sure the build step for the wrapper script
|
|
||||||
# is consistent throughout the entire module environment.
|
|
||||||
#
|
|
||||||
# Besides, if the user wants a desktop entry along with the wrapper
|
|
||||||
# script, it will be included alongside in whatever environment
|
|
||||||
# they are using it for anyways.
|
|
||||||
exec = config.executableName;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
with lib.types; attrsOf (submodule xdgDesktopEntryWrapperSubmodule);
|
with lib.types;
|
||||||
|
attrsOf (submodule xdgDesktopEntryWrapperSubmodule);
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
@ -134,6 +159,6 @@ in
|
|||||||
let
|
let
|
||||||
wrappersWithDesktopEntries = lib.filterAttrs (_: v: v.xdg.desktopEntry.enable) config.wrappers;
|
wrappersWithDesktopEntries = lib.filterAttrs (_: v: v.xdg.desktopEntry.enable) config.wrappers;
|
||||||
in
|
in
|
||||||
lib.mapAttrs (_: v: v.xdg.desktopEntry.settings) wrappersWithDesktopEntries;
|
lib.mapAttrs (_: v: v.xdg.desktopEntry.settings) wrappersWithDesktopEntries;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -41,26 +41,34 @@ in
|
|||||||
options.wrappers = lib.mkOption {
|
options.wrappers = lib.mkOption {
|
||||||
type =
|
type =
|
||||||
let
|
let
|
||||||
xdgDirsType = { name, lib, config, ... }: {
|
xdgDirsType =
|
||||||
options.xdg = xdgDirsOption;
|
{
|
||||||
|
name,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
options.xdg = xdgDirsOption;
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
{
|
{
|
||||||
# When set this way, we could allow the user to override everything.
|
# When set this way, we could allow the user to override everything.
|
||||||
xdg.configDirs = cfg.configDirs;
|
xdg.configDirs = cfg.configDirs;
|
||||||
xdg.dataDirs = cfg.dataDirs;
|
xdg.dataDirs = cfg.dataDirs;
|
||||||
}
|
}
|
||||||
|
|
||||||
(lib.mkIf (config.xdg.configDirs != [ ]) {
|
(lib.mkIf (config.xdg.configDirs != [ ]) {
|
||||||
env.XDG_CONFIG_DIRS.value = lib.concatStringsSep ":" config.xdg.configDirs;
|
env.XDG_CONFIG_DIRS.value = lib.concatStringsSep ":" config.xdg.configDirs;
|
||||||
})
|
})
|
||||||
|
|
||||||
(lib.mkIf (config.xdg.dataDirs != [ ]) {
|
(lib.mkIf (config.xdg.dataDirs != [ ]) {
|
||||||
env.XDG_DATA_DIRS.value = lib.concatStringsSep ":" config.xdg.dataDirs;
|
env.XDG_DATA_DIRS.value = lib.concatStringsSep ":" config.xdg.dataDirs;
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
with lib.types; attrsOf (submodule xdgDirsType);
|
with lib.types;
|
||||||
|
attrsOf (submodule xdgDirsType);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
let
|
let
|
||||||
sources = import ./npins;
|
sources = import ./npins;
|
||||||
in
|
in
|
||||||
{ pkgs ? import sources.nixos-unstable { } }:
|
{
|
||||||
|
pkgs ? import sources.nixos-unstable { },
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
docs = import ./docs { inherit pkgs; };
|
docs = import ./docs { inherit pkgs; };
|
||||||
@ -12,7 +14,7 @@ pkgs.mkShell {
|
|||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
npins
|
npins
|
||||||
treefmt
|
treefmt
|
||||||
nixpkgs-fmt
|
nixfmt-rfc-style
|
||||||
|
|
||||||
# For easy validation of the test suite.
|
# For easy validation of the test suite.
|
||||||
yajsv
|
yajsv
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
let
|
let
|
||||||
sources = import ../../npins;
|
sources = import ../../npins;
|
||||||
in
|
in
|
||||||
{ pkgs ? import sources.nixos-unstable { } }:
|
{
|
||||||
|
pkgs ? import sources.nixos-unstable { },
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
wmLib = (import ../../. { }).lib;
|
wmLib = (import ../../. { }).lib;
|
||||||
build = modules: wmLib.build {
|
build = modules: wmLib.build { inherit pkgs modules; };
|
||||||
inherit pkgs modules;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
fastfetch = build [ ./wrapper-fastfetch.nix ];
|
fastfetch = build [ ./wrapper-fastfetch.nix ];
|
||||||
|
@ -1,18 +1,28 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
wrappers.fastfetch = {
|
wrappers.fastfetch = {
|
||||||
arg0 = lib.getExe' pkgs.fastfetch "fastfetch";
|
arg0 = lib.getExe' pkgs.fastfetch "fastfetch";
|
||||||
appendArgs = [ "--logo" "Guix" ];
|
appendArgs = [
|
||||||
|
"--logo"
|
||||||
|
"Guix"
|
||||||
|
];
|
||||||
env.NO_COLOR.value = "1";
|
env.NO_COLOR.value = "1";
|
||||||
xdg.desktopEntry.enable = true;
|
xdg.desktopEntry.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
build.extraPassthru.tests = {
|
build.extraPassthru.tests = {
|
||||||
actuallyBuilt = let
|
actuallyBuilt =
|
||||||
wrapper = config.build.toplevel;
|
let
|
||||||
in pkgs.runCommand "wrapper-manager-fastfetch-actually-built" { } ''
|
wrapper = config.build.toplevel;
|
||||||
[ -e "${wrapper}/share/applications/fastfetch.desktop" ] && [ -x "${wrapper}/bin/${config.wrappers.fastfetch.executableName}" ] && touch $out
|
in
|
||||||
'';
|
pkgs.runCommand "wrapper-manager-fastfetch-actually-built" { } ''
|
||||||
|
[ -e "${wrapper}/share/applications/fastfetch.desktop" ] && [ -x "${wrapper}/bin/${config.wrappers.fastfetch.executableName}" ] && touch $out
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,32 @@
|
|||||||
{ config, lib, pkgs, yourMomName, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
yourMomName,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
wrappers.neofetch = {
|
wrappers.neofetch = {
|
||||||
arg0 = lib.getExe' pkgs.neofetch "neofetch";
|
arg0 = lib.getExe' pkgs.neofetch "neofetch";
|
||||||
executableName = yourMomName;
|
executableName = yourMomName;
|
||||||
appendArgs = [
|
appendArgs = [
|
||||||
"--ascii_distro" "guix"
|
"--ascii_distro"
|
||||||
"--title_fqdn" "off"
|
"guix"
|
||||||
"--os_arch" "off"
|
"--title_fqdn"
|
||||||
|
"off"
|
||||||
|
"--os_arch"
|
||||||
|
"off"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
build.extraPassthru.tests = {
|
build.extraPassthru.tests = {
|
||||||
actuallyBuilt = let
|
actuallyBuilt =
|
||||||
wrapper = config.build.toplevel;
|
let
|
||||||
in pkgs.runCommand "wrapper-manager-neofetch-actually-built" { } ''
|
wrapper = config.build.toplevel;
|
||||||
[ -x "${wrapper}/bin/${config.wrappers.fastfetch.executableName}" ] && touch $out
|
in
|
||||||
'';
|
pkgs.runCommand "wrapper-manager-neofetch-actually-built" { } ''
|
||||||
|
[ -x "${wrapper}/bin/${config.wrappers.fastfetch.executableName}" ] && touch $out
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
let
|
let
|
||||||
sources = import ../npins;
|
sources = import ../npins;
|
||||||
in
|
in
|
||||||
{ pkgs ? import sources.nixos-unstable { } }:
|
{
|
||||||
|
pkgs ? import sources.nixos-unstable { },
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
lib = import ./lib { inherit pkgs; };
|
lib = import ./lib { inherit pkgs; };
|
||||||
@ -9,11 +11,16 @@ in
|
|||||||
{
|
{
|
||||||
inherit lib;
|
inherit lib;
|
||||||
libTestPkg =
|
libTestPkg =
|
||||||
pkgs.runCommand "wrapper-manager-fds-lib-test" {
|
pkgs.runCommand "wrapper-manager-fds-lib-test"
|
||||||
testData = builtins.toJSON lib;
|
{
|
||||||
passAsFile = [ "testData" ];
|
testData = builtins.toJSON lib;
|
||||||
nativeBuildInputs = with pkgs; [ yajsv jq ];
|
passAsFile = [ "testData" ];
|
||||||
} ''
|
nativeBuildInputs = with pkgs; [
|
||||||
yajsv -s "${./lib/tests.schema.json}" "$testDataPath" && touch $out || jq . "$testDataPath"
|
yajsv
|
||||||
'';
|
jq
|
||||||
|
];
|
||||||
|
}
|
||||||
|
''
|
||||||
|
yajsv -s "${./lib/tests.schema.json}" "$testDataPath" && touch $out || jq . "$testDataPath"
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
lib = import ../../lib { inherit pkgs; };
|
lib = import ../../lib { inherit pkgs; };
|
||||||
callLib = file: import file {
|
callLib =
|
||||||
inherit (pkgs) lib; inherit pkgs;
|
file:
|
||||||
self = lib;
|
import file {
|
||||||
};
|
inherit (pkgs) lib;
|
||||||
|
inherit pkgs;
|
||||||
|
self = lib;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
env = callLib ./env;
|
env = callLib ./env;
|
||||||
|
14
tests/lib/env/default.nix
vendored
14
tests/lib/env/default.nix
vendored
@ -1,4 +1,8 @@
|
|||||||
{ pkgs, lib, self }:
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
self,
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
neofetchWrapper = ../../configs/wrapper-neofetch.nix;
|
neofetchWrapper = ../../configs/wrapper-neofetch.nix;
|
||||||
@ -14,7 +18,7 @@ lib.runTests {
|
|||||||
specialArgs.yourMomName = "Joe Mama";
|
specialArgs.yourMomName = "Joe Mama";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
lib.isDerivation sampleConf.config.build.toplevel;
|
lib.isDerivation sampleConf.config.build.toplevel;
|
||||||
expected = true;
|
expected = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -27,7 +31,7 @@ lib.runTests {
|
|||||||
specialArgs.yourMomName = "Joe Mama";
|
specialArgs.yourMomName = "Joe Mama";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
lib.isDerivation sampleConf.config.build.toplevel;
|
lib.isDerivation sampleConf.config.build.toplevel;
|
||||||
expected = true;
|
expected = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -40,7 +44,7 @@ lib.runTests {
|
|||||||
specialArgs.yourMomName = "Joe Mama";
|
specialArgs.yourMomName = "Joe Mama";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
lib.isDerivation sampleConf;
|
lib.isDerivation sampleConf;
|
||||||
expected = true;
|
expected = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -53,7 +57,7 @@ lib.runTests {
|
|||||||
specialArgs.yourMomName = "Joe Mama";
|
specialArgs.yourMomName = "Joe Mama";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
lib.isDerivation sampleConf;
|
lib.isDerivation sampleConf;
|
||||||
expected = true;
|
expected = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
{ pkgs, lib, self }:
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
self,
|
||||||
|
}:
|
||||||
|
|
||||||
lib.runTests {
|
lib.runTests {
|
||||||
testsUtilsGetBin = {
|
testsUtilsGetBin = {
|
||||||
|
Loading…
Reference in New Issue
Block a user