summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--flake.lock61
-rw-r--r--flake.nix68
-rw-r--r--version1
4 files changed, 134 insertions, 0 deletions
diff --git a/README.md b/README.md
index 146a3fa..3b6051f 100644
--- a/README.md
+++ b/README.md
@@ -46,3 +46,7 @@ On Arch Linux you can install the dependencies using `pacman(8)`:
$ make
$ sudo make install
+Alternatively you can run (or install) the experimental Nix flake.
+
+ $ nix run git+https://git.skreutz.com/temp-postgres.git -- <dbname> <username>
+
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..f1824cc
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,61 @@
+{
+ "nodes": {
+ "flake-parts": {
+ "inputs": {
+ "nixpkgs-lib": "nixpkgs-lib"
+ },
+ "locked": {
+ "lastModified": 1775087534,
+ "narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1775888245,
+ "narHash": "sha256-nwASzrRDD1JBEu/o8ekKYEXm/oJW6EMCzCRdrwcLe90=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "13043924aaa7375ce482ebe2494338e058282925",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-lib": {
+ "locked": {
+ "lastModified": 1774748309,
+ "narHash": "sha256-+U7gF3qxzwD5TZuANzZPeJTZRHS29OFQgkQ2kiTJBIQ=",
+ "owner": "nix-community",
+ "repo": "nixpkgs.lib",
+ "rev": "333c4e0545a6da976206c74db8773a1645b5870a",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "nixpkgs.lib",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-parts": "flake-parts",
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..bedd3af
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,68 @@
+{
+ description = "Run the PostgreSQL server off a temporary data directory";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ flake-parts.url = "github:hercules-ci/flake-parts";
+ };
+
+ outputs =
+ inputs@{
+ self,
+ nixpkgs,
+ flake-parts,
+ ...
+ }:
+ flake-parts.lib.mkFlake { inherit inputs; } {
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ "aarch64-darwin"
+ ];
+
+ perSystem =
+ {
+ self',
+ pkgs,
+ lib,
+ ...
+ }:
+ let
+ version = builtins.head (lib.splitString "\n" (builtins.readFile ./version));
+ revision = lib.toString (self.shortRev or self.dirtyShortRev or "unknown");
+ in
+ {
+ packages.default = self'.packages.temp-postgres;
+
+ packages.temp-postgres = pkgs.stdenv.mkDerivation {
+ name = "temp-postgres-${version}-${revision}";
+ version = "${version}-${revision}";
+ src = lib.cleanSource (
+ builtins.path {
+ path = ./.;
+ name = "temp-postgres";
+ }
+ );
+ nativeBuildInputs = [ pkgs.makeBinaryWrapper ];
+ 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 [ pkgs.postgresql ]}
+ '';
+ };
+
+ formatter = pkgs.nixfmt-tree;
+
+ devShells.default = pkgs.mkShell {
+ nativeBuildInputs = with pkgs; [
+ postgresql
+ ];
+ shellHook = ''
+ export FLAKE=${self}
+ '';
+ };
+ };
+ };
+}
diff --git a/version b/version
new file mode 100644
index 0000000..0ea3a94
--- /dev/null
+++ b/version
@@ -0,0 +1 @@
+0.2.0
Generated by cgit. See skreutz.com for my tech blog and contact information.