module does not build:
$ nix build .#nixosConfigurations.vm.config.system.build.vm error: … while calling the 'derivationStrict' builtin at /builtin/derivation.nix:9:12: (source not available) … while evaluating derivation 'nixos-vm' whose name attribute is located at /nix/store/ikx99aci297hpgys7114fjwyf38iv9qi-source/pkgs/stdenv/generic/make-derivation.nix:348:7 … while evaluating attribute 'buildCommand' of derivation 'nixos-vm' at /nix/store/ikx99aci297hpgys7114fjwyf38iv9qi-source/pkgs/build-support/trivial-builders/default.nix:87:14: 86| enableParallelBuilding = true; 87| inherit buildCommand name; | ^ 88| passAsFile = [ "buildCommand" ] (stack trace truncated; use '--show-trace' to show the full trace) error: attribute 'system' missing at /nix/store/ikx99aci297hpgys7114fjwyf38iv9qi-source/lib/modules.nix:506:28: 505| builtins.addErrorContext (context name) 506| (args.${name} or config._module.args.${name}) | ^ 507| ) (lib.functionArgs f);
This commit is contained in:
parent
66d8a424a2
commit
a382d78d63
59
flake.nix
59
flake.nix
@ -36,53 +36,19 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
flake-utils.lib.eachDefaultSystem (system: let
|
flake-utils.lib.eachDefaultSystem (system: let
|
||||||
pkgs = import nixpkgs {
|
pkgs = import ./pkgs.nix {
|
||||||
inherit system;
|
inherit nixpkgs system geoip2-tarball;
|
||||||
overlays = [
|
|
||||||
(_: super: {
|
|
||||||
python3 = super.python3.override {
|
|
||||||
packageOverrides = _: python-super: {
|
|
||||||
django = python-super.django_5;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
geoip-mmdb = pkgs.callPackage ./pkgs/geoip-mmdb.nix {
|
|
||||||
inherit geoip2-tarball;
|
|
||||||
};
|
|
||||||
e11sync-static = pkgs.callPackage ./pkgs/e11sync-static.nix {};
|
|
||||||
e11sync-frontend = pkgs.callPackage ./pkgs/e11sync-frontend.nix {};
|
|
||||||
e11sync-backend = pkgs.callPackage ./pkgs/e11sync-backend.nix {};
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
geoip-mmdb = pkgs.callPackage ./pkgs/geoip-mmdb.nix {
|
|
||||||
inherit geoip2-tarball;
|
|
||||||
};
|
|
||||||
|
|
||||||
e11sync-static = pkgs.callPackage ./pkgs/e11sync-static.nix {};
|
|
||||||
|
|
||||||
e11sync-frontend = pkgs.callPackage ./pkgs/e11sync-frontend.nix {
|
|
||||||
inherit e11sync-static;
|
|
||||||
};
|
|
||||||
|
|
||||||
e11sync-backend = pkgs.callPackage ./pkgs/e11sync-backend.nix {
|
|
||||||
inherit geoip-mmdb;
|
|
||||||
e11sync-static-manifest = e11sync-static.passthru.manifest;
|
|
||||||
};
|
|
||||||
|
|
||||||
e11sync-module = import ./modules/e11sync {
|
|
||||||
inherit e11sync-backend e11sync-frontend;
|
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
packages = {
|
packages = {
|
||||||
inherit geoip-mmdb;
|
inherit (pkgs) geoip-mmdb;
|
||||||
inherit e11sync-static;
|
inherit (pkgs) e11sync-static;
|
||||||
inherit e11sync-frontend;
|
inherit (pkgs) e11sync-frontend;
|
||||||
inherit e11sync-backend;
|
inherit (pkgs) e11sync-backend;
|
||||||
};
|
};
|
||||||
|
|
||||||
checks = {
|
checks = {
|
||||||
e11sync-unit = e11sync-backend.passthru.tests.unit;
|
e11sync-unit = pkgs.e11sync-backend.passthru.tests.unit;
|
||||||
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||||
src = ./.;
|
src = ./.;
|
||||||
hooks = {
|
hooks = {
|
||||||
@ -98,9 +64,6 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosModules.e11sync = e11sync-module;
|
|
||||||
nixosModules.default = e11sync-module;
|
|
||||||
|
|
||||||
apps = {
|
apps = {
|
||||||
e11sync-frontend = {
|
e11sync-frontend = {
|
||||||
type = "app";
|
type = "app";
|
||||||
@ -115,7 +78,7 @@
|
|||||||
debug
|
debug
|
||||||
}
|
}
|
||||||
:8001
|
:8001
|
||||||
${builtins.readFile "${e11sync-frontend}"}
|
${builtins.readFile "${pkgs.e11sync-frontend}"}
|
||||||
'';
|
'';
|
||||||
}} --adapter caddyfile'');
|
}} --adapter caddyfile'');
|
||||||
};
|
};
|
||||||
@ -124,7 +87,7 @@
|
|||||||
name = "e11sync-backend";
|
name = "e11sync-backend";
|
||||||
program = toString (pkgs.writeShellScript "wrapper" ''
|
program = toString (pkgs.writeShellScript "wrapper" ''
|
||||||
export E11SYNC_DATABASE_PATH=$PWD/db.sqlite3
|
export E11SYNC_DATABASE_PATH=$PWD/db.sqlite3
|
||||||
exec ${e11sync-backend}/bin/e11sync-backend
|
exec ${pkgs.e11sync-backend}/bin/e11sync-backend
|
||||||
'');
|
'');
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -145,7 +108,7 @@
|
|||||||
libmaxminddb
|
libmaxminddb
|
||||||
dart-sass
|
dart-sass
|
||||||
];
|
];
|
||||||
GEOIP_PATH = "${geoip-mmdb}";
|
GEOIP_PATH = "${pkgs.geoip-mmdb}";
|
||||||
E11SYNC_DEBUG = "1";
|
E11SYNC_DEBUG = "1";
|
||||||
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
||||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
||||||
@ -162,6 +125,6 @@
|
|||||||
self.nixosModules.e11sync
|
self.nixosModules.e11sync
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
nixosModules.e11sync = import ./modules/e11sync geoip2-tarball;
|
nixosModules.e11sync = import ./modules/e11sync nixpkgs;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
geoip2-tarball: {
|
nixpkgs: {
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
system,
|
||||||
|
geoip2-tarball,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
|
pkgs = import ../../pkgs.nix {inherit nixpkgs system geoip2-tarball;};
|
||||||
|
in {
|
||||||
options.e11sync = with lib.types; {
|
options.e11sync = with lib.types; {
|
||||||
enable = lib.mkEnableOption "Enable e11sync";
|
enable = lib.mkEnableOption "Enable e11sync";
|
||||||
secretKeyPath = lib.mkOption {type = oneOf [path (enum ["unsafe"])];};
|
secretKeyPath = lib.mkOption {type = oneOf [path (enum ["unsafe"])];};
|
||||||
@ -28,21 +31,10 @@ geoip2-tarball: {
|
|||||||
|
|
||||||
config = let
|
config = let
|
||||||
cfg = config.e11sync;
|
cfg = config.e11sync;
|
||||||
geoip-mmdb = pkgs.callPackage ../../pkgs/geoip-mmdb.nix {
|
|
||||||
inherit geoip2-tarball;
|
|
||||||
};
|
|
||||||
e11sync-static = pkgs.callPackage ../../pkgs/e11sync-static.nix {};
|
|
||||||
e11sync-frontend = pkgs.callPackage ../../pkgs/e11sync-frontend.nix {
|
|
||||||
inherit e11sync-static;
|
|
||||||
};
|
|
||||||
e11sync-backend = pkgs.callPackage ../../pkgs/e11sync-backend.nix {
|
|
||||||
inherit e11sync-static geoip-mmdb;
|
|
||||||
inherit (cfg) backendPort databasePath;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
lib.mkIf cfg.enable {
|
lib.mkIf cfg.enable {
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
e11sync-backend
|
pkgs.e11sync-backend
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.services = {
|
systemd.services = {
|
||||||
@ -67,7 +59,7 @@ geoip2-tarball: {
|
|||||||
StateDirectory = "e11sync-backend";
|
StateDirectory = "e11sync-backend";
|
||||||
WorkingDirectory = "/var/lib/e11sync-backend";
|
WorkingDirectory = "/var/lib/e11sync-backend";
|
||||||
KillSignal = "SIGQUIT";
|
KillSignal = "SIGQUIT";
|
||||||
ExecStart = "${e11sync-backend}/bin/e11sync-backend";
|
ExecStart = "${pkgs.e11sync-backend}/bin/e11sync-backend";
|
||||||
|
|
||||||
MemoryHigh = "1535M";
|
MemoryHigh = "1535M";
|
||||||
MemoryMax = "4096M";
|
MemoryMax = "4096M";
|
||||||
@ -79,7 +71,7 @@ geoip2-tarball: {
|
|||||||
ProtectControlGroups = true;
|
ProtectControlGroups = true;
|
||||||
}
|
}
|
||||||
(lib.mkIf cfg.migrateOnStart {
|
(lib.mkIf cfg.migrateOnStart {
|
||||||
ExecStartPre = "${e11sync-backend}/bin/e11sync migrate";
|
ExecStartPre = "${pkgs.e11sync-backend}/bin/e11sync migrate";
|
||||||
})
|
})
|
||||||
(lib.mkIf (cfg.secretKeyPath != "unsafe") {
|
(lib.mkIf (cfg.secretKeyPath != "unsafe") {
|
||||||
LoadCredential = "secret_key:${cfg.secretKeyPath}";
|
LoadCredential = "secret_key:${cfg.secretKeyPath}";
|
||||||
@ -89,6 +81,6 @@ geoip2-tarball: {
|
|||||||
};
|
};
|
||||||
|
|
||||||
services.caddy.virtualHosts."${cfg.vhost}".extraConfig =
|
services.caddy.virtualHosts."${cfg.vhost}".extraConfig =
|
||||||
builtins.readFile "${e11sync-frontend}";
|
builtins.readFile "${pkgs.e11sync-frontend}";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
25
pkgs.nix
Normal file
25
pkgs.nix
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
nixpkgs,
|
||||||
|
system,
|
||||||
|
geoip2-tarball,
|
||||||
|
}: let
|
||||||
|
inherit (import nixpkgs {inherit system;}) callPackage;
|
||||||
|
in
|
||||||
|
import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = [
|
||||||
|
(_: super: {
|
||||||
|
python3 = super.python3.override {
|
||||||
|
packageOverrides = _: python-super: {
|
||||||
|
django = python-super.django_5;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
geoip-mmdb = callPackage ./pkgs/geoip-mmdb.nix {
|
||||||
|
inherit geoip2-tarball;
|
||||||
|
};
|
||||||
|
e11sync-static = callPackage ./pkgs/e11sync-static.nix {};
|
||||||
|
e11sync-frontend = callPackage ./pkgs/e11sync-frontend.nix {};
|
||||||
|
e11sync-backend = callPackage ./pkgs/e11sync-backend.nix {};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user