-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
84 lines (80 loc) · 2.11 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
{
description = "NixOS configuration for my personal hosts";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
unstable.url = "nixpkgs/nixos-unstable";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
secrets = {
url = "git+ssh://[email protected]/parveshdhull/nixos-config-secrets";
flake = false;
};
agenix = {
url = "github:ryantm/agenix";
inputs = {
nixpkgs.follows = "nixpkgs";
darwin.follows = "";
home-manager.follows = "";
};
};
};
outputs =
{
self,
nixpkgs,
unstable,
disko,
secrets,
agenix,
}:
let
overlay =
final: prev:
let
# Import nixpkgs for stable and unstable with unfree enabled
stablePkgs = import nixpkgs {
inherit (prev) system;
config.allowUnfree = true;
};
unstablePkgs = import unstable {
inherit (prev) system;
config.allowUnfree = true;
};
in
{
nixpkgs = stablePkgs;
unstable = unstablePkgs;
};
# Overlay to make `pkgs.unstable` available in configuration
overlayModule =
{ config, pkgs, ... }:
{
nixpkgs.overlays = [ overlay ];
};
# To generate host configurations for all hosts.
hostnames = builtins.attrNames (builtins.readDir ./hosts);
in
{
nixosConfigurations = builtins.listToAttrs (
builtins.map (hostname: {
name = hostname;
value = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
channels = {
inherit nixpkgs unstable agenix;
};
inherit secrets;
};
modules = [
overlayModule
disko.nixosModules.disko
agenix.nixosModules.default
./hosts/${hostname}/configuration.nix
(_: { networking.hostName = hostname; })
];
};
}) hostnames
);
};
}