Skip to content

Commit

Permalink
system: add ucodenix to update microcode
Browse files Browse the repository at this point in the history
use upstream bcachefs-tools flake
use rc kernel, enable scx conditionally
enable tpm2

home manager revamps
  • Loading branch information
JohnRTitor committed Aug 10, 2024
1 parent d1a718d commit 667acf8
Show file tree
Hide file tree
Showing 16 changed files with 118 additions and 57 deletions.
63 changes: 49 additions & 14 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
34 changes: 28 additions & 6 deletions flake/hosts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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];
};
Expand Down
6 changes: 1 addition & 5 deletions home-manager/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules-overlays/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
})
];

Expand Down
10 changes: 7 additions & 3 deletions modules-overlays/uwsm/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 {
Expand Down
3 changes: 0 additions & 3 deletions pkgs/global-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
inputs,
...
}: {
imports = [
inputs.nix-flatpak.nixosModules.nix-flatpak
];
environment.systemPackages =
(with pkgs; [
# System Packages
Expand Down
3 changes: 0 additions & 3 deletions pkgs/user-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion system/boot/kernel.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions system/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions system/hardware/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
config,
lib,
...
}: {
imports = [
./audio.nix
./bluetooth.nix
./disk.nix
./graphics.nix
./tpm.nix
];
}
3 changes: 2 additions & 1 deletion system/hardware/disk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
memoryPercent = 200;
};

/* SWAP DELETED
/*
SWAP DELETED
swapDevices = [
{
device = "/dev/disk/by-partuuid/90c8cb42-7424-467c-927a-0d6a63d5b2a2";
Expand Down
4 changes: 2 additions & 2 deletions system/hardware/tpm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
8 changes: 6 additions & 2 deletions system/hyprland/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; [
Expand All @@ -26,7 +29,8 @@ in {
package =
(pkgs-hyprland.hyprland.override {
#stdenv = pkgs.clangStdenv;
}).overrideAttrs
})
.overrideAttrs
(prevAttrs: {
patches =
(prevAttrs.patches or [])
Expand Down
6 changes: 5 additions & 1 deletion system/services/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Configure system services
{
config,
lib,
pkgs,
systemSettings,
Expand All @@ -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
Expand Down Expand Up @@ -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";
}
11 changes: 0 additions & 11 deletions system/users.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
}

0 comments on commit 667acf8

Please sign in to comment.