forked from fediversity/fediversity
Compare commits
2 commits
1fcba0942d
...
3eca69140c
Author | SHA1 | Date | |
---|---|---|---|
3eca69140c | |||
38d2f702dd |
5 changed files with 64 additions and 64 deletions
116
flake.nix
116
flake.nix
|
@ -14,60 +14,66 @@
|
||||||
inherit (sources) git-hooks agenix;
|
inherit (sources) git-hooks agenix;
|
||||||
nixpkgs = import-flake sources.nixpkgs;
|
nixpkgs = import-flake sources.nixpkgs;
|
||||||
in
|
in
|
||||||
flake-parts.lib.mkFlake { inputs = inputs // { inherit nixpkgs; }; } {
|
flake-parts.lib.mkFlake
|
||||||
systems = [
|
{
|
||||||
"x86_64-linux"
|
inputs = inputs // {
|
||||||
"aarch64-linux"
|
inherit nixpkgs;
|
||||||
"x86_64-darwin"
|
|
||||||
"aarch64-darwin"
|
|
||||||
];
|
|
||||||
|
|
||||||
imports = [
|
|
||||||
(import "${git-hooks}/flake-module.nix")
|
|
||||||
inputs.nixops4.modules.flake.default
|
|
||||||
|
|
||||||
./deployment/flake-part.nix
|
|
||||||
./infra/flake-part.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
perSystem =
|
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
inputs',
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
formatter = pkgs.nixfmt-rfc-style;
|
|
||||||
|
|
||||||
pre-commit.settings.hooks =
|
|
||||||
let
|
|
||||||
## Add a directory here if pre-commit hooks shouldn't apply to it.
|
|
||||||
optout = [ "npins" ];
|
|
||||||
excludes = map (dir: "^${dir}/") optout;
|
|
||||||
addExcludes = lib.mapAttrs (_: c: c // { inherit excludes; });
|
|
||||||
in
|
|
||||||
addExcludes {
|
|
||||||
nixfmt-rfc-style.enable = true;
|
|
||||||
deadnix.enable = true;
|
|
||||||
trim-trailing-whitespace.enable = true;
|
|
||||||
shellcheck.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
|
||||||
packages = [
|
|
||||||
pkgs.npins
|
|
||||||
pkgs.nil
|
|
||||||
(pkgs.callPackage "${agenix}/pkgs/agenix.nix" { })
|
|
||||||
pkgs.openssh
|
|
||||||
pkgs.httpie
|
|
||||||
pkgs.jq
|
|
||||||
# exposing this env var as a hack to pass info in from form
|
|
||||||
(inputs'.nixops4.packages.default.overrideAttrs {
|
|
||||||
impureEnvVars = [ "DEPLOYMENT" ];
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
{
|
||||||
|
systems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
(import "${git-hooks}/flake-module.nix")
|
||||||
|
inputs.nixops4.modules.flake.default
|
||||||
|
|
||||||
|
./deployment/flake-part.nix
|
||||||
|
./infra/flake-part.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
perSystem =
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
inputs',
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
formatter = pkgs.nixfmt-rfc-style;
|
||||||
|
|
||||||
|
pre-commit.settings.hooks =
|
||||||
|
let
|
||||||
|
## Add a directory here if pre-commit hooks shouldn't apply to it.
|
||||||
|
optout = [ "npins" ];
|
||||||
|
excludes = map (dir: "^${dir}/") optout;
|
||||||
|
addExcludes = lib.mapAttrs (_: c: c // { inherit excludes; });
|
||||||
|
in
|
||||||
|
addExcludes {
|
||||||
|
nixfmt-rfc-style.enable = true;
|
||||||
|
deadnix.enable = true;
|
||||||
|
trim-trailing-whitespace.enable = true;
|
||||||
|
shellcheck.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
packages = [
|
||||||
|
pkgs.npins
|
||||||
|
pkgs.nil
|
||||||
|
(pkgs.callPackage "${agenix}/pkgs/agenix.nix" { })
|
||||||
|
pkgs.openssh
|
||||||
|
pkgs.httpie
|
||||||
|
pkgs.jq
|
||||||
|
# exposing this env var as a hack to pass info in from form
|
||||||
|
(inputs'.nixops4.packages.default.overrideAttrs {
|
||||||
|
impureEnvVars = [ "DEPLOYMENT" ];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,4 @@ in
|
||||||
{
|
{
|
||||||
REPO_DIR = toString ../.;
|
REPO_DIR = toString ../.;
|
||||||
# explicitly use nix, as e.g. lix does not have configurable-impure-env
|
# explicitly use nix, as e.g. lix does not have configurable-impure-env
|
||||||
BIN_PATH = lib.makeBinPath [
|
|
||||||
# explicitly use nix, as e.g. lix does not have configurable-impure-env
|
|
||||||
pkgs.nix
|
|
||||||
# nixops error maybe due to our flake git hook: executing 'git': No such file or directory
|
|
||||||
pkgs.git
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,6 +181,8 @@ in
|
||||||
path = [
|
path = [
|
||||||
python-environment
|
python-environment
|
||||||
manage-service
|
manage-service
|
||||||
|
nix
|
||||||
|
git
|
||||||
];
|
];
|
||||||
preStart = ''
|
preStart = ''
|
||||||
# Auto-migrate on first run or if the package has changed
|
# Auto-migrate on first run or if the package has changed
|
||||||
|
|
|
@ -240,8 +240,6 @@ if user_settings_file is not None:
|
||||||
# The correct thing to do here would be using a helper function such as with `get_secret()` that will catch the exception and explain what's wrong and where to put the right values.
|
# The correct thing to do here would be using a helper function such as with `get_secret()` that will catch the exception and explain what's wrong and where to put the right values.
|
||||||
# Replacing the `USER_SETTINGS_FILE` mechanism following the comment there would probably be a good thing.
|
# Replacing the `USER_SETTINGS_FILE` mechanism following the comment there would probably be a good thing.
|
||||||
|
|
||||||
# PATH to expose to launch button
|
|
||||||
bin_path=env['BIN_PATH']
|
|
||||||
# path of the root flake to trigger nixops from, see #94.
|
# path of the root flake to trigger nixops from, see #94.
|
||||||
# to deploy this should be specified, for dev just use a relative path.
|
# to deploy this should be specified, for dev just use a relative path.
|
||||||
repo_dir = env["REPO_DIR"]
|
repo_dir = env["REPO_DIR"]
|
||||||
|
|
|
@ -89,7 +89,7 @@ class DeploymentStatus(ConfigurationForm):
|
||||||
|
|
||||||
def deployment(self, config: BaseModel):
|
def deployment(self, config: BaseModel):
|
||||||
env = {
|
env = {
|
||||||
"PATH": settings.bin_path,
|
"PATH": os.environ.get("PATH"),
|
||||||
# pass in form info to our deployment
|
# pass in form info to our deployment
|
||||||
"DEPLOYMENT": config.json()
|
"DEPLOYMENT": config.json()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue