mirror of
https://github.com/nickolaj-jepsen/nixos.git
synced 2026-01-22 08:06:50 +01:00
refactor: simplify host setup
This commit is contained in:
parent
15fb616845
commit
d1d4082d56
27 changed files with 147 additions and 90 deletions
|
|
@ -4,12 +4,6 @@
|
|||
inputs,
|
||||
...
|
||||
}: {
|
||||
# Minimal system without desktop or dev tools
|
||||
fireproof.desktop.enable = false;
|
||||
fireproof.dev.enable = false;
|
||||
fireproof.work.enable = false;
|
||||
fireproof.homelab.enable = false;
|
||||
|
||||
# Use the nixos installation ISO as base
|
||||
imports = [
|
||||
"${inputs.nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
|
||||
|
|
|
|||
9
hosts/bootstrap/default.nix
Normal file
9
hosts/bootstrap/default.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
config.fireproof.hostname = "bootstrap";
|
||||
config.fireproof.username = "nickolaj";
|
||||
|
||||
imports = [
|
||||
./configuration.nix
|
||||
./disk-configuration.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,21 +1,10 @@
|
|||
{
|
||||
inputs,
|
||||
withSystem,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
mkSystemImports = hostname: let
|
||||
hostDirectory = ./. + ("/" + hostname);
|
||||
nixFiles = filter (file: hasSuffix ".nix" file) (attrNames (builtins.readDir hostDirectory));
|
||||
imports = map (file: ./. + ("/" + hostname + "/" + file)) nixFiles;
|
||||
in {
|
||||
inherit imports;
|
||||
};
|
||||
|
||||
}: let
|
||||
mkSystem = {
|
||||
hostname,
|
||||
username,
|
||||
host,
|
||||
modules ? [],
|
||||
system ? "x86_64-linux",
|
||||
}:
|
||||
|
|
@ -28,7 +17,7 @@ with lib; let
|
|||
in
|
||||
inputs.nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = {inherit inputs hostname username pkgsUnstable;};
|
||||
specialArgs = {inherit inputs pkgsUnstable;};
|
||||
modules =
|
||||
[
|
||||
inputs.disko.nixosModules.disko
|
||||
|
|
@ -46,37 +35,17 @@ with lib; let
|
|||
../modules/programs
|
||||
../modules/desktop
|
||||
../modules/homelab
|
||||
(mkSystemImports hostname)
|
||||
{nixpkgs.config.allowUnfree = true;}
|
||||
host
|
||||
]
|
||||
++ modules
|
||||
++ (
|
||||
lib.optional (builtins.pathExists ./${hostname}/facter.json)
|
||||
{config.facter.reportPath = ./${hostname}/facter.json;}
|
||||
);
|
||||
++ modules;
|
||||
}
|
||||
);
|
||||
in {
|
||||
config.flake.nixosConfigurations = {
|
||||
laptop = mkSystem {
|
||||
hostname = "laptop";
|
||||
username = "nickolaj";
|
||||
};
|
||||
desktop = mkSystem {
|
||||
hostname = "desktop";
|
||||
username = "nickolaj";
|
||||
};
|
||||
work = mkSystem {
|
||||
hostname = "work";
|
||||
username = "nickolaj";
|
||||
};
|
||||
homelab = mkSystem {
|
||||
hostname = "homelab";
|
||||
username = "nickolaj";
|
||||
};
|
||||
bootstrap = mkSystem {
|
||||
hostname = "bootstrap";
|
||||
username = "nickolaj";
|
||||
};
|
||||
laptop = mkSystem {host = ./laptop;};
|
||||
desktop = mkSystem {host = ./desktop;};
|
||||
work = mkSystem {host = ./work;};
|
||||
homelab = mkSystem {host = ./homelab;};
|
||||
bootstrap = mkSystem {host = ./bootstrap;};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
fireproof.desktop.enable = true;
|
||||
fireproof.work.enable = true;
|
||||
fireproof.dev.enable = true;
|
||||
}
|
||||
22
hosts/desktop/default.nix
Normal file
22
hosts/desktop/default.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
config = {
|
||||
fireproof = {
|
||||
hostname = "desktop";
|
||||
username = "nickolaj";
|
||||
desktop.enable = true;
|
||||
work.enable = true;
|
||||
dev.enable = true;
|
||||
};
|
||||
|
||||
facter.reportPath = ./facter.json;
|
||||
};
|
||||
|
||||
imports = [
|
||||
./boot.nix
|
||||
./disk-configuration.nix
|
||||
./monitors.nix
|
||||
./networking.nix
|
||||
./nvidia.nix
|
||||
./ssh.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -3,9 +3,6 @@
|
|||
lib,
|
||||
...
|
||||
}: {
|
||||
fireproof.dev.enable = true;
|
||||
fireproof.homelab.enable = true;
|
||||
|
||||
boot = {
|
||||
# Use grub as bootloader as it works better with mdadm
|
||||
loader.grub.enable = true;
|
||||
|
|
|
|||
17
hosts/homelab/default.nix
Normal file
17
hosts/homelab/default.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
config = {
|
||||
fireproof = {
|
||||
hostname = "homelab";
|
||||
username = "nickolaj";
|
||||
dev.enable = true;
|
||||
homelab.enable = true;
|
||||
};
|
||||
facter.reportPath = ./facter.json;
|
||||
};
|
||||
|
||||
imports = [
|
||||
./configuration.nix
|
||||
./disks.nix
|
||||
./networking.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,7 +1,4 @@
|
|||
{pkgs, ...}: {
|
||||
fireproof.desktop.enable = true;
|
||||
fireproof.work.enable = true;
|
||||
fireproof.dev.enable = true;
|
||||
# Enable OpenGL
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
|
|
|
|||
19
hosts/laptop/default.nix
Normal file
19
hosts/laptop/default.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
config = {
|
||||
fireproof = {
|
||||
desktop.enable = true;
|
||||
work.enable = true;
|
||||
dev.enable = true;
|
||||
hostname = "laptop";
|
||||
username = "nickolaj";
|
||||
};
|
||||
facter.reportPath = ./facter.json;
|
||||
};
|
||||
|
||||
imports = [
|
||||
./configuration.nix
|
||||
./disk-configuration.nix
|
||||
./monitors.nix
|
||||
./ssh.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
fireproof.desktop.enable = true;
|
||||
fireproof.work.enable = true;
|
||||
fireproof.dev.enable = true;
|
||||
}
|
||||
21
hosts/work/default.nix
Normal file
21
hosts/work/default.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
config = {
|
||||
fireproof = {
|
||||
hostname = "work";
|
||||
username = "nickolaj";
|
||||
desktop.enable = true;
|
||||
work.enable = true;
|
||||
dev.enable = true;
|
||||
};
|
||||
facter.reportPath = ./facter.json;
|
||||
};
|
||||
|
||||
imports = [
|
||||
./bluetooth.nix
|
||||
./disk-configuration.nix
|
||||
./monitors.nix
|
||||
./networking.nix
|
||||
./nvidia.nix
|
||||
./ssh.nix
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue