Package Atuin as NixNG image
This commit is contained in:
parent
ae0d45e71f
commit
613bc83b89
8 changed files with 113 additions and 36 deletions
|
@ -25,8 +25,8 @@ Legend:
|
||||||
| ✨ | `nixng-prowlarr` | |
|
| ✨ | `nixng-prowlarr` | |
|
||||||
| ✨ | `nixng-deluge` | |
|
| ✨ | `nixng-deluge` | |
|
||||||
| ✨ | `nixng-mealie` | |
|
| ✨ | `nixng-mealie` | |
|
||||||
|
| ✨ | `nixng-atuin` | |
|
||||||
| ✅ | `jellyfin/jellyfin` | |
|
| ✅ | `jellyfin/jellyfin` | |
|
||||||
| ✅ | `ghcr.io/atuinsh/atuin` | |
|
|
||||||
| ✅ | `postgres:14` | Database for Atuin |
|
| ✅ | `postgres:14` | Database for Atuin |
|
||||||
| ✅ | `ghcr.io/paperless-ngx/paperless-ngx` | |
|
| ✅ | `ghcr.io/paperless-ngx/paperless-ngx` | |
|
||||||
| ✅ | `docker.io/library/redis:7` | Database for Paperless-ngx |
|
| ✅ | `docker.io/library/redis:7` | Database for Paperless-ngx |
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
utils,
|
||||||
globals,
|
globals,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
|
@ -29,35 +30,17 @@
|
||||||
metadata.labels.app = "atuin";
|
metadata.labels.app = "atuin";
|
||||||
|
|
||||||
spec = {
|
spec = {
|
||||||
volumes = {
|
volumes.database.persistentVolumeClaim.claimName = "database";
|
||||||
data.persistentVolumeClaim.claimName = "data";
|
|
||||||
database.persistentVolumeClaim.claimName = "database";
|
|
||||||
};
|
|
||||||
|
|
||||||
containers = {
|
containers = {
|
||||||
atuin = {
|
atuin = {
|
||||||
image = globals.images.atuin;
|
image = utils.mkNixNGImage "atuin";
|
||||||
imagePullPolicy = "IfNotPresent";
|
|
||||||
ports.web.containerPort = 8888;
|
ports.web.containerPort = 8888;
|
||||||
args = ["server" "start"];
|
|
||||||
|
|
||||||
env = {
|
env.ATUIN_DB_URI.valueFrom.secretKeyRef = {
|
||||||
ATUIN_HOST.value = "0.0.0.0";
|
name = "database";
|
||||||
ATUIN_PORT.value = "8888";
|
key = "databaseURL";
|
||||||
ATUIN_OPEN_REGISTRATION.value = "false";
|
|
||||||
|
|
||||||
ATUIN_DB_URI.valueFrom.secretKeyRef = {
|
|
||||||
name = "database";
|
|
||||||
key = "databaseURL";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
volumeMounts = [
|
|
||||||
{
|
|
||||||
name = "data";
|
|
||||||
mountPath = "/config";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
database = {
|
database = {
|
||||||
|
@ -106,16 +89,9 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
longhorn.persistentVolumeClaim = {
|
longhorn.persistentVolumeClaim.database = {
|
||||||
data = {
|
volumeName = "atuin-db";
|
||||||
volumeName = "atuin";
|
storage = "300Mi";
|
||||||
storage = "300Mi";
|
|
||||||
};
|
|
||||||
|
|
||||||
database = {
|
|
||||||
volumeName = "atuin-db";
|
|
||||||
storage = "300Mi";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -92,7 +92,6 @@
|
||||||
longhorn.persistentVolume = {
|
longhorn.persistentVolume = {
|
||||||
freshrss.storage = "1Gi";
|
freshrss.storage = "1Gi";
|
||||||
radicale.storage = "200Mi";
|
radicale.storage = "200Mi";
|
||||||
atuin.storage = "300Mi";
|
|
||||||
atuin-db.storage = "300Mi";
|
atuin-db.storage = "300Mi";
|
||||||
nextcloud.storage = "50Gi";
|
nextcloud.storage = "50Gi";
|
||||||
nextcloud-db.storage = "400Mi";
|
nextcloud-db.storage = "400Mi";
|
||||||
|
|
12
nixng-configurations/atuin.nix
Normal file
12
nixng-configurations/atuin.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
dinit.enable = true;
|
||||||
|
init.services.atuin.shutdownOnExit = true;
|
||||||
|
|
||||||
|
services.atuin = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
open_registration = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ flake-utils.lib.eachDefaultSystem (system: let
|
||||||
blog = ./blog.nix;
|
blog = ./blog.nix;
|
||||||
deluge = ./deluge.nix;
|
deluge = ./deluge.nix;
|
||||||
mealie = ./mealie.nix;
|
mealie = ./mealie.nix;
|
||||||
|
atuin = ./atuin.nix;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
nixngConfigurations = builtins.mapAttrs (name: configFile:
|
nixngConfigurations = builtins.mapAttrs (name: configFile:
|
||||||
|
@ -44,7 +45,7 @@ in {
|
||||||
self.nixngModules.sonarr
|
self.nixngModules.sonarr
|
||||||
self.nixngModules.prowlarr
|
self.nixngModules.prowlarr
|
||||||
self.nixngModules.deluge
|
self.nixngModules.deluge
|
||||||
self.nixngModules.mealie
|
self.nixngModules.atuin
|
||||||
{
|
{
|
||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
(_final: _prev: {
|
(_final: _prev: {
|
||||||
|
|
86
nixng-modules/atuin.nix
Normal file
86
nixng-modules/atuin.nix
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
nglib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
cfg = config.services.atuin;
|
||||||
|
cfgInit = config.init.services.atuin;
|
||||||
|
settingsFormat = pkgs.formats.toml {};
|
||||||
|
in {
|
||||||
|
options.services.atuin = {
|
||||||
|
enable = lib.mkEnableOption "atuin";
|
||||||
|
package = lib.mkPackageOption pkgs "atuin" {};
|
||||||
|
|
||||||
|
settings = lib.mkOption {
|
||||||
|
type = lib.types.submodule {
|
||||||
|
freeformType = settingsFormat.type;
|
||||||
|
|
||||||
|
options = {
|
||||||
|
host = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "0.0.0.0";
|
||||||
|
description = "The host to listen on";
|
||||||
|
};
|
||||||
|
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 8888;
|
||||||
|
description = "The TCP port to listen on";
|
||||||
|
};
|
||||||
|
|
||||||
|
open_registration = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "If true, accept new user registrations";
|
||||||
|
};
|
||||||
|
|
||||||
|
db_uri = lib.mkOption {
|
||||||
|
type = with lib.types; nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = "A valid PostgreSQL URI, for saving history";
|
||||||
|
};
|
||||||
|
|
||||||
|
path = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "";
|
||||||
|
description = "A path to prepend to all the routes of the server";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
init.services.atuin = {
|
||||||
|
enabled = true;
|
||||||
|
user = lib.mkDefault "atuin";
|
||||||
|
group = lib.mkDefault "atuin";
|
||||||
|
|
||||||
|
script = pkgs.writeShellScript "atuin-run" ''
|
||||||
|
${lib.getExe cfg.package} server start
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
systemPackages = [cfg.package];
|
||||||
|
|
||||||
|
variables.ATUIN_CONFIG_DIR = let
|
||||||
|
settingsFile = settingsFormat.generate "server.toml" (lib.filterAttrs (_: v: v != null) cfg.settings);
|
||||||
|
in
|
||||||
|
toString (pkgs.writeTextDir "server.toml" (builtins.readFile settingsFile));
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users.${cfgInit.user} = nglib.mkDefaultRec {
|
||||||
|
description = "atuin";
|
||||||
|
inherit (cfgInit) group;
|
||||||
|
createHome = false;
|
||||||
|
home = "/var/empty";
|
||||||
|
useDefaultShell = true;
|
||||||
|
uid = config.ids.uids.atuin;
|
||||||
|
};
|
||||||
|
|
||||||
|
users.groups.${cfgInit.group} = nglib.mkDefaultRec {gid = config.ids.gids.atuin;};
|
||||||
|
};
|
||||||
|
}
|
|
@ -9,5 +9,6 @@ _: {
|
||||||
ids = import ./ids.nix;
|
ids = import ./ids.nix;
|
||||||
deluge = import ./deluge.nix;
|
deluge = import ./deluge.nix;
|
||||||
mealie = import ./mealie.nix;
|
mealie = import ./mealie.nix;
|
||||||
|
atuin = import ./atuin.nix;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
prowlarr = 413;
|
prowlarr = 413;
|
||||||
deluge = 414;
|
deluge = 414;
|
||||||
mealie = 415;
|
mealie = 415;
|
||||||
|
atuin = 416;
|
||||||
};
|
};
|
||||||
|
|
||||||
gids = {
|
gids = {
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
prowlarr = 413;
|
prowlarr = 413;
|
||||||
deluge = 414;
|
deluge = 414;
|
||||||
mealie = 415;
|
mealie = 415;
|
||||||
|
atuin = 416;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue