Initial config

This commit is contained in:
Wekuz 2025-11-21 23:06:35 +02:00
commit a313068ec5
Signed by: Wekuz
GPG key ID: 2E502F2AABD32DF9
5 changed files with 144 additions and 0 deletions

2
TODO Normal file
View file

@ -0,0 +1,2 @@
- distributed build (https://nix.dev/tutorials/nixos/distributed-builds-setup)
- setup script (https://github.com/jakeb-grant/nix-configs/blob/main/setup.sh)

21
flake.nix Normal file
View file

@ -0,0 +1,21 @@
{
description = "Opti NixOS Flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, disko, ... }@inputs: {
nixosConfigurations = {
opti = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [ disko.nixosModules.disko ./hosts/opti ];
};
};
};
}

View file

@ -0,0 +1,40 @@
{ config, lib, pkgs, meta, ... }:
{
imports = [ ./hardware-configuration.nix ./disko.nix ./configuration.nix ];
nix = {
package = pkgs.nixFlakes;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
nixpkgs.hostPlatform = "x86_64-linux";
networking = {
hostName = "opti";
networkmanager.enable = true;
firewall.enable = false; # TODO: Configure firewall
};
services.openssh.enable = true;
environment.systemPackages = with pkgs; [ git ];
users.users.wekuz = {
isNormalUser = true;
extraGroups = [ "wheel" ];
packages = with pkgs; [ ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBs3aPxyJpVGytuVSO3va2WybKNFMR241o8DCJQbBEWV"
];
};
system.stateVersion = "25.05";
}

56
hosts/opti/disko.nix Normal file
View file

@ -0,0 +1,56 @@
{
disko.devices = {
disk = {
one = {
type = "disk";
device = "/dev/disk/by-id/nvme-eui.00000000000000000c82d58020000000";
content = {
type = "gpt";
partitions = {
boot = {
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
primary = {
size = "100%";
content = {
type = "lvm_pv";
vg = "pool";
};
};
};
};
};
};
lvm_vg = {
pool = {
type = "lvm_vg";
lvs = {
root = {
size = "96G";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
mountOptions = [ "defaults" ];
};
};
home = {
size = "100%FREE";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/home";
};
};
};
};
};
};
}

25
iso/iso.nix Normal file
View file

@ -0,0 +1,25 @@
{
description = "My NixOS installation media";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }: {
packages.x86_64-linux.default =
self.nixosConfigurations.exampleIso.config.system.build.isoImage;
nixosConfigurations = {
exampleIso = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ pkgs, modulesPath, ... }: {
imports = [
(modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix")
];
systemd.services.sshd.wantedBy =
pkgs.lib.mkForce [ "multi-user.target" ];
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBs3aPxyJpVGytuVSO3va2WybKNFMR241o8DCJQbBEWV"
];
})
];
};
};
};
}