mirror of
https://github.com/foo-dogsquared/nix-module-wrapper-manager-fds.git
synced 2025-04-25 00:19:14 +00:00
wrapper-manager-fds: reformat codebase
This commit is contained in:
parent
6eed3dbaea
commit
d4a8025d06
@ -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 {
|
options =
|
||||||
modules = modules ++ [ { _module.check = false; _module.args.pkgs = pkgs; } ];
|
(pkgs.lib.evalModules {
|
||||||
|
modules = modules ++ [
|
||||||
|
{
|
||||||
|
_module.check = false;
|
||||||
|
_module.args.pkgs = pkgs;
|
||||||
|
}
|
||||||
|
];
|
||||||
class = "wrapperManager";
|
class = "wrapperManager";
|
||||||
}).options;
|
}).options;
|
||||||
in
|
in
|
||||||
nixosOptionsDoc ({
|
nixosOptionsDoc (
|
||||||
|
{
|
||||||
options =
|
options =
|
||||||
if includeModuleSystemOptions
|
if includeModuleSystemOptions then options else builtins.removeAttrs options [ "_module" ];
|
||||||
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,18 +64,26 @@ 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
|
||||||
@ -106,9 +130,16 @@ in
|
|||||||
|
|
||||||
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"
|
||||||
} ''
|
{
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
nixos-render-docs
|
||||||
|
gems
|
||||||
|
gems.wrappedRuby
|
||||||
|
];
|
||||||
|
}
|
||||||
|
''
|
||||||
mkdir -p $out/share/man/man5
|
mkdir -p $out/share/man/man5
|
||||||
asciidoctor --backend manpage ${./manpages/header.adoc} --out-file header.5
|
asciidoctor --backend manpage ${./manpages/header.adoc} --out-file header.5
|
||||||
nixos-render-docs options manpage --revision ${releaseConfig.version} \
|
nixos-render-docs options manpage --revision ${releaseConfig.version} \
|
||||||
@ -117,9 +148,15 @@ in
|
|||||||
$out/share/man/man5/wrapper-manager.nix.5
|
$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"
|
||||||
} ''
|
{
|
||||||
|
nativeBuildInputs = [
|
||||||
|
gems
|
||||||
|
gems.wrappedRuby
|
||||||
|
];
|
||||||
|
}
|
||||||
|
''
|
||||||
mkdir -p $out/share/wrapper-manager
|
mkdir -p $out/share/wrapper-manager
|
||||||
asciidoctor --backend html ${wmOptionsDoc.optionsAsciiDoc} --out-file $out/share/wrapper-manager/options-reference.html
|
asciidoctor --backend html ${wmOptionsDoc.optionsAsciiDoc} --out-file $out/share/wrapper-manager/options-reference.html
|
||||||
'';
|
'';
|
||||||
|
128
docs/gemset.nix
128
docs/gemset.nix
@ -10,7 +10,12 @@
|
|||||||
version = "2.0.23";
|
version = "2.0.23";
|
||||||
};
|
};
|
||||||
asciidoctor-diagram = {
|
asciidoctor-diagram = {
|
||||||
dependencies = ["asciidoctor" "asciidoctor-diagram-ditaamini" "asciidoctor-diagram-plantuml" "rexml"];
|
dependencies = [
|
||||||
|
"asciidoctor"
|
||||||
|
"asciidoctor-diagram-ditaamini"
|
||||||
|
"asciidoctor-diagram-plantuml"
|
||||||
|
"rexml"
|
||||||
|
];
|
||||||
groups = [ "default" ];
|
groups = [ "default" ];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
@ -52,7 +57,10 @@
|
|||||||
version = "1.2024.5";
|
version = "1.2024.5";
|
||||||
};
|
};
|
||||||
asciidoctor-foodogsquared-extensions = {
|
asciidoctor-foodogsquared-extensions = {
|
||||||
dependencies = ["asciidoctor" "rugged"];
|
dependencies = [
|
||||||
|
"asciidoctor"
|
||||||
|
"rugged"
|
||||||
|
];
|
||||||
groups = [ "default" ];
|
groups = [ "default" ];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
@ -63,7 +71,10 @@
|
|||||||
version = "1.2.1";
|
version = "1.2.1";
|
||||||
};
|
};
|
||||||
ast = {
|
ast = {
|
||||||
groups = ["default" "lint"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"lint"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -83,7 +94,10 @@
|
|||||||
version = "1.3.3";
|
version = "1.3.3";
|
||||||
};
|
};
|
||||||
json = {
|
json = {
|
||||||
groups = ["default" "lint"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"lint"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -93,7 +107,11 @@
|
|||||||
version = "2.7.2";
|
version = "2.7.2";
|
||||||
};
|
};
|
||||||
language_server-protocol = {
|
language_server-protocol = {
|
||||||
groups = ["default" "development" "lint"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"development"
|
||||||
|
"lint"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -103,7 +121,10 @@
|
|||||||
version = "3.17.0.3";
|
version = "3.17.0.3";
|
||||||
};
|
};
|
||||||
logger = {
|
logger = {
|
||||||
groups = ["default" "development"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"development"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -123,7 +144,10 @@
|
|||||||
version = "1.0.0";
|
version = "1.0.0";
|
||||||
};
|
};
|
||||||
parallel = {
|
parallel = {
|
||||||
groups = ["default" "lint"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"lint"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -133,8 +157,14 @@
|
|||||||
version = "1.25.1";
|
version = "1.25.1";
|
||||||
};
|
};
|
||||||
parser = {
|
parser = {
|
||||||
dependencies = ["ast" "racc"];
|
dependencies = [
|
||||||
groups = ["default" "lint"];
|
"ast"
|
||||||
|
"racc"
|
||||||
|
];
|
||||||
|
groups = [
|
||||||
|
"default"
|
||||||
|
"lint"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -144,7 +174,10 @@
|
|||||||
version = "3.3.4.0";
|
version = "3.3.4.0";
|
||||||
};
|
};
|
||||||
prism = {
|
prism = {
|
||||||
groups = ["default" "development"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"development"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -154,7 +187,10 @@
|
|||||||
version = "0.30.0";
|
version = "0.30.0";
|
||||||
};
|
};
|
||||||
racc = {
|
racc = {
|
||||||
groups = ["default" "lint"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"lint"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -164,7 +200,10 @@
|
|||||||
version = "1.8.0";
|
version = "1.8.0";
|
||||||
};
|
};
|
||||||
rainbow = {
|
rainbow = {
|
||||||
groups = ["default" "lint"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"lint"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -185,7 +224,10 @@
|
|||||||
};
|
};
|
||||||
rbs = {
|
rbs = {
|
||||||
dependencies = [ "logger" ];
|
dependencies = [ "logger" ];
|
||||||
groups = ["default" "development"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"development"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -195,7 +237,10 @@
|
|||||||
version = "3.5.2";
|
version = "3.5.2";
|
||||||
};
|
};
|
||||||
regexp_parser = {
|
regexp_parser = {
|
||||||
groups = ["default" "lint"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"lint"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -206,7 +251,10 @@
|
|||||||
};
|
};
|
||||||
rexml = {
|
rexml = {
|
||||||
dependencies = [ "strscan" ];
|
dependencies = [ "strscan" ];
|
||||||
groups = ["default" "lint"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"lint"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -226,7 +274,18 @@
|
|||||||
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 = [
|
||||||
|
"json"
|
||||||
|
"language_server-protocol"
|
||||||
|
"parallel"
|
||||||
|
"parser"
|
||||||
|
"rainbow"
|
||||||
|
"regexp_parser"
|
||||||
|
"rexml"
|
||||||
|
"rubocop-ast"
|
||||||
|
"ruby-progressbar"
|
||||||
|
"unicode-display_width"
|
||||||
|
];
|
||||||
groups = [ "lint" ];
|
groups = [ "lint" ];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
@ -238,7 +297,10 @@
|
|||||||
};
|
};
|
||||||
rubocop-ast = {
|
rubocop-ast = {
|
||||||
dependencies = [ "parser" ];
|
dependencies = [ "parser" ];
|
||||||
groups = ["default" "lint"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"lint"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -248,7 +310,12 @@
|
|||||||
version = "1.31.3";
|
version = "1.31.3";
|
||||||
};
|
};
|
||||||
ruby-lsp = {
|
ruby-lsp = {
|
||||||
dependencies = ["language_server-protocol" "prism" "rbs" "sorbet-runtime"];
|
dependencies = [
|
||||||
|
"language_server-protocol"
|
||||||
|
"prism"
|
||||||
|
"rbs"
|
||||||
|
"sorbet-runtime"
|
||||||
|
];
|
||||||
groups = [ "development" ];
|
groups = [ "development" ];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
@ -259,7 +326,10 @@
|
|||||||
version = "0.17.7";
|
version = "0.17.7";
|
||||||
};
|
};
|
||||||
ruby-progressbar = {
|
ruby-progressbar = {
|
||||||
groups = ["default" "lint"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"lint"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -279,7 +349,10 @@
|
|||||||
version = "1.7.2";
|
version = "1.7.2";
|
||||||
};
|
};
|
||||||
slim = {
|
slim = {
|
||||||
dependencies = ["temple" "tilt"];
|
dependencies = [
|
||||||
|
"temple"
|
||||||
|
"tilt"
|
||||||
|
];
|
||||||
groups = [ "default" ];
|
groups = [ "default" ];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
@ -290,7 +363,10 @@
|
|||||||
version = "5.2.1";
|
version = "5.2.1";
|
||||||
};
|
};
|
||||||
sorbet-runtime = {
|
sorbet-runtime = {
|
||||||
groups = ["default" "development"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"development"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -300,7 +376,10 @@
|
|||||||
version = "0.5.11481";
|
version = "0.5.11481";
|
||||||
};
|
};
|
||||||
strscan = {
|
strscan = {
|
||||||
groups = ["default" "lint"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"lint"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
@ -330,7 +409,10 @@
|
|||||||
version = "2.4.0";
|
version = "2.4.0";
|
||||||
};
|
};
|
||||||
unicode-display_width = {
|
unicode-display_width = {
|
||||||
groups = ["default" "lint"];
|
groups = [
|
||||||
|
"default"
|
||||||
|
"lint"
|
||||||
|
];
|
||||||
platforms = [ ];
|
platforms = [ ];
|
||||||
source = {
|
source = {
|
||||||
remotes = [ "https://rubygems.org" ];
|
remotes = [ "https://rubygems.org" ];
|
||||||
|
@ -1,73 +1,93 @@
|
|||||||
{ 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 =
|
||||||
|
if (vendorHash == null) then
|
||||||
|
""
|
||||||
|
else
|
||||||
(stdenv.mkDerivation {
|
(stdenv.mkDerivation {
|
||||||
name = "${name}-hugo-modules";
|
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;
|
||||||
@ -93,7 +113,8 @@ let
|
|||||||
"GOPROXY"
|
"GOPROXY"
|
||||||
];
|
];
|
||||||
|
|
||||||
configurePhase = args.modConfigurePhase or ''
|
configurePhase =
|
||||||
|
args.modConfigurePhase or ''
|
||||||
runHook preConfigure
|
runHook preConfigure
|
||||||
export GOCACHE=$TMPDIR/go-cache
|
export GOCACHE=$TMPDIR/go-cache
|
||||||
export GOPATH="$TMPDIR/go"
|
export GOPATH="$TMPDIR/go"
|
||||||
@ -101,45 +122,61 @@ let
|
|||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildPhase = args.modBuildPhase or (''
|
buildPhase =
|
||||||
|
args.modBuildPhase or (
|
||||||
|
''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
'' + lib.optionalString deleteVendor ''
|
''
|
||||||
|
+ lib.optionalString deleteVendor ''
|
||||||
if [ ! -d _vendor ]; then
|
if [ ! -d _vendor ]; then
|
||||||
echo "_vendor folder does not exist, 'deleteVendor' is not needed"
|
echo "_vendor folder does not exist, 'deleteVendor' is not needed"
|
||||||
exit 10
|
exit 10
|
||||||
else
|
else
|
||||||
rm -rf _vendor
|
rm -rf _vendor
|
||||||
fi
|
fi
|
||||||
'' + ''
|
''
|
||||||
|
+ ''
|
||||||
if [ -d _vendor ]; then
|
if [ -d _vendor ]; then
|
||||||
echo "_vendor folder exists, please set 'vendorHash = null;' in your expression"
|
echo "_vendor folder exists, please set 'vendorHash = null;' in your expression"
|
||||||
exit 10
|
exit 10
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${if proxyVendor then ''
|
${
|
||||||
|
if proxyVendor then
|
||||||
|
''
|
||||||
mkdir -p "''${GOPATH}/pkg/mod/cache/download"
|
mkdir -p "''${GOPATH}/pkg/mod/cache/download"
|
||||||
hugo mod vendor
|
hugo mod vendor
|
||||||
'' else ''
|
''
|
||||||
|
else
|
||||||
|
''
|
||||||
if (( "''${NIX_DEBUG:-0}" >= 1 )); then
|
if (( "''${NIX_DEBUG:-0}" >= 1 )); then
|
||||||
hugoModVendorFlags+=(-v)
|
hugoModVendorFlags+=(-v)
|
||||||
fi
|
fi
|
||||||
hugo mod vendor "''${hugoModVendorFlags[@]}"
|
hugo mod vendor "''${hugoModVendorFlags[@]}"
|
||||||
''}
|
''
|
||||||
|
}
|
||||||
|
|
||||||
mkdir -p _vendor
|
mkdir -p _vendor
|
||||||
|
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
|
|
||||||
installPhase = args.modInstallPhase or ''
|
installPhase =
|
||||||
|
args.modInstallPhase or ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
${if proxyVendor then ''
|
${
|
||||||
|
if proxyVendor then
|
||||||
|
''
|
||||||
rm -rf "''${GOPATH}/pkg/mod/cache/download/sumdb"
|
rm -rf "''${GOPATH}/pkg/mod/cache/download/sumdb"
|
||||||
cp -r --reflink=auto "''${GOPATH}/pkg/mod/cache/download" $out
|
cp -r --reflink=auto "''${GOPATH}/pkg/mod/cache/download" $out
|
||||||
'' else ''
|
''
|
||||||
|
else
|
||||||
|
''
|
||||||
cp -r --reflink=auto _vendor $out
|
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"
|
||||||
@ -156,24 +193,43 @@ let
|
|||||||
# 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.warnIf (lib.any (lib.hasPrefix "-mod=") GOFLAGS)
|
||||||
|
"use `proxyVendor` to control Go module/vendor behavior instead of setting `-mod=` in GOFLAGS"
|
||||||
(lib.optional (!proxyVendor) "-mod=vendor")
|
(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 (builtins.elem "-trimpath" GOFLAGS)
|
||||||
|
"`-trimpath` is added by default to GOFLAGS by buildGoModule when allowGoReference isn't set to true"
|
||||||
(lib.optional (!allowGoReference) "-trimpath");
|
(lib.optional (!allowGoReference) "-trimpath");
|
||||||
inherit CGO_ENABLED enableParallelBuilding GO111MODULE GOTOOLCHAIN;
|
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 =
|
||||||
|
args.configurePhase or (
|
||||||
|
''
|
||||||
runHook preConfigure
|
runHook preConfigure
|
||||||
|
|
||||||
export GOCACHE=$TMPDIR/go-cache
|
export GOCACHE=$TMPDIR/go-cache
|
||||||
@ -181,14 +237,21 @@ let
|
|||||||
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) ''
|
||||||
|
${
|
||||||
|
if proxyVendor then
|
||||||
|
''
|
||||||
export GOPROXY=file://${hugoModules}
|
export GOPROXY=file://${hugoModules}
|
||||||
'' else ''
|
''
|
||||||
|
else
|
||||||
|
''
|
||||||
rm -rf _vendor
|
rm -rf _vendor
|
||||||
cp -r --reflink=auto ${hugoModules} _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
|
||||||
@ -197,12 +260,15 @@ let
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
|
|
||||||
buildPhase = args.buildPhase or (
|
buildPhase =
|
||||||
|
args.buildPhase or (
|
||||||
lib.warnIf (buildFlags != "" || buildFlagsArray != "")
|
lib.warnIf (buildFlags != "" || buildFlagsArray != "")
|
||||||
"`buildFlags`/`buildFlagsArray` are deprecated and will be removed in the 24.11 release. Use the `ldflags` and/or `tags` attributes instead of `buildFlags`/`buildFlagsArray`"
|
"`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 (builtins.elem "-buildid=" ldflags)
|
lib.warnIf
|
||||||
|
(builtins.elem "-buildid=" ldflags)
|
||||||
"`-buildid=` is set by default as ldflag by buildGoModule"
|
"`-buildid=` is set by default as ldflag by buildGoModule"
|
||||||
''
|
''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
@ -265,7 +331,8 @@ let
|
|||||||
echo "Building subPackage $pkg"
|
echo "Building subPackage $pkg"
|
||||||
buildGoDir install "$pkg"
|
buildGoDir install "$pkg"
|
||||||
done
|
done
|
||||||
'' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
''
|
||||||
|
+ lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
||||||
# normalize cross-compiled builds w.r.t. native builds
|
# normalize cross-compiled builds w.r.t. native builds
|
||||||
(
|
(
|
||||||
dir=$GOPATH/bin/${go.GOOS}_${go.GOARCH}
|
dir=$GOPATH/bin/${go.GOOS}_${go.GOARCH}
|
||||||
@ -276,12 +343,15 @@ let
|
|||||||
rmdir $dir
|
rmdir $dir
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
'' + ''
|
''
|
||||||
|
+ ''
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
|
|
||||||
doCheck = args.doCheck or true;
|
doCheck = args.doCheck or true;
|
||||||
checkPhase = args.checkPhase or ''
|
checkPhase =
|
||||||
|
args.checkPhase or ''
|
||||||
runHook preCheck
|
runHook preCheck
|
||||||
# We do not set trimpath for tests, in case they reference test assets
|
# We do not set trimpath for tests, in case they reference test assets
|
||||||
export GOFLAGS=''${GOFLAGS//-trimpath/}
|
export GOFLAGS=''${GOFLAGS//-trimpath/}
|
||||||
@ -293,7 +363,8 @@ let
|
|||||||
runHook postCheck
|
runHook postCheck
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = args.installPhase or ''
|
installPhase =
|
||||||
|
args.installPhase or ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
@ -307,12 +378,20 @@ let
|
|||||||
|
|
||||||
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; };
|
||||||
|
58
flake.nix
58
flake.nix
@ -2,38 +2,53 @@
|
|||||||
# 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 =
|
||||||
|
{ ... }:
|
||||||
|
let
|
||||||
sources = import ./npins;
|
sources = import ./npins;
|
||||||
systems = [ "x86_64-linux" "aarch64-linux" ];
|
systems = [
|
||||||
eachSystem = systems: f:
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
];
|
||||||
|
eachSystem =
|
||||||
|
systems: f:
|
||||||
let
|
let
|
||||||
# Merge together the outputs for all systems.
|
# Merge together the outputs for all systems.
|
||||||
op = attrs: system:
|
op =
|
||||||
|
attrs: system:
|
||||||
let
|
let
|
||||||
ret = f system;
|
ret = f system;
|
||||||
op = attrs: key: attrs //
|
op =
|
||||||
{
|
attrs: key:
|
||||||
${key} = (attrs.${key} or { })
|
attrs
|
||||||
// { ${system} = ret.${key}; };
|
// {
|
||||||
}
|
${key} = (attrs.${key} or { }) // {
|
||||||
;
|
${system} = ret.${key};
|
||||||
|
};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
builtins.foldl' op attrs (builtins.attrNames ret);
|
builtins.foldl' op attrs (builtins.attrNames ret);
|
||||||
in
|
in
|
||||||
builtins.foldl' op { }
|
builtins.foldl' op { } (
|
||||||
(systems
|
systems
|
||||||
++ # add the current system if --impure is used
|
# add the current system if --impure is used
|
||||||
(if builtins?currentSystem then
|
++ (
|
||||||
if builtins.elem builtins.currentSystem systems
|
if builtins ? currentSystem then
|
||||||
then []
|
if builtins.elem builtins.currentSystem systems then [ ] else [ builtins.currentSystem ]
|
||||||
else [ builtins.currentSystem ]
|
|
||||||
else
|
else
|
||||||
[]));
|
[ ]
|
||||||
in import ./. { } // (eachSystem systems (system: let
|
)
|
||||||
|
);
|
||||||
|
in
|
||||||
|
import ./. { }
|
||||||
|
// (eachSystem systems (
|
||||||
|
system:
|
||||||
|
let
|
||||||
pkgs = import sources.nixos-unstable { inherit system; };
|
pkgs = import sources.nixos-unstable { inherit system; };
|
||||||
tests = import ./tests { inherit pkgs; };
|
tests = import ./tests { inherit pkgs; };
|
||||||
docs = import ./docs { inherit pkgs; };
|
docs = import ./docs { inherit pkgs; };
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
devShells = {
|
devShells = {
|
||||||
default = import ./shell.nix { inherit pkgs; };
|
default = import ./shell.nix { inherit pkgs; };
|
||||||
website = import ./docs/website/shell.nix { inherit pkgs; };
|
website = import ./docs/website/shell.nix { inherit pkgs; };
|
||||||
@ -46,5 +61,6 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
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;
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
18
lib/env.nix
18
lib/env.nix
@ -1,12 +1,13 @@
|
|||||||
rec {
|
rec {
|
||||||
/* Given the attrset for evaluating a wrapper-manager module, return a
|
/*
|
||||||
|
Given the attrset for evaluating a wrapper-manager module, return a
|
||||||
derivation containing the wrapper.
|
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,
|
pkgs,
|
||||||
lib ? pkgs.lib,
|
lib ? pkgs.lib,
|
||||||
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, ... }: {
|
(
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
config._module.args.pkgs = lib.mkDefault pkgs;
|
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;
|
|
||||||
}
|
}
|
||||||
|
14
modules/env/common.nix
vendored
14
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, ... }: {
|
(
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
config._module.args.pkgs = lib.mkDefault pkgs;
|
config._module.args.pkgs = lib.mkDefault pkgs;
|
||||||
})
|
}
|
||||||
|
)
|
||||||
] ++ cfg.sharedModules;
|
] ++ cfg.sharedModules;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
21
modules/env/home-manager/default.nix
vendored
21
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, ... }: {
|
(
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
# NixOS already has the option to set the locale so we don't need to
|
# NixOS already has the option to set the locale so we don't need to
|
||||||
# have this.
|
# have this.
|
||||||
config.locale.enable = lib.mkDefault false;
|
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;
|
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
21
modules/env/nixos/default.nix
vendored
21
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, ... }: {
|
(
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
# NixOS already has the option to set the locale so we don't need to
|
# NixOS already has the option to set the locale so we don't need to
|
||||||
# have this.
|
# have this.
|
||||||
config.locale.enable = lib.mkDefault false;
|
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,13 +1,29 @@
|
|||||||
{ 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 =
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
name,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
options = {
|
options = {
|
||||||
action = lib.mkOption {
|
action = lib.mkOption {
|
||||||
type = lib.types.enum [ "unset" "set" "set-default" ];
|
type = lib.types.enum [
|
||||||
|
"unset"
|
||||||
|
"set"
|
||||||
|
"set-default"
|
||||||
|
];
|
||||||
description = ''
|
description = ''
|
||||||
Sets the appropriate action for the environment variable.
|
Sets the appropriate action for the environment variable.
|
||||||
|
|
||||||
@ -34,7 +50,14 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
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"
|
||||||
|
config.arg0
|
||||||
]
|
]
|
||||||
++ (lib.mapAttrsToList
|
++ (lib.mapAttrsToList (
|
||||||
(n: v:
|
n: v:
|
||||||
if v.action == "unset"
|
if v.action == "unset" then
|
||||||
then "--${v.action} ${lib.escapeShellArg n}"
|
"--${v.action} ${lib.escapeShellArg n}"
|
||||||
else "--${v.action} ${lib.escapeShellArg n} ${if v.isEscaped then lib.escapeShellArg v.value else v.value}")
|
else
|
||||||
config.env)
|
"--${v.action} ${lib.escapeShellArg n} ${
|
||||||
|
if v.isEscaped then lib.escapeShellArg v.value else v.value
|
||||||
|
}"
|
||||||
|
) config.env)
|
||||||
++ (builtins.map (v: "--add-flags ${lib.escapeShellArg v}") config.prependArgs)
|
++ (builtins.map (v: "--add-flags ${lib.escapeShellArg v}") config.prependArgs)
|
||||||
++ (builtins.map (v: "--append-flags ${lib.escapeShellArg v}") config.appendArgs)
|
++ (builtins.map (v: "--append-flags ${lib.escapeShellArg v}") config.appendArgs)
|
||||||
++ (lib.optionals (!envConfig.build.isBinary && config.preScript != "") (
|
++ (lib.optionals (!envConfig.build.isBinary && config.preScript != "") (
|
||||||
let
|
let
|
||||||
preScript =
|
preScript =
|
||||||
pkgs.runCommand "wrapper-script-prescript-${config.executableName}" { } config.preScript;
|
pkgs.runCommand "wrapper-script-prescript-${config.executableName}" { }
|
||||||
|
config.preScript;
|
||||||
in
|
in
|
||||||
[ "--run" preScript ]));
|
[
|
||||||
|
"--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,25 +53,22 @@
|
|||||||
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 ]
|
|
||||||
else [ pkgs.makeWrapper ];
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
${config.build.extraSetup}
|
${config.build.extraSetup}
|
||||||
${mkWrapBuild (lib.attrValues config.wrappers)}
|
${mkWrapBuild (lib.attrValues config.wrappers)}
|
||||||
|
@ -1,17 +1,30 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.locale;
|
cfg = config.locale;
|
||||||
|
|
||||||
localeModuleFactory = { isGlobal ? false }: {
|
localeModuleFactory =
|
||||||
|
{
|
||||||
|
isGlobal ? false,
|
||||||
|
}:
|
||||||
|
{
|
||||||
enable = lib.mkOption {
|
enable = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = if isGlobal then true else cfg.enable;
|
default = if isGlobal then true else cfg.enable;
|
||||||
example = false;
|
example = false;
|
||||||
description = if isGlobal then ''
|
description =
|
||||||
|
if isGlobal then
|
||||||
|
''
|
||||||
Whether to enable explicit glibc locale support. This is recommended
|
Whether to enable explicit glibc locale support. This is recommended
|
||||||
for Nix-built applications.
|
for Nix-built applications.
|
||||||
'' else ''
|
''
|
||||||
|
else
|
||||||
|
''
|
||||||
Whether to enable locale support for this wrapper. Recommended for
|
Whether to enable locale support for this wrapper. Recommended for
|
||||||
Nix-built applications.
|
Nix-built applications.
|
||||||
'';
|
'';
|
||||||
@ -19,10 +32,7 @@ let
|
|||||||
|
|
||||||
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
|
|
||||||
then (pkgs.glibcLocales.override { allLocales = true; })
|
|
||||||
else cfg.package;
|
|
||||||
description = ''
|
description = ''
|
||||||
The package containing glibc locales.
|
The package containing glibc locales.
|
||||||
'';
|
'';
|
||||||
@ -34,9 +44,17 @@ in
|
|||||||
|
|
||||||
options.wrappers =
|
options.wrappers =
|
||||||
let
|
let
|
||||||
localeSubmodule = { config, lib, name, ... }: let
|
localeSubmodule =
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
name,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
submoduleCfg = config.locale;
|
submoduleCfg = config.locale;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options.locale = localeModuleFactory { isGlobal = false; };
|
options.locale = localeModuleFactory { isGlobal = false; };
|
||||||
|
|
||||||
config = lib.mkIf submoduleCfg.enable {
|
config = lib.mkIf submoduleCfg.enable {
|
||||||
@ -44,7 +62,5 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
lib.mkOption {
|
lib.mkOption { type = with lib.types; attrsOf (submodule localeSubmodule); };
|
||||||
type = with lib.types; attrsOf (submodule localeSubmodule);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,22 @@
|
|||||||
{ 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 =
|
||||||
|
{
|
||||||
|
name,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
freeformType = with lib.types; attrsOf anything;
|
freeformType = with lib.types; attrsOf anything;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
@ -47,14 +59,20 @@ let
|
|||||||
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"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -89,10 +107,16 @@ in
|
|||||||
options.wrappers = lib.mkOption {
|
options.wrappers = lib.mkOption {
|
||||||
type =
|
type =
|
||||||
let
|
let
|
||||||
xdgDesktopEntryWrapperSubmodule = { name, config, lib, ... }: {
|
xdgDesktopEntryWrapperSubmodule =
|
||||||
|
{
|
||||||
|
name,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
options.xdg.desktopEntry = {
|
options.xdg.desktopEntry = {
|
||||||
enable =
|
enable = lib.mkEnableOption "automatic creation of a desktop entry for the wrapper";
|
||||||
lib.mkEnableOption "automatic creation of a desktop entry for the wrapper";
|
|
||||||
settings = lib.mkOption {
|
settings = lib.mkOption {
|
||||||
type = lib.types.submodule xdgDesktopEntry;
|
type = lib.types.submodule xdgDesktopEntry;
|
||||||
description = ''
|
description = ''
|
||||||
@ -126,7 +150,8 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
with lib.types; attrsOf (submodule xdgDesktopEntryWrapperSubmodule);
|
with lib.types;
|
||||||
|
attrsOf (submodule xdgDesktopEntryWrapperSubmodule);
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
@ -41,7 +41,14 @@ in
|
|||||||
options.wrappers = lib.mkOption {
|
options.wrappers = lib.mkOption {
|
||||||
type =
|
type =
|
||||||
let
|
let
|
||||||
xdgDirsType = { name, lib, config, ... }: {
|
xdgDirsType =
|
||||||
|
{
|
||||||
|
name,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
options.xdg = xdgDirsOption;
|
options.xdg = xdgDirsOption;
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
@ -61,6 +68,7 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
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,17 +1,27 @@
|
|||||||
{ 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 =
|
||||||
|
let
|
||||||
wrapper = config.build.toplevel;
|
wrapper = config.build.toplevel;
|
||||||
in pkgs.runCommand "wrapper-manager-fastfetch-actually-built" { } ''
|
in
|
||||||
|
pkgs.runCommand "wrapper-manager-fastfetch-actually-built" { } ''
|
||||||
[ -e "${wrapper}/share/applications/fastfetch.desktop" ] && [ -x "${wrapper}/bin/${config.wrappers.fastfetch.executableName}" ] && touch $out
|
[ -e "${wrapper}/share/applications/fastfetch.desktop" ] && [ -x "${wrapper}/bin/${config.wrappers.fastfetch.executableName}" ] && touch $out
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -1,20 +1,31 @@
|
|||||||
{ 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 =
|
||||||
|
let
|
||||||
wrapper = config.build.toplevel;
|
wrapper = config.build.toplevel;
|
||||||
in pkgs.runCommand "wrapper-manager-neofetch-actually-built" { } ''
|
in
|
||||||
|
pkgs.runCommand "wrapper-manager-neofetch-actually-built" { } ''
|
||||||
[ -x "${wrapper}/bin/${config.wrappers.fastfetch.executableName}" ] && touch $out
|
[ -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;
|
testData = builtins.toJSON lib;
|
||||||
passAsFile = [ "testData" ];
|
passAsFile = [ "testData" ];
|
||||||
nativeBuildInputs = with pkgs; [ yajsv jq ];
|
nativeBuildInputs = with pkgs; [
|
||||||
} ''
|
yajsv
|
||||||
|
jq
|
||||||
|
];
|
||||||
|
}
|
||||||
|
''
|
||||||
yajsv -s "${./lib/tests.schema.json}" "$testDataPath" && touch $out || jq . "$testDataPath"
|
yajsv -s "${./lib/tests.schema.json}" "$testDataPath" && touch $out || jq . "$testDataPath"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,11 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
lib = import ../../lib { inherit pkgs; };
|
lib = import ../../lib { inherit pkgs; };
|
||||||
callLib = file: import file {
|
callLib =
|
||||||
inherit (pkgs) lib; inherit pkgs;
|
file:
|
||||||
|
import file {
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
inherit pkgs;
|
||||||
self = lib;
|
self = lib;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
6
tests/lib/env/default.nix
vendored
6
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;
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
{ pkgs, lib, self }:
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
self,
|
||||||
|
}:
|
||||||
|
|
||||||
lib.runTests {
|
lib.runTests {
|
||||||
testsUtilsGetBin = {
|
testsUtilsGetBin = {
|
||||||
|
Loading…
Reference in New Issue
Block a user