-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
146 lines (141 loc) · 6.38 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
{
description = "lun's system config";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/release-24.05";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
systems.url = "github:nix-systems/default-linux";
flake-utils.url = "github:numtide/flake-utils";
flake-utils.inputs.systems.follows = "systems";
nix-gaming.url = "github:fufexan/nix-gaming";
nix-gaming.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
erosanix.url = "github:emmanuelrosa/erosanix";
erosanix.inputs.nixpkgs.follows = "nixpkgs";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
thoth-reminder-bot.url = "github:mmk150/reminder_bot";
thoth-reminder-bot.inputs.nixpkgs.follows = "nixpkgs";
thoth-reminder-bot.inputs.flake-utils.follows = "flake-utils";
deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
openxr-nix-flake.url = "github:LunNova/openxr-nix-flake";
openxr-nix-flake.inputs.nixpkgs.follows = "nixpkgs";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
crane.url = "github:ipetkov/crane";
advisory-db = {
url = "github:rustsec/advisory-db";
flake = false;
};
background-switcher = {
url = "github:bootstrap-prime/background-switcher";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
inputs.rust-overlay.follows = "rust-overlay";
inputs.crane.follows = "crane";
inputs.advisory-db.follows = "advisory-db";
};
i3status-nix-update-widget = {
url = "github:bootstrap-prime/i3status-nix-update-widget";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
inputs.rust-overlay.follows = "rust-overlay";
inputs.crane.follows = "crane";
inputs.advisory-db.follows = "advisory-db";
};
mobile-nixos = {
url = "github:NixOS/mobile-nixos";
flake = false;
};
plover-flake = {
url = "github:dnaq/plover-flake";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
nixos-cosmic = {
url = "github:lilyinstarlight/nixos-cosmic";
inputs.nixpkgs.follows = "nixpkgs";
};
alicorn-vscode-extension = {
url = "github:Fundament-Software/alicorn-vscode-extension";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
minimal-shell.url = "github:LunNova/nix-minimal-shell";
};
# SCHEMA:
# lib = nix library functions, work on any system
# nixosConfigurations = attrset with nixosConfigurations by hostname, each host is for one specific system
# overlay = function that can be used as a nixpkgs overlay, hopefully works on any system
# perSystem = function which takes system as input and generates system specific outputs for that system
# (system: { packages, legacyPackages, homeConfigurations, checks, slowChecks })
# packages.system = attrset with packages marked as able to eval/build, generated by perSystem
# legacyPackages.system = attrset with packages including unsupported/marked broken, generated by perSystem
# homeConfigurations.system = attrset with homeConfigurations by username, generated by perSystem
# checks.system = attrset with checks, generated by perSystem
# slowChecks.system = attrset with checks that are too slow for nix flake check but are used in CI, generated by perSystem
outputs = flakeArgs:
let
lib = import ./lib { bootstrapLib = flakeArgs.nixpkgs.lib; };
perSystem = import ./per-system.nix { inherit flakeArgs; };
allSystemsUnmerged = flakeArgs.flake-utils.lib.eachDefaultSystem perSystem;
allSystems = allSystemsUnmerged // { homeConfigurations = lib.flatten allSystemsUnmerged.homeConfigurations; };
serviceTest = import ./service-test.nix { };
inherit (flakeArgs) self;
in
{
inherit flakeArgs perSystem lib;
assets = import ./assets;
overlays.default = import ./overlay.nix { inherit flakeArgs; };
localPackagesForPkgs = pkgs: import ./packages { inherit pkgs flakeArgs; };
nixosModules = self.lib.readExportedModules ./modules/exported;
nixosConfigurations = {
test-vm = allSystems.makeHost.x86_64-linux ./hosts/test-vm;
router-nixos = allSystems.makeHost.x86_64-linux ./hosts/router;
tsukiakari-nixos = allSystems.makeHost.x86_64-linux ./hosts/tsukiakari;
lun-kosame-nixos = allSystems.makeHost.x86_64-linux ./hosts/kosame;
lun-hisame-nixos = allSystems.makeHost.x86_64-linux ./hosts/hisame;
lun-amayadori-nixos = allSystems.makeHost.aarch64-linux ./hosts/amayadori;
};
deploy.nodes.router = {
hostname = "10.5.5.1"; # "router-nixos";
profiles.system = {
sshUser = "lun";
user = "root";
path = flakeArgs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.router-nixos;
};
};
deploy.nodes.tsukiakari = {
hostname = "tsukiakari-nixos";
interactiveSudo = true;
profiles.system = {
sshUser = "lun";
user = "root";
path = flakeArgs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.tsukiakari-nixos;
};
remoteBuild = true;
};
deploy.nodes.testSingleServiceDeployAsLunOnLocalhost = {
hostname = "localhost";
profiles.serviceTest = serviceTest.hmProfile {
inherit (flakeArgs) deploy-rs;
inherit (flakeArgs.nixpkgs) lib;
inherit (flakeArgs.self.homeConfigurations.x86_64-linux.lun) pkgs;
user = "lun";
profileName = "lunHello";
modules = [
serviceTest.helloWorldModule
];
hm = import "${flakeArgs.home-manager}/modules";
postActivate = ''
systemctl --user reload-or-restart hello
systemctl --user status hello --lines=1 || true
'';
};
};
} // allSystems;
}