commit a313068ec5ba228027402e9cbb81cf5d8878afcb Author: Wekuz Date: Fri Nov 21 23:06:35 2025 +0200 Initial config diff --git a/TODO b/TODO new file mode 100644 index 0000000..9efa0b0 --- /dev/null +++ b/TODO @@ -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) diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..4eed61c --- /dev/null +++ b/flake.nix @@ -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 ]; + }; + }; + }; +} diff --git a/hosts/opti/configuration.nix b/hosts/opti/configuration.nix new file mode 100644 index 0000000..5434b57 --- /dev/null +++ b/hosts/opti/configuration.nix @@ -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"; +} diff --git a/hosts/opti/disko.nix b/hosts/opti/disko.nix new file mode 100644 index 0000000..3362694 --- /dev/null +++ b/hosts/opti/disko.nix @@ -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"; + }; + }; + }; + }; + }; + }; +} diff --git a/iso/iso.nix b/iso/iso.nix new file mode 100644 index 0000000..5e29467 --- /dev/null +++ b/iso/iso.nix @@ -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" + ]; + }) + ]; + }; + }; + }; +}