-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
67 lines (67 loc) · 2.19 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
{
description = "Lacuna CMS CLI.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }: let
name = "lacuna";
version = "0.0.0";
utils = flake-utils;
in utils.lib.eachDefaultSystem (
system: let
# import pkgs from inputs.nixpkgs
pkgs = import nixpkgs { inherit system; };
# import submodules from src/
submodules = pkgs.lib.attrsets.mapAttrs
(n: v: import (./. + "/src/${n}") { inherit pkgs; })
(builtins.readDir ./src);
in rec {
packages = {
help = pkgs.callPackage ./scripts/help.nix {
inherit name version;
};
start = pkgs.callPackage ./scripts/start.nix {
inherit name version;
webServer = submodules.sveltekit.packages;
database = submodules.postgres.packages;
envFiles = [ ".env.development" ];
};
default = packages.start;
};
apps = {
help = utils.lib.mkApp { drv = packages.help; };
start = utils.lib.mkApp { drv = packages.start; };
default = utils.lib.mkApp {
drv = packages.start.override { cliArgs = [ "dev" ]; };
};
};
# the default devShell for each submodule is provided
devShells = (pkgs.lib.attrsets.mapAttrs
(n: v: v.devShells.default)
submodules
) // {
# the root devshell provides packages used in scripts/
root = pkgs.mkShell {
packages = [
# kill program at PORT using: fuser -k PORT/tcp
pkgs.psmisc
# get sha256 for dockerTools.pullImage using:
# nix-prefetch-docker --quiet --image-name _ --image-tag _ --image-digest sha256:_
pkgs.nix-prefetch-docker
# run docker containers without starting a daemon
pkgs.podman
];
};
# the default devShell is a combination of every devShell
default = pkgs.mkShell {
inputsFrom = (
pkgs.lib.attrsets.mapAttrsToList
(n: v: devShells."${n}")
submodules
) ++ [ devShells.root ];
};
};
}
);
}