From 1815bf6ea105b312cc269fad599db68c27e6c459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Mon, 19 Jun 2023 20:50:13 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20(neodymium/system)=20move?= =?UTF-8?q?=20around=20a=20lot=20of=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hosts/neodymium/configuration.nix | 31 ++------------ hosts/neodymium/hardware-configuration.nix | 42 ------------------- hosts/neodymium/system/adb/default.nix | 7 ++++ hosts/neodymium/system/boot/default.nix | 9 +++- hosts/neodymium/system/default.nix | 2 + hosts/neodymium/system/hardware/default.nix | 6 +++ .../neodymium/system/hardware/partitions.nix | 23 ++++++++++ hosts/neodymium/system/networking/default.nix | 10 ++++- hosts/neodymium/system/nix/default.nix | 3 -- hosts/neodymium/system/users/default.nix | 28 +++++++++++++ 10 files changed, 86 insertions(+), 75 deletions(-) delete mode 100644 hosts/neodymium/hardware-configuration.nix create mode 100644 hosts/neodymium/system/adb/default.nix create mode 100644 hosts/neodymium/system/hardware/partitions.nix create mode 100644 hosts/neodymium/system/users/default.nix diff --git a/hosts/neodymium/configuration.nix b/hosts/neodymium/configuration.nix index f8a8a09..efce23a 100644 --- a/hosts/neodymium/configuration.nix +++ b/hosts/neodymium/configuration.nix @@ -1,17 +1,11 @@ -{ pkgs, hyprland, ... }: { - imports = [ ./hardware-configuration.nix ./system ]; +{ pkgs, ... }: { + imports = [ ./system ]; # shorter timeout for systemd services systemd.extraConfig = '' DefaultTimeoutStopSec=10s ''; - # enable thermald - services.thermald.enable = true; - - # udev - services.udev.packages = [ pkgs.android-udev-rules ]; - services.dbus.enable = true; xdg.portal = { enable = true; @@ -19,27 +13,8 @@ extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ]; }; - users = { - # disable user creation/deletion - mutableUsers = false; - - # absolute gigachad - users.laurent = { - isNormalUser = true; - initialPassword = "laurent"; - extraGroups = [ "wheel" "video" "docker" "adbusers" ]; - shell = pkgs.zsh; - }; - }; programs.zsh.enable = true; - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - extraSpecialArgs = { inherit hyprland; }; - users.laurent = ./home; - }; - # enable gnome virtual file system services.gvfs.enable = true; @@ -49,5 +24,5 @@ # 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.11"; # Did you read the comment? + system.stateVersion = "23.05"; # Did you read the comment? } diff --git a/hosts/neodymium/hardware-configuration.nix b/hosts/neodymium/hardware-configuration.nix deleted file mode 100644 index a9c48ca..0000000 --- a/hosts/neodymium/hardware-configuration.nix +++ /dev/null @@ -1,42 +0,0 @@ -# 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, modulesPath, ... }: - -{ - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - - boot.initrd.availableKernelModules = - [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" "v4l2loopback" ]; - boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/b0ea5f1f-104f-4026-840a-4d46f3e827d1"; - fsType = "btrfs"; - options = [ "subvol=nixos" ]; - }; - - boot.initrd.luks.devices."nixenc".device = - "/dev/disk/by-uuid/93d0b0d8-b586-48cf-acc2-025fba1eaadb"; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/6D10-BBAF"; - fsType = "vfat"; - }; - - 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.eno1.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/hosts/neodymium/system/adb/default.nix b/hosts/neodymium/system/adb/default.nix new file mode 100644 index 0000000..c8f9736 --- /dev/null +++ b/hosts/neodymium/system/adb/default.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: { + # udev rules + services.udev.packages = [ pkgs.android-udev-rules ]; + + # adb users + users.users.laurent.extraGroups = [ "adbusers" ]; +} diff --git a/hosts/neodymium/system/boot/default.nix b/hosts/neodymium/system/boot/default.nix index 5bc534e..58d064e 100644 --- a/hosts/neodymium/system/boot/default.nix +++ b/hosts/neodymium/system/boot/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{ pkgs, config, ... }: { # support for mounting windaube partitions boot.supportedFilesystems = [ "ntfs" ]; boot.loader.efi.canTouchEfiVariables = true; @@ -10,4 +10,11 @@ boot.kernelPackages = pkgs.linuxPackages_latest; imports = [ ./lanzaboot.nix ]; + + boot.initrd.availableKernelModules = + [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" "v4l2loopback" ]; + boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; + } diff --git a/hosts/neodymium/system/default.nix b/hosts/neodymium/system/default.nix index 79ce630..eb1d666 100644 --- a/hosts/neodymium/system/default.nix +++ b/hosts/neodymium/system/default.nix @@ -1,5 +1,6 @@ { ... }: { imports = [ + ./adb ./age ./audio ./boot @@ -12,5 +13,6 @@ ./networking ./nix ./security + ./users ]; } diff --git a/hosts/neodymium/system/hardware/default.nix b/hosts/neodymium/system/hardware/default.nix index 8758c21..7c73ed8 100644 --- a/hosts/neodymium/system/hardware/default.nix +++ b/hosts/neodymium/system/hardware/default.nix @@ -19,10 +19,16 @@ # tlp, power management services.tlp.enable = true; + # thermald, controls temperature + services.thermald.enable = true; + # bluetooth hardware.bluetooth.enable = true; services.blueman.enable = true; # backlight intensity programs.light.enable = true; + + # paritions and filesystems + imports = [ ./partitions.nix ]; } diff --git a/hosts/neodymium/system/hardware/partitions.nix b/hosts/neodymium/system/hardware/partitions.nix new file mode 100644 index 0000000..c258002 --- /dev/null +++ b/hosts/neodymium/system/hardware/partitions.nix @@ -0,0 +1,23 @@ +{ config, lib, ... }: + +{ + fileSystems."/" = { + device = "/dev/disk/by-uuid/b0ea5f1f-104f-4026-840a-4d46f3e827d1"; + fsType = "btrfs"; + options = [ "subvol=nixos" ]; + }; + + boot.initrd.luks.devices."nixenc".device = + "/dev/disk/by-uuid/93d0b0d8-b586-48cf-acc2-025fba1eaadb"; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/6D10-BBAF"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/neodymium/system/networking/default.nix b/hosts/neodymium/system/networking/default.nix index dd994d8..67fef21 100644 --- a/hosts/neodymium/system/networking/default.nix +++ b/hosts/neodymium/system/networking/default.nix @@ -1,4 +1,4 @@ -{ ... }: { +{ lib, ... }: { # set hostname networking.hostName = "neodymium"; @@ -13,5 +13,13 @@ allowedUDPPorts = [ ]; }; + # 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.eno1.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; + imports = [ ./wireguard.nix ]; } diff --git a/hosts/neodymium/system/nix/default.nix b/hosts/neodymium/system/nix/default.nix index 1e98d60..e6bc9ec 100644 --- a/hosts/neodymium/system/nix/default.nix +++ b/hosts/neodymium/system/nix/default.nix @@ -15,9 +15,6 @@ options = "--delete-older-than 30d"; }; - # enable unfree - nixpkgs.config.allowUnfree = true; - nix.settings = { substituters = [ "https://hyprland.cachix.org" ]; trusted-public-keys = diff --git a/hosts/neodymium/system/users/default.nix b/hosts/neodymium/system/users/default.nix new file mode 100644 index 0000000..74bfdd7 --- /dev/null +++ b/hosts/neodymium/system/users/default.nix @@ -0,0 +1,28 @@ +{ pkgs, hyprland, ... }: { + # disable user creation/deletion + users.mutableUsers = false; + + # setup home-manager + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { inherit hyprland; }; + }; + + # configure users + users = { + # absolute gigachad + users.laurent = { + isNormalUser = true; + initialPassword = "laurent"; + extraGroups = [ "wheel" "video" "docker" ]; + shell = pkgs.zsh; + }; + }; + + # configure users' home + home-manager = { + # gigachad's home + users.laurent = ../../home; + }; +}