Picsur is an image sharing platform developed on top of the Flask microframework. It uses SQLAlchemy for database operations and Amazon S3 for storing images. Follow this tutorial to install Picsur on NixOS Latest.
Clone the Picsur repository from Github using the following command:
$ git clone https://github.com/rubikscraft/Picsur.git
Picsur depends on the following packages:
To install these dependencies, add the following lines to your /etc/nixos/configuration.nix
file:
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
python36 python36Packages.flask python36Packages.flask_cors python36Packages.flask_migrate python36Packages.flask_restful python36Packages.flask_script python36Packages.sqlalchemy python36Packages.psycopg2 python36Packages.awscli
];
}
Save and close the file, and then update the system packages using the following command:
$ sudo nixos-rebuild switch
Picsur uses PostgreSQL as the database backend. To install and configure PostgreSQL, add the following lines to your /etc/nixos/configuration.nix
file:
{ config, pkgs, ... }:
{
services.postgresql = {
enable = true;
initialScript = builtins.readFile "${./db.sql}";
ensureDatabases = ["picsur"];
ensureUsers = [
{
name = "picsur";
ensureGroups = ["picsur"];
password = "picsur";
}
];
};
users.extraGroups = ["picsur"];
users.mutableUsers = false;
security.sudo.wheelNeedsPassword = false;
security.sudo.wheelAllUsers = true;
}
Create a file named db.sql
in the same directory as /etc/nixos/configuration.nix
, and copy the following lines into it:
CREATE DATABASE picsur;
GRANT ALL PRIVILEGES ON DATABASE picsur TO picsur;
This file will create the picsur
database and grant all privileges to the picsur
user.
Next, run the following command to update the system configuration:
$ sudo nixos-rebuild switch
Picsur uses Amazon S3 to store images. To configure Amazon S3, you need to create an AWS account and create an access key and secret key. To create an access key and secret key, follow these steps:
Once you have an access key and secret key, add the following lines to your /etc/nixos/configuration.nix
file:
{
pkgs, ... }:
{
environment.systemPackages = with pkgs; [
# ...
];
services.picsur = {
enable = true;
accessKeyId = "YOUR_ACCESS_KEY_ID";
secretAccessKey = "YOUR_SECRET_ACCESS_KEY";
bucketName = "YOUR_BUCKET_NAME";
regionName = "YOUR_REGION_NAME";
};
}
Replace YOUR_ACCESS_KEY_ID
, YOUR_SECRET_ACCESS_KEY
, YOUR_BUCKET_NAME
, and YOUR_REGION_NAME
with your own values.
To start the Picsur service, run the following command:
$ sudo systemctl start picsur.service
To enable Picsur to start automatically on boot, run the following command:
$ sudo systemctl enable picsur.service
You have successfully installed Picsur on NixOS Latest. You can access the Picsur web interface by visiting http://localhost:5000
in your web browser.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!