-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
125 lines (106 loc) · 2.98 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
{
description = "My NixOS config";
inputs = {
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager-stable = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
home-manager-unstable = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
private-config = {
# url = "path:/home/mateus/repos/nixos-private-config";
url = "git+ssh://[email protected]/mateusauler/nixos-private-config";
flake = false;
};
nixvim-stable.url = "github:nix-community/nixvim/nixos-24.11";
nixvim-unstable.url = "github:nix-community/nixvim";
sops-nix = {
url = "github:mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
stylix-stable.url = "github:danth/stylix/release-24.11";
stylix-unstable.url = "github:mateusauler/stylix";
gx = {
url = "github:chrishrb/gx.nvim";
flake = false;
};
};
outputs =
inputs@{ nixpkgs-stable, nixpkgs-unstable, ... }:
let
system = "x86_64-linux";
default-channel = "unstable";
overlays = [
(final: prev: {
lib =
prev.lib
// import ./lib {
inherit (final) lib;
inherit pkgs;
};
})
];
pkgs-args = {
inherit overlays;
localSystem = system;
config.allowUnfree = true;
};
pkgs-stable = import nixpkgs-stable pkgs-args;
pkgs-unstable = import nixpkgs-unstable pkgs-args;
pkgs = if default-channel == "stable" then pkgs-stable else pkgs-unstable;
inherit (pkgs) lib;
lib-stable = pkgs-stable.lib;
lib-unstable = pkgs-unstable.lib;
private-config = import inputs.private-config (inputs // { inherit lib pkgs; });
machines = lib.readDirNames ./hosts;
hosts-preferred-nixpkgs-channel = {
amadeus = "stable";
};
specialArgs = {
inherit
nixpkgs-stable
nixpkgs-unstable
pkgs-stable
pkgs-unstable
lib-stable
lib-unstable
;
};
mkHost =
acc: hostname:
acc
// {
${hostname} = lib-stable.mkNixosSystem {
inherit
hostname
system
inputs
default-channel
pkgs
specialArgs
private-config
hosts-preferred-nixpkgs-channel
;
};
};
in
{
nixosConfigurations =
(private-config.systems {
inherit
system
inputs
default-channel
pkgs
specialArgs
;
})
// (lib.foldl mkHost { } machines);
devShells.${system}.default = import ./shell.nix { inherit pkgs; };
templates = import ./templates;
};
}