From 047b07165670b88e35bc92eb034dbe102067b4ba Mon Sep 17 00:00:00 2001 From: Markus Heurung Date: Thu, 11 Apr 2024 18:02:41 +0200 Subject: [PATCH] minor refactoring for workstation. needs work on laptop probably --- flake.nix | 9 +- home.nix | 3 + hosts/cube-hardware-configuration.nix | 38 +++++ hosts/cube.nix | 141 ++++++++++++++++++ .../muhhStar-hardware-configuration.nix | 0 configuration.nix => hosts/muhhStar.nix | 2 +- 6 files changed, 191 insertions(+), 2 deletions(-) create mode 100644 hosts/cube-hardware-configuration.nix create mode 100644 hosts/cube.nix rename hardware-configuration.nix => hosts/muhhStar-hardware-configuration.nix (100%) rename configuration.nix => hosts/muhhStar.nix (98%) diff --git a/flake.nix b/flake.nix index 2d4cfa7..bdff37d 100644 --- a/flake.nix +++ b/flake.nix @@ -32,11 +32,18 @@ pkgs = nixpkgs.legacyPackages.${system}; in { nixosConfigurations = { + cube = lib.nixosSystem { + inherit system; + modules = [ + ./hosts/cube.nix + inputs.sops-nix.nixosModules.sops + ]; + }; muhhStar = lib.nixosSystem { inherit system; modules = [ inputs.sops-nix.nixosModules.sops - ./configuration.nix + ./hosts/muhhStar.nix ]; }; }; diff --git a/home.nix b/home.nix index 5f010c6..3604715 100644 --- a/home.nix +++ b/home.nix @@ -391,6 +391,9 @@ "mail/privat/address" = {}; "mail/privat/username" = {}; "mail/privat/password" = {}; + "mail/icloud/address" = {}; + "mail/icloud/username" = {}; + "mail/icloud/password" = {}; }; }; diff --git a/hosts/cube-hardware-configuration.nix b/hosts/cube-hardware-configuration.nix new file mode 100644 index 0000000..b50cd6d --- /dev/null +++ b/hosts/cube-hardware-configuration.nix @@ -0,0 +1,38 @@ +# 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 + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/f0a69b93-3fdc-48ad-a288-a12ce1e3a205"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/0428-C12E"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/cube.nix b/hosts/cube.nix new file mode 100644 index 0000000..c5b65bc --- /dev/null +++ b/hosts/cube.nix @@ -0,0 +1,141 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./cube-hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = false; + boot.loader.grub = { + enable = true; + device = "nodev"; + efiSupport = true; + useOSProber = true; + }; + + boot.loader.efi.canTouchEfiVariables = true; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + networking.hostName = "cube"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + + services.flatpak.enable = true; + services.fwupd.enable = true; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + }; + services.tailscale = { + enable = true; + }; + + # Configure keymap in X11 + services.xserver = { + xkb.layout = "eu"; + xkb.options = "compose:ralt"; + }; + + # sops.defaultSopsFile = "/home/muhh/nix-config/secrets/secrets.yaml"; + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.muhh = { + isNormalUser = true; + name = "muhh"; + description = "Markus Heurung"; + extraGroups = [ "input" "networkmanager" "video" "wheel" ]; + shell = pkgs.fish; + linger = true; + }; + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + nixpkgs.config.allowUnfreePredicate = pkg: true; + + environment.shells = with pkgs; [ bash fish zsh ]; + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + git + home-manager + toolbox + vim + wget + ]; + + fonts.packages = with pkgs; [ + atkinson-hyperlegible + iosevka + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + programs = { + fish.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + light.enable = true; + sway.enable = true; + }; + virtualisation.podman = { + enable = true; + dockerCompat = true; + }; + + xdg.portal.wlr.enable = true; + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # FIREWALL IS ENABLED BY DEFAULT - muhh + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # 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/hardware-configuration.nix b/hosts/muhhStar-hardware-configuration.nix similarity index 100% rename from hardware-configuration.nix rename to hosts/muhhStar-hardware-configuration.nix diff --git a/configuration.nix b/hosts/muhhStar.nix similarity index 98% rename from configuration.nix rename to hosts/muhhStar.nix index fbbb6f3..bd1913e 100644 --- a/configuration.nix +++ b/hosts/muhhStar.nix @@ -7,7 +7,7 @@ { imports = [ # Include the results of the hardware scan. - ./hardware-configuration.nix + ./muhhStar-hardware-configuration.nix ]; nix.settings.experimental-features = [ "nix-command" "flakes"];