From 51f30e487c1967919e72f6fe7fb566b19a1a6a43 Mon Sep 17 00:00:00 2001 From: depsterr Date: Sat, 19 Aug 2023 16:58:57 +0200 Subject: [PATCH] added desktop (computational) --- computational/configuration.nix | 124 +++++++++++++++++++++++ computational/hardware-configuration.nix | 42 ++++++++ flake.nix | 20 ++++ 3 files changed, 186 insertions(+) create mode 100644 computational/configuration.nix create mode 100644 computational/hardware-configuration.nix diff --git a/computational/configuration.nix b/computational/configuration.nix new file mode 100644 index 0000000..1e20cfd --- /dev/null +++ b/computational/configuration.nix @@ -0,0 +1,124 @@ +{ config, pkgs, ... }: +{ + + # [HARDWARE] + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + + # [BOOT] + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # [NETWORKING] + networking.hostName = "computational"; + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + + # [NFS] + fileSystems."/home/rachel/music" = { + device = "rachel.cafe:/srv/music"; + fsType = "nfs"; + options = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=60" ]; + }; + + # [LOCALE] + time.timeZone = "Europe/Stockholm"; + i18n.defaultLocale = "en_GB.UTF-8"; + i18n.supportedLocales = [ "sv_SE.UTF-8/UTF-8" "en_GB.UTF-8/UTF-8" ]; + + # [NIX] + nix = { + settings = { + bash-prompt = "\\033[1m\\u\\033[0m@\\033[1m\\h\\033[0m: \\w\\n❄\\040"; + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + }; + gc = { + automatic = true; + dates = "monthly"; + options = "--delete-older-than 30d"; + }; + }; + + nixpkgs.config.allowUnfree = true; + + # [DESKTOP / XORG / WAYLAND] + services.xserver = { + enable = true; + desktopManager.plasma5.enable = true; + displayManager.startx.enable = true; + layout = "us,se"; + xkbOptions = "grp:alt_caps_toggle"; + }; + + # [SOUND] + sound.enable = false; + services.pipewire = { + enable = true; + + alsa = { + enable = true; + support32Bit = true; + }; + + pulse.enable = true; + + wireplumber.enable = true; + }; + + + # [PACKAGES] + environment.systemPackages = with pkgs; [ + git + neovim + ]; + + # [SERVICES] + services.printing.enable = true; + + # [SECURITY / FIREWALL] + networking.firewall.enable = true; + networking.firewall.allowedTCPPorts = [ ]; + networking.firewall.allowedUDPPorts = [ ]; + programs.gnupg.agent = { + enable = true; + pinentryFlavor = "qt"; + }; + security.doas = { + enable = true; + extraRules = [{ + runAs = "root"; + groups = [ "wheel" ]; + noPass = false; + keepEnv = true; + }]; + }; + + # [USER / HOME MANAGER] + users.users.rachel = { + isNormalUser = true; + extraGroups = [ + "wheel" + "networkmanager" + "video" + "input" + "audio" + ]; + }; + + # 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.05"; # Did you read the comment? + +} diff --git a/computational/hardware-configuration.nix b/computational/hardware-configuration.nix new file mode 100644 index 0000000..a7eb4dd --- /dev/null +++ b/computational/hardware-configuration.nix @@ -0,0 +1,42 @@ +# 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" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/963c5cb4-e35d-4992-83e9-5f8724de2c88"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/5951-2630"; + fsType = "vfat"; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/91bac28e-235d-447a-8b6e-7e8ab17b60f1"; + fsType = "ext4"; + }; + + 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; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/flake.nix b/flake.nix index ceab166..167e6c7 100644 --- a/flake.nix +++ b/flake.nix @@ -28,5 +28,25 @@ } ]; }; + + nixosConfigurations.computational = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + { + nix.registry.nixpkgs.flake = nixpkgs; + system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; + } + ./computational/configuration.nix + home-manager.nixosModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.rachel = import ./home/rachel.nix; + }; + } + ]; + }; + }; }