-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
80 lines (77 loc) · 2.44 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
{
description = "Fastapi-mvc generator flake";
nixConfig = {
bash-prompt = ''\n\[\033[1;32m\][nix-develop:\w]\$\[\033[0m\] '';
extra-trusted-public-keys = [
"fastapi-mvc.cachix.org-1:knQ8Qo41bnhBmOB6Sp0UH10EV76AXW5o69SbAS668Fg="
];
extra-substituters = [
"https://fastapi-mvc.cachix.org"
];
};
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
fastapi-mvc.url = "github:fastapi-mvc/fastapi-mvc";
nixpkgs.follows = "fastapi-mvc/nixpkgs";
};
outputs = { self, nixpkgs, flake-parts, fastapi-mvc }@inputs:
let
mkApp =
{ drv
, name ? drv.pname or drv.name
, exePath ? drv.passthru.exePath or "/bin/${name}"
}:
{
type = "app";
program = "${drv}${exePath}";
};
in
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, ... }: {
apps = {
fastapi-mvc = mkApp { drv = fastapi-mvc.packages.${system}.default; };
copier = {
type = "app";
program = toString (pkgs.writeScript "copier" ''
export PATH="${pkgs.lib.makeBinPath [
fastapi-mvc.packages.${system}.default.dependencyEnv
pkgs.git
pkgs.coreutils
]}"
copier $@
'');
};
update = {
type = "app";
program = toString (pkgs.writeScript "update" ''
export PATH="${pkgs.lib.makeBinPath [
fastapi-mvc.packages.${system}.default.dependencyEnv
pkgs.git
pkgs.coreutils
]}"
copier -x template/** -x copier.yml -x *.py -x CHANGELOG.md \
$@ \
-d generator=script \
-d nix=True \
-d license=MIT \
-d repo_url=https://github.com/fastapi-mvc/copier-script \
-d copyright_date=2022 \
-d github_actions=True \
-a .generator.yml \
update ./.
'');
};
};
devShells = {
default = fastapi-mvc.packages.${system}.fastapi-mvc-dev.env.overrideAttrs (oldAttrs: {
buildInputs = [
pkgs.git
pkgs.coreutils
pkgs.poetry
];
});
};
};
};
}