-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
170 lines (139 loc) · 5.29 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
{
description = "My NixOS infrastructure";
inputs = {
### Essential inputs
# Nix Packages collection & NixOS
# https://github.com/nixos/nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# A collection of NixOS modules covering hardware quirks.
# https://github.com/NixOS/nixos-hardware
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
# Manage a user environment using Nix
# https://github.com/nix-community/home-manager
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
### Tools for managing NixOS infrastructure
# Format disks with nix-config
# https://github.com/nix-community/disko
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
# NixOS Deployment Tool
# https://github.com/pinpox/lollypops/
lollypops = {
url = "github:pinpox/lollypops";
inputs.nixpkgs.follows = "nixpkgs";
};
# NixOS on the Windows Subsystem for Linux
# https://github.com/nix-community/NixOS-WSL
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
### Packages outside of nixpkgs
# MayNiklas - used for build_outputs
mayniklas = {
url = "github:MayNiklas/nixos";
inputs = {
disko.follows = "disko";
home-manager.follows = "home-manager";
lollypops.follows = "lollypops";
nixos-hardware.follows = "nixos-hardware";
nixpkgs.follows = "nixpkgs";
};
};
authentik-nix = {
url = "github:nix-community/authentik-nix";
## optional overrides. Note that using a different version of nixpkgs can cause issues, especially with python dependencies
# inputs.nixpkgs.follows = "nixpkgs"
# inputs.flake-parts.follows = "flake-parts"
};
zen-browser.url = "github:youwen5/zen-browser-flake";
grub2-themes = {
#url = "git+file:///home/paulmiro/repos/paulmiro/grub2-themes";
url = "github:paulmiro/grub2-themes";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, ... }@inputs:
with inputs;
let
supportedSystems = [ "aarch64-linux" "x86_64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ ]; });
in
{
formatter = forAllSystems
(system: nixpkgsFor.${system}.nixpkgs-fmt);
packages = forAllSystems (system:
let pkgs = nixpkgsFor.${system}; in {
woodpecker-pipeline =
pkgs.callPackage ./pkgs/woodpecker-pipeline {
flake-self = self;
inputs = inputs;
};
build_outputs =
pkgs.callPackage mayniklas.packages.${system}.build_outputs.override {
inherit self;
output_path = "~/.keep-nix-outputs-paulmiro";
};
});
apps = forAllSystems (system: {
lollypops = lollypops.apps.${system}.default { configFlake = self; };
});
# Output all modules in ./modules to flake. Modules should be in
# individual subdirectories and contain a default.nix file
nixosModules = builtins.listToAttrs (map
(x: {
name = x;
value = import (./modules + "/${x}");
})
(builtins.attrNames (builtins.readDir ./modules)));
# Each subdirectory in ./machines is a host. Add them all to
# nixosConfiguratons. Host configurations need a file called
# configuration.nix that will be read first
nixosConfigurations = builtins.listToAttrs (map
(x: {
name = x;
value = nixpkgs.lib.nixosSystem {
# Make inputs and the flake itself accessible as module parameters.
# Technically, adding the inputs is redundant as they can be also
# accessed with flake-self.inputs.X, but adding them individually
# allows to only pass what is needed to each module.
specialArgs = { flake-self = self; } // inputs;
modules = [
home-manager.nixosModules.home-manager
lollypops.nixosModules.lollypops
authentik-nix.nixosModules.default
nixos-wsl.nixosModules.default
grub2-themes.nixosModules.default
(import "${./.}/machines/${x}/configuration.nix" { inherit self; })
{ imports = builtins.attrValues self.nixosModules; }
];
};
})
(builtins.attrNames (builtins.readDir ./machines)));
homeConfigurations = {
desktop = { pkgs, lib, username, ... }: {
imports = [
./home-manager/profiles/common.nix
./home-manager/profiles/desktop.nix
] ++
(builtins.attrValues self.homeManagerModules);
};
server = { pkgs, lib, username, ... }: {
imports = [
./home-manager/profiles/common.nix
./home-manager/profiles/server.nix
] ++
(builtins.attrValues self.homeManagerModules);
};
};
homeManagerModules = builtins.listToAttrs (map
(name: {
inherit name;
value = import (./home-manager/modules + "/${name}");
})
(builtins.attrNames (builtins.readDir ./home-manager/modules)));
};
}