Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define the initial NixOS configuration of webforge in a flake #32

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
inputs = {
# The nixpkgs channels we want to consume
nixpkgs-24_11.url = "github:NixOS/nixpkgs/nixos-24.11-small";

# Some links to the above channels for consistent naming in outputs
nixpkgs.follows = "nixpkgs-24_11";
};
outputs = { self, nixpkgs, ... }@attrs: {
# Generate an attrset of nixosConfigurations based on their system name
nixosConfigurations = nixpkgs.lib.attrsets.genAttrs [
"webforge"
] (sysname: nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = attrs;
modules = [
{ system.name = sysname; }
./nix/hosts/${sysname}/configuration.nix
];
}
);
};
}
16 changes: 16 additions & 0 deletions nix/hosts/webforge/configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{ ... }: {
imports = [
./hardware-configuration.nix
./networking.nix # generated at runtime by nixos-infect
];

boot.tmp.cleanOnBoot = true;
zramSwap.enable = true;
networking.hostName = "webforge";
networking.domain = "";
services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJlPneIaRT/mqu13N83ctEftub4O6zAfi6qgzZKerU5o florian@leastauthority.com"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIZtWY7t8HVnaz6bluYsrAlzZC3MZtb8g0nO5L5fCQKR benoit@leastauthority.com" ];
system.stateVersion = "23.11";
}
8 changes: 8 additions & 0 deletions nix/hosts/webforge/hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.loader.grub.device = "/dev/sda";
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ];
boot.initrd.kernelModules = [ "nvme" ];
fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; };
}
35 changes: 35 additions & 0 deletions nix/hosts/webforge/networking.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{ lib, ... }: {
# This file was populated at runtime with the networking
# details gathered from the active system.
networking = {
nameservers = [
"2a01:4ff:ff00::add:2"
"2a01:4ff:ff00::add:1"
"185.12.64.1"
"185.12.64.2"
];
defaultGateway = "172.31.1.1";
defaultGateway6 = {
address = "fe80::1";
interface = "eth0";
};
dhcpcd.enable = false;
usePredictableInterfaceNames = lib.mkForce false;
interfaces = {
eth0 = {
ipv4.addresses = [
{ address="135.181.155.146"; prefixLength=32; }
];
ipv6.addresses = [
{ address="2a01:4f9:c011:b882::1"; prefixLength=64; }
{ address="fe80::9400:4ff:fe03:57eb"; prefixLength=64; }
];
ipv4.routes = [ { address = "172.31.1.1"; prefixLength = 32; } ];
ipv6.routes = [ { address = "fe80::1"; prefixLength = 128; } ];
};
};
};
services.udev.extraRules = ''
ATTR{address}=="96:00:04:03:57:eb", NAME="eth0"
'';
}