initial commit

This commit is contained in:
Victor Ișan 2025-12-19 16:33:40 +01:00
commit 4fe3976a16
5 changed files with 121 additions and 0 deletions

30
disko/btrfs-legacy.nix Normal file
View File

@ -0,0 +1,30 @@
{ device }:
{
disk.main = {
type = "disk";
inherit device;
content = {
type = "msdos";
partitions = {
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"@root" = { mountpoint = "/"; };
"@nix" = { mountpoint = "/nix"; };
"@var" = { mountpoint = "/var"; };
"@docker" = { mountpoint = "/var/lib/docker"; };
"@home" = { mountpoint = "/home"; };
"@snapshots" = { mountpoint = "/.snapshots"; };
};
};
};
};
};
};
}

36
flake.nix Normal file
View File

@ -0,0 +1,36 @@
{
description = "NixOS server fleet";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
disko.url = "github:nix-community/disko";
};
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
release = "25.11";
mainDisk = "/dev/sda";
myUser = "victor";
in {
nixosConfigurations = {
isengard = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit release mainDisk myUser; };
modules = [
inputs.disko.nixosModules.disko
./hosts/isengard.nix
./modules/base.nix
./modules/docker.nix
({ ... }: {
disko.devices = import ./disko/btrfs-legacy.nix {
device = mainDisk;
};
})
];
};
};
};
}

25
hosts/isengard.nix Normal file
View File

@ -0,0 +1,25 @@
{ config, pkgs, myUser, release, ... }:
{
networking.hostName = "isengard";
time.timeZone = "Europe/Bucharest";
users.users.myUser = {
isNormalUser = true;
extraGroups = [ "wheel" "docker" ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOiNyGO4RAxSdxvn2ZIBZ2Ze4iVVMrBNmu/V9JO70PoT victor@battleship"
];
};
networking.useDHCP = true;
services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
};
system.stateVersion = release;
}

20
modules/base.nix Normal file
View File

@ -0,0 +1,20 @@
{ config, pkgs, mainDisk, ... }:
{
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
boot.loader.grub = {
enable = true;
device = mainDisk;
};
environment.systemPackages = with pkgs; [
git
curl
htop
tmux
];
}

10
modules/docker.nix Normal file
View File

@ -0,0 +1,10 @@
{ config, myUser, ... }:
{
virtualization.docker.rootless = {
enable = true;
setSocketVariable = true;
storageDriver = "btrfs";
users.users.myUser.extraGroups = [ "docker" ];
}
}