style: format (alejandra)

This commit is contained in:
zerosummed
2025-02-14 21:06:51 +03:00
parent 70021da132
commit e1c484b1c0
14 changed files with 363 additions and 341 deletions

View File

@@ -55,93 +55,86 @@
# This last approach is the one we're taking in this file. To make sure the removal of the # This last approach is the one we're taking in this file. To make sure the removal of the
# nested nix/store happens immediately after the installPhase, before any other postInstall # nested nix/store happens immediately after the installPhase, before any other postInstall
# hooks run, this needs to be run in an override of `mkDerivation` and not in a setup hook. # hooks run, this needs to be run in an override of `mkDerivation` and not in a setup hook.
{ {
lib, lib,
stdenv, stdenv,
postgresql, postgresql,
nix-update-script, nix-update-script,
}: }: args: let
buildPostgresqlExtension = finalAttrs: {enableUpdateScript ? true, ...} @ prevAttrs: {
passthru =
prevAttrs.passthru
or {}
// lib.optionalAttrs enableUpdateScript {
updateScript =
prevAttrs.passthru.updateScript
or (nix-update-script (
lib.optionalAttrs (lib.hasInfix "unstable" prevAttrs.version) {
extraArgs = ["--version=branch"];
}
));
};
args: buildInputs = [postgresql] ++ prevAttrs.buildInputs or [];
let installFlags =
buildPostgresqlExtension = [
finalAttrs:
{
enableUpdateScript ? true,
...
}@prevAttrs:
{
passthru =
prevAttrs.passthru or { }
// lib.optionalAttrs enableUpdateScript {
updateScript =
prevAttrs.passthru.updateScript or (nix-update-script (
lib.optionalAttrs (lib.hasInfix "unstable" prevAttrs.version) {
extraArgs = [ "--version=branch" ];
}
));
};
buildInputs = [ postgresql ] ++ prevAttrs.buildInputs or [ ];
installFlags = [
"DESTDIR=${placeholder "out"}" "DESTDIR=${placeholder "out"}"
] ++ prevAttrs.installFlags or [ ]; ]
++ prevAttrs.installFlags or [];
postInstall = postInstall =
'' ''
# DESTDIR + pg_config install the files into # DESTDIR + pg_config install the files into
# /nix/store/<extension>/nix/store/<postgresql>/... # /nix/store/<extension>/nix/store/<postgresql>/...
# We'll now remove the /nix/store/<postgresql> part: # We'll now remove the /nix/store/<postgresql> part:
if [[ -d "$out${postgresql}" ]]; then if [[ -d "$out${postgresql}" ]]; then
cp -alt "$out" "$out${postgresql}"/* cp -alt "$out" "$out${postgresql}"/*
rm -r "$out${postgresql}" rm -r "$out${postgresql}"
fi fi
if [[ -d "$out${postgresql.dev}" ]]; then if [[ -d "$out${postgresql.dev}" ]]; then
mkdir -p "''${dev:-$out}" mkdir -p "''${dev:-$out}"
cp -alt "''${dev:-$out}" "$out${postgresql.dev}"/* cp -alt "''${dev:-$out}" "$out${postgresql.dev}"/*
rm -r "$out${postgresql.dev}" rm -r "$out${postgresql.dev}"
fi fi
if [[ -d "$out${postgresql.lib}" ]]; then if [[ -d "$out${postgresql.lib}" ]]; then
mkdir -p "''${lib:-$out}" mkdir -p "''${lib:-$out}"
cp -alt "''${lib:-$out}" "$out${postgresql.lib}"/* cp -alt "''${lib:-$out}" "$out${postgresql.lib}"/*
rm -r "$out${postgresql.lib}" rm -r "$out${postgresql.lib}"
fi fi
if [[ -d "$out${postgresql.doc}" ]]; then if [[ -d "$out${postgresql.doc}" ]]; then
mkdir -p "''${doc:-$out}" mkdir -p "''${doc:-$out}"
cp -alt "''${doc:-$out}" "$out${postgresql.doc}"/* cp -alt "''${doc:-$out}" "$out${postgresql.doc}"/*
rm -r "$out${postgresql.doc}" rm -r "$out${postgresql.doc}"
fi fi
if [[ -d "$out${postgresql.man}" ]]; then if [[ -d "$out${postgresql.man}" ]]; then
mkdir -p "''${man:-$out}" mkdir -p "''${man:-$out}"
cp -alt "''${man:-$out}" "$out${postgresql.man}"/* cp -alt "''${man:-$out}" "$out${postgresql.man}"/*
rm -r "$out${postgresql.man}" rm -r "$out${postgresql.man}"
fi fi
# In some cases (postgis) parts of the install script # In some cases (postgis) parts of the install script
# actually work "OK", before we add DESTDIR, so some # actually work "OK", before we add DESTDIR, so some
# files end up in # files end up in
# /nix/store/<extension>/nix/store/<extension>/... # /nix/store/<extension>/nix/store/<extension>/...
if [[ -d "$out$out" ]]; then if [[ -d "$out$out" ]]; then
cp -alt "$out" "$out$out"/* cp -alt "$out" "$out$out"/*
rm -r "$out$out" rm -r "$out$out"
fi fi
if [[ -d "$out/nix/store" ]]; then if [[ -d "$out/nix/store" ]]; then
if ! rmdir "$out/nix/store" "$out/nix"; then if ! rmdir "$out/nix/store" "$out/nix"; then
find "$out/nix" find "$out/nix"
nixErrorLog 'Found left-overs in $out/nix/store, make sure to move them into $out properly.' nixErrorLog 'Found left-overs in $out/nix/store, make sure to move them into $out properly.'
exit 1 exit 1
fi fi
fi fi
'' ''
+ prevAttrs.postInstall or ""; + prevAttrs.postInstall or "";
}; };
in in
stdenv.mkDerivation (lib.extends buildPostgresqlExtension (lib.toFunction args)) stdenv.mkDerivation (lib.extends buildPostgresqlExtension (lib.toFunction args))

364
flake.nix
View File

@@ -10,24 +10,31 @@
}; };
}; };
outputs = { self, nixpkgs, rust-overlay }: outputs = {
let self,
nixpkgs,
rust-overlay,
}: let
lib = nixpkgs.lib; lib = nixpkgs.lib;
recursiveUpdate = lib.recursiveUpdate; recursiveUpdate = lib.recursiveUpdate;
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ]; supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin"];
forSpecSystemsWithPkgs = supportedSystems: pkgOverlays: f: forSpecSystemsWithPkgs = supportedSystems: pkgOverlays: f:
builtins.foldl' (acc: system: builtins.foldl' (
let acc: system: let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = pkgOverlays; overlays = pkgOverlays;
}; };
systemOutputs = f { system = system; pkgs = pkgs; }; systemOutputs = f {
system = system;
pkgs = pkgs;
};
in in
recursiveUpdate acc systemOutputs recursiveUpdate acc systemOutputs
) {} supportedSystems; ) {}
supportedSystems;
forAllSystemsWithPkgs = pkgOverlays: f: forSpecSystemsWithPkgs supportedSystems pkgOverlays f; forAllSystemsWithPkgs = pkgOverlays: f: forSpecSystemsWithPkgs supportedSystems pkgOverlays f;
@@ -36,96 +43,97 @@
parseEnv = import ./parse-env.nix; parseEnv = import ./parse-env.nix;
dotEnv = builtins.getEnv "DOTENV"; dotEnv = builtins.getEnv "DOTENV";
minorEnvironment = minorEnvironment =
if dotEnv != "" then if dotEnv != ""
if builtins.pathExists dotEnv then then
parseEnv dotEnv if builtins.pathExists dotEnv
else then parseEnv dotEnv
throw "${dotEnv} file not exist" else throw "${dotEnv} file not exist"
else else if builtins.pathExists ./.env
if builtins.pathExists ./.env then then parseEnv ./.env
parseEnv ./.env else {};
else
{};
in in
forAllSystemsWithPkgs [ (import rust-overlay) ] ({ system, pkgs }: forAllSystemsWithPkgs [(import rust-overlay)] ({
{ system,
packages.${system} = pkgs,
let }: {
rust = { packages.${system} = let
nativeBuildInputs = [ rust = {
pkgs.pkgsBuildHost.rust-bin.stable."1.81.0".default nativeBuildInputs = [
pkgs.pkg-config pkgs.pkgsBuildHost.rust-bin.stable."1.81.0".default
]; pkgs.pkg-config
commonArgs = { ];
inherit (self.lib) cargoToml; commonArgs = {
inherit (rust) nativeBuildInputs; inherit (self.lib) cargoToml;
}; inherit (rust) nativeBuildInputs;
};
};
in {
nvim-alias = pkgs.callPackage ./package/nvim-alias.nix {};
bolt-unpack = pkgs.callPackage ./package/bolt-unpack.nix {};
nvim-pager = pkgs.callPackage ./package/nvim-pager.nix {};
printobstacle = pkgs.callPackage ./package/printobstacle.nix {};
printprogress = pkgs.callPackage ./package/printprogress.nix {};
colorize = pkgs.callPackage ./package/colorize.nix {};
github.gh-tl = pkgs.callPackage ./package/github/gh-tl.nix {};
supabase-with-env-collection = pkgs.callPackage ./package/supabase-with-env-collection.nix {};
migration-name = pkgs.callPackage ./package/migration-name.nix {};
prettify-log = pkgs.callPackage ./package/prettify-log/default.nix rust.commonArgs;
pg = {
pg-from = pkgs.callPackage ./package/postgres/pg-from/default.nix rust.commonArgs;
pg-migration = pkgs.callPackage ./package/postgres/pg-migration/default.nix rust.commonArgs;
};
}; };
in
{ devShells.${system} = let
nvim-alias = pkgs.callPackage ./package/nvim-alias.nix {}; shells = self.devShells.${system};
bolt-unpack = pkgs.callPackage ./package/bolt-unpack.nix {}; in {
nvim-pager = pkgs.callPackage ./package/nvim-pager.nix {}; default = pkgs.mkShell {
printobstacle = pkgs.callPackage ./package/printobstacle.nix {}; buildInputs =
printprogress = pkgs.callPackage ./package/printprogress.nix {}; (with self.packages.${system}; [
colorize = pkgs.callPackage ./package/colorize.nix {}; nvim-alias
github.gh-tl = pkgs.callPackage ./package/github/gh-tl.nix {}; #prettify-log
supabase-with-env-collection = pkgs.callPackage ./package/supabase-with-env-collection.nix {}; nvim-pager
migration-name = pkgs.callPackage ./package/migration-name.nix {}; ])
prettify-log = pkgs.callPackage ./package/prettify-log/default.nix rust.commonArgs; ++ (with pkgs; [
pg = { git
pg-from = pkgs.callPackage ./package/postgres/pg-from/default.nix rust.commonArgs; jq
pg-migration = pkgs.callPackage ./package/postgres/pg-migration/default.nix rust.commonArgs; yq-go
curl
]);
# environment
PAGER = "${self.packages.${system}.nvim-pager}/bin/pager";
};
rust = let
rustToolchain =
if builtins.pathExists ./rust-toolchain.toml
then pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml
else pkgs.pkgsBuildHost.rust-bin.stable."1.81.0".default;
in
shells.default
// (pkgs.mkShell {
nativeBuildInputs = [
rustToolchain
pkgs.pkg-config
];
});
haskell =
shells.default
// (pkgs.mkShell {
buildInputs = [pkgs.stack];
});
}; };
};
devShells.${system} = nixosModules.${system} = {
let "preset.default" = {
shells = self.devShells.${system}; pkgs,
in modulesPath,
{ ...
default = pkgs.mkShell { }: {
buildInputs = (with self.packages.${system}; [
nvim-alias
#prettify-log
nvim-pager
]) ++ (with pkgs; [
git
jq
yq-go
curl
]);
# environment
PAGER="${self.packages.${system}.nvim-pager}/bin/pager";
};
rust =
let
rustToolchain = if builtins.pathExists ./rust-toolchain.toml then
pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml
else
pkgs.pkgsBuildHost.rust-bin.stable."1.81.0".default;
in
shells.default //
(pkgs.mkShell {
nativeBuildInputs = [
rustToolchain
pkgs.pkg-config
];
});
haskell = shells.default // (pkgs.mkShell {
buildInputs = [ pkgs.stack ];
});
};
nixosModules.${system} = {
"preset.default" = { pkgs, modulesPath, ... }: {
imports = [ imports = [
(modulesPath + "/profiles/qemu-guest.nix") (modulesPath + "/profiles/qemu-guest.nix")
]; ];
services.getty.autologinUser = "root"; services.getty.autologinUser = "root";
@@ -133,18 +141,22 @@
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;
# Enable flakes and new 'nix' command # Enable flakes and new 'nix' command
nix.settings.experimental-features = "nix-command flakes"; nix.settings.experimental-features = "nix-command flakes";
virtualisation.vmVariant.virtualisation = { virtualisation.vmVariant.virtualisation = {
qemu.options = [ qemu.options = [
"-nographic" "-nographic"
"-display curses" "-display curses"
"-append console=ttyS0" "-append console=ttyS0"
"-serial mon:stdio" "-serial mon:stdio"
"-vga qxl" "-vga qxl"
]; ];
forwardPorts = [ forwardPorts = [
{ from = "host"; host.port = 40500; guest.port = 22; } {
from = "host";
host.port = 40500;
guest.port = 22;
}
]; ];
}; };
@@ -157,30 +169,31 @@
networking.firewall = { networking.firewall = {
enable = true; enable = true;
allowedTCPPorts = [ ]; allowedTCPPorts = [];
}; };
environment = { environment = {
defaultPackages = []; defaultPackages = [];
systemPackages = (with pkgs; [ systemPackages =
curl (with pkgs; [
neovim curl
yq-go neovim
jq yq-go
htop-vim jq
]) ++ (with self.packages.${system}; [ htop-vim
prettify-log ])
nvim-pager ++ (with self.packages.${system}; [
]); prettify-log
variables = { nvim-pager
PAGER=with self.packages.${system}; "${nvim-pager}/bin/pager"; ]);
}; variables = {
}; PAGER = with self.packages.${system}; "${nvim-pager}/bin/pager";
};
};
system.stateVersion = "24.11"; system.stateVersion = "24.11";
}; };
"hardware.hetzner" = { ... }: { "hardware.hetzner" = {...}: {
boot.loader.grub.device = "/dev/sda"; boot.loader.grub.device = "/dev/sda";
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules = [
"ata_piix" "ata_piix"
@@ -188,69 +201,76 @@
"xen_blkfront" "xen_blkfront"
"vmw_pvscsi" "vmw_pvscsi"
]; ];
boot.initrd.kernelModules = [ "nvme" ]; boot.initrd.kernelModules = ["nvme"];
fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; }; fileSystems."/" = {
}; device = "/dev/sda1";
}; fsType = "ext4";
}) // {
overlays.default =
final: prev: (
let
version = "1.6.1";
buildHttpExt = versionSuffix: let
buildPostgresqlExtension =
prev.callPackage (import (builtins.path {
name = "extension-builder";
path = ./buildPostgresqlExtension.nix;
})) {
postgresql = prev."postgresql_${versionSuffix}";
};
in buildPostgresqlExtension {
pname = "http";
inherit version;
src = prev.fetchFromGitHub {
owner = "pramsey";
repo = "pgsql-http";
rev = "v${version}";
hash = "sha256-C8eqi0q1dnshUAZjIsZFwa5FTYc7vmATF3vv2CReWPM=";
}; };
nativeBuildInputs = with prev; [ pkg-config curl ];
}; };
in };
{ })
hectic = self.packages.${prev.system}; // {
postgresql_17 = prev.postgresql_17 // { pkgs = prev.postgresql_17.pkgs // { http = buildHttpExt "17"; }; }; overlays.default = final: prev: (
postgresql_16 = prev.postgresql_16 // { pkgs = prev.postgresql_16.pkgs // { http = buildHttpExt "16"; }; }; let
postgresql_15 = prev.postgresql_15 // { pkgs = prev.postgresql_15.pkgs // { http = buildHttpExt "15"; }; }; version = "1.6.1";
postgresql_14 = prev.postgresql_14 // { pkgs = prev.postgresql_14.pkgs // { http = buildHttpExt "14"; }; }; buildHttpExt = versionSuffix: let
}); buildPostgresqlExtension =
lib = { prev.callPackage (import (builtins.path {
# -- For all systems -- name = "extension-builder";
inherit dotEnv minorEnvironment parseEnv forAllSystemsWithPkgs forSpecSystemsWithPkgs; path = ./buildPostgresqlExtension.nix;
})) {
postgresql = prev."postgresql_${versionSuffix}";
};
in
buildPostgresqlExtension {
pname = "http";
inherit version;
src = prev.fetchFromGitHub {
owner = "pramsey";
repo = "pgsql-http";
rev = "v${version}";
hash = "sha256-C8eqi0q1dnshUAZjIsZFwa5FTYc7vmATF3vv2CReWPM=";
};
nativeBuildInputs = with prev; [pkg-config curl];
};
in {
hectic = self.packages.${prev.system};
postgresql_17 = prev.postgresql_17 // {pkgs = prev.postgresql_17.pkgs // {http = buildHttpExt "17";};};
postgresql_16 = prev.postgresql_16 // {pkgs = prev.postgresql_16.pkgs // {http = buildHttpExt "16";};};
postgresql_15 = prev.postgresql_15 // {pkgs = prev.postgresql_15.pkgs // {http = buildHttpExt "15";};};
postgresql_14 = prev.postgresql_14 // {pkgs = prev.postgresql_14.pkgs // {http = buildHttpExt "14";};};
}
);
lib = {
# -- For all systems --
inherit dotEnv minorEnvironment parseEnv forAllSystemsWithPkgs forSpecSystemsWithPkgs;
makeEnvironment = envVars: makeEnvironment = envVars:
builtins.listToAttrs builtins.listToAttrs
(map (name: { inherit name; value = self.lib.getEnv name; }) envVars); (map (name: {
inherit name;
value = self.lib.getEnv name;
})
envVars);
# -- Env processing -- # -- Env processing --
getEnv = varName: let getEnv = varName: let
var = builtins.getEnv varName; var = builtins.getEnv varName;
in in
if var != "" then if var != ""
var then var
else if minorEnvironment ? varName then else if minorEnvironment ? varName
minorEnvironment."${varName}" then minorEnvironment."${varName}"
else else throw (envErrorMessage varName);
throw (envErrorMessage varName);
# -- Cargo.toml -- # -- Cargo.toml --
cargoToml = src: (builtins.fromTOML (builtins.readFile "${src}/Cargo.toml")); cargoToml = src: (builtins.fromTOML (builtins.readFile "${src}/Cargo.toml"));
ssh.keys = { ssh.keys = {
hetzner-test = { hetzner-test = {
yukkop = ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ8scy1tv6zfXX6xyaukhO/fsZwif5rC89DvXNc6XxOf''; yukkop = ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ8scy1tv6zfXX6xyaukhO/fsZwif5rC89DvXNc6XxOf'';
}; };
};
}; };
}; };
};
} }

View File

@@ -1,12 +1,11 @@
{ pkgs, ... }: {pkgs, ...}:
pkgs.writeShellScriptBin "unpack" '' pkgs.writeShellScriptBin "unpack" ''
#!/usr/bin/env sh #!/usr/bin/env sh
set -e set -e
# Determine the Git repository root or default to current directory # Determine the Git repository root or default to current directory
GIT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo .)" GIT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo .)"
SILENT=false SILENT=false
AUTO_YES=false AUTO_YES=false
ZIPFILE= ZIPFILE=
@@ -16,7 +15,7 @@ pkgs.writeShellScriptBin "unpack" ''
# Check if the user is inside the 'web' directory or any of its subdirectories # Check if the user is inside the 'web' directory or any of its subdirectories
RELATIVE_PATH="$(realpath --relative-to="$GIT_ROOT" "$ORIGINAL_DIR")" RELATIVE_PATH="$(realpath --relative-to="$GIT_ROOT" "$ORIGINAL_DIR")"
IN_WEB=false IN_WEB=false
if [ "$RELATIVE_PATH" = "web" ] || echo "$RELATIVE_PATH" | grep -qE '^web(/|$)'; then if [ "$RELATIVE_PATH" = "web" ] || echo "$RELATIVE_PATH" | grep -qE '^web(/|$)'; then
IN_WEB=true IN_WEB=true

View File

@@ -1,4 +1,4 @@
{ pkgs, ... }: {pkgs, ...}:
pkgs.writeShellScriptBin "colorize" '' pkgs.writeShellScriptBin "colorize" ''
awk ' awk '
BEGIN { BEGIN {

View File

@@ -1,5 +1,5 @@
# FIXME: very unstable (on every request opens pager) but works somehow # FIXME: very unstable (on every request opens pager) but works somehow
{ pkgs, ... }: {pkgs, ...}:
pkgs.writeShellScriptBin "gh-tl" '' pkgs.writeShellScriptBin "gh-tl" ''
set -euo pipefail set -euo pipefail
@@ -54,7 +54,7 @@ pkgs.writeShellScriptBin "gh-tl" ''
# Fetch all labels from the source repository with pagination # Fetch all labels from the source repository with pagination
echo "Fetching labels from $SOURCE_REPO..." echo "Fetching labels from $SOURCE_REPO..."
LABELS_JSON=$(gh api -H "Accept: application/vnd.github.v3+json" \ LABELS_JSON=$(gh api -H "Accept: application/vnd.github.v3+json" \
/repos/"$SOURCE_REPO"/labels --paginate | jq -s 'add') /repos/"$SOURCE_REPO"/labels --paginate | jq -s 'add')

View File

@@ -1,4 +1,4 @@
{ pkgs, ... }: {pkgs, ...}:
pkgs.writeShellScriptBin "migration-name" '' pkgs.writeShellScriptBin "migration-name" ''
curl --silent https://raw.githubusercontent.com/dwyl/english-words/master/words.txt | shuf -n2 | tr '\n' '_' | sed 's/_$//' curl --silent https://raw.githubusercontent.com/dwyl/english-words/master/words.txt | shuf -n2 | tr '\n' '_' | sed 's/_$//'
'' ''

View File

@@ -1,28 +1,28 @@
# necessary to load every time .nvimrc # necessary to load every time .nvimrc
# makes some magic to shading nvim but still uses nvim that shaded # makes some magic to shading nvim but still uses nvim that shaded
{ pkgs, ... }: {pkgs, ...}:
pkgs.writeShellScriptBin "nvim" '' pkgs.writeShellScriptBin "nvim" ''
# Source .env file # Source .env file
if [ -f .env ]; then if [ -f .env ]; then
set -a set -a
. .env . .env
set +a set +a
fi fi
# Get the directory of this script # Get the directory of this script
SCRIPT_DIR=$(dirname "$(readlink -f "$0")") SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
# Remove the script's directory from PATH to avoid recursion
PATH=$(echo "$PATH" | tr ':' '\n' | grep -v "$SCRIPT_DIR" | paste -sd ':' -)
# Find the system's nvim
SYSTEM_NVIM=$(command -v nvim)
if [ -z "$SYSTEM_NVIM" ]; then
echo "Error: nvim not found in PATH" >&2
exit 1
fi
# Execute the system's nvim with your custom arguments # Remove the script's directory from PATH to avoid recursion
exec "$SYSTEM_NVIM" --cmd 'lua vim.o.exrc = true' "$@" PATH=$(echo "$PATH" | tr ':' '\n' | grep -v "$SCRIPT_DIR" | paste -sd ':' -)
# Find the system's nvim
SYSTEM_NVIM=$(command -v nvim)
if [ -z "$SYSTEM_NVIM" ]; then
echo "Error: nvim not found in PATH" >&2
exit 1
fi
# Execute the system's nvim with your custom arguments
exec "$SYSTEM_NVIM" --cmd 'lua vim.o.exrc = true' "$@"
'' ''

View File

@@ -1,14 +1,14 @@
{ pkgs, ... }: {pkgs, ...}:
pkgs.writeShellScriptBin "pager" '' pkgs.writeShellScriptBin "pager" ''
nvim -R --clean -c 'set buftype=nofile' -c 'nnoremap q :q!<CR>' -c 'set nowrap' \ nvim -R --clean -c 'set buftype=nofile' -c 'nnoremap q :q!<CR>' -c 'set nowrap' \
-c 'set runtimepath^=${pkgs.vimPlugins.vim-plugin-AnsiEsc}' \ -c 'set runtimepath^=${pkgs.vimPlugins.vim-plugin-AnsiEsc}' \
-c 'runtime! plugin/*.vim' -c 'AnsiEsc' - -c 'runtime! plugin/*.vim' -c 'AnsiEsc' -
# ^^^^^^^^^^^^^^^^^^^^ # ^^^^^^^^^^^^^^^^^^^^
# Prevents Neovim from treating the buffer as a file # Prevents Neovim from treating the buffer as a file
# ^^^^^^^^^^^^^^^^^^^^ # ^^^^^^^^^^^^^^^^^^^^
# Makes 'q' quit Neovim immediately # Makes 'q' quit Neovim immediately
# ^^^^^^^^^^^ # ^^^^^^^^^^^
# Disables text wrapping # Disables text wrapping
# ^^^^^^^^ # ^^^^^^^^
# Enables ANSI color interpretation # Enables ANSI color interpretation
'' ''

View File

@@ -1,15 +1,19 @@
{ cargoToml, nativeBuildInputs, pkgs, ... }: {
let cargoToml,
nativeBuildInputs,
pkgs,
...
}: let
src = ./.; src = ./.;
cargo = cargoToml src; cargo = cargoToml src;
in in
pkgs.rustPlatform.buildRustPackage { pkgs.rustPlatform.buildRustPackage {
pname = cargo.package.name; pname = cargo.package.name;
version = cargo.package.version; version = cargo.package.version;
inherit nativeBuildInputs src; inherit nativeBuildInputs src;
cargoLock.lockFile = ./Cargo.lock; cargoLock.lockFile = ./Cargo.lock;
doCheck = true; doCheck = true;
} }

View File

@@ -1,15 +1,19 @@
{ cargoToml, nativeBuildInputs, pkgs, ... }: {
let cargoToml,
nativeBuildInputs,
pkgs,
...
}: let
src = ./.; src = ./.;
cargo = cargoToml src; cargo = cargoToml src;
in in
pkgs.rustPlatform.buildRustPackage { pkgs.rustPlatform.buildRustPackage {
pname = cargo.package.name; pname = cargo.package.name;
version = cargo.package.version; version = cargo.package.version;
inherit nativeBuildInputs src; inherit nativeBuildInputs src;
cargoLock.lockFile = ./Cargo.lock; cargoLock.lockFile = ./Cargo.lock;
doCheck = true; doCheck = true;
} }

View File

@@ -1,15 +1,19 @@
{ cargoToml, nativeBuildInputs, pkgs, ... }: {
let cargoToml,
nativeBuildInputs,
pkgs,
...
}: let
src = ./.; src = ./.;
cargo = cargoToml src; cargo = cargoToml src;
in in
pkgs.rustPlatform.buildRustPackage { pkgs.rustPlatform.buildRustPackage {
pname = cargo.package.name; pname = cargo.package.name;
version = cargo.package.version; version = cargo.package.version;
inherit nativeBuildInputs src; inherit nativeBuildInputs src;
cargoLock.lockFile = ./Cargo.lock; cargoLock.lockFile = ./Cargo.lock;
doCheck = true; doCheck = true;
} }

View File

@@ -1,7 +1,6 @@
{ pkgs, ... }: {pkgs, ...}: let
let
name = "printobstacle"; name = "printobstacle";
in in
pkgs.writeShellScriptBin "${name}" '' pkgs.writeShellScriptBin "${name}" ''
printf "%s%s%s\n" "''${RED}" "$*" "''${RESET}" printf "%s%s%s\n" "''${RED}" "$*" "''${RESET}"
'' ''

View File

@@ -1,7 +1,6 @@
{ pkgs, ... }: {pkgs, ...}: let
let
name = "printprogress"; name = "printprogress";
in in
pkgs.writeShellScriptBin "${name}" '' pkgs.writeShellScriptBin "${name}" ''
printf "%s%s%s\n" "''${YELLOW}" "$*" "''${RESET}" printf "%s%s%s\n" "''${YELLOW}" "$*" "''${RESET}"
'' ''

View File

@@ -1,14 +1,14 @@
{ pkgs, ... }: {pkgs, ...}:
pkgs.writeShellScriptBin "supabase" '' pkgs.writeShellScriptBin "supabase" ''
# Get the root of the repository # Get the root of the repository
GIT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo .)" GIT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo .)"
# Source .env from root of the repo if it exists # Source .env from root of the repo if it exists
if [ -f "$GIT_ROOT/.env" ]; then if [ -f "$GIT_ROOT/.env" ]; then
set -a set -a
. "$GIT_ROOT/.env" . "$GIT_ROOT/.env"
set +a set +a
fi fi
${pkgs.supabase-cli}/bin/supabase --workdir "$GIT_ROOT/web" $@ ${pkgs.supabase-cli}/bin/supabase --workdir "$GIT_ROOT/web" $@
'' ''