diff --git a/nixos/hermod/configuration.nix b/nixos/hermod/configuration.nix new file mode 100644 index 0000000..622cdec --- /dev/null +++ b/nixos/hermod/configuration.nix @@ -0,0 +1,30 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ ./hardware-configuration.nix ./disko-config.nix ]; + + boot.loader.grub.enable = true; + + services.openssh.enable = true; + + users.users.hermod = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + openssh.authorizedKeys.keys = [ + "sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBDpeouwzFZoYA7AYARaJ/qdQHORJB2h1V73PXQYEAI7sDrc3kYwgZPbrZ3pGkGKaHBl45kiV6SYsC7191OCwIl8AAAAEc3NoOg== A" + "sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBHlAtX4mBifZZ8u6sJckCgA6skwN7aamVK+lQuXLQ6kQWJy7GlEXEmoR9RW/0UIrQYLC+wd8Q5MROkYpn+cHLSoAAAAEc3NoOg== B" + ]; + }; + + networking.hostName = "hermod"; + + nix.settings.trusted-users = [ "hermod" ]; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + environment.systemPackages = with pkgs; [ btop vim tailscale python3 htop ]; + nixpkgs.config.allowUnfree = true; + security.sudo.wheelNeedsPassword = false; + time.timeZone = "Europe/Helsinki"; + + console.keyMap = "no"; + system.stateVersion = "24.11"; +} diff --git a/nixos/hermod/disko-config.nix b/nixos/hermod/disko-config.nix new file mode 100644 index 0000000..d439fcc --- /dev/null +++ b/nixos/hermod/disko-config.nix @@ -0,0 +1,37 @@ +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "gpt"; + partitions = { + boot = { + size = "1M"; + type = "EF02"; + priority = 1; + }; + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/nixos/hermod/flake.lock b/nixos/hermod/flake.lock new file mode 100644 index 0000000..bd17d01 --- /dev/null +++ b/nixos/hermod/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749200714, + "narHash": "sha256-W8KiJIrVwmf43JOPbbTu5lzq+cmdtRqaNbOsZigjioY=", + "owner": "nix-community", + "repo": "disko", + "rev": "17d08c65c241b1d65b3ddf79e3fac1ddc870b0f6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1748995628, + "narHash": "sha256-bFufQGSAEYQgjtc4wMrobS5HWN0hDP+ZX+zthYcml9U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8eb3b6a2366a7095939cd22f0dc0e9991313294b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "disko": "disko", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nixos/hermod/flake.nix b/nixos/hermod/flake.nix new file mode 100644 index 0000000..09e12b6 --- /dev/null +++ b/nixos/hermod/flake.nix @@ -0,0 +1,20 @@ +{ + inputs = { + nixpkgs = { url = "github:NixOS/nixpkgs/nixos-24.11"; }; + + disko = { + url = "github:nix-community/disko"; + inputs = { nixpkgs = { follows = "nixpkgs"; }; }; + }; + }; + + outputs = inputs@{ self, nixpkgs, ... }: { + nixosConfigurations = { + hermod = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + + modules = [ ./configuration.nix inputs.disko.nixosModules.disko ]; + }; + }; + }; +} diff --git a/nixos/hermod/hardware-configuration.nix b/nixos/hermod/hardware-configuration.nix new file mode 100644 index 0000000..ffe3d69 --- /dev/null +++ b/nixos/hermod/hardware-configuration.nix @@ -0,0 +1,18 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. + +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; + + boot.initrd.availableKernelModules = + [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + swapDevices = [ ]; + networking.useDHCP = lib.mkDefault true; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +}