From 069ed5fc22c76bc436c178ecbf0cd08b83cbe591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sun, 21 Apr 2019 10:18:35 +0100 Subject: [PATCH] Split configuration --- nixos/boot.nix | 22 +++++++++++++++ nixos/boxes/skinnyv.nix | 4 +++ nixos/configuration.nix | 60 +++++------------------------------------ nixos/gfx.nix | 27 +++++++++++++++++++ nixos/gsconnect.nix | 13 +++++++++ nixos/syncthing.nix | 9 +++++++ 6 files changed, 81 insertions(+), 54 deletions(-) create mode 100644 nixos/boot.nix create mode 100644 nixos/boxes/skinnyv.nix create mode 100644 nixos/gfx.nix create mode 100644 nixos/gsconnect.nix create mode 100644 nixos/syncthing.nix diff --git a/nixos/boot.nix b/nixos/boot.nix new file mode 100644 index 00000000..46b82b1a --- /dev/null +++ b/nixos/boot.nix @@ -0,0 +1,22 @@ +{ config, pkgs, ... }: +{ + fileSystems."/".options = [ "noatime" "nodiratime" "discard" ]; + + boot = { + initrd.luks.devices = [ + { + name = "root"; + device = "/dev/disk/by-uuid/8c76bf01-59b3-4c60-b853-e9cb77f3ca14"; + preLVM = true; + allowDiscards = true; + } + ]; + loader.grub = { + enable = true; + version = 2; + device = "nodev"; + efiSupport = true; + }; + loader.efi.canTouchEfiVariables = true; + }; +} \ No newline at end of file diff --git a/nixos/boxes/skinnyv.nix b/nixos/boxes/skinnyv.nix new file mode 100644 index 00000000..9fd6760b --- /dev/null +++ b/nixos/boxes/skinnyv.nix @@ -0,0 +1,4 @@ +{ config, pkgs, ... }: +{ + networking.hostName = "skinnyv"; +} \ No newline at end of file diff --git a/nixos/configuration.nix b/nixos/configuration.nix index cf576738..17683ef2 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -8,12 +8,17 @@ in [ /etc/nixos/hardware-configuration.nix ./vscode.nix + ./syncthing.nix + ./gsconnect.nix + ./gfx.nix + ./boot.nix + + ./boxes/skinnyv.nix # TODO: invert relationship ]; nixpkgs.config = { allowUnfree = true; packageOverrides = pkgs: { - vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; unstable = import unstableTarball { config = config.nixpkgs.config; }; @@ -25,19 +30,8 @@ in environment.systemPackages = with pkgs; [ wget git zsh gnupg curl tmux python36Packages.glances - gnomeExtensions.gsconnect - ( - vim_configurable.override { - python = python3; - } - ) ]; - networking.hostName = "skinnyv"; - # gsconnect - networking.firewall.allowedTCPPortRanges = [ { from = 1716; to = 1764; } ]; - networking.firewall.allowedUDPPortRanges = [ { from = 1716; to = 1764; } ]; - i18n.defaultLocale = "en_GB.UTF-8"; users.users.cyryl = { @@ -66,7 +60,6 @@ in enableHardening = false; #needed for 3D acceleration }; - virtualisation.docker = { enable = true; autoPrune.enable = true; @@ -84,13 +77,6 @@ in nssmdns = true; }; - syncthing = { - enable = true; - user = "cyryl"; - dataDir = "/home/cyryl/.syncthing"; - openDefaultPorts = true; - }; - restic.backups.home = { passwordFile = "/etc/nixos/secrets/restic-password"; paths = [ "/home" ]; @@ -124,42 +110,8 @@ in hardware.u2f.enable = true; hardware.brightnessctl.enable = true; hardware.cpu.intel.updateMicrocode = true; - hardware.opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; - extraPackages = with pkgs; [ - vaapiIntel - vaapiVdpau - libvdpau-va-gl - intel-media-driver - ]; - }; hardware.sane.enable = true; - fileSystems."/".options = [ "noatime" "nodiratime" "discard" ]; - - boot = { - initrd.luks.devices = [ - { - name = "root"; - device = "/dev/disk/by-uuid/8c76bf01-59b3-4c60-b853-e9cb77f3ca14"; - preLVM = true; - allowDiscards = true; - } - ]; - loader.grub = { - enable = true; - version = 2; - device = "nodev"; - efiSupport = true; - }; - loader.efi.canTouchEfiVariables = true; - kernelParams = [ - "i915.enable_rc6=7" - ]; - }; - nix.gc.automatic = true; system.autoUpgrade.enable = true; system.stateVersion = "18.09"; diff --git a/nixos/gfx.nix b/nixos/gfx.nix new file mode 100644 index 00000000..f8c5e723 --- /dev/null +++ b/nixos/gfx.nix @@ -0,0 +1,27 @@ +{ config, pkgs, ... }: +{ + + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + extraPackages = with pkgs; [ + vaapiIntel + vaapiVdpau + libvdpau-va-gl + intel-media-driver + ]; + }; + + nixpkgs.config = { + packageOverrides = pkgs: { + vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; + }; + }; + + boot = { + kernelParams = [ + "i915.enable_rc6=7" + ]; + }; +} \ No newline at end of file diff --git a/nixos/gsconnect.nix b/nixos/gsconnect.nix new file mode 100644 index 00000000..4672255c --- /dev/null +++ b/nixos/gsconnect.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: +{ + networking.firewall.allowedTCPPortRanges = [ { from = 1716; to = 1764; } ]; + networking.firewall.allowedUDPPortRanges = [ { from = 1716; to = 1764; } ]; + environment.systemPackages = with pkgs; [ + gnomeExtensions.gsconnect + ( + vim_configurable.override { + python = python3; + } + ) + ]; +} \ No newline at end of file diff --git a/nixos/syncthing.nix b/nixos/syncthing.nix new file mode 100644 index 00000000..ae314ff6 --- /dev/null +++ b/nixos/syncthing.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: +{ + services.syncthing = { + enable = true; + user = "cyryl"; + dataDir = "/home/cyryl/.syncthing"; + openDefaultPorts = true; + }; +} \ No newline at end of file