style: format (alejandra)
This commit is contained in:
@@ -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/<extension>/nix/store/<postgresql>/...
|
||||
# We'll now remove the /nix/store/<postgresql> 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/<extension>/nix/store/<postgresql>/...
|
||||
# We'll now remove the /nix/store/<postgresql> 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/<extension>/nix/store/<extension>/...
|
||||
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/<extension>/nix/store/<extension>/...
|
||||
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))
|
||||
|
||||
358
flake.nix
358
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
|
||||
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;
|
||||
|
||||
@@ -37,95 +44,96 @@
|
||||
|
||||
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
|
||||
{};
|
||||
|
||||
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,7 +141,7 @@
|
||||
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 = [
|
||||
@@ -144,7 +152,11 @@
|
||||
"-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'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{pkgs, ...}:
|
||||
pkgs.writeShellScriptBin "unpack" ''
|
||||
#!/usr/bin/env sh
|
||||
set -e
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{pkgs, ...}:
|
||||
pkgs.writeShellScriptBin "colorize" ''
|
||||
awk '
|
||||
BEGIN {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# FIXME: very unstable (on every request opens pager) but works somehow
|
||||
{ pkgs, ... }:
|
||||
{pkgs, ...}:
|
||||
pkgs.writeShellScriptBin "gh-tl" ''
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
@@ -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/_$//'
|
||||
''
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
# necessary to load every time .nvimrc
|
||||
# makes some magic to shading nvim but still uses nvim that shaded
|
||||
{ pkgs, ... }:
|
||||
{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")")
|
||||
# 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 ':' -)
|
||||
# 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)
|
||||
# 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
|
||||
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' "$@"
|
||||
# Execute the system's nvim with your custom arguments
|
||||
exec "$SYSTEM_NVIM" --cmd 'lua vim.o.exrc = true' "$@"
|
||||
''
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{ pkgs, ... }:
|
||||
{pkgs, ...}:
|
||||
pkgs.writeShellScriptBin "pager" ''
|
||||
nvim -R --clean -c 'set buftype=nofile' -c 'nnoremap q :q!<CR>' -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!<CR>' -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
|
||||
''
|
||||
|
||||
@@ -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;
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
|
||||
doCheck = true;
|
||||
}
|
||||
doCheck = true;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
|
||||
doCheck = true;
|
||||
}
|
||||
doCheck = true;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
|
||||
doCheck = true;
|
||||
}
|
||||
doCheck = true;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
{pkgs, ...}: let
|
||||
name = "printobstacle";
|
||||
in
|
||||
pkgs.writeShellScriptBin "${name}" ''
|
||||
printf "%s%s%s\n" "''${RED}" "$*" "''${RESET}"
|
||||
''
|
||||
pkgs.writeShellScriptBin "${name}" ''
|
||||
printf "%s%s%s\n" "''${RED}" "$*" "''${RESET}"
|
||||
''
|
||||
|
||||
@@ -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}"
|
||||
''
|
||||
|
||||
@@ -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" $@
|
||||
''
|
||||
|
||||
Reference in New Issue
Block a user