forked from Fediversity/Fediversity
adds a deploy button to the panel form - covers the local part of #76. As a workaround to pass info (from our user form) into nixops4 uses environment variable `DEPLOYMENT` thru nix's `--extra-experimental-features configurable-impure-env`.
47 lines
1.3 KiB
Nix
47 lines
1.3 KiB
Nix
{
|
|
system ? builtins.currentSystem,
|
|
sources ? import ../npins,
|
|
pkgs ? import sources.nixpkgs {
|
|
inherit system;
|
|
config = { };
|
|
overlays = [ (import ./nix/overlay.nix) ];
|
|
},
|
|
}:
|
|
let
|
|
manage = pkgs.writeScriptBin "manage" ''
|
|
exec ${pkgs.lib.getExe pkgs.python3} ${toString ./src/manage.py} $@
|
|
'';
|
|
in
|
|
{
|
|
shell = pkgs.mkShellNoCC {
|
|
inputsFrom = [ (pkgs.callPackage ./nix/package.nix { }) ];
|
|
packages = [
|
|
pkgs.npins
|
|
manage
|
|
];
|
|
env = {
|
|
NPINS_DIRECTORY = toString ../npins;
|
|
};
|
|
shellHook = ''
|
|
# in production, secrets are passed via CREDENTIALS_DIRECTORY by systemd.
|
|
# use this directory for testing with local secrets
|
|
mkdir -p .credentials
|
|
echo secret > ${builtins.toString ./.credentials}/SECRET_KEY
|
|
export CREDENTIALS_DIRECTORY=${builtins.toString ./.credentials}
|
|
export DATABASE_URL="sqlite:///${toString ./src}/db.sqlite3"
|
|
'';
|
|
# explicitly use nix, as e.g. lix does not have configurable-impure-env
|
|
NIX_DIR = pkgs.nix;
|
|
};
|
|
|
|
module = import ./nix/configuration.nix;
|
|
tests = pkgs.callPackage ./nix/tests.nix { };
|
|
|
|
# re-export inputs so they can be overridden granularly
|
|
# (they can't be accessed from the outside any other way)
|
|
inherit
|
|
sources
|
|
system
|
|
pkgs
|
|
;
|
|
}
|