Added most basic postgresql
Changelog: added Signed-off-by: GeorgeRaven <GeorgeRavenCommunity@pm.me>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
**result
|
||||
**result-*
|
||||
|
||||
2
containers/postgresql/.dockerignore
Normal file
2
containers/postgresql/.dockerignore
Normal file
@@ -0,0 +1,2 @@
|
||||
result
|
||||
Dockerfile
|
||||
31
containers/postgresql/Dockerfile
Normal file
31
containers/postgresql/Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
||||
# https://mitchellh.com/writing/nix-with-dockerfiles
|
||||
ARG GID="1000"
|
||||
ARG UID="1000"
|
||||
ARG SRC_DIR="."
|
||||
ARG PKG_DIR="/app"
|
||||
ARG NIX_STORE_DIR="/nix/store"
|
||||
|
||||
FROM harbor.deepcypher.me/docker.io/nixos/nix:2.32.1 AS builder
|
||||
ARG SRC_DIR \
|
||||
PKG_DIR
|
||||
WORKDIR ${PKG_DIR}
|
||||
COPY ${SRC_DIR} ${PKG_DIR}
|
||||
RUN nix \
|
||||
--extra-experimental-features "nix-command flakes" \
|
||||
--option filter-syscalls false \
|
||||
build
|
||||
RUN mkdir /tmp/nix-store-closure && \
|
||||
cp -R $(nix-store --query --requisites result/) /tmp/nix-store-closure && \
|
||||
ls -alh /tmp/nix-store-closure
|
||||
|
||||
FROM scratch
|
||||
ARG PKG_DIR \
|
||||
UID \
|
||||
GID
|
||||
ENV PKG_DIR=${PKG_DIR} \
|
||||
PATH=${PKG_DIR}/bin:${PATH}
|
||||
COPY --from=builder /tmp/nix-store-closure /nix/store
|
||||
COPY --from=builder ${PKG_DIR}/result ${PKG_DIR}
|
||||
USER ${UID}:${GID}
|
||||
WORKDIR ${PKG_DIR}
|
||||
CMD ["postgres"]
|
||||
@@ -1,23 +1,28 @@
|
||||
{
|
||||
description = "A flake to build and provide a postgresql environment";
|
||||
description = "Basic postgresql flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/release-25.05";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
# force subflake dependencies to follow nixpkgs version
|
||||
# of parent flake
|
||||
# flake-utils.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
...
|
||||
}@inputs:
|
||||
inputs.flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in
|
||||
{
|
||||
packages.postgresql = pkgs.postgresql;
|
||||
packages.default = self.packages.${system}.postgresql;
|
||||
# nix fmt formatter option attributes
|
||||
formatter = pkgs.nixfmt-tree;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user