Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
119 lines (111 loc) · 4.24 KB
/
Copy pathflake.nix
File metadata and controls
119 lines (111 loc) · 4.24 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
{
description = "Fredrik's unified Nix configurations";
# NOTE: To eliminate substituter warnings, add your username to trusted users:
# Edit /etc/nix/nix.conf: change "trusted-users = root" to "trusted-users = root fredrik"
# Then restart nix daemon: sudo launchctl kickstart -k system/org.nixos.nix-daemon
nixConfig = {
extra-substituters = [
"https://nixos-raspberrypi.cachix.org"
];
extra-trusted-public-keys = [
"nixos-raspberrypi.cachix.org-1:4iMO9LXa8BqhU+Rpg6LQKiGa2lsNh/j2oiYLNOQ5sPI="
];
};
inputs = {
# Mixed stability approach:
# - Linux/NixOS: Uses stable (nixos-25.05 + home-manager/release-25.05)
# - Darwin/macOS: Uses unstable (nixpkgs-unstable + home-manager-unstable + nix-darwin)
#
# Rationale: Darwin ecosystem moves faster, benefits from latest packages.
# Linux systems prioritize stability.
#
# Version alignment references:
# - home-manager releases: https://github.com/nix-community/home-manager/releases
# - Darwin state versions: https://github.com/LnL7/nix-darwin/blob/master/modules/system/default.nix
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
nixos-raspberrypi.url = "github:nvmd/nixos-raspberrypi/main";
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-25.05";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager-unstable = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
dotfiles = {
# Used by home-manager for dotfiles bootstrapping.
url = "github:fredrikaverpil/dotfiles";
flake = false;
};
};
outputs =
{ self, ... }@inputs:
let
lib = import ./nix/lib { inherit inputs; };
stable = inputs.nixpkgs.legacyPackages;
unstable = inputs.nixpkgs-unstable.legacyPackages;
mkDevShells = system: {
default = stable.${system}.mkShell {
packages = [
stable.${system}.nixfmt
];
};
dotfiles-toolchain = unstable.${system}.mkShell {
packages = [
# Stable packages
# stable.${system}.xxx
# Unstable packages
unstable.${system}.bun
unstable.${system}.go_latest
unstable.${system}.nodejs
unstable.${system}.pnpm
unstable.${system}.python3
unstable.${system}.ruby
];
shellHook = ''
echo -e "\033[32m[dotfiles-toolchain] bun $(bun --version) | $(go version | awk '{print $1" "$3}') | lua $(lua -v 2>&1 | awk '{print $2}') | node $(node -v) (npm $(npm -v)) | pnpm $(pnpm -v) | python $(python --version | awk '{print $2}') | $(ruby -v | cut -d' ' -f1-2)\033[0m"
'';
};
};
in
{
overlays.default = import ./nix/shared/overlays;
nixosConfigurations = {
rpi5-homelab = lib.mkRpiNixos {
configPath = ./nix/hosts/rpi5-homelab/configuration.nix;
};
# Example standard NixOS configuration:
# my-server = lib.mkNixos {
# configPath = ./nix/hosts/my-server/configuration.nix;
# };
};
darwinConfigurations = {
zap = lib.mkDarwin {
configPath = ./nix/hosts/zap/configuration.nix;
};
plumbus = lib.mkDarwin {
configPath = ./nix/hosts/plumbus/configuration.nix;
};
};
# Formatters for `nix fmt` - uses nixfmt for each architecture
formatter.x86_64-linux = stable.x86_64-linux.nixfmt;
formatter.aarch64-linux = stable.aarch64-linux.nixfmt;
formatter.aarch64-darwin = unstable.aarch64-darwin.nixfmt;
# Development shells for `nix develop` or direnv's `use flake` - provides toolchains for each architecture
devShells = {
x86_64-linux = mkDevShells "x86_64-linux";
aarch64-linux = mkDevShells "aarch64-linux";
aarch64-darwin = mkDevShells "aarch64-darwin";
};
};
}