-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathflake.nix
107 lines (87 loc) · 2.62 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
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
{
description = "Nix flake of all Vim/Neovim plugins";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = { self, nixpkgs, flake-utils, poetry2nix, ... }:
let
inherit (flake-utils.lib)
filterPackages
eachSystem
mkApp;
systems = [ "aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ];
in eachSystem systems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
inherit (pkgs)
callPackage
runCommandNoCC;
inherit (pkgs.lib)
mapAttrsToList;
inherit (poetry2nix.legacyPackages.${system})
mkPoetryApplication;
update-vim-plugins = callPackage ./pkgs/update-vim-plugins.nix { inherit mkPoetryApplication; };
# cheks if a plugin has a license
hasLicense = pkg:
let
warn = x: nixpkgs.lib.warn x x;
msg =
if builtins.hasAttr "license" pkg.meta then
"${pkg.name} has license"
else
warn "${pkg.name} has no license";
msg' = nixpkgs.lib.replaceStrings [" "] ["-"] msg;
in runCommandNoCC msg' {} "echo : > $out ";
# function to check lisece for all packages
check-missing-licenses =
let
buildInputs =
mapAttrsToList
(_: pkg: hasLicense pkg)
self.packages.${system};
in runCommandNoCC
"check-missing-licenses"
{ inherit buildInputs; }
"echo : > $out";
in {
packages = filterPackages system pkgs.vimExtraPlugins;
apps = {
update-vim-plugins = mkApp {
drv = update-vim-plugins;
};
};
checks = self.packages.${system} // {
inherit check-missing-licenses;
inherit update-vim-plugins;
};
devShells = {
default = pkgs.mkShell {
inherit (update-vim-plugins) buildInputs;
};
pythonEnv = pkgs.mkShell {
name = "Python Env";
packages = with pkgs; let
python-with-packages = pkgs.python3.withPackages (p: with p; [
cleo
requests
jsonpickle
]);
in [
python-with-packages
alejandra
];
};
};
}) // {
overlays.default = import ./overlay.nix;
};
}