From e1c484b1c00a7e99309c9ea1817ce9a434773ba8 Mon Sep 17 00:00:00 2001 From: zerosummed Date: Fri, 14 Feb 2025 21:06:51 +0300 Subject: [PATCH] style: format (alejandra) --- buildPostgresqlExtension.nix | 141 ++++----- flake.nix | 364 ++++++++++++---------- package/bolt-unpack.nix | 7 +- package/colorize.nix | 2 +- package/github/gh-tl.nix | 4 +- package/migration-name.nix | 4 +- package/nvim-alias.nix | 46 +-- package/nvim-pager.nix | 24 +- package/postgres/pg-from/default.nix | 24 +- package/postgres/pg-migration/default.nix | 24 +- package/prettify-log/default.nix | 24 +- package/printobstacle.nix | 11 +- package/printprogress.nix | 9 +- package/supabase-with-env-collection.nix | 20 +- 14 files changed, 363 insertions(+), 341 deletions(-) diff --git a/buildPostgresqlExtension.nix b/buildPostgresqlExtension.nix index 03797b6..479ee1a 100644 --- a/buildPostgresqlExtension.nix +++ b/buildPostgresqlExtension.nix @@ -55,93 +55,86 @@ # 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 # hooks run, this needs to be run in an override of `mkDerivation` and not in a setup hook. - { lib, stdenv, postgresql, 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 - 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 = [ + installFlags = + [ "DESTDIR=${placeholder "out"}" - ] ++ prevAttrs.installFlags or [ ]; + ] + ++ prevAttrs.installFlags or []; - postInstall = - '' - # DESTDIR + pg_config install the files into - # /nix/store//nix/store//... - # We'll now remove the /nix/store/ part: - if [[ -d "$out${postgresql}" ]]; then - cp -alt "$out" "$out${postgresql}"/* - rm -r "$out${postgresql}" - fi + postInstall = + '' + # DESTDIR + pg_config install the files into + # /nix/store//nix/store//... + # We'll now remove the /nix/store/ part: + if [[ -d "$out${postgresql}" ]]; then + cp -alt "$out" "$out${postgresql}"/* + rm -r "$out${postgresql}" + fi - if [[ -d "$out${postgresql.dev}" ]]; then - mkdir -p "''${dev:-$out}" - cp -alt "''${dev:-$out}" "$out${postgresql.dev}"/* - rm -r "$out${postgresql.dev}" - fi + if [[ -d "$out${postgresql.dev}" ]]; then + mkdir -p "''${dev:-$out}" + cp -alt "''${dev:-$out}" "$out${postgresql.dev}"/* + rm -r "$out${postgresql.dev}" + fi - if [[ -d "$out${postgresql.lib}" ]]; then - mkdir -p "''${lib:-$out}" - cp -alt "''${lib:-$out}" "$out${postgresql.lib}"/* - rm -r "$out${postgresql.lib}" - fi + if [[ -d "$out${postgresql.lib}" ]]; then + mkdir -p "''${lib:-$out}" + cp -alt "''${lib:-$out}" "$out${postgresql.lib}"/* + rm -r "$out${postgresql.lib}" + fi - if [[ -d "$out${postgresql.doc}" ]]; then - mkdir -p "''${doc:-$out}" - cp -alt "''${doc:-$out}" "$out${postgresql.doc}"/* - rm -r "$out${postgresql.doc}" - fi + if [[ -d "$out${postgresql.doc}" ]]; then + mkdir -p "''${doc:-$out}" + cp -alt "''${doc:-$out}" "$out${postgresql.doc}"/* + rm -r "$out${postgresql.doc}" + fi - if [[ -d "$out${postgresql.man}" ]]; then - mkdir -p "''${man:-$out}" - cp -alt "''${man:-$out}" "$out${postgresql.man}"/* - rm -r "$out${postgresql.man}" - fi + if [[ -d "$out${postgresql.man}" ]]; then + mkdir -p "''${man:-$out}" + cp -alt "''${man:-$out}" "$out${postgresql.man}"/* + rm -r "$out${postgresql.man}" + fi - # In some cases (postgis) parts of the install script - # actually work "OK", before we add DESTDIR, so some - # files end up in - # /nix/store//nix/store//... - if [[ -d "$out$out" ]]; then - cp -alt "$out" "$out$out"/* - rm -r "$out$out" - fi + # In some cases (postgis) parts of the install script + # actually work "OK", before we add DESTDIR, so some + # files end up in + # /nix/store//nix/store//... + if [[ -d "$out$out" ]]; then + cp -alt "$out" "$out$out"/* + rm -r "$out$out" + fi - if [[ -d "$out/nix/store" ]]; then - if ! rmdir "$out/nix/store" "$out/nix"; then - find "$out/nix" - nixErrorLog 'Found left-overs in $out/nix/store, make sure to move them into $out properly.' - exit 1 - fi - fi - '' - + prevAttrs.postInstall or ""; - }; + if [[ -d "$out/nix/store" ]]; then + if ! rmdir "$out/nix/store" "$out/nix"; then + find "$out/nix" + nixErrorLog 'Found left-overs in $out/nix/store, make sure to move them into $out properly.' + exit 1 + fi + fi + '' + + prevAttrs.postInstall or ""; + }; in -stdenv.mkDerivation (lib.extends buildPostgresqlExtension (lib.toFunction args)) + stdenv.mkDerivation (lib.extends buildPostgresqlExtension (lib.toFunction args)) diff --git a/flake.nix b/flake.nix index d6df320..8389d65 100644 --- a/flake.nix +++ b/flake.nix @@ -10,24 +10,31 @@ }; }; - outputs = { self, nixpkgs, rust-overlay }: - let + outputs = { + self, + nixpkgs, + rust-overlay, + }: let lib = nixpkgs.lib; 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: - builtins.foldl' (acc: system: - let - pkgs = import nixpkgs { + builtins.foldl' ( + acc: system: let + pkgs = import nixpkgs { inherit system; overlays = pkgOverlays; }; - systemOutputs = f { system = system; pkgs = pkgs; }; + systemOutputs = f { + system = system; + pkgs = pkgs; + }; in recursiveUpdate acc systemOutputs - ) {} supportedSystems; + ) {} + supportedSystems; forAllSystemsWithPkgs = pkgOverlays: f: forSpecSystemsWithPkgs supportedSystems pkgOverlays f; @@ -36,96 +43,97 @@ parseEnv = import ./parse-env.nix; dotEnv = builtins.getEnv "DOTENV"; - minorEnvironment = - if dotEnv != "" then - if builtins.pathExists dotEnv then - parseEnv dotEnv - else - throw "${dotEnv} file not exist" - else - if builtins.pathExists ./.env then - parseEnv ./.env - else - {}; - + minorEnvironment = + if dotEnv != "" + then + if builtins.pathExists dotEnv + then parseEnv dotEnv + else throw "${dotEnv} file not exist" + else if builtins.pathExists ./.env + then parseEnv ./.env + else {}; in - forAllSystemsWithPkgs [ (import rust-overlay) ] ({ system, pkgs }: - { - packages.${system} = - let - rust = { - nativeBuildInputs = [ - pkgs.pkgsBuildHost.rust-bin.stable."1.81.0".default - pkgs.pkg-config - ]; - commonArgs = { - inherit (self.lib) cargoToml; - inherit (rust) nativeBuildInputs; - }; + forAllSystemsWithPkgs [(import rust-overlay)] ({ + system, + pkgs, + }: { + packages.${system} = let + rust = { + nativeBuildInputs = [ + pkgs.pkgsBuildHost.rust-bin.stable."1.81.0".default + pkgs.pkg-config + ]; + commonArgs = { + 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 - { - 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; + + devShells.${system} = let + shells = self.devShells.${system}; + in { + 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]; + }); }; - }; - devShells.${system} = - let - shells = self.devShells.${system}; - in - { - 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, ... }: { + nixosModules.${system} = { + "preset.default" = { + pkgs, + modulesPath, + ... + }: { imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + (modulesPath + "/profiles/qemu-guest.nix") + ]; services.getty.autologinUser = "root"; @@ -133,18 +141,22 @@ users.defaultUserShell = pkgs.zsh; # Enable flakes and new 'nix' command - nix.settings.experimental-features = "nix-command flakes"; + nix.settings.experimental-features = "nix-command flakes"; virtualisation.vmVariant.virtualisation = { qemu.options = [ - "-nographic" + "-nographic" "-display curses" "-append console=ttyS0" "-serial mon:stdio" "-vga qxl" ]; forwardPorts = [ - { from = "host"; host.port = 40500; guest.port = 22; } + { + from = "host"; + host.port = 40500; + guest.port = 22; + } ]; }; @@ -157,30 +169,31 @@ networking.firewall = { enable = true; - allowedTCPPorts = [ ]; + allowedTCPPorts = []; }; - environment = { - defaultPackages = []; - systemPackages = (with pkgs; [ - curl - neovim - yq-go - jq - htop-vim - ]) ++ (with self.packages.${system}; [ - prettify-log - nvim-pager - ]); - variables = { - PAGER=with self.packages.${system}; "${nvim-pager}/bin/pager"; - }; - }; + environment = { + defaultPackages = []; + systemPackages = + (with pkgs; [ + curl + neovim + yq-go + jq + htop-vim + ]) + ++ (with self.packages.${system}; [ + prettify-log + nvim-pager + ]); + variables = { + PAGER = with self.packages.${system}; "${nvim-pager}/bin/pager"; + }; + }; - system.stateVersion = "24.11"; - }; - "hardware.hetzner" = { ... }: { + }; + "hardware.hetzner" = {...}: { boot.loader.grub.device = "/dev/sda"; boot.initrd.availableKernelModules = [ "ata_piix" @@ -188,69 +201,76 @@ "xen_blkfront" "vmw_pvscsi" ]; - boot.initrd.kernelModules = [ "nvme" ]; - 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="; + boot.initrd.kernelModules = ["nvme"]; + fileSystems."/" = { + device = "/dev/sda1"; + fsType = "ext4"; }; - 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; + }; + }) + // { + 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";};}; + 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: - builtins.listToAttrs - (map (name: { inherit name; value = self.lib.getEnv name; }) envVars); + makeEnvironment = envVars: + builtins.listToAttrs + (map (name: { + inherit name; + value = self.lib.getEnv name; + }) + envVars); - # -- Env processing -- - getEnv = varName: let - var = builtins.getEnv varName; - in - if var != "" then - var - else if minorEnvironment ? varName then - minorEnvironment."${varName}" - else - throw (envErrorMessage varName); + # -- Env processing -- + getEnv = varName: let + var = builtins.getEnv varName; + in + if var != "" + then var + else if minorEnvironment ? varName + then minorEnvironment."${varName}" + else throw (envErrorMessage varName); - # -- Cargo.toml -- - cargoToml = src: (builtins.fromTOML (builtins.readFile "${src}/Cargo.toml")); + # -- Cargo.toml -- + cargoToml = src: (builtins.fromTOML (builtins.readFile "${src}/Cargo.toml")); - ssh.keys = { + ssh.keys = { hetzner-test = { - yukkop = ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ8scy1tv6zfXX6xyaukhO/fsZwif5rC89DvXNc6XxOf''; - }; + yukkop = ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ8scy1tv6zfXX6xyaukhO/fsZwif5rC89DvXNc6XxOf''; + }; + }; }; }; - }; } diff --git a/package/bolt-unpack.nix b/package/bolt-unpack.nix index 4c10a26..ddc725e 100644 --- a/package/bolt-unpack.nix +++ b/package/bolt-unpack.nix @@ -1,12 +1,11 @@ -{ pkgs, ... }: - +{pkgs, ...}: pkgs.writeShellScriptBin "unpack" '' #!/usr/bin/env sh set -e # Determine the Git repository root or default to current directory GIT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo .)" - + SILENT=false AUTO_YES=false ZIPFILE= @@ -16,7 +15,7 @@ pkgs.writeShellScriptBin "unpack" '' # Check if the user is inside the 'web' directory or any of its subdirectories RELATIVE_PATH="$(realpath --relative-to="$GIT_ROOT" "$ORIGINAL_DIR")" - + IN_WEB=false if [ "$RELATIVE_PATH" = "web" ] || echo "$RELATIVE_PATH" | grep -qE '^web(/|$)'; then IN_WEB=true diff --git a/package/colorize.nix b/package/colorize.nix index 1546233..0e346c2 100644 --- a/package/colorize.nix +++ b/package/colorize.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{pkgs, ...}: pkgs.writeShellScriptBin "colorize" '' awk ' BEGIN { diff --git a/package/github/gh-tl.nix b/package/github/gh-tl.nix index bd70ad5..76ee913 100644 --- a/package/github/gh-tl.nix +++ b/package/github/gh-tl.nix @@ -1,5 +1,5 @@ # FIXME: very unstable (on every request opens pager) but works somehow -{ pkgs, ... }: +{pkgs, ...}: pkgs.writeShellScriptBin "gh-tl" '' set -euo pipefail @@ -54,7 +54,7 @@ pkgs.writeShellScriptBin "gh-tl" '' # Fetch all labels from the source repository with pagination echo "Fetching labels from $SOURCE_REPO..." - + LABELS_JSON=$(gh api -H "Accept: application/vnd.github.v3+json" \ /repos/"$SOURCE_REPO"/labels --paginate | jq -s 'add') diff --git a/package/migration-name.nix b/package/migration-name.nix index efe3dda..9ea5921 100644 --- a/package/migration-name.nix +++ b/package/migration-name.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{pkgs, ...}: 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/_$//' '' diff --git a/package/nvim-alias.nix b/package/nvim-alias.nix index 68fb097..e36b6ae 100644 --- a/package/nvim-alias.nix +++ b/package/nvim-alias.nix @@ -1,28 +1,28 @@ # necessary to load every time .nvimrc -# makes some magic to shading nvim but still uses nvim that shaded -{ pkgs, ... }: +# makes some magic to shading nvim but still uses nvim that shaded +{pkgs, ...}: pkgs.writeShellScriptBin "nvim" '' - # Source .env file - if [ -f .env ]; then - set -a - . .env - set +a - fi + # Source .env file + if [ -f .env ]; then + set -a + . .env + set +a + fi - # Get the directory of this script - 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 + # Get the directory of this script + SCRIPT_DIR=$(dirname "$(readlink -f "$0")") - # Execute the system's nvim with your custom arguments - exec "$SYSTEM_NVIM" --cmd 'lua vim.o.exrc = true' "$@" + # 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 + exec "$SYSTEM_NVIM" --cmd 'lua vim.o.exrc = true' "$@" '' diff --git a/package/nvim-pager.nix b/package/nvim-pager.nix index 6efc775..562d6e3 100644 --- a/package/nvim-pager.nix +++ b/package/nvim-pager.nix @@ -1,14 +1,14 @@ -{ pkgs, ... }: +{pkgs, ...}: pkgs.writeShellScriptBin "pager" '' - nvim -R --clean -c 'set buftype=nofile' -c 'nnoremap q :q!' -c 'set nowrap' \ - -c 'set runtimepath^=${pkgs.vimPlugins.vim-plugin-AnsiEsc}' \ - -c 'runtime! plugin/*.vim' -c 'AnsiEsc' - - # ^^^^^^^^^^^^^^^^^^^^ - # Prevents Neovim from treating the buffer as a file - # ^^^^^^^^^^^^^^^^^^^^ - # Makes 'q' quit Neovim immediately - # ^^^^^^^^^^^ - # Disables text wrapping - # ^^^^^^^^ - # Enables ANSI color interpretation + nvim -R --clean -c 'set buftype=nofile' -c 'nnoremap q :q!' -c 'set nowrap' \ + -c 'set runtimepath^=${pkgs.vimPlugins.vim-plugin-AnsiEsc}' \ + -c 'runtime! plugin/*.vim' -c 'AnsiEsc' - + # ^^^^^^^^^^^^^^^^^^^^ + # Prevents Neovim from treating the buffer as a file + # ^^^^^^^^^^^^^^^^^^^^ + # Makes 'q' quit Neovim immediately + # ^^^^^^^^^^^ + # Disables text wrapping + # ^^^^^^^^ + # Enables ANSI color interpretation '' diff --git a/package/postgres/pg-from/default.nix b/package/postgres/pg-from/default.nix index e38d168..266ae25 100644 --- a/package/postgres/pg-from/default.nix +++ b/package/postgres/pg-from/default.nix @@ -1,15 +1,19 @@ -{ cargoToml, nativeBuildInputs, pkgs, ... }: -let +{ + cargoToml, + nativeBuildInputs, + pkgs, + ... +}: let src = ./.; cargo = cargoToml src; in -pkgs.rustPlatform.buildRustPackage { - pname = cargo.package.name; - version = cargo.package.version; + pkgs.rustPlatform.buildRustPackage { + pname = cargo.package.name; + version = cargo.package.version; - inherit nativeBuildInputs src; + inherit nativeBuildInputs src; - cargoLock.lockFile = ./Cargo.lock; - - doCheck = true; -} + cargoLock.lockFile = ./Cargo.lock; + + doCheck = true; + } diff --git a/package/postgres/pg-migration/default.nix b/package/postgres/pg-migration/default.nix index e38d168..266ae25 100644 --- a/package/postgres/pg-migration/default.nix +++ b/package/postgres/pg-migration/default.nix @@ -1,15 +1,19 @@ -{ cargoToml, nativeBuildInputs, pkgs, ... }: -let +{ + cargoToml, + nativeBuildInputs, + pkgs, + ... +}: let src = ./.; cargo = cargoToml src; in -pkgs.rustPlatform.buildRustPackage { - pname = cargo.package.name; - version = cargo.package.version; + pkgs.rustPlatform.buildRustPackage { + pname = cargo.package.name; + version = cargo.package.version; - inherit nativeBuildInputs src; + inherit nativeBuildInputs src; - cargoLock.lockFile = ./Cargo.lock; - - doCheck = true; -} + cargoLock.lockFile = ./Cargo.lock; + + doCheck = true; + } diff --git a/package/prettify-log/default.nix b/package/prettify-log/default.nix index e38d168..266ae25 100644 --- a/package/prettify-log/default.nix +++ b/package/prettify-log/default.nix @@ -1,15 +1,19 @@ -{ cargoToml, nativeBuildInputs, pkgs, ... }: -let +{ + cargoToml, + nativeBuildInputs, + pkgs, + ... +}: let src = ./.; cargo = cargoToml src; in -pkgs.rustPlatform.buildRustPackage { - pname = cargo.package.name; - version = cargo.package.version; + pkgs.rustPlatform.buildRustPackage { + pname = cargo.package.name; + version = cargo.package.version; - inherit nativeBuildInputs src; + inherit nativeBuildInputs src; - cargoLock.lockFile = ./Cargo.lock; - - doCheck = true; -} + cargoLock.lockFile = ./Cargo.lock; + + doCheck = true; + } diff --git a/package/printobstacle.nix b/package/printobstacle.nix index 31fca93..9b5fe2d 100644 --- a/package/printobstacle.nix +++ b/package/printobstacle.nix @@ -1,7 +1,6 @@ -{ pkgs, ... }: -let +{pkgs, ...}: let name = "printobstacle"; -in -pkgs.writeShellScriptBin "${name}" '' - printf "%s%s%s\n" "''${RED}" "$*" "''${RESET}" -'' +in + pkgs.writeShellScriptBin "${name}" '' + printf "%s%s%s\n" "''${RED}" "$*" "''${RESET}" + '' diff --git a/package/printprogress.nix b/package/printprogress.nix index 5398118..dd84a95 100644 --- a/package/printprogress.nix +++ b/package/printprogress.nix @@ -1,7 +1,6 @@ -{ pkgs, ... }: -let +{pkgs, ...}: let name = "printprogress"; in -pkgs.writeShellScriptBin "${name}" '' - printf "%s%s%s\n" "''${YELLOW}" "$*" "''${RESET}" -'' + pkgs.writeShellScriptBin "${name}" '' + printf "%s%s%s\n" "''${YELLOW}" "$*" "''${RESET}" + '' diff --git a/package/supabase-with-env-collection.nix b/package/supabase-with-env-collection.nix index ef8d320..237344c 100644 --- a/package/supabase-with-env-collection.nix +++ b/package/supabase-with-env-collection.nix @@ -1,14 +1,14 @@ -{ pkgs, ... }: +{pkgs, ...}: pkgs.writeShellScriptBin "supabase" '' -# Get the root of the repository -GIT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo .)" + # Get the root of the repository + GIT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo .)" -# Source .env from root of the repo if it exists -if [ -f "$GIT_ROOT/.env" ]; then - set -a - . "$GIT_ROOT/.env" - set +a -fi + # Source .env from root of the repo if it exists + if [ -f "$GIT_ROOT/.env" ]; then + set -a + . "$GIT_ROOT/.env" + set +a + fi -${pkgs.supabase-cli}/bin/supabase --workdir "$GIT_ROOT/web" $@ + ${pkgs.supabase-cli}/bin/supabase --workdir "$GIT_ROOT/web" $@ ''