Graystripe
This commit is contained in:
commit
ce0729ed48
45
egpu.nix
Normal file
45
egpu.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
keyValues = (key: values: lib.strings.concatStringsSep " " [
|
||||
key
|
||||
(lib.strings.concatMapStringsSep " " (value: lib.strings.concatStrings [ "\"" value "\"" ]) values)
|
||||
]);
|
||||
|
||||
keyValue = (key: value: keyValues key [ value ]);
|
||||
|
||||
section = (name: strings: lib.strings.concatStrings [
|
||||
(keyValue "Section" name)
|
||||
(lib.strings.concatStringsSep "\n " strings)
|
||||
"EndSection"
|
||||
]);
|
||||
|
||||
nvidia = ({ side, busID }: {
|
||||
system.nixos.tags = [ "eGPU" side ];
|
||||
|
||||
# boot.kernelPackages = lib.mkForce pkgs.linuxPackages;
|
||||
|
||||
# Set X11 to use Nvidia drivers
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
|
||||
hardware.opengl.enable = true;
|
||||
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
services.xserver.config = pkgs.lib.mkOverride 0 (lib.strings.concatStringsSep "\n\n" [
|
||||
(section "Module" [ (keyValue "Load" "modesetting") ])
|
||||
(section "Device" [
|
||||
(keyValue "Identifier" "Device0")
|
||||
(keyValue "Driver" "nvidia")
|
||||
(keyValue "BusID" busID)
|
||||
(keyValue "Option" "AllowEmptyInitialConfiguration")
|
||||
(keyValues "Option" [ "AllowExternalGpus" "True" ])
|
||||
])
|
||||
]);
|
||||
});
|
||||
in {
|
||||
# eGPU specialisation config
|
||||
specialisation = {
|
||||
eGPUright.configuration = nvidia { side = "right"; busID = "4:0:0"; };
|
||||
|
||||
eGPUleft.configuration = nvidia { side = "left"; busID = "2:0:0"; };
|
||||
};
|
||||
}
|
26
flake.lock
Normal file
26
flake.lock
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1675918889,
|
||||
"narHash": "sha256-hy7re4F9AEQqwZxubct7jBRos6md26bmxnCjxf5utJA=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "49efda9011e8cdcd6c1aad30384cb1dc230c82fe",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-22.11",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
15
flake.nix
Normal file
15
flake.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-22.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@attrs: {
|
||||
nixosConfigurations.graystripe = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = attrs;
|
||||
modules = [
|
||||
./graystripe.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
208
graystripe.nix
Normal file
208
graystripe.nix
Normal file
|
@ -0,0 +1,208 @@
|
|||
# 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?
|
||||
|
||||
}
|
68
hardware-configuration.nix
Normal file
68
hardware-configuration.nix
Normal file
|
@ -0,0 +1,68 @@
|
|||
# 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" "thunderbolt" "nvme" "usb_storage" "usbhid" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/402a73d2-efb3-4833-9e2c-e484129f2872";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@" ];
|
||||
};
|
||||
|
||||
boot.initrd.luks.devices."luks-7c7d4f5b-969e-4d47-8e8e-c457936314a7".device = "/dev/disk/by-uuid/7c7d4f5b-969e-4d47-8e8e-c457936314a7";
|
||||
|
||||
fileSystems."/boot/efi" =
|
||||
{ device = "/dev/disk/by-uuid/7414-0B58";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
fileSystems."/home" =
|
||||
{ device = "/dev/disk/by-uuid/402a73d2-efb3-4833-9e2c-e484129f2872";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@home" ];
|
||||
};
|
||||
|
||||
fileSystems."/root" =
|
||||
{ device = "/dev/disk/by-uuid/402a73d2-efb3-4833-9e2c-e484129f2872";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@root" ];
|
||||
};
|
||||
|
||||
fileSystems."/nix" =
|
||||
{ device = "/dev/disk/by-uuid/402a73d2-efb3-4833-9e2c-e484129f2872";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@nix" ];
|
||||
};
|
||||
|
||||
fileSystems."/btrfs/nvme" =
|
||||
{ device = "/dev/disk/by-uuid/402a73d2-efb3-4833-9e2c-e484129f2872";
|
||||
fsType = "btrfs";
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[ { device = "/dev/disk/by-uuid/7c83a814-173c-46ef-a3a6-bfefc02095c9"; }
|
||||
];
|
||||
|
||||
# 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.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp4s0u1u3u4.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlp170s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
# high-resolution display
|
||||
hardware.video.hidpi.enable = lib.mkDefault true;
|
||||
}
|
23
wireguard.nix
Normal file
23
wireguard.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
networking.firewall = {
|
||||
allowedUDPPorts = [ 51820 ];
|
||||
};
|
||||
|
||||
networking.wg-quick.interfaces = {
|
||||
wg0 = {
|
||||
address = [ "192.168.5.9/24" ];
|
||||
dns = [ "192.168.5.1" ];
|
||||
privateKeyFile = "/etc/wireguard/privatekey";
|
||||
peers = [
|
||||
{
|
||||
publicKey = "lQYGzNIxgUrDmU32rlnmnc72dK7TSH7hxts3tMtE+VQ=";
|
||||
allowedIPs = [ "192.168.5.0/24" "192.168.6.0/24" "192.168.20.0/24" ];
|
||||
endpoint = "wg.asonix.dog:51820";
|
||||
persistentKeepalive = 25;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue