-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
82 lines (71 loc) · 2.4 KB
/
flake.nix
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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
# Add the backend flake as an input
backend = {
url = "./backend"; # Points to the flake in the backend directory
inputs.nixpkgs.follows = "nixpkgs";
};
static = {
url = "./blog-static";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, disko, backend, static, ... }@attrs:
let
# The system we are building for. It will not work on other systems.
# One might use flake-utils to make it work on other systems.
system = "x86_64-linux";
# Import the Nix packages from nixpkgs
pkgs = import nixpkgs { inherit system; };
# Integration that are run using kvm virtual machines
integration = import ./integration.nix {
makeTest = import (nixpkgs + "/nixos/tests/make-test-python.nix");
inherit pkgs;
inherit backend;
inherit static;
};
in
{
# Define a formatter package for the system to enable `nix fmt`
formatter.${system} = pkgs.nixpkgs-fmt;
# NixOS configuration for the 'blog' system
nixosConfigurations.blog = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = attrs;
modules = [
disko.nixosModules.disko # Include disko module
./configuration.nix # Include custom configuration
./plausible.nix
];
};
# Merge the checks from the backend flake into the root flake's checks
checks.${system} = nixpkgs.lib.recursiveUpdate
(backend.checks.${system} or { })
{
itg = integration;
};
# Development shell environment
# It will include the packages specified in the buildInputs attribute
# once the shell is entered using `nix develop` or direnv integration.
devShell.${system} = pkgs.mkShell {
DATABASE_PATH = "./db.sqlite";
DATABASE_URL = "sqlite://./db.sqlite";
FONT = "${pkgs.nerdfonts}";
buildInputs = with pkgs; [
opentofu # provisioning tool for the OpenTofu project
ponysay # just for fun run `ponysay hello`
hugo
sqlx-cli
python312
python312Packages.cairosvg
python312Packages.pillow
python312Packages.svgwrite
];
};
};
}