2023-05-01 20:10:37 +02:00
|
|
|
{
|
2023-08-21 16:14:53 +02:00
|
|
|
description = "Iceshrimp development flake";
|
2023-05-01 20:10:37 +02:00
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
|
|
|
# Flake Parts framework(https://flake.parts)
|
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
|
|
# Devenv for better devShells(https://devenv.sh)
|
|
|
|
devenv.url = "github:cachix/devenv";
|
|
|
|
};
|
|
|
|
outputs = inputs@{ flake-parts, ... }:
|
|
|
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
|
|
|
imports = [
|
|
|
|
inputs.devenv.flakeModule
|
|
|
|
];
|
|
|
|
|
2023-07-24 04:09:15 +02:00
|
|
|
# Define the systems that this works on. Only tested with x86_64-linux, add more if you test and it works.
|
2023-05-01 20:10:37 +02:00
|
|
|
systems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
];
|
|
|
|
# Expose these attributes for every system defined above.
|
|
|
|
perSystem = { config, pkgs, ... }: {
|
|
|
|
# Devenv shells
|
|
|
|
devenv = {
|
|
|
|
shells = {
|
|
|
|
# The default shell, used by nix-direnv
|
|
|
|
default = {
|
2023-07-26 22:27:59 +02:00
|
|
|
name = "iceshrimp-dev-shell";
|
2023-05-01 20:10:37 +02:00
|
|
|
# Add additional packages to our environment
|
|
|
|
packages = [
|
2023-07-27 13:45:15 +02:00
|
|
|
pkgs.yarn-berry
|
2023-05-11 15:11:28 +02:00
|
|
|
pkgs.python3
|
2023-05-01 20:10:37 +02:00
|
|
|
];
|
|
|
|
# No need to warn on a new version, we'll update as needed.
|
|
|
|
devenv.warnOnNewVersion = false;
|
|
|
|
# Enable typescript support
|
|
|
|
languages.typescript.enable = true;
|
2023-07-30 20:44:55 +02:00
|
|
|
# Enable javascript for NPM and Yarn
|
2023-05-01 20:10:37 +02:00
|
|
|
languages.javascript.enable = true;
|
2023-05-31 13:52:21 +02:00
|
|
|
languages.javascript.package = pkgs.nodejs_18;
|
2023-05-11 15:11:28 +02:00
|
|
|
processes = {
|
2023-07-30 20:44:55 +02:00
|
|
|
dev-server.exec = "yarn run dev";
|
2023-05-11 15:11:28 +02:00
|
|
|
};
|
|
|
|
scripts = {
|
2023-07-24 09:57:15 +02:00
|
|
|
build.exec = "yarn run build";
|
|
|
|
clean.exec = "yarn run clean";
|
2023-05-11 15:11:28 +02:00
|
|
|
clear-state.exec = "rm -rf .devenv/state/redis .devenv/state/postgres";
|
2023-07-24 09:57:15 +02:00
|
|
|
format.exec = "yarn run format";
|
|
|
|
install-deps.exec = "yarn install";
|
|
|
|
migrate.exec = "yarn run migrate";
|
2023-05-11 15:11:28 +02:00
|
|
|
prepare-config.exec = "cp .config/devenv.yml .config/default.yml";
|
|
|
|
};
|
2023-05-01 20:10:37 +02:00
|
|
|
services = {
|
|
|
|
postgres = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.postgresql_12;
|
|
|
|
initialDatabases = [{
|
2023-07-26 22:27:59 +02:00
|
|
|
name = "iceshrimp";
|
2023-05-01 20:10:37 +02:00
|
|
|
}];
|
|
|
|
initialScript = ''
|
2023-07-27 00:28:11 +02:00
|
|
|
CREATE USER iceshrimp WITH PASSWORD 'iceshrimp';
|
2023-07-27 13:17:56 +02:00
|
|
|
ALTER USER iceshrimp WITH SUPERUSER;
|
2023-07-27 00:28:11 +02:00
|
|
|
GRANT ALL ON DATABASE iceshrimp TO iceshrimp;
|
2023-05-01 20:10:37 +02:00
|
|
|
'';
|
|
|
|
listen_addresses = "127.0.0.1";
|
|
|
|
port = 5432;
|
|
|
|
};
|
|
|
|
redis = {
|
|
|
|
enable = true;
|
|
|
|
bind = "127.0.0.1";
|
|
|
|
port = 6379;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|