aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiran Bastaja <miran.bastaja04@gmail.com>2023-11-27 08:59:40 +0100
committerMiran Bastaja <miran.bastaja04@gmail.com>2023-11-27 08:59:40 +0100
commitaa6f4fa0d87677c6b62b52595e7e3f29b2e06380 (patch)
tree64712b06885e9376a76c7e747a1c34c1bac72829
parent6379844a32d8c5378bba2cad2f5b20c9a4fea1d8 (diff)
Create underworld host
-rw-r--r--flake.lock21
-rw-r--r--flake.nix5
-rw-r--r--hosts/underworld/default.nix95
-rw-r--r--hosts/underworld/disko.nix45
-rw-r--r--hosts/underworld/hardware.nix26
-rw-r--r--hosts/underworld/home.nix23
6 files changed, 215 insertions, 0 deletions
diff --git a/flake.lock b/flake.lock
index 3bd1b26..91b3bf0 100644
--- a/flake.lock
+++ b/flake.lock
@@ -21,6 +21,26 @@
"type": "github"
}
},
+ "disko": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1700927249,
+ "narHash": "sha256-iqmIWiEng890/ru7ZBf4nUezFPyRm2fjRTvuwwxqk2o=",
+ "owner": "nix-community",
+ "repo": "disko",
+ "rev": "3cb78c93e6a02f494aaf6aeb37481c27a2e2ee22",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "disko",
+ "type": "github"
+ }
+ },
"flake-compat": {
"flake": false,
"locked": {
@@ -367,6 +387,7 @@
"root": {
"inputs": {
"devshell": "devshell",
+ "disko": "disko",
"flake-parts": "flake-parts",
"home-manager": "home-manager",
"hyprland": "hyprland",
diff --git a/flake.nix b/flake.nix
index f73cd4d..3cbdf5d 100644
--- a/flake.nix
+++ b/flake.nix
@@ -3,6 +3,10 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
+ disko = {
+ url = "github:nix-community/disko";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
@@ -56,6 +60,7 @@
modules = [
inputs.home-manager.nixosModules.home-manager
inputs.sops-nix.nixosModules.sops
+ inputs.disko.nixosModules.disko
./share/nixos-modules/nix-config.nix
# This directory has to exist and have a `default.nix` in it, see
diff --git a/hosts/underworld/default.nix b/hosts/underworld/default.nix
new file mode 100644
index 0000000..d900560
--- /dev/null
+++ b/hosts/underworld/default.nix
@@ -0,0 +1,95 @@
+{ config, pkgs, flakeRoot, inputs, ... }: {
+ imports = [
+ # Include the results of the hardware scan.
+ ./hardware.nix
+ ./disko.nix
+
+ ./home.nix
+ (flakeRoot + /share/system/steam.nix)
+ (flakeRoot + /share/system/hyprland.nix)
+ #(flakeRoot + /share/system/spotifyd.nix)
+ { _module.args = { inherit inputs; }; }
+ ];
+
+ nixpkgs.config.allowUnfree = true;
+ nix.gc = {
+ dates = "weekly";
+ automatic = true;
+ persistent = true;
+ randomizedDelaySec = "15min";
+ };
+
+ # Using grub because the disko docs tell me to use it
+ boot = {
+ supportedFilesystems = [ "bacachefs" ];
+ loader.grub = {
+ enable = true;
+ efiSupport = true;
+ efiInstallAsRemovable = true;
+ };
+ };
+
+ networking = {
+ hostName = "underworld";
+ useNetworkd = true;
+
+ firewall = {
+ enable = true;
+ allowedTCPPorts = [ 80 443 34197 ];
+ };
+ };
+
+ time.timeZone = "Europe/Zagreb";
+ i18n.defaultLocale = "en_US.UTF-8";
+
+ # Enable sound.
+ sound.enable = true;
+ services.pipewire = {
+ enable = true;
+ alsa.enable = true;
+ pulse.enable = true;
+ };
+
+ programs.gnupg.agent = {
+ enable = true;
+ enableSSHSupport = true;
+ };
+
+ virtualisation.podman = {
+ enable = true;
+ dockerCompat = true;
+ autoPrune.enable = true;
+ };
+
+ users.users = {
+ osiris = {
+ isNormalUser = true;
+ extraGroups = [ "wheel" "video" "network" "podman" ];
+ };
+ guest = {
+ isNormalUser = true;
+ extraGroups = [ "video" "network" ];
+ };
+ };
+
+ programs.zsh.enable = true;
+ users.defaultUserShell = pkgs.zsh;
+
+ fonts.packages = with pkgs; [
+ noto-fonts
+ noto-fonts-cjk
+ noto-fonts-emoji
+ proggyfonts
+ (nerdfonts.override { fonts = [ "FiraCode" ]; })
+ overpass
+ inter
+ ];
+
+ # This value determines the NixOS release from which the default
+ # settings for stateful data, like file locations and database versions
+ # on your system were taken. It‘s perfectly fine and recommended to leave
+ # this value at the release version of the first install of this system.
+ # Before changing this value read the documentation for this option
+ # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
+ system.stateVersion = "23.11"; # Did you read the comment?
+}
diff --git a/hosts/underworld/disko.nix b/hosts/underworld/disko.nix
new file mode 100644
index 0000000..e713323
--- /dev/null
+++ b/hosts/underworld/disko.nix
@@ -0,0 +1,45 @@
+{
+ disko.devices = {
+ disk = {
+ main = {
+ type = "disk";
+ device = "/dev/disk/by-id/ata-WDC_WDS240G2G0B-00EPW0_194176803299";
+ content = {
+ type = "gpt";
+ partitions = {
+ boot = {
+ size = "1M";
+ type = "EF02"; # for grub MBR
+ };
+ ESP = {
+ size = "512M";
+ type = "EF00";
+ content = {
+ type = "filesystem";
+ format = "vfat";
+ mountpoint = "/boot";
+ };
+ };
+ root = {
+ name = "root";
+ end = "-20G";
+ content = {
+ type = "filesystem";
+ format = "bcachefs";
+ mountpoint = "/";
+ };
+ };
+ encryptedSwap = {
+ size = "100%";
+ content = {
+ type = "swap";
+ randomEncryption = true;
+ resumeDevice = true; # resume from hibernation from this device
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+}
diff --git a/hosts/underworld/hardware.nix b/hosts/underworld/hardware.nix
new file mode 100644
index 0000000..305d6ce
--- /dev/null
+++ b/hosts/underworld/hardware.nix
@@ -0,0 +1,26 @@
+# 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, modulesPath, ... }:
+
+{
+ imports =
+ [
+ (modulesPath + "/installer/scan/not-detected.nix")
+ ];
+
+ boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
+ boot.initrd.kernelModules = [ ];
+ boot.kernelModules = [ "kvm-amd" ];
+ boot.extraModulePackages = [ ];
+
+ # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
+ # (the default) this is the recommended approach. When using systemd-networkd it's
+ # still possible to use this option, but it's recommended to use it in conjunction
+ # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
+ networking.useDHCP = lib.mkDefault true;
+ # networking.interfaces.enp9s0.useDHCP = lib.mkDefault true;
+
+ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
+ hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+}
diff --git a/hosts/underworld/home.nix b/hosts/underworld/home.nix
new file mode 100644
index 0000000..42061ef
--- /dev/null
+++ b/hosts/underworld/home.nix
@@ -0,0 +1,23 @@
+{ flakeRoot
+, inputs
+, ...
+}: {
+ home-manager = {
+ useGlobalPkgs = true;
+ useUserPackages = true;
+ sharedModules = [{ imports = [ (flakeRoot + /share/home/hyprdesktop.nix) ]; }];
+ extraSpecialArgs = { inherit inputs; };
+ };
+
+ home-manager.users.osiris = {
+ imports = [
+ (flakeRoot + /share/home/gallery-dl.nix)
+ ];
+
+ home.stateVersion = "23.11";
+ };
+
+ home-manager.users.root = {
+ home.stateVersion = "23.11";
+ };
+}