-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
84 lines (70 loc) · 2.98 KB
/
flake.nix
File metadata and controls
84 lines (70 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{
description = "NixOS Raspberry Pi 4 SD image running LNbits";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
# Raspberry Pi firmware + SD image module
# Using main branch for better cache coverage
raspberry-pi-nix.url = "github:nix-community/raspberry-pi-nix";
raspberry-pi-nix.inputs.nixpkgs.follows = "nixpkgs";
# LNbits flake input - using dev branch
# To update: nix flake lock --update-input lnbits
#lnbits.url = "github:lnbits/lnbits/refs/tags/v1.5.0";
lnbits.url = "github:lnbits/lnbits/dev";
# Spark sidecar for L2 Lightning integration
spark-sidecar.url = "github:blackcoffeexbt/spark_sidecar/feat/no-polling";
spark-sidecar.flake = false; # Not a flake, just source
};
outputs = { self, nixpkgs, raspberry-pi-nix, lnbits, spark-sidecar, ... }:
let
version = "0.9.8"; # Bump before each release tag to match the next tag name
system = "aarch64-linux";
in
{
# Compressed SD image (default, for releases)
nixosConfigurations.pi4 = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit lnbits spark-sidecar version; };
modules = [
raspberry-pi-nix.nixosModules.raspberry-pi
raspberry-pi-nix.nixosModules.sd-image
./nixos/configuration.nix
];
};
# Uncompressed SD image (for faster local testing)
nixosConfigurations.pi4-uncompressed = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit lnbits spark-sidecar version; };
modules = [
raspberry-pi-nix.nixosModules.raspberry-pi
raspberry-pi-nix.nixosModules.sd-image
./nixos/configuration.nix
# Disable compression for faster testing
{
sdImage.compressImage = false;
}
];
};
# Expose packages for x86_64-linux (cross-compilation)
packages.x86_64-linux = {
# Compressed SD image (default, for releases)
sdImage = self.nixosConfigurations.pi4.config.system.build.sdImage;
# Uncompressed SD image (for faster local testing)
sdImageUncompressed = self.nixosConfigurations.pi4-uncompressed.config.system.build.sdImage;
# System toplevel (for OTA updates — CI builds and pushes to Cachix)
toplevel = self.nixosConfigurations.pi4.config.system.build.toplevel;
# Default to compressed
default = self.nixosConfigurations.pi4.config.system.build.sdImage;
};
# Expose packages for aarch64-linux (native builds)
packages.aarch64-linux = {
# Compressed SD image (default, for releases)
sdImage = self.nixosConfigurations.pi4.config.system.build.sdImage;
# Uncompressed SD image (for faster local testing)
sdImageUncompressed = self.nixosConfigurations.pi4-uncompressed.config.system.build.sdImage;
# System toplevel (for OTA updates)
toplevel = self.nixosConfigurations.pi4.config.system.build.toplevel;
# Default to compressed
default = self.nixosConfigurations.pi4.config.system.build.sdImage;
};
};
}