This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
114 lines (101 loc) · 3.07 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
108
109
110
111
112
113
114
{
# TODO update me
description = "Description for the project";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devenv.url = "github:cachix/devenv";
nix2container.url = "github:nlewo/nix2container";
nix2container.inputs.nixpkgs.follows = "nixpkgs";
mk-shell-bin.url = "github:rrbutani/nix-mk-shell-bin";
};
nixConfig = {
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
extra-substituters = "https://devenv.cachix.org";
};
outputs = inputs @ {
flake-parts,
nixpkgs,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
inputs.devenv.flakeModule
];
systems = ["x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
perSystem = {
config,
self',
inputs',
pkgs,
system,
...
}: let
python-packages = p:
with p; [
pip
python-lsp-server
importmagic
epc
black
mypy
];
in {
# Per-system attributes can be defined here. The self' and inputs'
# module parameters provide easy access to attributes of the same
# system.
devenv.shells.default = {
# TODO update me
name = "Name of the project";
imports = [
# This is just like the imports in devenv.nix.
# See https://devenv.sh/guides/using-with-flake-parts/#import-a-devenv-module
# ./devenv-foo.nix
];
# https://devenv.sh/reference/options/
packages = with pkgs; [
stdenv.cc.cc.lib # required by Jupyter
(python3.withPackages python-packages)
];
# https://devenv.sh/basics/
env = {
GREET = "🛠️ Let's hack 🧑🏻💻";
};
# https://devenv.sh/scripts/
scripts.hello.exec = "echo $GREET";
enterShell = ''
hello
'';
# https://devenv.sh/languages/
languages.python = {
enable = true;
poetry = {
enable = true;
activate.enable = true;
install.enable = true;
install.allExtras = true;
};
};
# Make diffs fantastic
difftastic.enable = true;
# https://devenv.sh/pre-commit-hooks/
pre-commit.hooks = {
black.enable = true;
nixfmt.enable = true;
yamllint = {
enable = true;
settings.preset = "relaxed";
};
pyright.enable = true;
editorconfig-checker.enable = true;
};
# https://devenv.sh/integrations/dotenv/
dotenv.enable = true;
};
};
flake = {
# The usual flake attributes can be defined here, including system-
# agnostic ones like nixosModule and system-enumerating ones, although
# those are more easily expressed in perSystem.
};
};
}