-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
69 lines (66 loc) · 1.79 KB
/
flake.nix
File metadata and controls
69 lines (66 loc) · 1.79 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
{
description = "Build NixOS devbox VMs from a single workload module.";
inputs = {
nix-pins.url = "github:firefly-engineering/nix-pins";
nixpkgs.follows = "nix-pins/nixpkgs-stable";
};
outputs =
{ self, nixpkgs, ... }:
let
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
forSystems = nixpkgs.lib.genAttrs systems;
in
{
nixosModules.default = ./modules;
lib = import ./lib;
# In-tree smoke test. `nix eval .#nixosConfigurations.example.config.<...>`
# validates that mkDevbox + the modules wire up cleanly.
nixosConfigurations.example = (import ./lib/mkDevbox.nix) {
inherit nixpkgs;
system = "aarch64-linux";
modules = [ ./examples/minimal.nix ];
};
packages = forSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
devbox-cli = pkgs.callPackage ./pkgs/devbox-cli.nix { };
in
{
inherit devbox-cli;
default = devbox-cli;
}
);
apps = forSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
cli = self.packages.${system}.devbox-cli;
mkSubApp = sub: {
type = "app";
program = toString (
pkgs.writeShellScript "devbox-cli-${sub}" ''
exec ${cli}/bin/devbox-cli ${sub} "$@"
''
);
};
in
{
default = {
type = "app";
program = "${cli}/bin/devbox-cli";
};
init = mkSubApp "init";
update = mkSubApp "update";
up = mkSubApp "up";
down = mkSubApp "down";
rm = mkSubApp "rm";
}
);
};
}