-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
145 lines (126 loc) · 3.87 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
{
description = "Stefans Laptop config";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
stefan-website = {
type = "github";
owner = "stefankeidel";
repo = "website";
flake = false;
};
# for pinning poetry to 1.6.1
# https://github.com/NixOS/nixpkgs/commit/881e946d8b96b1c52d74e2b69792aa89354feffd
poetrypin.url = "github:NixOS/nixpkgs/881e946d8b96b1c52d74e2b69792aa89354feffd";
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
agenix.inputs.home-manager.follows = "home-manager";
# vscode
# nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
};
outputs = inputs @ {
self,
nixpkgs,
nix-darwin,
nix-stable,
home-manager,
agenix,
...
}: let
pkgs-unstable = inputs.nixpkgs.legacyPackages.aarch64-darwin;
poetrypin = inputs.poetrypin.legacyPackages.aarch64-darwin;
pythonVersions = {
python39 = pkgs-unstable.python39;
python310 = pkgs-unstable.python310;
python311 = pkgs-unstable.python311;
python312 = pkgs-unstable.python312;
python313 = pkgs-unstable.python313;
default = pkgs-unstable.python312;
};
# A function to make a shell with a python version
makePythonShell = shellName: pythonPackage:
pkgs-unstable.mkShell {
# You could add extra packages you need here too
packages = [
pythonPackage
poetrypin.poetry
pkgs-unstable.azure-cli
pkgs-unstable.openssl
pkgs-unstable.postgresql
];
# You can also add commands that run on shell startup with shellHook
shellHook = ''
# use nix python
poetry env use $(which python)
# install locally
poetry config virtualenvs.in-project true
'';
};
in {
nixosConfigurations.nixie = nix-stable.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs;
};
modules = [
agenix.nixosModules.default
./hosts/nixie/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.stefan = import ./hosts/nixie/home.nix;
home-manager.extraSpecialArgs = {inherit inputs;};
}
];
};
# Mac Laptop crap
darwinConfigurations = {
# work laptop
"Stefan-Keidel-MacBook-Pro" = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {
inherit inputs;
userConfig = {
name = "[email protected]";
home = "/Users/[email protected]/";
};
};
modules = [
./hosts/darwin/default.nix
agenix.nixosModules.default
home-manager.darwinModules.home-manager
# custom settings for this machine
./hosts/darwin/lichtblick.nix
];
};
# Mac mini at home
"mini" = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {
inherit inputs;
userConfig = {
name = "stefan";
home = "/Users/stefan/";
};
};
modules = [
./hosts/darwin/default.nix
agenix.nixosModules.default
home-manager.darwinModules.home-manager
# custom settings for this machine
./hosts/darwin/mini.nix
];
};
};
devShells.aarch64-darwin = builtins.mapAttrs makePythonShell pythonVersions;
};
}