Compare commits

...

2 commits

Author SHA1 Message Date
350245c097 use deployed environment for launching nixops4 from the panel
this still needs more work to clean up fully
2025-06-06 12:14:34 +02:00
631ce8a92d use Nixpkgs from npins in the flake 2025-06-06 12:13:51 +02:00
6 changed files with 32 additions and 15 deletions

View file

@ -1,6 +1,5 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; # consumed by flake-parts
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
git-hooks.url = "github:cachix/git-hooks.nix"; git-hooks.url = "github:cachix/git-hooks.nix";
nixops4.follows = "nixops4-nixos/nixops4"; nixops4.follows = "nixops4-nixos/nixops4";
@ -11,9 +10,11 @@
inputs@{ flake-parts, ... }: inputs@{ flake-parts, ... }:
let let
sources = import ./npins; sources = import ./npins;
inherit (import "${flake-inputs}/lib.nix") import-flake;
inherit (sources) git-hooks agenix; inherit (sources) git-hooks agenix;
nixpkgs = import-flake sources.nixpkgs;
in in
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inputs = inputs // { inherit nixpkgs; }; } {
systems = [ systems = [
"x86_64-linux" "x86_64-linux"
"aarch64-linux" "aarch64-linux"

View file

@ -25,6 +25,22 @@
"url": null, "url": null,
"hash": "1w2gsy6qwxa5abkv8clb435237iifndcxq0s79wihqw11a5yb938" "hash": "1w2gsy6qwxa5abkv8clb435237iifndcxq0s79wihqw11a5yb938"
}, },
"flake-inputs": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "fricklerhandwerk",
"repo": "flake-inputs"
},
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"submodules": false,
"version": "1.1",
"revision": "6461d0b56e790bf289af07c5e5261abbf4f536af",
"url": "https://api.github.com/repos/fricklerhandwerk/flake-inputs/tarball/1.1",
"hash": "03mwisvr1mc3nd33nvg4bvcyxjxpm4lwhwym39r0768cm1007ixl"
},
"flake-parts": { "flake-parts": {
"type": "Git", "type": "Git",
"repository": { "repository": {

View file

@ -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
];
} }

View file

@ -178,10 +178,18 @@ in
description = "${name} ASGI server"; description = "${name} ASGI server";
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
path = [ path =
python-environment [
manage-service python-environment
]; manage-service
]
++ (
with pkgs;
lib.mkBinPath [
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
versionFile="/var/lib/${name}/package-version" versionFile="/var/lib/${name}/package-version"

View file

@ -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"]

View file

@ -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()
} }