reformat with nixfmt

This commit is contained in:
Jörg Thalheim 2024-06-06 17:52:20 +02:00
parent ab6c39c77e
commit 4e182bec1d
33 changed files with 1269 additions and 1121 deletions

View File

@ -1,13 +1,13 @@
{
perSystem =
{ inputs'
, pkgs
, lib
, ...
}:
{ inputs', pkgs, ... }:
let
convert2Tofu = provider: provider.override (prev: {
homepage = builtins.replaceStrings [ "registry.terraform.io/providers" ] [ "registry.opentofu.org" ] prev.homepage;
convert2Tofu =
provider:
provider.override (prev: {
homepage = builtins.replaceStrings [ "registry.terraform.io/providers" ] [
"registry.opentofu.org"
] prev.homepage;
});
in
{
@ -18,17 +18,18 @@
inputs'.clan-core.packages.clan-cli
(pkgs.opentofu.withPlugins (p: builtins.map convert2Tofu [
(pkgs.opentofu.withPlugins (
p:
builtins.map convert2Tofu [
p.hetznerdns
p.hcloud
p.null
p.external
p.local
]))
];
inputsFrom = [
inputs'.clan-core.devShells.default
]
))
];
inputsFrom = [ inputs'.clan-core.devShells.default ];
};
};
}

View File

@ -37,8 +37,11 @@
buildbot-nix.inputs.treefmt-nix.follows = "treefmt-nix";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } ({ self, ... }: {
outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } (
{ self, ... }:
{
systems = [
"x86_64-linux"
"aarch64-linux"
@ -50,12 +53,19 @@
./modules/flake-module.nix
./pkgs/flake-module.nix
];
perSystem = ({ lib, self', system, ... }: {
perSystem = (
{
lib,
self',
system,
...
}:
{
treefmt = {
projectRootFile = ".git/config";
programs.hclfmt.enable = true;
programs.nixpkgs-fmt.enable = true;
settings.formatter.nixpkgs-fmt.excludes = [
programs.nixfmt-rfc-style.enable = true;
settings.formatter.nixfmt-rfc-style.excludes = [
# generated files
"node-env.nix"
"node-packages.nix"
@ -64,12 +74,18 @@
};
checks =
let
nixosMachines = lib.mapAttrs' (name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations);
nixosMachines = lib.mapAttrs' (
name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel
) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations);
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
homeConfigurations = lib.mapAttrs' (name: config: lib.nameValuePair "home-manager-${name}" config.activation-script) (self'.legacyPackages.homeConfigurations or { });
homeConfigurations = lib.mapAttrs' (
name: config: lib.nameValuePair "home-manager-${name}" config.activation-script
) (self'.legacyPackages.homeConfigurations or { });
in
nixosMachines // packages // devShells // homeConfigurations;
});
});
}
);
}
);
}

View File

@ -41,7 +41,10 @@ in
extraGroups = [ "wheel" ];
shell = "/run/current-system/sw/bin/zsh";
uid = 1004;
openssh.authorizedKeys.keys = [ admins.kenji admins.kenji-remote ];
openssh.authorizedKeys.keys = [
admins.kenji
admins.kenji-remote
];
};
johannes = {
isNormalUser = true;

View File

@ -1,4 +1,5 @@
{ self, inputs, ... }: {
{ self, inputs, ... }:
{
flake.nixosModules = {
server.imports = [
inputs.srvos.nixosModules.server

View File

@ -1,31 +1,22 @@
{ config
, lib
, ...
}:
with lib; let
{ config, lib, ... }:
let
cfg = config.clan.networking;
in
{
options = {
clan.networking.ipv4.address = mkOption {
type = types.str;
};
clan.networking.ipv4.address = lib.mkOption { type = lib.types.str; };
clan.networking.ipv4.cidr = mkOption {
type = types.str;
clan.networking.ipv4.cidr = lib.mkOption {
type = lib.types.str;
default = "26";
};
clan.networking.ipv4.gateway = mkOption {
type = types.str;
};
clan.networking.ipv4.gateway = lib.mkOption { type = lib.types.str; };
clan.networking.ipv6.address = mkOption {
type = types.str;
};
clan.networking.ipv6.address = lib.mkOption { type = lib.types.str; };
clan.networking.ipv6.cidr = mkOption {
type = types.str;
clan.networking.ipv6.cidr = lib.mkOption {
type = lib.types.str;
default = "64";
};
};

View File

@ -1,9 +1,8 @@
{ config, ... }: {
{ config, ... }:
{
# 100GB storagebox is under the nix-community hetzner account
systemd.services.borgbackup-job-clan-lol.serviceConfig.ReadWritePaths = [
"/var/log/telegraf"
];
systemd.services.borgbackup-job-clan-lol.serviceConfig.ReadWritePaths = [ "/var/log/telegraf" ];
# Run this from the hetzner network:
# ssh-keyscan -p 23 u359378.your-storagebox.de

View File

@ -1,10 +1,18 @@
{ config, self, pkgs, ... }: {
{
config,
self,
pkgs,
...
}:
{
# service to for automatic merge bot
systemd.services.clan-merge = {
description = "Merge clan.lol PRs automatically";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
environment = { GITEA_TOKEN_FILE = "%d/GITEA_TOKEN_FILE"; };
environment = {
GITEA_TOKEN_FILE = "%d/GITEA_TOKEN_FILE";
};
serviceConfig = {
LoadCredential = [ "GITEA_TOKEN_FILE:${config.sops.secrets.merge-bot-gitea-token.path}" ];
Restart = "on-failure";

View File

@ -1,4 +1,5 @@
{ self, ... }: {
{ self, ... }:
{
imports = [
./borgbackup.nix
./clan-merge.nix

View File

@ -1,8 +1,26 @@
{ config, self, pkgs, lib, ... }:
{
config,
self,
pkgs,
lib,
...
}:
let
storeDeps = pkgs.runCommand "store-deps" { } ''
mkdir -p $out/bin
for dir in ${toString [ pkgs.coreutils pkgs.findutils pkgs.gnugrep pkgs.gawk pkgs.git pkgs.nix pkgs.bash pkgs.jq pkgs.nodejs ]}; do
for dir in ${
toString [
pkgs.coreutils
pkgs.findutils
pkgs.gnugrep
pkgs.gawk
pkgs.git
pkgs.nix
pkgs.bash
pkgs.jq
pkgs.nodejs
]
}; do
for bin in "$dir"/bin/*; do
ln -s "$bin" "$out/bin/$(basename "$bin")"
done
@ -14,13 +32,19 @@ let
'';
numInstances = 2;
in
lib.mkMerge [{
lib.mkMerge [
{
# everything here has no dependencies on the store
systemd.services.gitea-runner-nix-image = {
wantedBy = [ "multi-user.target" ];
after = [ "podman.service" ];
requires = [ "podman.service" ];
path = [ config.virtualisation.podman.package pkgs.gnutar pkgs.shadow pkgs.getent ];
path = [
config.virtualisation.podman.package
pkgs.gnutar
pkgs.shadow
pkgs.getent
];
# we also include etc here because the cleanup job also wants the nixuser to be present
script = ''
set -eux -o pipefail
@ -74,7 +98,9 @@ lib.mkMerge [{
users.groups.nixuser = { };
}
{
systemd.services = lib.genAttrs (builtins.genList (n: "gitea-runner-nix${builtins.toString n}-token") numInstances) (name: {
systemd.services =
lib.genAttrs (builtins.genList (n: "gitea-runner-nix${builtins.toString n}-token") numInstances)
(name: {
wantedBy = [ "multi-user.target" ];
after = [ "gitea.service" ];
environment = {
@ -111,11 +137,16 @@ lib.mkMerge [{
virtualisation.containers.containersConf.settings = {
# podman seems to not work with systemd-resolved
containers.dns_servers = [ "8.8.8.8" "8.8.4.4" ];
containers.dns_servers = [
"8.8.8.8"
"8.8.4.4"
];
};
}
{
systemd.services = lib.genAttrs (builtins.genList (n: "gitea-runner-nix${builtins.toString n}") numInstances) (name: {
systemd.services =
lib.genAttrs (builtins.genList (n: "gitea-runner-nix${builtins.toString n}") numInstances)
(name: {
after = [
"${name}-token.service"
"gitea-runner-nix-image.service"
@ -168,7 +199,12 @@ lib.mkMerge [{
"~setdomainname"
"~sethostname"
];
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" "AF_NETLINK" ];
RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
"AF_UNIX"
"AF_NETLINK"
];
# Needs network access
PrivateNetwork = false;
@ -192,7 +228,9 @@ lib.mkMerge [{
};
});
services.gitea-actions-runner.instances = lib.genAttrs (builtins.genList (n: "nix${builtins.toString n}") numInstances) (name: {
services.gitea-actions-runner.instances =
lib.genAttrs (builtins.genList (n: "nix${builtins.toString n}") numInstances)
(name: {
enable = true;
name = "nix-runner";
# take the git root url from the gitea config
@ -213,4 +251,5 @@ lib.mkMerge [{
];
};
});
}]
}
]

View File

@ -1,9 +1,19 @@
{ config, pkgs, lib, self, ... }:
{
pkgs,
lib,
self,
config,
...
}:
let
# make the logs for this host "public" so that they show up in e.g. metrics
publog = vhost: lib.attrsets.unionOfDisjoint vhost {
extraConfig = (vhost.extraConfig or "") + ''
publog =
vhost:
lib.attrsets.unionOfDisjoint vhost {
extraConfig =
(vhost.extraConfig or "")
+ ''
access_log /var/log/nginx/public.log vcombined;
'';
};

View File

@ -1,4 +1,5 @@
{ pkgs, ... }: {
{ pkgs, ... }:
{
services.postgresql.enable = true;
services.postgresql.package = pkgs.postgresql_14;
services.postgresql.settings = {

View File

@ -1,4 +1,4 @@
{ stdenv, lib, pkgs, ... }:
{ pkgs, ... }:
let
domain = "metrics.clan.lol";
@ -38,7 +38,6 @@ in
"d ${pub_goaccess} 0755 goaccess nginx -"
];
# --browsers-file=/etc/goaccess/browsers.list
# https://raw.githubusercontent.com/allinurl/goaccess/master/config/browsers.list
systemd.services.goaccess = {
@ -83,7 +82,11 @@ in
ProtectSystem = "strict";
SystemCallFilter = "~@clock @cpu-emulation @debug @keyring @memlock @module @mount @obsolete @privileged @reboot @resources @setuid @swap @raw-io";
ReadOnlyPaths = "/";
ReadWritePaths = [ "/proc/self" "${pub_goaccess}" "${priv_goaccess}" ];
ReadWritePaths = [
"/proc/self"
"${pub_goaccess}"
"${priv_goaccess}"
];
PrivateDevices = "yes";
ProtectKernelModules = "yes";
ProtectKernelTunables = "yes";
@ -92,7 +95,6 @@ in
wantedBy = [ "multi-user.target" ];
};
services.nginx.virtualHosts."${domain}" = {
addSSL = true;
enableACME = true;

View File

@ -1,17 +1,18 @@
{ config, pkgs, ... }: {
{ config, pkgs, ... }:
{
services.harmonia.enable = true;
# $ nix-store --generate-binary-cache-key cache.yourdomain.tld-1 harmonia.secret harmonia.pub
services.harmonia.signKeyPath = config.sops.secrets.harmonia-secret.path;
services.nginx = {
package = pkgs.nginxStable.override {
modules = [ pkgs.nginxModules.zstd ];
};
package = pkgs.nginxStable.override { modules = [ pkgs.nginxModules.zstd ]; };
};
# trust our own cache
nix.settings.trusted-substituters = [ "https://cache.clan.lol" ];
nix.settings.trusted-public-keys = [ "cache.clan.lol-1:3KztgSAB5R1M+Dz7vzkBGzXdodizbgLXGXKXlcQLA28=" ];
nix.settings.trusted-public-keys = [
"cache.clan.lol-1:3KztgSAB5R1M+Dz7vzkBGzXdodizbgLXGXKXlcQLA28="
];
services.nginx.virtualHosts."cache.clan.lol" = {
forceSSL = true;

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, self, ... }:
{ config, ... }:
{
security.acme.defaults.email = "admins@clan.lol";
@ -6,9 +6,7 @@
# www user to push website artifacts via ssh
users.users.www = {
openssh.authorizedKeys.keys =
config.users.users.root.openssh.authorizedKeys.keys
++ [
openssh.authorizedKeys.keys = config.users.users.root.openssh.authorizedKeys.keys ++ [
# ssh-homepage-key
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMxZ3Av30M6Sh6NU1mnCskB16bYtNP8vskc/+ud0AU1C ssh-homepage-key"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBuYyfSuETSrwqCsWHeeClqjcsFlMEmiJN6Rr8/DwrU0 gitea-ci"
@ -20,9 +18,7 @@
users.groups.www = { };
# ensure /var/www can be accessed by nginx and www user
systemd.tmpfiles.rules = [
"d /var/www 0755 www nginx"
];
systemd.tmpfiles.rules = [ "d /var/www 0755 www nginx" ];
services.nginx = {

View File

@ -1,4 +1,10 @@
{ config, self, pkgs, lib, ... }:
{
config,
self,
pkgs,
lib,
...
}:
let
configForJob = name: {
systemd.timers.${name} = {
@ -46,9 +52,11 @@ let
};
in
{
config = lib.mkMerge (map configForJob [
config = lib.mkMerge (
map configForJob [
"job-flake-update-clan-core"
"job-flake-update-clan-homepage"
"job-flake-update-clan-infra"
]);
]
);
}

View File

@ -1,4 +1,3 @@
{ self, ... }:
let
mirrorBoot = idx: {
type = "disk";
@ -41,8 +40,14 @@ in
efiSupport = true;
efiInstallAsRemovable = true;
mirroredBoots = [
{ path = "/boot0"; devices = [ "nodev" ]; }
{ path = "/boot1"; devices = [ "nodev" ]; }
{
path = "/boot0";
devices = [ "nodev" ];
}
{
path = "/boot1";
devices = [ "nodev" ];
}
];
};

View File

@ -1,10 +1,19 @@
{ bash
, coreutils
, git
, tea
, openssh
, writePureShellScriptBin
{
bash,
coreutils,
git,
tea,
openssh,
writePureShellScriptBin,
}:
writePureShellScriptBin "action-create-pr" [ bash coreutils git tea openssh ] ''
writePureShellScriptBin "action-create-pr"
[
bash
coreutils
git
tea
openssh
]
''
bash ${./script.sh} "$@"
''

View File

@ -1,8 +1,15 @@
{ bash
, coreutils
, tea
, writePureShellScriptBin
{
bash,
coreutils,
tea,
writePureShellScriptBin,
}:
writePureShellScriptBin "action-ensure-tea-login" [ bash coreutils tea ] ''
writePureShellScriptBin "action-ensure-tea-login"
[
bash
coreutils
tea
]
''
bash ${./script.sh}
''

View File

@ -1,13 +1,15 @@
{ bash
, coreutils
, git
, openssh
, action-ensure-tea-login
, action-create-pr
, action-flake-update
, writePureShellScriptBin
{
bash,
coreutils,
git,
openssh,
action-ensure-tea-login,
action-create-pr,
action-flake-update,
writePureShellScriptBin,
}:
writePureShellScriptBin "action-flake-update-pr-clan" [
writePureShellScriptBin "action-flake-update-pr-clan"
[
bash
coreutils
git
@ -15,6 +17,7 @@ writePureShellScriptBin "action-flake-update-pr-clan" [
action-ensure-tea-login
action-create-pr
action-flake-update
] ''
]
''
bash ${./script.sh}
''

View File

@ -1,9 +1,17 @@
{ bash
, coreutils
, git
, nix
, writePureShellScriptBin
{
bash,
coreutils,
git,
nix,
writePureShellScriptBin,
}:
writePureShellScriptBin "action-flake-update" [ bash coreutils git nix ] ''
writePureShellScriptBin "action-flake-update"
[
bash
coreutils
git
nix
]
''
bash ${./script.sh}
''

View File

@ -1,7 +1,7 @@
import argparse
import json
import urllib.request
import urllib.error
import urllib.request
from os import environ
from typing import Optional
@ -38,6 +38,7 @@ def is_ci_green(pr: dict) -> bool:
return False
return True
def is_org_member(user: str, token: str) -> bool:
url = "https://git.clan.lol/api/v1/orgs/clan/members/" + user + f"?token={token}"
try:
@ -50,7 +51,6 @@ def is_org_member(user: str, token: str) -> bool:
raise
def merge_allowed(pr: dict, bot_name: str, token: str) -> bool:
assignees = pr["assignees"] if pr["assignees"] else []
if (

View File

@ -1,9 +1,9 @@
{ pkgs ? import <nixpkgs> { }
, lib ? pkgs.lib
, python3 ? pkgs.python3
, ruff ? pkgs.ruff
, runCommand ? pkgs.runCommand
,
{
pkgs ? import <nixpkgs> { },
lib ? pkgs.lib,
python3 ? pkgs.python3,
ruff ? pkgs.ruff,
runCommand ? pkgs.runCommand,
}:
let
pyproject = builtins.fromTOML (builtins.readFile ./pyproject.toml);
@ -32,13 +32,11 @@ let
package = python3.pkgs.buildPythonPackage {
inherit name src;
format = "pyproject";
nativeBuildInputs = [
python3.pkgs.setuptools
];
propagatedBuildInputs =
dependencies
++ [ ];
passthru.tests = { inherit check; };
nativeBuildInputs = [ python3.pkgs.setuptools ];
propagatedBuildInputs = dependencies ++ [ ];
passthru.tests = {
inherit check;
};
passthru.devDependencies = devDependencies;
};

View File

@ -1,5 +1,6 @@
{
perSystem = { pkgs, ... }:
perSystem =
{ pkgs, ... }:
let
package = pkgs.callPackage ./default.nix { inherit pkgs; };
in

View File

@ -1,16 +1,11 @@
{ pkgs ? import <nixpkgs> { } }:
{
pkgs ? import <nixpkgs> { },
}:
let
inherit (pkgs) lib python3;
package = import ./default.nix {
inherit lib pkgs python3;
};
package = import ./default.nix { inherit lib pkgs python3; };
pythonWithDeps = python3.withPackages (
ps:
package.propagatedBuildInputs
++ package.devDependencies
++ [
ps.pip
]
ps: package.propagatedBuildInputs ++ package.devDependencies ++ [ ps.pip ]
);
checkScript = pkgs.writeScriptBin "check" ''
nix build -f . tests -L "$@"

View File

@ -112,4 +112,6 @@ def test_list_prs_to_merge(monkeypatch: pytest.MonkeyPatch) -> None:
assignees=[dict(login=bot_name)],
),
]
assert clan_merge.list_prs_to_merge(prs, bot_name=bot_name, gitea_token="test") == [prs[0]]
assert clan_merge.list_prs_to_merge(prs, bot_name=bot_name, gitea_token="test") == [
prs[0]
]

View File

@ -1,8 +1,8 @@
{
imports = [
./clan-merge/flake-module.nix
];
perSystem = { pkgs, config, ... }: {
imports = [ ./clan-merge/flake-module.nix ];
perSystem =
{ pkgs, config, ... }:
{
packages =
let
writers = pkgs.callPackage ./writers.nix { };
@ -24,10 +24,15 @@
inherit (writers) writePureShellScriptBin;
inherit (config.packages) action-ensure-tea-login action-create-pr action-flake-update;
};
inherit (pkgs.callPackages ./job-flake-updates {
inherit
(pkgs.callPackages ./job-flake-updates {
inherit (writers) writePureShellScriptBin;
inherit (config.packages) action-flake-update-pr-clan;
}) job-flake-update-clan-core job-flake-update-clan-homepage job-flake-update-clan-infra;
})
job-flake-update-clan-core
job-flake-update-clan-homepage
job-flake-update-clan-infra
;
};
};
}

View File

@ -1,8 +1,8 @@
{ action-flake-update-pr-clan
, writePureShellScriptBin
}:
{ action-flake-update-pr-clan, writePureShellScriptBin }:
let
job-flake-update = repo: writePureShellScriptBin "job-flake-update-${repo}" [ action-flake-update-pr-clan ] ''
job-flake-update =
repo:
writePureShellScriptBin "job-flake-update-${repo}" [ action-flake-update-pr-clan ] ''
export REPO="gitea@git.clan.lol:clan/${repo}.git"
export KEEP_VARS="REPO''${KEEP_VARS:+ $KEEP_VARS}"

View File

@ -1,17 +1,32 @@
# This file has been generated by node2nix 1.11.1. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_18"}:
{
pkgs ? import <nixpkgs> { inherit system; },
system ? builtins.currentSystem,
nodejs ? pkgs."nodejs_18",
}:
let
nodeEnv = import ./node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit (pkgs)
stdenv
lib
python2
runCommand
writeTextFile
writeShellScript
;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
};
in
import ./node-packages.nix {
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
inherit (pkgs)
fetchurl
nix-gitignore
stdenv
lib
fetchgit
;
inherit nodeEnv;
}

View File

@ -1,4 +1,9 @@
{ pkgs, system, nodejs-18_x, makeWrapper }:
{
pkgs,
system,
nodejs-18_x,
makeWrapper,
}:
let
nodePackages = import ./composition.nix {
inherit pkgs system;

View File

@ -1,6 +1,16 @@
# This file originates from node2nix
{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}:
{
lib,
stdenv,
nodejs,
python2,
pkgs,
libtool,
runCommand,
writeTextFile,
writeShellScript,
}:
let
# Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master
@ -22,7 +32,12 @@ let
# Function that generates a TGZ file from a NPM project
buildNodeSourceDist =
{ name, version, src, ... }:
{
name,
version,
src,
...
}:
stdenv.mkDerivation {
name = "node-tarball-${name}-${version}";
@ -90,26 +105,31 @@ let
# Bundle the dependencies of the package
#
# Only include dependencies if they don't exist. They may also be bundled in the package.
includeDependencies = {dependencies}:
includeDependencies =
{ dependencies }:
lib.optionalString (dependencies != [ ]) (
''
mkdir -p node_modules
cd node_modules
''
+ (lib.concatMapStrings (dependency:
''
+ (lib.concatMapStrings (dependency: ''
if [ ! -e "${dependency.packageName}" ]; then
${composePackage dependency}
fi
''
) dependencies)
'') dependencies)
+ ''
cd ..
''
);
# Recursively composes the dependencies of a package
composePackage = { name, packageName, src, dependencies ? [], ... }@args:
composePackage =
{
packageName,
src,
dependencies ? [ ],
...
}:
builtins.addErrorContext "while evaluating node package '${packageName}'" ''
installPackage "${packageName}" "${src}"
${includeDependencies { inherit dependencies; }}
@ -117,7 +137,8 @@ let
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
'';
pinpointDependencies = {dependencies, production}:
pinpointDependencies =
{ dependencies, production }:
let
pinpointDependenciesFromPackageJSON = writeTextFile {
name = "pinpointDependencies.js";
@ -179,8 +200,7 @@ let
''
node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"}
${lib.optionalString (dependencies != [])
''
${lib.optionalString (dependencies != [ ]) ''
if [ -d node_modules ]
then
cd node_modules
@ -194,7 +214,13 @@ let
# dependencies in the package.json file to the versions that are actually
# being used.
pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }@args:
pinpointDependenciesOfPackage =
{
packageName,
dependencies ? [ ],
production ? true,
...
}:
''
if [ -d "${packageName}" ]
then
@ -414,7 +440,14 @@ let
'';
};
prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}:
prepareAndInvokeNPM =
{
packageName,
bypassCache,
reconstructLock,
npmFlags,
production,
}:
let
forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com";
in
@ -476,42 +509,65 @@ let
# Builds and composes an NPM package including all its dependencies
buildNodePackage =
{ name
, packageName
, version ? null
, dependencies ? []
, buildInputs ? []
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
, bypassCache ? false
, reconstructLock ? false
, preRebuild ? ""
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, meta ? {}
, ... }@args:
{
name,
packageName,
version ? null,
buildInputs ? [ ],
production ? true,
npmFlags ? "",
dontNpmInstall ? false,
bypassCache ? false,
reconstructLock ? false,
preRebuild ? "",
dontStrip ? true,
unpackPhase ? "true",
buildPhase ? "true",
meta ? { },
...
}@args:
let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ];
extraArgs = removeAttrs args [
"name"
"dependencies"
"buildInputs"
"dontStrip"
"dontNpmInstall"
"preRebuild"
"unpackPhase"
"buildPhase"
"meta"
];
in
stdenv.mkDerivation ({
stdenv.mkDerivation (
{
name = "${name}${if version == null then "" else "-${version}"}";
buildInputs = [ tarWrapper python nodejs ]
++ lib.optional (stdenv.isLinux) utillinux
++ lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
buildInputs =
[
tarWrapper
python
nodejs
]
++ lib.optional (stdenv.isLinux) utillinux ++ lib.optional (stdenv.isDarwin) libtool ++ buildInputs;
inherit nodejs;
inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall preRebuild unpackPhase buildPhase;
inherit
dontNpmInstall
preRebuild
unpackPhase
buildPhase
;
compositionScript = composePackage args;
pinpointDependenciesScript = pinpointDependenciesOfPackage args;
passAsFile = [ "compositionScript" "pinpointDependenciesScript" ];
passAsFile = [
"compositionScript"
"pinpointDependenciesScript"
];
installPhase = ''
source ${installPackage}
@ -523,7 +579,15 @@ let
# Compose the package and all its dependencies
source $compositionScriptPath
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
${prepareAndInvokeNPM {
inherit
packageName
bypassCache
reconstructLock
npmFlags
production
;
}}
# Create symlink to the deployed executable folder, if applicable
if [ -d "$out/lib/node_modules/.bin" ]
@ -564,36 +628,48 @@ let
# default to Node.js' platforms
platforms = nodejs.meta.platforms;
} // meta;
} // extraArgs);
}
// extraArgs
);
# Builds a node environment (a node_modules folder and a set of binaries)
buildNodeDependencies =
{ name
, packageName
, version ? null
, src
, dependencies ? []
, buildInputs ? []
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
, bypassCache ? false
, reconstructLock ? false
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
{
name,
packageName,
version ? null,
src,
dependencies ? [ ],
buildInputs ? [ ],
production ? true,
npmFlags ? "",
dontNpmInstall ? false,
bypassCache ? false,
reconstructLock ? false,
dontStrip ? true,
unpackPhase ? "true",
buildPhase ? "true",
...
}@args:
let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ];
extraArgs = removeAttrs args [
"name"
"dependencies"
"buildInputs"
];
in
stdenv.mkDerivation ({
stdenv.mkDerivation (
{
name = "node-dependencies-${name}${if version == null then "" else "-${version}"}";
buildInputs = [ tarWrapper python nodejs ]
++ lib.optional (stdenv.isLinux) utillinux
++ lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
buildInputs =
[
tarWrapper
python
nodejs
]
++ lib.optional (stdenv.isLinux) utillinux ++ lib.optional (stdenv.isDarwin) libtool ++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall unpackPhase buildPhase;
@ -601,7 +677,10 @@ let
includeScript = includeDependencies { inherit dependencies; };
pinpointDependenciesScript = pinpointDependenciesOfPackage args;
passAsFile = [ "includeScript" "pinpointDependenciesScript" ];
passAsFile = [
"includeScript"
"pinpointDependenciesScript"
];
installPhase = ''
source ${installPackage}
@ -626,7 +705,15 @@ let
cd ..
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
${prepareAndInvokeNPM {
inherit
packageName
bypassCache
reconstructLock
npmFlags
production
;
}}
# Expose the executables that were installed
cd ..
@ -635,34 +722,40 @@ let
mv ${packageName} lib
ln -s $out/lib/node_modules/.bin $out/bin
'';
} // extraArgs);
}
// extraArgs
);
# Builds a development shell
buildNodeShell =
{ name
, packageName
, version ? null
, src
, dependencies ? []
, buildInputs ? []
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
, bypassCache ? false
, reconstructLock ? false
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
{
name,
version ? null,
dependencies ? [ ],
buildInputs ? [ ],
...
}@args:
let
nodeDependencies = buildNodeDependencies args;
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "unpackPhase" "buildPhase" ];
extraArgs = removeAttrs args [
"name"
"dependencies"
"buildInputs"
"dontStrip"
"dontNpmInstall"
"unpackPhase"
"buildPhase"
];
in
stdenv.mkDerivation ({
stdenv.mkDerivation (
{
name = "node-shell-${name}${if version == null then "" else "-${version}"}";
buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs;
buildInputs = [
python
nodejs
] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs;
buildCommand = ''
mkdir -p $out/bin
cat > $out/bin/shell <<EOF
@ -679,7 +772,9 @@ let
export NODE_PATH=${nodeDependencies}/lib/node_modules
export PATH="${nodeDependencies}/bin:$PATH"
'';
} // extraArgs);
}
// extraArgs
);
in
{
buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist;

View File

@ -1,6 +1,10 @@
# This file has been generated by node2nix 1.11.1. Do not edit!
{nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? []}:
{
nodeEnv,
fetchurl,
globalBuildInputs ? [ ],
}:
let
sources = {
@ -7226,46 +7230,14 @@ in
};
dependencies = [
sources."@arcanis/slice-ansi-1.1.1"
(sources."@aws-crypto/crc32-3.0.0" // {
dependencies = [
sources."tslib-1.14.1"
];
})
(sources."@aws-crypto/crc32c-3.0.0" // {
dependencies = [
sources."tslib-1.14.1"
];
})
(sources."@aws-crypto/ie11-detection-3.0.0" // {
dependencies = [
sources."tslib-1.14.1"
];
})
(sources."@aws-crypto/sha1-browser-3.0.0" // {
dependencies = [
sources."tslib-1.14.1"
];
})
(sources."@aws-crypto/sha256-browser-3.0.0" // {
dependencies = [
sources."tslib-1.14.1"
];
})
(sources."@aws-crypto/sha256-js-3.0.0" // {
dependencies = [
sources."tslib-1.14.1"
];
})
(sources."@aws-crypto/supports-web-crypto-3.0.0" // {
dependencies = [
sources."tslib-1.14.1"
];
})
(sources."@aws-crypto/util-3.0.0" // {
dependencies = [
sources."tslib-1.14.1"
];
})
(sources."@aws-crypto/crc32-3.0.0" // { dependencies = [ sources."tslib-1.14.1" ]; })
(sources."@aws-crypto/crc32c-3.0.0" // { dependencies = [ sources."tslib-1.14.1" ]; })
(sources."@aws-crypto/ie11-detection-3.0.0" // { dependencies = [ sources."tslib-1.14.1" ]; })
(sources."@aws-crypto/sha1-browser-3.0.0" // { dependencies = [ sources."tslib-1.14.1" ]; })
(sources."@aws-crypto/sha256-browser-3.0.0" // { dependencies = [ sources."tslib-1.14.1" ]; })
(sources."@aws-crypto/sha256-js-3.0.0" // { dependencies = [ sources."tslib-1.14.1" ]; })
(sources."@aws-crypto/supports-web-crypto-3.0.0" // { dependencies = [ sources."tslib-1.14.1" ]; })
(sources."@aws-crypto/util-3.0.0" // { dependencies = [ sources."tslib-1.14.1" ]; })
sources."@aws-sdk/chunked-blob-reader-3.310.0"
sources."@aws-sdk/client-codecommit-3.363.0"
sources."@aws-sdk/client-ec2-3.363.0"
@ -7315,7 +7287,9 @@ in
sources."@aws-sdk/xml-builder-3.310.0"
sources."@babel/code-frame-7.22.5"
sources."@babel/helper-validator-identifier-7.22.5"
(sources."@babel/highlight-7.22.5" // {
(
sources."@babel/highlight-7.22.5"
// {
dependencies = [
sources."ansi-styles-3.2.1"
sources."chalk-2.4.2"
@ -7324,7 +7298,8 @@ in
sources."has-flag-3.0.0"
sources."supports-color-5.5.0"
];
})
}
)
sources."@babel/runtime-corejs3-7.22.6"
sources."@breejs/later-4.1.0"
sources."@cdktf/hcl2json-0.17.1"
@ -7334,7 +7309,9 @@ in
sources."@gwhitney/detect-indent-7.0.1"
sources."@httptoolkit/websocket-stream-6.0.1"
sources."@iarna/toml-3.0.0"
(sources."@isaacs/cliui-8.0.2" // {
(
sources."@isaacs/cliui-8.0.2"
// {
dependencies = [
sources."ansi-regex-6.0.1"
sources."ansi-styles-6.2.1"
@ -7343,7 +7320,8 @@ in
sources."strip-ansi-7.1.0"
sources."wrap-ansi-8.1.0"
];
})
}
)
sources."@kwsites/file-exists-1.1.1"
sources."@kwsites/promise-deferred-1.1.1"
sources."@nodelib/fs.scandir-2.1.5"
@ -7357,11 +7335,12 @@ in
sources."@octokit/openapi-types-18.0.0"
sources."@octokit/plugin-paginate-rest-6.1.2"
sources."@octokit/plugin-request-log-1.0.4"
(sources."@octokit/plugin-rest-endpoint-methods-7.2.3" // {
dependencies = [
sources."@octokit/types-10.0.0"
];
})
(
sources."@octokit/plugin-rest-endpoint-methods-7.2.3"
// {
dependencies = [ sources."@octokit/types-10.0.0" ];
}
)
sources."@octokit/request-6.2.8"
sources."@octokit/request-error-3.0.3"
sources."@octokit/rest-19.0.13"
@ -7374,12 +7353,15 @@ in
sources."@opentelemetry/core-1.15.0"
sources."@opentelemetry/exporter-trace-otlp-http-0.41.0"
sources."@opentelemetry/instrumentation-0.41.0"
(sources."@opentelemetry/instrumentation-bunyan-0.31.4" // {
(
sources."@opentelemetry/instrumentation-bunyan-0.31.4"
// {
dependencies = [
sources."@opentelemetry/instrumentation-0.40.0"
sources."import-in-the-middle-1.3.5"
];
})
}
)
sources."@opentelemetry/instrumentation-http-0.41.0"
sources."@opentelemetry/otlp-exporter-base-0.41.0"
sources."@opentelemetry/otlp-transformer-0.41.0"
@ -7402,11 +7384,7 @@ in
sources."@pnpm/write-project-manifest-4.1.1"
sources."@qnighy/marshal-0.1.3"
sources."@redis/bloom-1.2.0"
(sources."@redis/client-1.5.8" // {
dependencies = [
sources."yallist-4.0.0"
];
})
(sources."@redis/client-1.5.8" // { dependencies = [ sources."yallist-4.0.0" ]; })
sources."@redis/graph-1.1.0"
sources."@redis/json-1.0.4"
sources."@redis/search-1.1.3"
@ -7491,7 +7469,9 @@ in
sources."@types/unist-2.0.7"
sources."@types/ws-8.5.5"
sources."@types/yauzl-2.10.0"
(sources."@yarnpkg/core-3.5.2" // {
(
sources."@yarnpkg/core-3.5.2"
// {
dependencies = [
sources."ansi-regex-5.0.1"
sources."camelcase-5.3.1"
@ -7499,39 +7479,30 @@ in
sources."strip-ansi-6.0.1"
sources."tslib-1.14.1"
];
})
(sources."@yarnpkg/fslib-2.10.3" // {
dependencies = [
sources."tslib-1.14.1"
];
})
(sources."@yarnpkg/json-proxy-2.1.1" // {
dependencies = [
sources."tslib-1.14.1"
];
})
(sources."@yarnpkg/libzip-2.3.0" // {
dependencies = [
sources."tslib-1.14.1"
];
})
(sources."@yarnpkg/parsers-2.5.1" // {
}
)
(sources."@yarnpkg/fslib-2.10.3" // { dependencies = [ sources."tslib-1.14.1" ]; })
(sources."@yarnpkg/json-proxy-2.1.1" // { dependencies = [ sources."tslib-1.14.1" ]; })
(sources."@yarnpkg/libzip-2.3.0" // { dependencies = [ sources."tslib-1.14.1" ]; })
(
sources."@yarnpkg/parsers-2.5.1"
// {
dependencies = [
sources."js-yaml-3.14.1"
sources."tslib-1.14.1"
];
})
(sources."@yarnpkg/pnp-3.3.4" // {
dependencies = [
sources."@types/node-13.13.52"
];
})
(sources."@yarnpkg/shell-3.2.5" // {
}
)
(sources."@yarnpkg/pnp-3.3.4" // { dependencies = [ sources."@types/node-13.13.52" ]; })
(
sources."@yarnpkg/shell-3.2.5"
// {
dependencies = [
sources."chalk-3.0.0"
sources."tslib-1.14.1"
];
})
}
)
sources."abbrev-1.1.1"
sources."acorn-8.10.0"
sources."acorn-import-assertions-1.9.0"
@ -7563,12 +7534,15 @@ in
sources."before-after-hook-2.2.3"
sources."big-integer-1.6.51"
sources."binary-0.3.0"
(sources."bl-4.1.0" // {
(
sources."bl-4.1.0"
// {
dependencies = [
sources."buffer-5.7.1"
sources."readable-stream-3.6.2"
];
})
}
)
sources."bluebird-3.7.2"
sources."bn.js-4.12.0"
sources."boolbase-1.0.0"
@ -7585,28 +7559,30 @@ in
sources."bufferutil-4.0.7"
sources."builtins-5.0.1"
sources."bunyan-1.8.15"
(sources."cacache-17.1.3" // {
(
sources."cacache-17.1.3"
// {
dependencies = [
sources."fs-minipass-3.0.2"
sources."lru-cache-7.18.3"
sources."minipass-5.0.0"
];
})
}
)
sources."cacheable-lookup-5.0.4"
sources."cacheable-request-7.0.4"
sources."call-bind-1.0.2"
sources."camelcase-2.1.1"
(sources."camelcase-keys-6.2.2" // {
(
sources."camelcase-keys-6.2.2"
// {
dependencies = [
sources."camelcase-5.3.1"
sources."quick-lru-4.0.1"
];
})
(sources."chainsaw-0.1.0" // {
dependencies = [
sources."traverse-0.3.9"
];
})
}
)
(sources."chainsaw-0.1.0" // { dependencies = [ sources."traverse-0.3.9" ]; })
sources."chalk-4.1.2"
sources."changelog-filename-regex-2.0.1"
sources."character-entities-1.2.4"
@ -7622,7 +7598,9 @@ in
sources."cliui-3.2.0"
sources."clone-response-1.0.3"
sources."cluster-key-slot-1.1.2"
(sources."cmake-js-6.3.2" // {
(
sources."cmake-js-6.3.2"
// {
dependencies = [
sources."axios-0.21.4"
sources."fs-extra-5.0.0"
@ -7630,7 +7608,8 @@ in
sources."tar-4.4.19"
sources."url-join-0.0.1"
];
})
}
)
sources."code-point-at-1.1.0"
sources."color-convert-2.0.1"
sources."color-name-1.1.4"
@ -7638,40 +7617,20 @@ in
sources."commander-11.0.0"
sources."commist-1.1.0"
sources."concat-map-0.0.1"
(sources."concat-stream-2.0.0" // {
dependencies = [
sources."readable-stream-3.6.2"
];
})
(sources."concat-stream-2.0.0" // { dependencies = [ sources."readable-stream-3.6.2" ]; })
sources."console-control-strings-1.1.0"
sources."conventional-commits-detector-1.0.3"
sources."core-js-pure-3.31.1"
sources."core-util-is-1.0.3"
(sources."cross-spawn-7.0.3" // {
dependencies = [
sources."which-2.0.2"
];
})
(sources."cross-spawn-7.0.3" // { dependencies = [ sources."which-2.0.2" ]; })
sources."crypto-js-4.1.1"
sources."css-select-5.1.0"
sources."css-what-6.1.0"
sources."dargs-7.0.0"
(sources."debug-4.3.4" // {
dependencies = [
sources."ms-2.1.2"
];
})
(sources."debug-4.3.4" // { dependencies = [ sources."ms-2.1.2" ]; })
sources."decamelize-1.2.0"
(sources."decamelize-keys-1.1.1" // {
dependencies = [
sources."map-obj-1.0.1"
];
})
(sources."decompress-response-6.0.0" // {
dependencies = [
sources."mimic-response-3.1.0"
];
})
(sources."decamelize-keys-1.1.1" // { dependencies = [ sources."map-obj-1.0.1" ]; })
(sources."decompress-response-6.0.0" // { dependencies = [ sources."mimic-response-3.1.0" ]; })
sources."deep-extend-0.6.0"
sources."deepmerge-4.3.1"
sources."defer-to-connect-2.0.1"
@ -7684,11 +7643,7 @@ in
sources."detect-node-2.1.0"
sources."diff-5.1.0"
sources."dir-glob-3.0.1"
(sources."dom-serializer-2.0.0" // {
dependencies = [
sources."entities-4.5.0"
];
})
(sources."dom-serializer-2.0.0" // { dependencies = [ sources."entities-4.5.0" ]; })
sources."domelementtype-2.3.0"
sources."domhandler-5.0.3"
sources."domutils-3.1.0"
@ -7696,12 +7651,15 @@ in
sources."duplexer2-0.1.4"
sources."duplexify-3.7.1"
sources."eastasianwidth-0.2.0"
(sources."editorconfig-2.0.0" // {
(
sources."editorconfig-2.0.0"
// {
dependencies = [
sources."brace-expansion-2.0.1"
sources."minimatch-9.0.2"
];
})
}
)
sources."email-addresses-5.0.0"
sources."emoji-regex-10.2.1"
sources."emojibase-15.0.0"
@ -7726,22 +7684,28 @@ in
sources."fd-slicer-1.1.0"
sources."fill-range-7.0.1"
sources."find-packages-10.0.4"
(sources."find-up-5.0.0" // {
(
sources."find-up-5.0.0"
// {
dependencies = [
sources."locate-path-6.0.0"
sources."p-limit-3.1.0"
sources."p-locate-5.0.0"
];
})
}
)
sources."follow-redirects-1.15.2"
sources."for-each-0.3.3"
sources."foreground-child-3.1.1"
(sources."fs-extra-11.1.1" // {
(
sources."fs-extra-11.1.1"
// {
dependencies = [
sources."jsonfile-6.1.0"
sources."universalify-2.0.0"
];
})
}
)
sources."fs-minipass-1.2.7"
sources."fs.realpath-1.0.0"
sources."fstream-1.0.12"
@ -7750,19 +7714,11 @@ in
sources."generic-pool-3.9.0"
sources."get-intrinsic-1.2.1"
sources."get-stream-5.2.0"
(sources."git-raw-commits-2.0.11" // {
dependencies = [
sources."meow-8.1.2"
];
})
(sources."git-raw-commits-2.0.11" // { dependencies = [ sources."meow-8.1.2" ]; })
sources."git-up-7.0.0"
sources."git-url-parse-13.1.0"
sources."github-url-from-git-1.5.0"
(sources."glob-10.3.1" // {
dependencies = [
sources."minipass-6.0.2"
];
})
(sources."glob-10.3.1" // { dependencies = [ sources."minipass-6.0.2" ]; })
sources."glob-parent-5.1.2"
sources."global-agent-3.0.0"
sources."globalthis-1.0.3"
@ -7782,19 +7738,18 @@ in
sources."has-symbols-1.0.3"
sources."has-tostringtag-1.0.0"
sources."has-unicode-2.0.1"
(sources."hasha-5.2.2" // {
dependencies = [
sources."type-fest-0.8.1"
];
})
(sources."hasha-5.2.2" // { dependencies = [ sources."type-fest-0.8.1" ]; })
sources."he-1.2.0"
(sources."help-me-3.0.0" // {
(
sources."help-me-3.0.0"
// {
dependencies = [
sources."glob-7.2.3"
sources."minimatch-3.1.2"
sources."readable-stream-3.6.2"
];
})
}
)
sources."hosted-git-info-4.1.0"
sources."http-cache-semantics-4.1.1"
sources."http-proxy-agent-5.0.0"
@ -7844,11 +7799,7 @@ in
sources."jackspeak-2.2.1"
sources."js-sdsl-4.3.0"
sources."js-tokens-4.0.0"
(sources."js-yaml-4.1.0" // {
dependencies = [
sources."argparse-2.0.1"
];
})
(sources."js-yaml-4.1.0" // { dependencies = [ sources."argparse-2.0.1" ]; })
sources."json-buffer-3.0.1"
sources."json-dup-key-validator-1.0.3"
sources."json-file-plus-3.3.1"
@ -7876,47 +7827,44 @@ in
sources."lodash.padstart-4.6.1"
sources."longest-streak-2.0.4"
sources."lowercase-keys-2.0.0"
(sources."lru-cache-6.0.0" // {
dependencies = [
sources."yallist-4.0.0"
];
})
(sources."lru-cache-6.0.0" // { dependencies = [ sources."yallist-4.0.0" ]; })
sources."luxon-3.3.0"
(sources."make-fetch-happen-11.1.1" // {
(
sources."make-fetch-happen-11.1.1"
// {
dependencies = [
sources."lru-cache-7.18.3"
sources."minipass-5.0.0"
];
})
}
)
sources."map-obj-4.3.0"
(sources."markdown-it-13.0.1" // {
dependencies = [
sources."argparse-2.0.1"
];
})
(sources."markdown-it-13.0.1" // { dependencies = [ sources."argparse-2.0.1" ]; })
sources."markdown-table-2.0.0"
(sources."matcher-3.0.0" // {
dependencies = [
sources."escape-string-regexp-4.0.0"
];
})
(sources."mdast-util-find-and-replace-1.1.1" // {
dependencies = [
sources."escape-string-regexp-4.0.0"
];
})
(sources."matcher-3.0.0" // { dependencies = [ sources."escape-string-regexp-4.0.0" ]; })
(
sources."mdast-util-find-and-replace-1.1.1"
// {
dependencies = [ sources."escape-string-regexp-4.0.0" ];
}
)
sources."mdast-util-from-markdown-0.8.5"
sources."mdast-util-to-markdown-0.6.5"
sources."mdast-util-to-string-2.0.0"
sources."mdurl-1.0.1"
(sources."memory-stream-0.0.3" // {
(
sources."memory-stream-0.0.3"
// {
dependencies = [
sources."isarray-0.0.1"
sources."readable-stream-1.0.34"
sources."string_decoder-0.10.31"
];
})
(sources."meow-7.1.1" // {
}
)
(
sources."meow-7.1.1"
// {
dependencies = [
sources."camelcase-5.3.1"
sources."hosted-git-info-2.8.9"
@ -7925,85 +7873,101 @@ in
sources."type-fest-0.13.1"
sources."yargs-parser-18.1.3"
];
})
}
)
sources."merge2-1.4.1"
sources."micromark-2.11.4"
sources."micromatch-4.0.5"
sources."mimic-response-1.0.1"
sources."min-indent-1.0.1"
sources."minimalistic-assert-1.0.1"
(sources."minimatch-9.0.3" // {
dependencies = [
sources."brace-expansion-2.0.1"
];
})
(sources."minimatch-9.0.3" // { dependencies = [ sources."brace-expansion-2.0.1" ]; })
sources."minimist-1.2.8"
sources."minimist-options-4.1.0"
sources."minipass-2.9.0"
(sources."minipass-collect-1.0.2" // {
(
sources."minipass-collect-1.0.2"
// {
dependencies = [
sources."minipass-3.3.6"
sources."yallist-4.0.0"
];
})
(sources."minipass-fetch-3.0.3" // {
}
)
(
sources."minipass-fetch-3.0.3"
// {
dependencies = [
sources."minipass-5.0.0"
(sources."minizlib-2.1.2" // {
dependencies = [
sources."minipass-3.3.6"
];
})
(sources."minizlib-2.1.2" // { dependencies = [ sources."minipass-3.3.6" ]; })
sources."yallist-4.0.0"
];
})
(sources."minipass-flush-1.0.5" // {
}
)
(
sources."minipass-flush-1.0.5"
// {
dependencies = [
sources."minipass-3.3.6"
sources."yallist-4.0.0"
];
})
(sources."minipass-pipeline-1.2.4" // {
}
)
(
sources."minipass-pipeline-1.2.4"
// {
dependencies = [
sources."minipass-3.3.6"
sources."yallist-4.0.0"
];
})
(sources."minipass-sized-1.0.3" // {
}
)
(
sources."minipass-sized-1.0.3"
// {
dependencies = [
sources."minipass-3.3.6"
sources."yallist-4.0.0"
];
})
}
)
sources."minizlib-1.3.3"
sources."mkdirp-0.5.6"
sources."module-details-from-path-1.0.3"
sources."moment-2.29.4"
sources."moo-0.5.2"
(sources."mqtt-4.3.7" // {
(
sources."mqtt-4.3.7"
// {
dependencies = [
sources."duplexify-4.1.2"
sources."readable-stream-3.6.2"
sources."utf-8-validate-5.0.10"
sources."ws-7.5.9"
];
})
}
)
sources."mqtt-packet-6.10.0"
sources."ms-2.1.3"
(sources."mv-2.1.1" // {
(
sources."mv-2.1.1"
// {
dependencies = [
sources."glob-6.0.4"
sources."minimatch-3.1.2"
sources."rimraf-2.4.5"
];
})
}
)
sources."nan-2.17.0"
sources."nanoid-3.3.6"
sources."ncp-2.0.0"
sources."negotiator-0.6.3"
sources."neo-async-2.6.2"
sources."node-fetch-2.6.12"
(sources."node-gyp-9.4.0" // {
(
sources."node-gyp-9.4.0"
// {
dependencies = [
sources."ansi-regex-5.0.1"
sources."are-we-there-yet-3.0.1"
@ -8020,7 +7984,8 @@ in
sources."strip-ansi-6.0.1"
sources."which-2.0.2"
];
})
}
)
sources."node-gyp-build-4.6.0"
sources."node-html-parser-6.1.5"
sources."node.extend-2.0.2"
@ -8039,11 +8004,7 @@ in
sources."os-locale-1.4.0"
sources."p-all-3.0.0"
sources."p-cancelable-2.1.1"
(sources."p-filter-2.1.0" // {
dependencies = [
sources."p-map-2.1.0"
];
})
(sources."p-filter-2.1.0" // { dependencies = [ sources."p-map-2.1.0" ]; })
sources."p-finally-1.0.0"
sources."p-limit-2.3.0"
sources."p-locate-4.1.0"
@ -8061,12 +8022,15 @@ in
sources."path-is-absolute-1.0.1"
sources."path-key-3.1.1"
sources."path-parse-1.0.7"
(sources."path-scurry-1.10.1" // {
(
sources."path-scurry-1.10.1"
// {
dependencies = [
sources."lru-cache-10.0.0"
sources."minipass-7.0.2"
];
})
}
)
sources."path-type-4.0.0"
sources."pend-1.2.0"
sources."picomatch-2.3.1"
@ -8084,43 +8048,37 @@ in
sources."qs-6.11.2"
sources."queue-microtask-1.2.3"
sources."quick-lru-5.1.1"
(sources."rc-1.2.8" // {
dependencies = [
sources."ini-1.3.8"
];
})
(sources."rc-1.2.8" // { dependencies = [ sources."ini-1.3.8" ]; })
sources."re2-1.19.1"
(sources."read-pkg-5.2.0" // {
(
sources."read-pkg-5.2.0"
// {
dependencies = [
sources."hosted-git-info-2.8.9"
sources."normalize-package-data-2.5.0"
sources."semver-5.7.2"
sources."type-fest-0.6.0"
];
})
(sources."read-pkg-up-7.0.1" // {
}
)
(
sources."read-pkg-up-7.0.1"
// {
dependencies = [
sources."find-up-4.1.0"
sources."type-fest-0.8.1"
];
})
}
)
sources."read-yaml-file-2.1.0"
(sources."readable-stream-2.3.8" // {
dependencies = [
sources."safe-buffer-5.1.2"
];
})
(sources."readable-stream-2.3.8" // { dependencies = [ sources."safe-buffer-5.1.2" ]; })
sources."redent-3.0.0"
sources."redis-4.6.7"
sources."regenerator-runtime-0.13.11"
sources."regexp-to-ast-0.5.0"
sources."reinterval-1.1.0"
sources."remark-13.0.0"
(sources."remark-github-10.1.0" // {
dependencies = [
sources."mdast-util-to-string-1.1.0"
];
})
(sources."remark-github-10.1.0" // { dependencies = [ sources."mdast-util-to-string-1.1.0" ]; })
sources."remark-parse-9.0.0"
sources."remark-stringify-9.0.1"
sources."repeat-string-1.6.1"
@ -8131,17 +8089,16 @@ in
sources."retry-0.12.0"
sources."reusify-1.0.4"
sources."rfdc-1.3.0"
(sources."rimraf-2.7.1" // {
(
sources."rimraf-2.7.1"
// {
dependencies = [
sources."glob-7.2.3"
sources."minimatch-3.1.2"
];
})
(sources."roarr-2.15.4" // {
dependencies = [
sources."sprintf-js-1.1.2"
];
})
}
)
(sources."roarr-2.15.4" // { dependencies = [ sources."sprintf-js-1.1.2" ]; })
sources."run-parallel-1.2.0"
sources."safe-buffer-5.2.1"
sources."safe-json-stringify-1.2.0"
@ -8150,17 +8107,9 @@ in
sources."sax-1.2.4"
sources."semver-7.5.3"
sources."semver-compare-1.0.0"
(sources."semver-stable-3.0.0" // {
dependencies = [
sources."semver-6.3.1"
];
})
(sources."semver-stable-3.0.0" // { dependencies = [ sources."semver-6.3.1" ]; })
sources."semver-utils-1.1.4"
(sources."serialize-error-7.0.1" // {
dependencies = [
sources."type-fest-0.13.1"
];
})
(sources."serialize-error-7.0.1" // { dependencies = [ sources."type-fest-0.13.1" ]; })
sources."set-blocking-2.0.0"
sources."setimmediate-1.0.5"
sources."shebang-command-2.0.0"
@ -8175,58 +8124,44 @@ in
sources."smart-buffer-4.2.0"
sources."socks-2.7.1"
sources."socks-proxy-agent-7.0.0"
(sources."sort-keys-4.2.0" // {
dependencies = [
sources."is-plain-obj-2.1.0"
];
})
(sources."sort-keys-4.2.0" // { dependencies = [ sources."is-plain-obj-2.1.0" ]; })
sources."source-map-0.6.1"
sources."source-map-support-0.5.21"
sources."spdx-correct-3.2.0"
sources."spdx-exceptions-2.3.0"
sources."spdx-expression-parse-3.0.1"
sources."spdx-license-ids-3.0.13"
(sources."split2-3.2.2" // {
dependencies = [
sources."readable-stream-3.6.2"
];
})
(sources."split2-3.2.2" // { dependencies = [ sources."readable-stream-3.6.2" ]; })
sources."splitargs-0.0.7"
sources."sprintf-js-1.0.3"
(sources."ssri-10.0.4" // {
dependencies = [
sources."minipass-5.0.0"
];
})
(sources."ssri-10.0.4" // { dependencies = [ sources."minipass-5.0.0" ]; })
sources."stream-buffers-3.0.2"
sources."stream-shift-1.0.1"
sources."stream-to-array-2.3.0"
(sources."stream-to-promise-2.2.0" // {
(
sources."stream-to-promise-2.2.0"
// {
dependencies = [
sources."end-of-stream-1.1.0"
sources."once-1.3.3"
];
})
}
)
sources."string-width-1.0.2"
(sources."string-width-cjs-4.2.3" // {
(
sources."string-width-cjs-4.2.3"
// {
dependencies = [
sources."ansi-regex-5.0.1"
sources."emoji-regex-8.0.0"
sources."is-fullwidth-code-point-3.0.0"
sources."strip-ansi-6.0.1"
];
})
(sources."string_decoder-1.1.1" // {
dependencies = [
sources."safe-buffer-5.1.2"
];
})
}
)
(sources."string_decoder-1.1.1" // { dependencies = [ sources."safe-buffer-5.1.2" ]; })
sources."strip-ansi-3.0.1"
(sources."strip-ansi-cjs-6.0.1" // {
dependencies = [
sources."ansi-regex-5.0.1"
];
})
(sources."strip-ansi-cjs-6.0.1" // { dependencies = [ sources."ansi-regex-5.0.1" ]; })
sources."strip-bom-4.0.0"
sources."strip-comments-strings-1.2.0"
sources."strip-indent-3.0.0"
@ -8234,34 +8169,21 @@ in
sources."strnum-1.0.5"
sources."supports-color-7.2.0"
sources."supports-preserve-symlinks-flag-1.0.0"
(sources."tar-6.1.15" // {
(
sources."tar-6.1.15"
// {
dependencies = [
sources."chownr-2.0.0"
(sources."fs-minipass-2.1.0" // {
dependencies = [
sources."minipass-3.3.6"
];
})
(sources."fs-minipass-2.1.0" // { dependencies = [ sources."minipass-3.3.6" ]; })
sources."minipass-5.0.0"
(sources."minizlib-2.1.2" // {
dependencies = [
sources."minipass-3.3.6"
];
})
(sources."minizlib-2.1.2" // { dependencies = [ sources."minipass-3.3.6" ]; })
sources."mkdirp-1.0.4"
sources."yallist-4.0.0"
];
})
(sources."through2-4.0.2" // {
dependencies = [
sources."readable-stream-3.6.2"
];
})
(sources."through2-concurrent-2.0.0" // {
dependencies = [
sources."through2-2.0.5"
];
})
}
)
(sources."through2-4.0.2" // { dependencies = [ sources."readable-stream-3.6.2" ]; })
(sources."through2-concurrent-2.0.0" // { dependencies = [ sources."through2-2.0.5" ]; })
sources."tinylogic-1.0.3"
sources."to-regex-range-5.0.1"
sources."tr46-0.0.3"
@ -8279,11 +8201,7 @@ in
sources."uc.micro-1.0.6"
sources."uglify-js-3.17.4"
sources."underscore-1.13.6"
(sources."unified-9.2.2" // {
dependencies = [
sources."is-plain-obj-2.1.0"
];
})
(sources."unified-9.2.2" // { dependencies = [ sources."is-plain-obj-2.1.0" ]; })
sources."unique-filename-3.0.0"
sources."unique-slug-4.0.0"
sources."unist-util-is-4.1.0"
@ -8292,14 +8210,17 @@ in
sources."unist-util-visit-parents-3.1.1"
sources."universal-user-agent-6.0.0"
sources."universalify-0.1.2"
(sources."unzipper-0.8.14" // {
(
sources."unzipper-0.8.14"
// {
dependencies = [
sources."bluebird-3.4.7"
sources."process-nextick-args-1.0.7"
sources."readable-stream-2.1.5"
sources."string_decoder-0.10.31"
];
})
}
)
sources."upath-2.0.1"
sources."url-join-4.0.1"
sources."utf-8-validate-6.0.3"
@ -8319,7 +8240,9 @@ in
sources."window-size-0.1.4"
sources."wordwrap-1.0.0"
sources."wrap-ansi-2.1.0"
(sources."wrap-ansi-cjs-7.0.0" // {
(
sources."wrap-ansi-cjs-7.0.0"
// {
dependencies = [
sources."ansi-regex-5.0.1"
sources."emoji-regex-8.0.0"
@ -8327,15 +8250,19 @@ in
sources."string-width-4.2.3"
sources."strip-ansi-6.0.1"
];
})
}
)
sources."wrappy-1.0.2"
sources."write-file-atomic-5.0.1"
(sources."write-yaml-file-4.2.0" // {
(
sources."write-yaml-file-4.2.0"
// {
dependencies = [
sources."signal-exit-3.0.7"
sources."write-file-atomic-3.0.3"
];
})
}
)
sources."ws-8.13.0"
sources."xmldoc-1.3.0"
sources."xtend-4.0.2"

View File

@ -1,12 +1,13 @@
{ lib
, bash
, coreutils
, gawk
, path
, # nixpkgs path
writeScript
, writeScriptBin
, ...
{
lib,
bash,
coreutils,
gawk,
path,
# nixpkgs path
writeScript,
writeScriptBin,
...
}:
let
# Create a script that runs in a `pure` environment, in the sense that:
@ -18,12 +19,12 @@ let
# - all environment variables are unset, except:
# - the ones listed in `keepVars` defined in ./default.nix
# - the ones listed via the `KEEP_VARS` variable
writePureShellScript = PATH: script:
writeScript "script.sh" (mkScript PATH script);
writePureShellScript = PATH: script: writeScript "script.sh" (mkScript PATH script);
# Creates a script in a `bin/` directory in the output; suitable for use with `lib.makeBinPath`, etc.
# See {option}`writers.writePureShellScript`
writePureShellScriptBin = binName: PATH: script:
writePureShellScriptBin =
binName: PATH: script:
writeScriptBin binName (mkScript PATH script);
mkScript = PATH: scriptText: ''
@ -91,8 +92,5 @@ let
'';
in
{
inherit
writePureShellScript
writePureShellScriptBin
;
inherit writePureShellScript writePureShellScriptBin;
}

View File

@ -4,13 +4,11 @@
meta.name = "infra";
directory = self;
# Make flake available in modules
specialArgs = {
self = {
specialArgs.self = {
inherit (self) inputs nixosModules packages;
};
};
machines = {
web01 = { modulesPath, ... }: {
web01 = {
imports = [ (./web01/configuration.nix) ];
};
};