summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--default.nix4
-rw-r--r--flake.lock43
-rw-r--r--flake.nix21
-rw-r--r--overlay.nix4
-rw-r--r--temp-postgres.nix23
5 files changed, 95 insertions, 0 deletions
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..cffb0da
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,4 @@
+{ pkgs ? import <nixpkgs> {} }:
+{
+ temp-postgres = pkgs.callPackage ./temp-postgres.nix {};
+}
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..7d29dda
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,43 @@
+{
+ "nodes": {
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1713248628,
+ "narHash": "sha256-NLznXB5AOnniUtZsyy/aPWOk8ussTuePp2acb9U+ISA=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "5672bc9dbf9d88246ddab5ac454e82318d094bb8",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "nixpkgs": "nixpkgs",
+ "systems": "systems"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..386b141
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,21 @@
+# Derived from https://github.com/ryantm/agenix/blob/1381a759b205dff7a6818733118d02253340fd5e/flake.nix
+
+{
+ description = "A temporary PostgreSQL server";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ systems.url = "github:nix-systems/default";
+ };
+
+ outputs = { self, nixpkgs, systems }:
+ let
+ eachSystem = nixpkgs.lib.genAttrs (import systems);
+ in {
+ overlays.default = import ./overlay.nix;
+ packages = eachSystem (system: {
+ temp-postgres = nixpkgs.legacyPackages.${system}.callPackage ./temp-postgres.nix {};
+ default = self.packages.${system}.temp-postgres;
+ });
+ };
+}
diff --git a/overlay.nix b/overlay.nix
new file mode 100644
index 0000000..a596a97
--- /dev/null
+++ b/overlay.nix
@@ -0,0 +1,4 @@
+final: prev:
+{
+ temp-postgres = pkgs.callPackage ./temp-postgres.nix {}
+}
diff --git a/temp-postgres.nix b/temp-postgres.nix
new file mode 100644
index 0000000..3dc3338
--- /dev/null
+++ b/temp-postgres.nix
@@ -0,0 +1,23 @@
+{ lib, stdenv, postgresql, makeBinaryWrapper }:
+stdenv.mkDerivation rec {
+ name = "temp-postgres-${version}";
+ version = "0.1";
+
+ src = ./.;
+
+ nativeBuildInputs = [
+ makeBinaryWrapper
+ ];
+
+ buildInputs = [
+ postgresql
+ ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp temp-postgres.sh $out/bin/temp-postgres
+ mkdir -p $out/man/man1
+ cp temp-postgres.1 $out/man/man1/temp-postgres.1
+ wrapProgram $out/bin/temp-postgres --prefix PATH : ${lib.makeBinPath [ postgresql ]}
+ '';
+}
Generated by cgit. See skreutz.com for my tech blog and contact information.