diff --git a/flake.lock b/flake.lock index b499de01..6f3209a3 100644 --- a/flake.lock +++ b/flake.lock @@ -68,11 +68,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1723190888, - "narHash": "sha256-Ly7nXtwKdg0IU6LS0ZGsTKkv21DVzlTYQdJgounfzIA=", + "lastModified": 1723306615, + "narHash": "sha256-HDafJS6unf5IICtMgpvokAIhw9RNwjta36j7pujnJdA=", "owner": "koverstreet", "repo": "bcachefs-tools", - "rev": "495a54c03b00ccc913ec8b4f3f5eb837c841d519", + "rev": "74a48d6da84af2b94d658a2ff8673b4f347ae303", "type": "github" }, "original": { @@ -314,7 +314,7 @@ }, "fenix_3": { "inputs": { - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_6", "rust-analyzer-src": "rust-analyzer-src_3" }, "locked": { @@ -782,11 +782,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1723241066, - "narHash": "sha256-et+BwLETF5e/9jBHK2GnVh6WGjRztRBThtllMezCvcM=", + "lastModified": 1723322565, + "narHash": "sha256-iwTi2QEc1H6s65Uv7V/Tro/vkvg8WCnpdjzX01mDp7g=", "ref": "refs/heads/main", - "rev": "4fdc0d55e4b44bb5300679025d2378fb6de0cae4", - "revCount": 5074, + "rev": "01ff5fdf6a00a9231bd3b56400d8bcab378c4257", + "revCount": 5076, "submodules": true, "type": "git", "url": "https://github.com/hyprwm/Hyprland" @@ -1357,11 +1357,11 @@ }, "nixpkgs-edge": { "locked": { - "lastModified": 1723274555, - "narHash": "sha256-gDCMNBju0BwYHUPp6RVVnqE0VnbXl53VMk21OT9fkFw=", + "lastModified": 1723320709, + "narHash": "sha256-DeKCsLQsS58D8TB/cTjXs2x8XMvsyv2JVxcF0Hu6pu8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "33c40979a7ccf487d6c0e1a420ecf8e4ac2b676e", + "rev": "e1d92cda6fd1bcec60e4938ce92fcee619eea793", "type": "github" }, "original": { @@ -1482,6 +1482,22 @@ } }, "nixpkgs_5": { + "locked": { + "lastModified": 1722630782, + "narHash": "sha256-hMyG9/WlUi0Ho9VkRrrez7SeNlDzLxalm9FwY7n/Noo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d04953086551086b44b6f3c6b7eeb26294f207da", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { "locked": { "lastModified": 1719506693, "narHash": "sha256-C8e9S7RzshSdHB7L+v9I51af1gDM5unhJ2xO1ywxNH8=", @@ -1499,11 +1515,11 @@ }, "nur": { "locked": { - "lastModified": 1723270775, - "narHash": "sha256-fVYCQ1s6he573+tmv97iG+9iMtzg03W2vGFfwi+U/KE=", + "lastModified": 1723319165, + "narHash": "sha256-seqBRa8LtRGK1cpYV3mA0dXWOhhVF+D5Q5DwijsDFAs=", "owner": "nix-community", "repo": "NUR", - "rev": "5dea43cd92cc98d4dfe5a8f21a97cca27b9e4901", + "rev": "a6a4bc14768382074ea582f5f315cab6dca63ea2", "type": "github" }, "original": { @@ -1660,6 +1676,7 @@ "nixpkgs-edge": "nixpkgs-edge", "nur": "nur", "pyprland": "pyprland", + "ucodenix": "ucodenix", "wallust": "wallust", "waybar": "waybar", "xdph": "xdph_2" @@ -2019,6 +2036,24 @@ "type": "github" } }, + "ucodenix": { + "inputs": { + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1723152038, + "narHash": "sha256-Vm4LeY8QZnVtM0xDijL+S20589DpFF3dP5rYcmvzzAA=", + "owner": "e-tho", + "repo": "ucodenix", + "rev": "dfcd427c945c80b135725f43e0a716cdf710b9c5", + "type": "github" + }, + "original": { + "owner": "e-tho", + "repo": "ucodenix", + "type": "github" + } + }, "wallust": { "inputs": { "fenix": "fenix_3", diff --git a/flake.nix b/flake.nix index 8b42a8b0..64385526 100644 --- a/flake.nix +++ b/flake.nix @@ -71,6 +71,8 @@ inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-parts.follows = "flake-parts"; }; + + ucodenix.url = "github:e-tho/ucodenix"; browser-previews = { url = "github:nix-community/browser-previews"; # Latest Chrome stable, beta, and dev inputs.nixpkgs.follows = "nixpkgs"; diff --git a/flake/hosts.nix b/flake/hosts.nix index 1d564b8d..242f3f6d 100644 --- a/flake/hosts.nix +++ b/flake/hosts.nix @@ -17,20 +17,42 @@ android_sdk.accept_license = true; }; }; + + specialArgs = {inherit self inputs pkgs-edge systemSettings userSettings;}; in { flake = { nixosConfigurations.${systemSettings.hostname} = lib.nixosSystem { - specialArgs = {inherit self inputs systemSettings userSettings;}; + inherit specialArgs; modules = [ - {_module.args = {inherit pkgs-edge;};} ../default-host/configuration.nix # main nix configuration inputs.chaotic.nixosModules.default # chaotic nix bleeding edge packages - inputs.nur.nixosModules.nur + inputs.nur.nixosModules.nur # NUR - NixOS user repository + inputs.ucodenix.nixosModules.ucodenix # ucodeNix - CPU microcode updates + inputs.nix-flatpak.nixosModules.nix-flatpak # nix-flatpak, allows flatpak declaratively + + # install home-manager as NixOS module + # so that it automatically gets deployed when running `nixos-rebuild switch` + inputs.home-manager.nixosModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + # backupFileExtension = ".hm.bak"; + extraSpecialArgs = + specialArgs + // { + # extra arguments for home-manager + }; + }; - # make home-manager as a module of nixos - # so that home-manager configuration will be deployed automatically when executing `nixos-rebuild switch` - inputs.home-manager.nixosModules.default + home-manager.users.${userSettings.username} = { + imports = [ + ../home-manager + inputs.nix-flatpak.homeManagerModules.nix-flatpak + ]; + }; + } ] ++ lib.optionals systemSettings.secureboot [inputs.lanzaboote.nixosModules.lanzaboote]; }; diff --git a/home-manager/default.nix b/home-manager/default.nix index d868c379..f541e401 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -4,15 +4,11 @@ lib, pkgs, pkgs-edge, + inputs, systemSettings, userSettings, ... }: { - # Home Manager needs a bit of information about you and the paths it should - # manage. - home.username = userSettings.username; - home.homeDirectory = "/home/" + userSettings.username; - imports = [ # system packages are imported in ./configuration.nix diff --git a/modules-overlays/default.nix b/modules-overlays/default.nix index f8ce0e16..434966fb 100644 --- a/modules-overlays/default.nix +++ b/modules-overlays/default.nix @@ -12,7 +12,7 @@ nixpkgs.overlays = [ (final: prev: { - # bcachefs-tools = inputs.bcachefs-tools.packages.${pkgs.system}.bcachefs-tools; + bcachefs-tools = inputs.bcachefs-tools.packages.${pkgs.system}.bcachefs-tools; }) ]; diff --git a/modules-overlays/uwsm/module.nix b/modules-overlays/uwsm/module.nix index a4a62eac..02e53755 100644 --- a/modules-overlays/uwsm/module.nix +++ b/modules-overlays/uwsm/module.nix @@ -6,12 +6,12 @@ }: let cfg = config.programs.uwsm; mk_uwsm_desktop_entry = opts: (pkgs.writeTextFile { - name = lib.traceVal "${opts.name}"; - text = lib.traceVal '' + name = "${opts.name}"; + text = '' [Desktop Entry] Name=${opts.compositor_pretty_name} (with UWSM) Comment=${opts.compositor_comment} - Exec=${lib.getExe cfg.package} start -S -- "${opts.compositor_bin_path}" + Exec=${lib.getExe cfg.package} start -S -F "${opts.compositor_bin_path}" Type=Application ''; destination = "/share/wayland-sessions/${opts.name}_uwsm.desktop"; @@ -30,8 +30,12 @@ in { config = lib.mkIf cfg.enable { environment.systemPackages = [cfg.package]; systemd.packages = [cfg.package]; + environment.pathsToLink = [ "/share/uwsm" ]; + + # UWSM recommends dBus broker for better compatibility services.dbus.implementation = "broker"; + services.displayManager.sessionPackages = lib.optionals config.programs.hyprland.enable [ (mk_uwsm_desktop_entry { diff --git a/pkgs/global-packages.nix b/pkgs/global-packages.nix index 02e2a810..0747c009 100644 --- a/pkgs/global-packages.nix +++ b/pkgs/global-packages.nix @@ -10,9 +10,6 @@ inputs, ... }: { - imports = [ - inputs.nix-flatpak.nixosModules.nix-flatpak - ]; environment.systemPackages = (with pkgs; [ # System Packages diff --git a/pkgs/user-packages.nix b/pkgs/user-packages.nix index 5530b341..21fac334 100644 --- a/pkgs/user-packages.nix +++ b/pkgs/user-packages.nix @@ -9,9 +9,6 @@ inputs, ... }: { - imports = [ - inputs.nix-flatpak.homeManagerModules.nix-flatpak - ]; home.packages = (with pkgs; [ # here is some command line tools I use frequently diff --git a/system/boot/kernel.nix b/system/boot/kernel.nix index e9678462..0f6869e9 100644 --- a/system/boot/kernel.nix +++ b/system/boot/kernel.nix @@ -4,7 +4,7 @@ pkgs, ... }: { - boot.kernelPackages = pkgs.linuxPackages_cachyos-lto; + boot.kernelPackages = pkgs.linuxPackages_testing; boot.extraModulePackages = with config.boot.kernelPackages; [ # zenpower is used for reading temperature, voltage, current and power diff --git a/system/default.nix b/system/default.nix index 96e1671f..06ef0427 100644 --- a/system/default.nix +++ b/system/default.nix @@ -12,10 +12,7 @@ # include user account settings ./users.nix # include hardware settings - ./hardware/audio.nix - ./hardware/bluetooth.nix - ./hardware/disk.nix - ./hardware/graphics.nix + ./hardware # ./hardware/tpm.nix # include network settings ./network.nix diff --git a/system/hardware/default.nix b/system/hardware/default.nix new file mode 100644 index 00000000..e2f0ed75 --- /dev/null +++ b/system/hardware/default.nix @@ -0,0 +1,13 @@ +{ + config, + lib, + ... +}: { + imports = [ + ./audio.nix + ./bluetooth.nix + ./disk.nix + ./graphics.nix + ./tpm.nix + ]; +} diff --git a/system/hardware/disk.nix b/system/hardware/disk.nix index 4eaf695b..7e45e98c 100644 --- a/system/hardware/disk.nix +++ b/system/hardware/disk.nix @@ -23,7 +23,8 @@ memoryPercent = 200; }; - /* SWAP DELETED + /* + SWAP DELETED swapDevices = [ { device = "/dev/disk/by-partuuid/90c8cb42-7424-467c-927a-0d6a63d5b2a2"; diff --git a/system/hardware/tpm.nix b/system/hardware/tpm.nix index ef7938cb..8d49e6a5 100644 --- a/system/hardware/tpm.nix +++ b/system/hardware/tpm.nix @@ -6,6 +6,6 @@ }: { security.tpm2.enable = true; security.tpm2.pkcs11.enable = true; # expose /run/current-system/sw/lib/libtpm2_pkcs11.so - security.tpm2.tctiEnvironment.enable = true; # TPM2TOOLS_TCTI and TPM2_PKCS11_TCTI env variables - users.users.${userSettings.username}.extraGroups = ["tss"]; # tss group has access to TPM devices + # security.tpm2.tctiEnvironment.enable = true; # TPM2TOOLS_TCTI and TPM2_PKCS11_TCTI env variables + # users.users.${userSettings.username}.extraGroups = ["tss"]; # tss group has access to TPM devices } diff --git a/system/hyprland/default.nix b/system/hyprland/default.nix index 78b70110..81ae0172 100644 --- a/system/hyprland/default.nix +++ b/system/hyprland/default.nix @@ -10,7 +10,10 @@ ... }: let hyprlandFlake = true; - pkgs-hyprland = if hyprlandFlake then inputs.hyprland.packages.${pkgs.system} else pkgs; + pkgs-hyprland = + if hyprlandFlake + then inputs.hyprland.packages.${pkgs.system} + else pkgs; python-packages = pkgs.python3.withPackages ( ps: with ps; [ @@ -26,7 +29,8 @@ in { package = (pkgs-hyprland.hyprland.override { #stdenv = pkgs.clangStdenv; - }).overrideAttrs + }) + .overrideAttrs (prevAttrs: { patches = (prevAttrs.patches or []) diff --git a/system/services/default.nix b/system/services/default.nix index 3fbb5747..a2de7146 100644 --- a/system/services/default.nix +++ b/system/services/default.nix @@ -1,5 +1,6 @@ # Configure system services { + config, lib, pkgs, systemSettings, @@ -24,7 +25,7 @@ }; # Enable scx extra schedulers, only available for linux-cachyos - chaotic.scx.enable = true; # by default uses rustland + chaotic.scx.enable = (config.boot.kernelPackages.kernel.passthru.config.CONFIG_SCHED_CLASS_EXT or null) == "y"; # by default uses rustland chaotic.scx.scheduler = "scx_bpfland"; # Accounts daemon is needed to remember passwords and other account information @@ -92,4 +93,7 @@ security.polkit.enable = true; # Enable polkit for elevated prompts # services.colord.enable = true; # For color management + + services.ucodenix.enable = true; + services.ucodenix.cpuSerialNumber = "00A6-0F12-0000-0000-0000-0000"; } diff --git a/system/users.nix b/system/users.nix index 142f8496..f4f55377 100644 --- a/system/users.nix +++ b/system/users.nix @@ -26,15 +26,4 @@ then pkgs.zsh else pkgs.bash; }; - - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - # backupFileExtension = ".hm.bak"; - - users.${userSettings.username} = import ../home-manager; - extraSpecialArgs = { - inherit self inputs pkgs-edge systemSettings userSettings; - }; - }; }