From 372874ff1c2f19b0a1f74bb8bba607642ccfaf79 Mon Sep 17 00:00:00 2001 From: Aode Date: Fri, 10 Feb 2023 19:40:39 -0600 Subject: [PATCH] Split configuration into smaller files --- desktop.nix | 58 +++++ flake.nix | 6 +- fonts.nix | 16 ++ graystripe.nix | 208 ------------------ graystripe/default.nix | 61 +++++ egpu.nix => graystripe/egpu.nix | 0 .../hardware-configuration.nix | 0 wireguard.nix => graystripe/wireguard.nix | 0 packages.nix | 56 +++++ user.nix | 16 ++ 10 files changed, 212 insertions(+), 209 deletions(-) create mode 100644 desktop.nix create mode 100644 fonts.nix delete mode 100644 graystripe.nix create mode 100644 graystripe/default.nix rename egpu.nix => graystripe/egpu.nix (100%) rename hardware-configuration.nix => graystripe/hardware-configuration.nix (100%) rename wireguard.nix => graystripe/wireguard.nix (100%) create mode 100644 packages.nix create mode 100644 user.nix diff --git a/desktop.nix b/desktop.nix new file mode 100644 index 0000000..f141499 --- /dev/null +++ b/desktop.nix @@ -0,0 +1,58 @@ +{ config, pkgs, ... }: +{ + # 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; + + # This makes Spyro Reignighted Trilogy not crash + networking.extraHosts = + '' + 0.0.0.0 datarouter.ol.epicgames.com + 0.0.0.0 datarouter-weighted.ol.epicgames.com + ''; + + # Set your time zone. + time.timeZone = "America/Chicago"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.utf8"; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Enable the Pantheon Desktop Environment. + services.xserver.displayManager.lightdm.enable = true; + services.xserver.desktopManager.pantheon.enable = true; + + # Configure keymap in X11 + services.xserver = { + layout = "us"; + xkbVariant = ""; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + services.avahi.enable = true; + services.avahi.openFirewall = true; + # services.ipp-usb.enable = true; + + # Enable sound with pipewire. + sound.enable = true; + 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; + }; +} diff --git a/flake.nix b/flake.nix index 1dc84cc..4b21041 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,11 @@ system = "x86_64-linux"; specialArgs = attrs; modules = [ - ./graystripe.nix + ./desktop.nix + ./fonts.nix + ./graystripe + ./packages.nix + ./user.nix ]; }; }; diff --git a/fonts.nix b/fonts.nix new file mode 100644 index 0000000..a508c2f --- /dev/null +++ b/fonts.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: + +{ + fonts = { + enableDefaultFonts = true; + + fonts = with pkgs; [ + fantasque-sans-mono + (nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + ]; + + fontconfig.defaultFonts.monospace = [ "Fantasque Sans Mono" "Roboto Mono" ]; + + fontDir.enable = true; + }; +} diff --git a/graystripe.nix b/graystripe.nix deleted file mode 100644 index 4914914..0000000 --- a/graystripe.nix +++ /dev/null @@ -1,208 +0,0 @@ -# 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 - ./egpu.nix - ./wireguard.nix - ]; - - # Nix cache - # nix.extraOptions = '' - # secret-key-files = /etc/nix/cache-priv-key.pem - # ''; - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.efi.efiSysMountPoint = "/boot/efi"; - - # Setup keyfile - boot.initrd.secrets = { - "/crypto_keyfile.bin" = null; - }; - - # Enable swap on luks - boot.initrd.luks.devices."luks-8b65fe7f-2115-422f-9443-7c6265d4d8ea".device = "/dev/disk/by-uuid/8b65fe7f-2115-422f-9443-7c6265d4d8ea"; - boot.initrd.luks.devices."luks-8b65fe7f-2115-422f-9443-7c6265d4d8ea".keyFile = "/crypto_keyfile.bin"; - - boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; - - fileSystems = { - "/".options = [ "compress=zstd" ]; - "/home".options = [ "compress=zstd" ]; - "/nix".options = [ "compress=zstd" ]; - "/root".options = [ "compress=zstd" ]; - }; - - networking.hostName = "graystripe"; # 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; - - # This makes Spyro Reignighted Trilogy not crash - networking.extraHosts = - '' - 0.0.0.0 datarouter.ol.epicgames.com - 0.0.0.0 datarouter-weighted.ol.epicgames.com - ''; - - # Set your time zone. - time.timeZone = "America/Chicago"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.utf8"; - - # Enable the X11 windowing system. - services.xserver.enable = true; - - # Enable the Pantheon Desktop Environment. - services.xserver.displayManager.lightdm.enable = true; - services.xserver.desktopManager.pantheon.enable = true; - - # Configure keymap in X11 - services.xserver = { - layout = "us"; - xkbVariant = ""; - }; - - # Enable CUPS to print documents. - services.printing.enable = true; - services.avahi.enable = true; - services.avahi.openFirewall = true; - # services.ipp-usb.enable = true; - - # Enable sound with pipewire. - sound.enable = true; - 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; - - services.flatpak.enable = true; - - xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - - # Define a user account. Don't forget to set a password with `passwd`. - users.users.asonix = { - isNormalUser = true; - description = "Aode"; - shell = pkgs.zsh; - extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; [ - firefox - ]; - }; - - users.defaultUserShell = pkgs.zsh; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - docker-compose - git - vim - zsh - - protonup - protontricks - wine-staging - winetricks - - usbutils - pciutils - bolt - thunderbolt - wireguard-tools - ]; - - systemd.packages = with pkgs; [ - bolt - ]; - - fonts = { - enableDefaultFonts = true; - - fonts = with pkgs; [ - fantasque-sans-mono - (nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) - ]; - - fontconfig.defaultFonts.monospace = [ "Fantasque Sans Mono" "Roboto Mono" ]; - - fontDir.enable = true; - }; - - programs.zsh.enable = true; - programs.vim.defaultEditor = true; - - programs.steam = { - enable = true; - remotePlay.openFirewall = true; - dedicatedServer.openFirewall = true; - }; - - # 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; - - services.fwupd.enable = true; - services.fwupd.enableTestRemote = true; - services.fwupd.extraRemotes = [ - "lvfs-testing" - ]; - - virtualisation.docker.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - - # 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 = "22.05"; # Did you read the comment? - -} diff --git a/graystripe/default.nix b/graystripe/default.nix new file mode 100644 index 0000000..7372d1a --- /dev/null +++ b/graystripe/default.nix @@ -0,0 +1,61 @@ +# 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 + ./egpu.nix + ./wireguard.nix + ]; + + # Nix cache + # nix.extraOptions = '' + # secret-key-files = /etc/nix/cache-priv-key.pem + # ''; + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot/efi"; + + # Setup keyfile + boot.initrd.secrets = { + "/crypto_keyfile.bin" = null; + }; + + # Enable swap on luks + boot.initrd.luks.devices."luks-8b65fe7f-2115-422f-9443-7c6265d4d8ea".device = "/dev/disk/by-uuid/8b65fe7f-2115-422f-9443-7c6265d4d8ea"; + boot.initrd.luks.devices."luks-8b65fe7f-2115-422f-9443-7c6265d4d8ea".keyFile = "/crypto_keyfile.bin"; + + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + + fileSystems = { + "/".options = [ "compress=zstd" ]; + "/home".options = [ "compress=zstd" ]; + "/nix".options = [ "compress=zstd" ]; + "/root".options = [ "compress=zstd" ]; + }; + + networking.hostName = "graystripe"; # Define your hostname. + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # 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 = "22.05"; # Did you read the comment? + +} diff --git a/egpu.nix b/graystripe/egpu.nix similarity index 100% rename from egpu.nix rename to graystripe/egpu.nix diff --git a/hardware-configuration.nix b/graystripe/hardware-configuration.nix similarity index 100% rename from hardware-configuration.nix rename to graystripe/hardware-configuration.nix diff --git a/wireguard.nix b/graystripe/wireguard.nix similarity index 100% rename from wireguard.nix rename to graystripe/wireguard.nix diff --git a/packages.nix b/packages.nix new file mode 100644 index 0000000..59afe92 --- /dev/null +++ b/packages.nix @@ -0,0 +1,56 @@ +{ pkgs, ... }: + +{ + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + docker-compose + git + vim + zsh + + protonup + protontricks + wine-staging + winetricks + + usbutils + pciutils + bolt + thunderbolt + wireguard-tools + ]; + + systemd.packages = with pkgs; [ + bolt + ]; + + programs.zsh.enable = true; + programs.vim.defaultEditor = true; + + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + services.fwupd.enable = true; + services.fwupd.enableTestRemote = true; + services.fwupd.extraRemotes = [ + "lvfs-testing" + ]; + + services.flatpak.enable = true; + + xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + + virtualisation.docker.enable = true; +} diff --git a/user.nix b/user.nix new file mode 100644 index 0000000..d595f77 --- /dev/null +++ b/user.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: + +{ + # Define a user account. Don't forget to set a password with `passwd`. + users.users.asonix = { + isNormalUser = true; + description = "Aode"; + shell = pkgs.zsh; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + firefox + ]; + }; + + users.defaultUserShell = pkgs.zsh; +}