From aa7acc2a4429fa87298b80e6b825188de7557040 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Thu, 15 Aug 2024 14:37:25 +0200 Subject: [PATCH] backwards: Add host `backwards` --- flake.nix | 9 +++ hosts/backwards/configuration.nix | 93 ++++++++++++++++++++++ hosts/backwards/hardware-configuration.nix | 41 ++++++++++ hosts/backwards/home.nix | 26 ++++++ 4 files changed, 169 insertions(+) create mode 100644 hosts/backwards/configuration.nix create mode 100644 hosts/backwards/hardware-configuration.nix create mode 100644 hosts/backwards/home.nix diff --git a/flake.nix b/flake.nix index dc85815..f845e18 100644 --- a/flake.nix +++ b/flake.nix @@ -51,6 +51,15 @@ ]; }; + backwards = inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./hosts/backwards/configuration.nix + ./hosts/backwards/home.nix + ]; + }; + sombrero = inputs.nixpkgs.lib.nixosSystem { system = "aarch64-linux"; specialArgs = { inherit inputs; }; diff --git a/hosts/backwards/configuration.nix b/hosts/backwards/configuration.nix new file mode 100644 index 0000000..f8e54f5 --- /dev/null +++ b/hosts/backwards/configuration.nix @@ -0,0 +1,93 @@ +{ config, pkgs, ... }: +{ + imports = + [ + ../../config-manager/default.nix + ./hardware-configuration.nix + ]; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nixpkgs.config.allowUnfree = true; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "backwards"; + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Enable networking + networking.networkmanager.enable = true; + + time.timeZone = "Europe/Stockholm"; + + i18n.defaultLocale = "en_GB.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "sv_SE.UTF-8"; + LC_IDENTIFICATION = "sv_SE.UTF-8"; + LC_MEASUREMENT = "sv_SE.UTF-8"; + LC_MONETARY = "sv_SE.UTF-8"; + LC_NAME = "sv_SE.UTF-8"; + LC_NUMERIC = "sv_SE.UTF-8"; + LC_PAPER = "sv_SE.UTF-8"; + LC_TELEPHONE = "sv_SE.UTF-8"; + LC_TIME = "sv_SE.UTF-8"; + }; + + services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + + # Enable automatic login for the user. + services.xserver.displayManager.autoLogin.enable = true; + services.xserver.displayManager.autoLogin.user = "alex"; + + # Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229 + systemd.services."getty@tty1".enable = false; + systemd.services."autovt@tty1".enable = false; + + services.xserver.xkb = { + layout = "se"; + variant = ""; + }; + + console.keyMap = "sv-latin1"; + + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + users.users.alex = { + isNormalUser = true; + description = "alex"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = []; + }; + + environment.variables.EDITOR = "vim"; + + environment.systemPackages = [ + pkgs.vim + ]; + + services.openssh.enable = true; + + config-manager = { + flakePath = "/home/alex/config"; + }; + + # 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/hosts/backwards/hardware-configuration.nix b/hosts/backwards/hardware-configuration.nix new file mode 100644 index 0000000..754e486 --- /dev/null +++ b/hosts/backwards/hardware-configuration.nix @@ -0,0 +1,41 @@ +# 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" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/bad3d82a-7bb8-490f-bd01-a4b16fe6f33d"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/D049-60DD"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/ff4de0e5-2c60-4ee7-a55c-450727efb921"; } + ]; + + # 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.enp2s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/backwards/home.nix b/hosts/backwards/home.nix new file mode 100644 index 0000000..080ed0f --- /dev/null +++ b/hosts/backwards/home.nix @@ -0,0 +1,26 @@ +{ inputs, pkgs, ... }: +{ + imports = [ inputs.home-manager.nixosModules.home-manager ]; + + config = { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + + users.alex = { + programs.home-manager.enable = true; + + home.username = "alex"; + home.homeDirectory = "/home/alex"; + + home.packages = [ + pkgs.git + pkgs.tig + pkgs.vim + ]; + + home.stateVersion = "24.05"; + }; + }; + }; +}