From 88a4f25fa5f710aa57d89fc1061ea11dbac565da Mon Sep 17 00:00:00 2001 From: Andreas Schaafsma Date: Sat, 9 Nov 2024 18:13:57 +0100 Subject: [PATCH] Added nixos config for battlestation --- .../andreas@drivebystation-nix/.gitkeep | 0 .../andreas@drivebystation-nix/default.nix | 24 ++++ .../drivebystation-nix/configuration.nix | 133 ++++++++++++++++++ .../drivebystation-nix/default.nix | 113 +++++++++++++++ .../hardware-configuration.nix | 38 +++++ 5 files changed, 308 insertions(+) create mode 100644 homes/x86_64-linux/andreas@drivebystation-nix/.gitkeep create mode 100644 homes/x86_64-linux/andreas@drivebystation-nix/default.nix create mode 100644 systems/x86_64-linux/drivebystation-nix/configuration.nix create mode 100644 systems/x86_64-linux/drivebystation-nix/default.nix create mode 100644 systems/x86_64-linux/drivebystation-nix/hardware-configuration.nix diff --git a/homes/x86_64-linux/andreas@drivebystation-nix/.gitkeep b/homes/x86_64-linux/andreas@drivebystation-nix/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/homes/x86_64-linux/andreas@drivebystation-nix/default.nix b/homes/x86_64-linux/andreas@drivebystation-nix/default.nix new file mode 100644 index 0000000..6245949 --- /dev/null +++ b/homes/x86_64-linux/andreas@drivebystation-nix/default.nix @@ -0,0 +1,24 @@ +{ config +, lib +, pkgs +, ... +}: +let + inherit (lib.my-namespace) enabled; +in +{ + imports = [ + # ../modules.nix + ]; + my-namespace.home = { + stream-tools = enabled; + # networking = enabled; + # personal-apps = enabled; + # suites.laptop = enabled; + }; + home = { + packages = [ + pkgs.nil + ]; + }; +} diff --git a/systems/x86_64-linux/drivebystation-nix/configuration.nix b/systems/x86_64-linux/drivebystation-nix/configuration.nix new file mode 100644 index 0000000..3af94aa --- /dev/null +++ b/systems/x86_64-linux/drivebystation-nix/configuration.nix @@ -0,0 +1,133 @@ +# 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. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "DRIVEBYSTATION-NIX"; # 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/Amsterdam"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "nl_NL.UTF-8"; + LC_IDENTIFICATION = "nl_NL.UTF-8"; + LC_MEASUREMENT = "nl_NL.UTF-8"; + LC_MONETARY = "nl_NL.UTF-8"; + LC_NAME = "nl_NL.UTF-8"; + LC_NUMERIC = "nl_NL.UTF-8"; + LC_PAPER = "nl_NL.UTF-8"; + LC_TELEPHONE = "nl_NL.UTF-8"; + LC_TIME = "nl_NL.UTF-8"; + }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "us"; + variant = "intl"; + }; + + # Configure console keymap + console.keyMap = "us-acentos"; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + hardware.pulseaudio.enable = false; + 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; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.andreas = { + isNormalUser = true; + description = "Andreas Schaafsma"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + # thunderbird + ]; + }; + + # Install firefox. + programs.firefox.enable = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # 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 = "24.05"; # Did you read the comment? + +} diff --git a/systems/x86_64-linux/drivebystation-nix/default.nix b/systems/x86_64-linux/drivebystation-nix/default.nix new file mode 100644 index 0000000..9a70d00 --- /dev/null +++ b/systems/x86_64-linux/drivebystation-nix/default.nix @@ -0,0 +1,113 @@ +# nixosConfigurations.th0nkpad-nixos = nixpkgs.lib.nixosSystem { + +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + # Additional metadata is provided by Snowfall Lib. + # The namespace used for your flake, defaulting to "internal" if not set. + namespace, + # The system architecture for this host (eg. `x86_64-linux`). + system, + # The Snowfall Lib target for this system (eg. `x86_64-iso`). + target, + # A normalized name for the system target (eg. `iso`). + format, + # A boolean to determine whether this system is a virtual target using nixos-generators. + virtual, + # An attribute map of your defined hosts. + systems, + # All other arguments come from the system system. + config +, ... +}: +let + inherit pkgs; + installedPackages = lib.my-namespace.mkPackages pkgs; +in +{ + # inherit system; + imports = [ + ./configuration.nix + ]; + config = { + system.stateVersion = "24.05"; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.andreas = { + isNormalUser = true; + description = "Andreas"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + flatpak + gnome-software + soundwireserver + vscode + spotify + appimage-run + inputs.game-of-life.packages.x86_64-linux.default + inputs.nixos-cosmic + # thunderbird + ]; + }; + # lib.my-namespace.home.stream-tools.enable = true; + + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ + 59010 #SoundWireServer + 3389 #RDP + ]; + networking.firewall.allowedUDPPorts = [ + 59010 #SoundWireServer + 3389 #RDP + ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # Install firefox. + programs.firefox.enable = true; + + # Set up system Packages + environment.systemPackages = with pkgs; [ + git + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget + ] + ++ installedPackages.packages; + programs.nix-ld = { + enable = true; + package = pkgs.nix-ld-rs; + }; + services.flatpak.enable = true; + systemd.services.flatpak-repo = { + wantedBy = [ "multi-user.target" ]; + path = [ pkgs.flatpak ]; + script = '' + flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + ''; + }; + + services.openssh = { + enable = true; + passwordAuthentication = true; + }; + + + # services.xrdp.enable = true; + # services.xrdp.defaultWindowManager = "${pkgs.gnome-session}/bin/gnome-session"; + # services.xrdp.openFirewall = true; + + + # Disable the GNOME3/GDM auto-suspend feature that cannot be disabled in GUI! + # If no user is logged in, the machine will power down after 20 minutes. + systemd.targets.sleep.enable = false; + systemd.targets.suspend.enable = false; + systemd.targets.hibernate.enable = false; + systemd.targets.hybrid-sleep.enable = false; + }; + } diff --git a/systems/x86_64-linux/drivebystation-nix/hardware-configuration.nix b/systems/x86_64-linux/drivebystation-nix/hardware-configuration.nix new file mode 100644 index 0000000..2672dc7 --- /dev/null +++ b/systems/x86_64-linux/drivebystation-nix/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/563805a1-5277-4488-bbdd-c1a7ed37be76"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/E846-D998"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + 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.enp72s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}