mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-29 13:22:37 +02:00
nix: fix nixosModule and build (#1979)
* lnbits/settings: get LNBITS_COMMIT from envvar if available There is no other way of setting the git commit at runtime, for build systems like Nix that allow you to hermetically define envvars derived from the source that will be available reproducibly at runtime * nix: update potree2nix and nixosModule This is a general refactor that gets everything building and passing the vmTest again * Update nix/modules/lnbits-service.nix --------- Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
This commit is contained in:
52
flake.lock
generated
52
flake.lock
generated
@@ -1,12 +1,15 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1676283394,
|
"lastModified": 1689068808,
|
||||||
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
|
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
|
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -15,6 +18,27 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nix-github-actions": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"poetry2nix",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1688870561,
|
||||||
|
"narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nix-github-actions",
|
||||||
|
"rev": "165b1650b753316aa7f1787f3005a8d2da0f5301",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nix-github-actions",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1678470307,
|
"lastModified": 1678470307,
|
||||||
@@ -34,16 +58,17 @@
|
|||||||
"poetry2nix": {
|
"poetry2nix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
|
"nix-github-actions": "nix-github-actions",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1678513806,
|
"lastModified": 1695386222,
|
||||||
"narHash": "sha256-bEto1lp9bIQ+DlJsXQyRxN5l6B/oy3Skb7DueYRJJBo=",
|
"narHash": "sha256-5lgnhCCGW0NH5+m5iTED8u6NSSM/dbH9LBPvX0x0XXg=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "poetry2nix",
|
"repo": "poetry2nix",
|
||||||
"rev": "bf239d53fafb53cf439a72b3a50e86dd6a3984a5",
|
"rev": "093383b3d7fdd36846a7d84e128ca11865800538",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -57,6 +82,21 @@
|
|||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"poetry2nix": "poetry2nix"
|
"poetry2nix": "poetry2nix"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
18
flake.nix
18
flake.nix
@@ -28,13 +28,29 @@
|
|||||||
});
|
});
|
||||||
overlays = {
|
overlays = {
|
||||||
default = final: prev: {
|
default = final: prev: {
|
||||||
${projectName} = self.packages.${final.hostPlatform.system}.${projectName};
|
${projectName} = self.packages.${prev.stdenv.hostPlatform.system}.${projectName};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
packages = forAllSystems (system: pkgs: {
|
packages = forAllSystems (system: pkgs: {
|
||||||
default = self.packages.${system}.${projectName};
|
default = self.packages.${system}.${projectName};
|
||||||
${projectName} = pkgs.poetry2nix.mkPoetryApplication {
|
${projectName} = pkgs.poetry2nix.mkPoetryApplication {
|
||||||
projectDir = ./.;
|
projectDir = ./.;
|
||||||
|
meta.rev = self.dirtyRev or self.rev;
|
||||||
|
overrides = pkgs.poetry2nix.overrides.withDefaults (final: prev: {
|
||||||
|
ruff = prev.ruff.override { preferWheel = true; };
|
||||||
|
fastapi = prev.fastapi.overridePythonAttrs (old: {
|
||||||
|
postPatch = ''
|
||||||
|
substituteInPlace pyproject.toml \
|
||||||
|
--replace '"Framework :: Pydantic",' "" \
|
||||||
|
--replace '"Framework :: Pydantic :: 1",' ""
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
bolt11 = prev.bolt11.overrideAttrs (old: {
|
||||||
|
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
|
||||||
|
prev.poetry
|
||||||
|
];
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
nixosModules = {
|
nixosModules = {
|
||||||
|
@@ -88,6 +88,8 @@ in
|
|||||||
after = [ "network-online.target" ];
|
after = [ "network-online.target" ];
|
||||||
environment = {
|
environment = {
|
||||||
LNBITS_DATA_FOLDER = "${cfg.stateDir}";
|
LNBITS_DATA_FOLDER = "${cfg.stateDir}";
|
||||||
|
LNBITS_EXTENSIONS_PATH = "${cfg.stateDir}/extensions";
|
||||||
|
LNBITS_PATH = "${cfg.package.src}";
|
||||||
};
|
};
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
{ pkgs, makeTest, inputs }:
|
{ pkgs, makeTest, inputs }:
|
||||||
makeTest {
|
makeTest {
|
||||||
|
name = "lnbits-nixos-module";
|
||||||
nodes = {
|
nodes = {
|
||||||
client = { config, pkgs, ... }: {
|
client = { config, pkgs, ... }: {
|
||||||
environment.systemPackages = [ pkgs.curl ];
|
environment.systemPackages = [ pkgs.curl ];
|
||||||
|
Reference in New Issue
Block a user