-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
157 lines (134 loc) · 4.65 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
{
description = "NixOS configuration with flakes";
inputs = {
home-manager.url = "github:nix-community/home-manager/release-24.05";
# NixOS profiles covering hardware quirks:
# https://github.com/NixOS/nixos-hardware
nixos-hardware = {
type = "github";
owner = "NixOS";
repo = "nixos-hardware";
flake = false;
};
# Zsh completion
nix-zsh-completions = {
type = "github";
owner = "spwhitt";
repo = "nix-zsh-completions";
flake = false;
};
# nixpkgs versions
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs-old.url = "github:NixOS/nixpkgs/nixos-24.05";
# Nix formatter
nixpkgs-fmt = {
url = "github:nix-community/nixpkgs-fmt";
flake = false;
};
# NixOS Artwork for background
nixos-artwork = {
type = "github";
owner = "nixos";
repo = "artwork";
flake = false;
};
# Personal config
gpg-config = {
url = "github:stefanDeveloper/gpg-conf";
flake = false;
};
# A few Nix expressions suitable for inclusion in Nix User Repository
rycee = {
url = "gitlab:rycee/nur-expressions";
flake = false;
};
# NixOS Generator for vBox, ISO, ... images
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
# NUR community for FireFox, and other apps
nur.url = github:nix-community/NUR;
};
outputs = { nixpkgs, nixpkgs-unstable, nixpkgs-old, self, nur, home-manager, nixpkgs-fmt, nixos-artwork, nixos-generators, ... } @ inputs: {
nixosModules = import ./modules;
nixosProfiles = import ./profiles;
nixosConfigurations = with nixpkgs.lib;
let
hosts = builtins.attrNames (builtins.readDir ./hosts);
mkHost = name:
nixosSystem {
system = removeSuffix "\n" (builtins.readFile (./hosts + "/${name}/system"));
modules =
let
defaults = { pkgs, ... }: {
_module.args.nixpkgs-unstable = import inputs.nixpkgs-unstable { inherit (pkgs.stdenv.targetPlatform) system; };
_module.args.nixpkgs-old = import inputs.nixpkgs-old { inherit (pkgs.stdenv.targetPlatform) system; };
};
in
[
defaults
(import (./hosts + "/${name}"))
{ nixpkgs.overlays = [ nur.overlay ]; }
];
specialArgs = { inherit inputs; };
};
in
genAttrs hosts mkHost;
legacyPackages.x86_64-linux =
(builtins.head (builtins.attrValues self.nixosConfigurations)).pkgs;
# For vBox, ISO and VMWare generation
packages.x86_64-linux = {
iso = nixos-generators.nixosGenerate {
system = "x86_64-linux";
customFormats = {
install-iso-minimal = {
imports = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
];
systemd.services.sshd.wantedBy = nixpkgs.lib.mkForce ["multi-user.target"];
isoImage.squashfsCompression = "zstd -Xcompression-level 3";
# EFI booting
isoImage.makeEfiBootable = true;
# USB booting
isoImage.makeUsbBootable = true;
formatAttr = "isoImage";
fileExtension = "*.iso";
};
};
format = "install-iso-minimal";
modules =
let
defaults = { pkgs, ... }: {
_module.args.nixpkgs-unstable = import inputs.nixpkgs-unstable { inherit (pkgs.stdenv.targetPlatform) system; };
_module.args.nixpkgs-old = import inputs.nixpkgs-old { inherit (pkgs.stdenv.targetPlatform) system; };
};
in
[
defaults
{ nixpkgs.overlays = [ nur.overlay ]; }
inputs.self.nixosProfiles.vm-i3
];
specialArgs = { inherit inputs; };
};
vm = nixos-generators.nixosGenerate {
system = "x86_64-linux";
format = "vm";
modules =
let
defaults = { pkgs, ... }: {
_module.args.nixpkgs-unstable = import inputs.nixpkgs-unstable { inherit (pkgs.stdenv.targetPlatform) system; };
_module.args.nixpkgs-old = import inputs.nixpkgs-old { inherit (pkgs.stdenv.targetPlatform) system; };
};
in
[
defaults
{ nixpkgs.overlays = [ nur.overlay ]; }
inputs.self.nixosProfiles.vm-sway
];
specialArgs = { inherit inputs; };
};
};
};
}