commit
8357b101a5
@ -0,0 +1,128 @@ |
||||
{ config, lib, pkgs, ... }: |
||||
|
||||
let |
||||
inherit (lib) |
||||
concatStringsSep |
||||
mkEnableOption mkIf mkOption types; |
||||
|
||||
cfg = config.services.https-dns-proxy; |
||||
|
||||
providers = { |
||||
cloudflare = { |
||||
ips = [ "1.1.1.1" "1.0.0.1" ]; |
||||
url = "https://cloudflare-dns.com/dns-query"; |
||||
}; |
||||
google = { |
||||
ips = [ "8.8.8.8" "8.8.4.4" ]; |
||||
url = "https://dns.google/dns-query"; |
||||
}; |
||||
quad9 = { |
||||
ips = [ "9.9.9.9" "149.112.112.112" ]; |
||||
url = "https://dns.quad9.net/dns-query"; |
||||
}; |
||||
}; |
||||
|
||||
defaultProvider = "quad9"; |
||||
|
||||
providerCfg = |
||||
let |
||||
isCustom = cfg.provider.kind == "custom"; |
||||
in |
||||
lib.concatStringsSep " " [ |
||||
"-b" |
||||
(concatStringsSep "," (if isCustom then cfg.provider.ips else providers."${cfg.provider.kind}".ips)) |
||||
"-r" |
||||
(if isCustom then cfg.provider.url else providers."${cfg.provider.kind}".url) |
||||
]; |
||||
|
||||
in |
||||
{ |
||||
meta.maintainers = with lib.maintainers; [ peterhoeg ]; |
||||
|
||||
###### interface |
||||
|
||||
options.services.https-dns-proxy = { |
||||
enable = mkEnableOption "https-dns-proxy daemon"; |
||||
|
||||
address = mkOption { |
||||
description = "The address on which to listen"; |
||||
type = types.str; |
||||
default = "127.0.0.1"; |
||||
}; |
||||
|
||||
port = mkOption { |
||||
description = "The port on which to listen"; |
||||
type = types.port; |
||||
default = 5053; |
||||
}; |
||||
|
||||
provider = { |
||||
kind = mkOption { |
||||
description = '' |
||||
The upstream provider to use or custom in case you do not trust any of |
||||
the predefined providers or just want to use your own. |
||||
|
||||
The default is ${defaultProvider} and there are privacy and security trade-offs |
||||
when using any upstream provider. Please consider that before using any |
||||
of them. |
||||
|
||||
If you pick a custom provider, you will need to provide the bootstrap |
||||
IP addresses as well as the resolver https URL. |
||||
''; |
||||
type = types.enum ((builtins.attrNames providers) ++ [ "custom" ]); |
||||
default = defaultProvider; |
||||
}; |
||||
|
||||
ips = mkOption { |
||||
description = "The custom provider IPs"; |
||||
type = types.listOf types.str; |
||||
}; |
||||
|
||||
url = mkOption { |
||||
description = "The custom provider URL"; |
||||
type = types.str; |
||||
}; |
||||
}; |
||||
|
||||
preferIPv4 = mkOption { |
||||
description = '' |
||||
https_dns_proxy will by default use IPv6 and fail if it is not available. |
||||
To play it safe, we choose IPv4. |
||||
''; |
||||
type = types.bool; |
||||
default = true; |
||||
}; |
||||
|
||||
extraArgs = mkOption { |
||||
description = "Additional arguments to pass to the process."; |
||||
type = types.listOf types.str; |
||||
default = [ "-v" ]; |
||||
}; |
||||
}; |
||||
|
||||
###### implementation |
||||
|
||||
config = lib.mkIf cfg.enable { |
||||
systemd.services.https-dns-proxy = { |
||||
description = "DNS to DNS over HTTPS (DoH) proxy"; |
||||
after = [ "network.target" ]; |
||||
wantedBy = [ "multi-user.target" ]; |
||||
serviceConfig = rec { |
||||
Type = "exec"; |
||||
DynamicUser = true; |
||||
ExecStart = lib.concatStringsSep " " ( |
||||
[ |
||||
"${pkgs.https-dns-proxy}/bin/https_dns_proxy" |
||||
"-a ${toString cfg.address}" |
||||
"-p ${toString cfg.port}" |
||||
"-l -" |
||||
providerCfg |
||||
] |
||||
++ lib.optional cfg.preferIPv4 "-4" |
||||
++ cfg.extraArgs |
||||
); |
||||
Restart = "on-failure"; |
||||
}; |
||||
}; |
||||
}; |
||||
} |
@ -0,0 +1,16 @@ |
||||
import ./make-test-python.nix ({ lib, ... }: { |
||||
name = "earlyoom"; |
||||
meta = { |
||||
maintainers = with lib.maintainers; [ ncfavier ]; |
||||
}; |
||||
|
||||
machine = { |
||||
services.earlyoom = { |
||||
enable = true; |
||||
}; |
||||
}; |
||||
|
||||
testScript = '' |
||||
machine.wait_for_unit("earlyoom.service") |
||||
''; |
||||
}) |
@ -0,0 +1,45 @@ |
||||
import ./make-test-python.nix ({ pkgs, ...} : { |
||||
name = "moonraker"; |
||||
meta = with pkgs.lib.maintainers; { |
||||
maintainers = [ zhaofengli ]; |
||||
}; |
||||
|
||||
nodes = { |
||||
printer = { config, pkgs, ... }: { |
||||
security.polkit.enable = true; |
||||
|
||||
services.moonraker = { |
||||
enable = true; |
||||
allowSystemControl = true; |
||||
|
||||
settings = { |
||||
authorization = { |
||||
trusted_clients = [ "127.0.0.0/8" "::1/128" ]; |
||||
}; |
||||
}; |
||||
}; |
||||
|
||||
services.klipper = { |
||||
enable = true; |
||||
|
||||
user = "moonraker"; |
||||
group = "moonraker"; |
||||
|
||||
# No mcu configured so won't even enter `ready` state |
||||
settings = {}; |
||||
}; |
||||
}; |
||||
}; |
||||
|
||||
testScript = '' |
||||
printer.start() |
||||
|
||||
printer.wait_for_unit("klipper.service") |
||||
printer.wait_for_unit("moonraker.service") |
||||
printer.wait_until_succeeds("curl http://localhost:7125/printer/info | grep -v 'Not Found' >&2", timeout=30) |
||||
|
||||
with subtest("Check that we can perform system-level operations"): |
||||
printer.succeed("curl -X POST http://localhost:7125/machine/services/stop?service=klipper | grep ok >&2") |
||||
printer.wait_until_succeeds("systemctl --no-pager show klipper.service | grep ActiveState=inactive", timeout=10) |
||||
''; |
||||
}) |
@ -0,0 +1,30 @@ |
||||
{ micro, expect, runCommand, writeScript, runtimeShell }: |
||||
|
||||
let expect-script = writeScript "expect-script" '' |
||||
#!${expect}/bin/expect -f |
||||
|
||||
spawn micro file.txt |
||||
expect "file.txt" |
||||
|
||||
send "Hello world!" |
||||
expect "Hello world!" |
||||
|
||||
# Send ctrl-q (exit) |
||||
send "\021" |
||||
|
||||
expect "Save changes to file.txt before closing?" |
||||
send "y" |
||||
|
||||
expect eof |
||||
''; in |
||||
runCommand "micro-test-expect" |
||||
{ |
||||
nativeBuildInputs = [ micro expect ]; |
||||
passthru = { inherit expect-script; }; |
||||
} '' |
||||
# Micro really wants a writable $HOME for its config directory. |
||||
export HOME=$(pwd) |
||||
expect -f ${expect-script} |
||||
grep "Hello world!" file.txt |
||||
touch $out |
||||
'' |
@ -0,0 +1,107 @@ |
||||
{ lib |
||||
, stdenv |
||||
, fetchurl |
||||
, makeWrapper |
||||
, libX11 |
||||
, libXext |
||||
, libXrandr |
||||
, freetype |
||||
, fontconfig |
||||
, libXrender |
||||
, libXinerama |
||||
, autoPatchelfHook |
||||
, libglvnd |
||||
, openal |
||||
, imagemagick |
||||
, makeDesktopItem |
||||
}: |
||||
let |
||||
version = "4.0"; |
||||
|
||||
arch = |
||||
if stdenv.hostPlatform.system == "x86_64-linux" then |
||||
"x64" |
||||
else if stdenv.hostPlatform.system == "i686-linux" then |
||||
"x86" |
||||
else |
||||
throw "Unsupported platform ${stdenv.hostPlatform.system}"; |
||||
|
||||
desktopItem = makeDesktopItem { |
||||
name = "Heaven"; |
||||
exec = "heaven"; |
||||
genericName = "A GPU Stress test tool from the UNIGINE"; |
||||
icon = "Heaven"; |
||||
desktopName = "Heaven Benchmark"; |
||||
}; |
||||
in |
||||
stdenv.mkDerivation |
||||
{ |
||||
pname = "unigine-heaven"; |
||||
inherit version; |
||||
|
||||
src = fetchurl { |
||||
url = "https://assets.unigine.com/d/Unigine_Heaven-${version}.run"; |
||||
sha256 = "19rndwwxnb9k2nw9h004hyrmr419471s0fp25yzvvc6rkd521c0v"; |
||||
}; |
||||
|
||||
installPhase = |
||||
'' |
||||
sh $src --target $name |
||||
|
||||
mkdir -p $out/lib/unigine/heaven/bin |
||||
mkdir -p $out/bin |
||||
mkdir -p $out/share/applications/ |
||||
mkdir -p $out/share/icons/hicolor |
||||
|
||||
install -m 0755 $name/bin/browser_${arch} $out/lib/unigine/heaven/bin |
||||
install -m 0755 $name/bin/libApp{Stereo,Surround,Wall}_${arch}.so $out/lib/unigine/heaven/bin |
||||
install -m 0755 $name/bin/libGPUMonitor_${arch}.so $out/lib/unigine/heaven/bin |
||||
install -m 0755 $name/bin/libQt{Core,Gui,Network,WebKit,Xml}Unigine_${arch}.so.4 $out/lib/unigine/heaven/bin |
||||
install -m 0755 $name/bin/libUnigine_${arch}.so $out/lib/unigine/heaven/bin |
||||
install -m 0755 $name/bin/heaven_${arch} $out/lib/unigine/heaven/bin |
||||
install -m 0755 $name/heaven $out/bin/heaven |
||||
|
||||
cp -R $name/data $name/documentation $out/lib/unigine/heaven |
||||
|
||||
wrapProgram $out/bin/heaven --prefix LD_LIBRARY_PATH : ${libglvnd}/lib:$out/bin:${openal}/lib --run "cd $out/lib/unigine/heaven/" |
||||
|
||||
convert $out/lib/unigine/heaven/data/launcher/icon.png -resize 128x128 $out/share/icons/Heaven.png |
||||
for RES in 16 24 32 48 64 128 256 |
||||
do |
||||
mkdir -p $out/share/icons/hicolor/"$RES"x"$RES"/apps |
||||
convert $out/lib/unigine/heaven/data/launcher/icon.png -resize "$RES"x"$RES" $out/share/icons/hicolor/"$RES"x"$RES"/apps/Heaven.png |
||||
done |
||||
|
||||
ln -s ${desktopItem}/share/applications/* $out/share/applications |
||||
''; |
||||
|
||||
nativeBuildInputs = |
||||
[ |
||||
autoPatchelfHook |
||||
makeWrapper |
||||
imagemagick |
||||
]; |
||||
|
||||
buildInputs = |
||||
[ |
||||
libX11 |
||||
stdenv.cc.cc |
||||
libXext |
||||
libXrandr |
||||
freetype |
||||
fontconfig |
||||
libXrender |
||||
libXinerama |
||||
]; |
||||
|
||||
dontUnpack = true; |
||||
|
||||
meta = |
||||
{ |
||||
description = "The Unigine Heaven GPU benchmarking tool"; |
||||
homepage = "https://benchmark.unigine.com/heaven"; |
||||
license = lib.licenses.unfree; |
||||
maintainers = [ lib.maintainers.BarinovMaxim ]; |
||||
platforms = [ "x86_64-linux" "i686-linux" ]; |
||||
}; |
||||
} |
@ -1,30 +1,19 @@ |
||||
{lib, stdenv, fetchhg}: |
||||
let |
||||
s = |
||||
rec { |
||||
baseName = "slmenu"; |
||||
version = "hg-${date}"; |
||||
date = "2012-02-01"; |
||||
name = "${baseName}-${version}"; |
||||
|
||||
stdenv.mkDerivation { |
||||
pname = "slmenu"; |
||||
version = "hg-2012-02-01"; |
||||
|
||||
src = fetchhg { |
||||
url = "https://bitbucket.org/rafaelgg/slmenu/"; |
||||
rev = "7e74fa5db73e8b018da48d50dbbaf11cb5c62d13"; |
||||
sha256 = "0zb7mm8344d3xmvrl62psazcabfk75pp083jqkmywdsrikgjagv6"; |
||||
}; |
||||
buildInputs = [ |
||||
]; |
||||
in |
||||
stdenv.mkDerivation { |
||||
inherit (s) name version; |
||||
inherit buildInputs; |
||||
src = fetchhg { |
||||
inherit (s) url sha256; |
||||
}; |
||||
makeFlags = [ "PREFIX=$(out)" ]; |
||||
meta = { |
||||
inherit (s) version; |
||||
meta = with lib; { |
||||
description = "A console dmenu-like tool"; |
||||
license = lib.licenses.mit; |
||||
maintainers = [lib.maintainers.raskin]; |
||||
platforms = lib.platforms.linux; |
||||
license = licenses.mit; |
||||
maintainers = with maintainers; [ raskin ]; |
||||
platforms = platforms.linux; |
||||
}; |
||||
} |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue