-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
124 lines (118 loc) · 3.29 KB
/
flake.nix
File metadata and controls
124 lines (118 loc) · 3.29 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
{
description = "Copier binary with jinja2-git-dir extension";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs =
{
nixpkgs,
...
}:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forEachSupportedSystem =
f:
nixpkgs.lib.genAttrs supportedSystems (
system:
f {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
}
);
in
rec {
devShells = forEachSupportedSystem (
{
pkgs,
system,
...
}:
{
default = pkgs.mkShell {
packages = [
packages.${system}.copier
pkgs.git
];
};
}
);
packages = forEachSupportedSystem (
{
pkgs,
system,
...
}:
{
copier = pkgs.writeShellApplication {
name = "copier";
runtimeInputs = [
pkgs.git
# Override upstream to use latest version and include additional extensions
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/co/copier/package.nix
(pkgs.copier.overridePythonAttrs (old: rec {
version = "9.13.1";
src = pkgs.fetchFromGitHub {
owner = "copier-org";
repo = "copier";
tag = "v${version}";
# Conflict on APFS on darwin
postFetch = ''
rm $out/tests/demo/doc/ma*ana.txt
'';
hash = "sha256-2ejDj9qAdziAaXmgl6eJGEznhceYYKnFBcHznuHZrGQ=";
};
dependencies = old.dependencies ++ [
packages.${system}.gitDirExtension
pkgs.python3.pkgs.hatchling
pkgs.python3.pkgs.hatch-vcs
];
}))
];
text = ''copier "$@"'';
};
gitDirExtension = pkgs.python3Packages.buildPythonPackage rec {
pname = "jinja2-git-dir";
version = "0.5.0";
pyproject = true;
disabled = pkgs.python3Packages.pythonOlder "3.9";
src = pkgs.fetchFromGitHub {
owner = "gordon-code";
repo = "jinja2-git-dir";
tag = "v${version}";
hash = "sha256-YYdwZ0Hypd2fihpsQ6gPht6vHqcpeYP41TahC9jgxzQ=";
};
build-system = [
pkgs.python3Packages.hatchling
pkgs.python3Packages.hatch-vcs
];
dependencies = [ pkgs.python3Packages.jinja2 ];
doCheck = false;
pythonImportsCheck = [ "jinja2_git_dir" ];
};
}
);
apps = forEachSupportedSystem (
{
system,
...
}:
{
default = {
meta.description = "Copier binary for creating project templates";
type = "app";
program = "${packages.${system}.copier}/bin/copier";
};
}
);
formatter = forEachSupportedSystem (
{
pkgs,
...
}:
pkgs.nixfmt-rfc-style
);
};
}