install docker and compose

This commit is contained in:
Sam 2024-09-21 22:19:00 +01:00
parent afaf3c4697
commit 53d2343f04
5 changed files with 37 additions and 49 deletions

View File

@ -1,26 +1,10 @@
{ pkgs, inputs, ... }:
{
imports = [ inputs.arion.nixosModules.arion ];
environment.systemPackages = [
pkgs.arion
];
# Arion works with Docker, but for NixOS-based containers, you need Podman
# since NixOS 21.05.
{pkgs, ...}: {
virtualisation = {
podman = {
enable = true;
defaultNetwork.settings.dns_enabled = true;
};
docker = {
enable = true;
storageDriver = "btrfs";
rootless = {
enable = true;
setSocketVariable = true;
};
};
};
environment.systemPackages = with pkgs; [
docker-compose
];
}

View File

@ -1,5 +1,10 @@
{ pkgs, lib, inputs, config, ... }:
let
{
pkgs,
lib,
inputs,
config,
...
}: let
admin_dbPasswordFile = lib.optionalString (lib.hasAttr "sops-nix" inputs) config.sops.secrets."software/postgres/admin_db/password".path;
initScript = pkgs.writeText "init.sh" ''
#!/bin/bash
@ -67,10 +72,9 @@ let
timezone = 'Etc/UTC'
default_text_search_config = 'pg_catalog.english'
'';
in
{
in {
sops.secrets = {
"software/postgres/admin_db/password" = { };
"software/postgres/admin_db/password" = {};
};
virtualisation.arion = {
backend = "docker";
@ -87,7 +91,7 @@ in
jq \
&& rm -rf /var/lib/apt/lists/*
''}";
command = [ "postgres" "-c" "config_file=/etc/postgresql/postgresql.conf" ];
command = ["postgres" "-c" "config_file=/etc/postgresql/postgresql.conf"];
environment = {
POSTGRES_PASSWORD_FILE = admin_dbPasswordFile;
POSTGRES_USER = "admin";
@ -119,9 +123,8 @@ in
]
'';
};
ports = [ "5432:5432" ];
ports = ["5432:5432"];
volumes = [
# Mount pgdata to external zfs volume
"/mnt/postgres:/var/lib/postgresql/data"
@ -140,4 +143,3 @@ in
};
};
}

View File

@ -23,6 +23,7 @@ in {
"networkmanager"
"scanner"
"lp"
"docker"
];
};

View File

@ -46,6 +46,7 @@ in {
../common/optional/nfs-mounts/media.nix
../common/optional/nfs-mounts/homeshare.nix
../common/optional/printing.nix
../common/optional/docker
];
boot = {

View File

@ -1,9 +1,9 @@
pkgs: {
sddm-theme = pkgs.callPackage ./sddm-theme { };
st = pkgs.callPackage ./st { };
dwmblocks = pkgs.callPackage ./dwmblocks { };
dmenu = pkgs.callPackage ./dmenu { };
nsxiv = pkgs.callPackage ./nsxiv { };
sqlfmt = pkgs.callPackage ./sqlfmt { };
kunst = pkgs.callPackage ./kunst { };
sddm-theme = pkgs.callPackage ./sddm-theme {};
st = pkgs.callPackage ./st {};
dwmblocks = pkgs.callPackage ./dwmblocks {};
dmenu = pkgs.callPackage ./dmenu {};
nsxiv = pkgs.callPackage ./nsxiv {};
sqlfmt = pkgs.callPackage ./sqlfmt {};
kunst = pkgs.callPackage ./kunst {};
}