diff --git a/flake.lock b/flake.lock index c67cf4d..c01aac0 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1663227421, - "narHash": "sha256-8M2ZQPLQw0CUylKbF8pgDMQ5vxOH4i0rxwUhtPIsf7Q=", + "lastModified": 1663328500, + "narHash": "sha256-7n+J/exp8ky4dmk02y5a9R7CGmJvHpzrHMzfEkMtSWA=", "owner": "nix-community", "repo": "home-manager", - "rev": "5408e27961599b1350b651f88715daf6e67244a7", + "rev": "5427f3d1f0ea4357cd4af0bffee7248d640c6ffc", "type": "github" }, "original": { @@ -29,11 +29,11 @@ "wlroots": "wlroots" }, "locked": { - "lastModified": 1663423623, - "narHash": "sha256-U1pqLkLTfqL48kgvNE/0QAFuENr8dgYWPMRqdXBjrVU=", + "lastModified": 1663501249, + "narHash": "sha256-OyLmS7oSM1VQvXXMD0PwuKoWpp+eWRYqBPQijaWrnZA=", "owner": "vaxerski", "repo": "Hyprland", - "rev": "5131a4acaf0f5319dc581ad0a26498b749ffd1e6", + "rev": "dd61f88ed15ab81d634652eed66bdd7e18834863", "type": "github" }, "original": { @@ -44,11 +44,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1663087123, - "narHash": "sha256-cNIRkF/J4mRxDtNYw+9/fBNq/NOA2nCuPOa3EdIyeDs=", + "lastModified": 1663357389, + "narHash": "sha256-oYA2nVRSi6yhCBqS5Vz465Hw+3BQOVFEhfbfy//3vTs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9608ace7009ce5bc3aeb940095e01553e635cbc7", + "rev": "da6a05816e7fa5226c3f61e285ef8d9dfc868f3c", "type": "github" }, "original": { diff --git a/hosts/default.nix b/hosts/default.nix index 38dea4e..9aabf90 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -63,6 +63,25 @@ in ]; }; + q920 = lib.nixosSystem { # Laptop profile + inherit system; + specialArgs = { inherit inputs user location hyprland; }; + modules = [ + hyprland.nixosModules.default + ./q920 + ./configuration.nix + + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit user; }; + home-manager.users.${user} = { + imports = [(import ./home.nix)] ++ [(import ./q920/home.nix)]; + }; + } + ]; + }; + vm = lib.nixosSystem { # VM profile inherit system; specialArgs = { inherit inputs user location; }; diff --git a/hosts/laptop/hardware-configuration.nix b/hosts/laptop/hardware-configuration.nix index 51e347d..2e9033c 100644 --- a/hosts/laptop/hardware-configuration.nix +++ b/hosts/laptop/hardware-configuration.nix @@ -34,6 +34,12 @@ options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@home" ]; }; + fileSystems."/srv" = + { device = "/dev/disk/by-label/ROOT"; + fsType = "btrfs"; + options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@srv" ]; + }; + fileSystems."/boot" = { device = "/dev/disk/by-label/BOOT"; fsType = "vfat"; diff --git a/hosts/q920/default.nix b/hosts/q920/default.nix new file mode 100644 index 0000000..739f896 --- /dev/null +++ b/hosts/q920/default.nix @@ -0,0 +1,101 @@ +# +# Specific system configuration settings for desktop +# +# flake.nix +# ├─ ./hosts +# │ └─ ./laptop +# │ ├─ default.nix * +# │ └─ hardware-configuration.nix +# └─ ./modules +# ├─ ./desktop +# │ └─ ./hyprland +# │ └─ hyprland.nix +# ├─ ./modules +# │ └─ ./programs +# │ └─ waybar.nix +# └─ ./hardware +# └─ default.nix +# + +{ config, pkgs, user, ... }: + +{ + imports = # For now, if applying to other system, swap files + [(import ./hardware-configuration.nix)] ++ # Current system hardware config @ /etc/nixos/hardware-configuration.nix + [(import ../../modules/desktop/hyprland/default.nix)] ++ # Window Manager + [(import ../../modules/desktop/virtualisation/docker.nix)] ++ # Docker + (import ../../modules/hardware); # Hardware devices + + boot = { # Boot options + kernelPackages = pkgs.linuxPackages_latest; + + loader = { # EFI Boot + systemd-boot.enable = true; + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot"; + }; + timeout = 1; # Grub auto select time + }; + }; + +# hardware.sane = { # Used for scanning with Xsane +# enable = false; +# extraBackends = [ pkgs.sane-airscan ]; +# }; + +# environment = { +# systemPackages = with pkgs; [ +# simple-scan +# ]; +# }; + +# programs = { # No xbacklight, this is the alterantive +# dconf.enable = true; +# light.enable = true; +# }; + + services = { +# tlp.enable = true; # TLP and auto-cpufreq for power management + #logind.lidSwitch = "ignore"; # Laptop does not go to sleep when lid is closed + auto-cpufreq.enable = true; + #blueman.enable = true; + printing = { # Printing and drivers for TS5300 + enable = true; + drivers = [ pkgs.gutenprint ]; + }; + avahi = { # Needed to find wireless printer + enable = true; + nssmdns = true; + publish = { # Needed for detecting the scanner + enable = true; + addresses = true; + userServices = true; + }; + }; + + #xserver = { + # libinput = { # Trackpad support & gestures + # touchpad = { + # tapping = true; + # scrollMethod = "twofinger"; + # naturalScrolling = true; # The correct way of scrolling + # accelProfile = "adaptive"; # Speed settings + # #accelSpeed = "-0.5"; + # disableWhileTyping = true; + # }; + # }; + # resolutions = [ + # { x = 1600; y = 920; } + # { x = 1280; y = 720; } + # { x = 1920; y = 1080; } + # ]; + #}; + }; + + #temporary bluetooth fix +# systemd.tmpfiles.rules = [ +# "d /var/lib/bluetooth 700 root root - -" +# ]; +# systemd.targets."bluetooth".after = ["systemd-tmpfiles-setup.service"]; +} diff --git a/hosts/q920/hardware-configuration.nix b/hosts/q920/hardware-configuration.nix new file mode 100644 index 0000000..54face5 --- /dev/null +++ b/hosts/q920/hardware-configuration.nix @@ -0,0 +1,82 @@ +# +# Hardware settings for Teclast F5 10" Laptop +# NixOS @ sda2 +# +# flake.nix +# └─ ./hosts +# └─ ./laptop +# └─ hardware-configuration.nix * +# +# 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" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "rtsx_usb_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-label/ROOT"; + fsType = "btrfs"; + options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-label/ROOT"; + fsType = "btrfs"; + options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@home" ]; + }; + + fileSystems."/srv" = + { device = "/dev/disk/by-label/ROOT"; + fsType = "btrfs"; + options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@srv" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-label/BOOT"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + networking = { + useDHCP = false; # Deprecated + hostName = "q920"; + networkmanager.enable = true; + interfaces = { + enp0s25 = { + useDHCP = true; # For versatility sake, manually edit IP on nm-applet. + #ipv4.addresses = [ { + # address = "192.168.0.51"; + # prefixLength = 24; + #} ]; + }; +# wlo1 = { +# useDHCP = true; +# #ipv4.addresses = [ { +# # address = "192.168.0.51"; +# # prefixLength = 24; +# #} ]; +# }; + }; + #defaultGateway = "192.168.0.1"; + #nameservers = [ "192.168.0.4" ]; + #firewall = { + # enable = false; + # #allowedUDPPorts = [ 53 67 ]; + # #allowedTCPPorts = [ 53 80 443 9443 ]; + #}; + }; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + # high-resolution display + hardware.video.hidpi.enable = lib.mkDefault true; +} diff --git a/hosts/q920/home.nix b/hosts/q920/home.nix new file mode 100644 index 0000000..41b392d --- /dev/null +++ b/hosts/q920/home.nix @@ -0,0 +1,50 @@ +# +# Home-manager configuration for laptop +# +# flake.nix +# ├─ ./hosts +# │ └─ ./laptop +# │ └─ home.nix * +# └─ ./modules +# └─ ./desktop +# └─ ./hyprland +# └─ hyprland.nix +# + +{ pkgs, ... }: + +{ + imports = + [ + ../../modules/desktop/hyprland/home.nix # Window Manager + ]; + + home = { # Specific packages for laptop + packages = with pkgs; [ + # Applications + #libreoffice # Office packages + + # Display + #light # xorg.xbacklight not supported. Other option is just use xrandr. + + # Power Management + auto-cpufreq # Power management + #tlp # Power management + ]; + }; + + programs = { + alacritty.settings.font.size = 11; + }; + + services = { # Applets + #blueman-applet.enable = true; # Bluetooth + network-manager-applet.enable = true; # Network +# cbatticon = { +# enable = true; +# criticalLevelPercent = 10; +# lowLevelPercent = 20; +# iconType = null; +# }; + }; +} diff --git a/modules/desktop/hyprland/home.nix b/modules/desktop/hyprland/home.nix index be0ced2..3ea595b 100644 --- a/modules/desktop/hyprland/home.nix +++ b/modules/desktop/hyprland/home.nix @@ -16,12 +16,12 @@ { home.file = { ".config/hypr/hyprland.conf".text = '' - monitor=DP-2,1920x1080@60,0x0,1 - monitor=HDMI-A-2,1920x1080@60,1920x0,1 - monitor=HDMI-A-1,1280x1028@60,3840x0,1 - workspace=DP-2,1 - workspace=HDMI-A-2,2 - workspace=HDMI-A-1,3 +# monitor=DP-2,1920x1080@60,0x0,1 +# monitor=HDMI-A-2,1920x1080@60,1920x0,1 +# monitor=HDMI-A-1,1280x1028@60,3840x0,1 +# workspace=DP-2,1 +# workspace=HDMI-A-2,2 +# workspace=HDMI-A-1,3 general { main_mod=SUPER border_size=4