Skip to content

Commit

Permalink
Add isshin and cachix config
Browse files Browse the repository at this point in the history
  • Loading branch information
arunoruto committed Sep 15, 2024
1 parent a090ede commit afdb98f
Show file tree
Hide file tree
Showing 29 changed files with 296 additions and 37 deletions.
6 changes: 3 additions & 3 deletions flake.lock

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

20 changes: 19 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,25 @@
];
in {
nixosConfigurations = {
# Framework Laptop
# Framework Laptop AMD 7040
isshin = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit theme;
inherit image;
username = "mirza";
};
modules =
nixos-modules
++ [
./hosts/isshin
home-manager.nixosModules.home-manager
./homes
];
};

# Framework Laptop Intel 11th
zangetsu = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
Expand Down
22 changes: 22 additions & 0 deletions hosts/isshin/configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{lib, ...}: {
# Set hostname
networking.hostName = lib.mkForce "isshin"; # Define your hostname.

# Eanble fingerprint for framework laptop
fingerprint.enable = true;

amd.enable = true;

# Framework specific kernel Params
boot = {
kernelParams = [
#"quiet"
#"splash"
# "ahci.mobile_lpm_policy=3"
# For Power consumption
# https://kvark.github.io/linux/framework/2021/10/17/framework-nixos.html
# "mem_sleep_default=deep"
];
# initrd.kernelModules = ["i915"];
};
}
11 changes: 11 additions & 0 deletions hosts/isshin/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{inputs, ...}: {
imports = [
# inputs.nixos-hardware.nixosModules.framework-11th-gen-intel
inputs.nixos-hardware.nixosModules.framework-13-7040-amd

./configuration.nix
./hardware-configuration.nix

../../modules/nixos
];
}
38 changes: 38 additions & 0 deletions hosts/isshin/hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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 = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];

fileSystems."/" =
{ device = "/dev/disk/by-uuid/b01b8966-afbd-47a4-9532-c520e2789584";
fsType = "ext4";
};

fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/BD45-D145";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};

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.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true;

nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
File renamed without changes.
37 changes: 20 additions & 17 deletions hosts/zangetsu/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
networking.hostName = lib.mkForce "zangetsu"; # Define your hostname.

# Eanble fingerprint for framework laptop
fingerprint.enable = true;
fingerprint.enable = false;

intel.enable = true;

# Framework specific kernel Params
boot = {
Expand All @@ -23,22 +25,23 @@
};

# Enable TLP and powertop for better battery life
services = {
power-profiles-daemon.enable = false;
tlp = {
enable = true;
settings = {
CPU_BOOST_ON_AC = 1;
CPU_BOOST_ON_BAT = 0;
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
PCIE_ASPM_ON_BAT = "powersupersave";
RESTORE_DEVICE_STATE_ON_STARTUP = 1;
RUNTIME_PM_ON_BAT = "auto";
};
};
};
powerManagement.powertop.enable = true;
tlp.enable = true;
# services = {
# power-profiles-daemon.enable = false;
# tlp = {
# enable = true;
# settings = {
# CPU_BOOST_ON_AC = 1;
# CPU_BOOST_ON_BAT = 0;
# CPU_SCALING_GOVERNOR_ON_AC = "performance";
# CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
# PCIE_ASPM_ON_BAT = "powersupersave";
# RESTORE_DEVICE_STATE_ON_STARTUP = 1;
# RUNTIME_PM_ON_BAT = "auto";
# };
# };
# };
# powerManagement.powertop.enable = true;

# nixpkgs.config.packageOverrides = pkgs: {
# intel-vaapi-driver = pkgs.intel-vaapi-driver.override {enableHybridCodec = true;};
Expand Down
7 changes: 0 additions & 7 deletions modules/home-manager/pc/desktop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@
#qbittorrent

exercism

gnomeExtensions.appindicator
gnomeExtensions.emoji-copy
# gnomeExtensions.focus
#gnomeExtensions.spotify-controller
gnomeExtensions.tailscale-status
gnomeExtensions.transparent-top-bar
];
};
}
18 changes: 17 additions & 1 deletion modules/home-manager/pc/desktop/gnome/dconf.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@
# gtk-theme = lib.mkForce "Catppuccin-Macchiato-Standard-Green-Dark";
icon-theme = lib.mkForce "candy-icons";
};
# Power settings
"org/gnome/settings-daemon/plugins/power" = {
ambient-enabled = false;
idle-dim = false;
sleep-inactive-ac-timeout = 1800;
sleep-inactive-ac-type = "suspend";
sleep-inactive-battery-timeout = 900;
sleep-inactive-battery-type = "suspend";
};
# Session
"org/gnome/desktop/session" = {
idle-delay = "uint32 900";
};
# Set list of custom keybinding
"org/gnome/settings-daemon/plugins/media-keys" = {
custom-keybindings = [
Expand Down Expand Up @@ -72,7 +85,10 @@
binding = "<Control>less";
};
# i3 keybindings
"org/gnome/mutter".dynamic-workspaces = false;
"org/gnome/mutter" = {
experimental-features = ["scale-monitor-framebuffer"];
dynamic-workspaces = false;
};
"org/gnome/desktop/wm/preferences".num-workspaces = 9;
"org/gnome/shell/keybindings" = {
switch-to-application-1 = [];
Expand Down
15 changes: 15 additions & 0 deletions modules/home-manager/pc/desktop/gnome/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
lib,
pkgs,
config,
...
}: {
Expand All @@ -15,5 +16,19 @@
dconf.enable = lib.mkDefault true;
theming.enable = lib.mkDefault true;
};

home.packages =
(with pkgs.gnomeExtensions; [
appindicator
emoji-copy
# focus
# spotify-controller
tailscale-status
# tiling-shell
transparent-top-bar
])
++ (with pkgs.unstable.gnomeExtensions; [
tiling-shell
]);
};
}
1 change: 1 addition & 0 deletions modules/home-manager/server/secrets.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ in {
path = config.home.homeDirectory + "/.ssh/sops_key";
};
"tokens/copilot" = {};
"tokens/cachix" = {};
};
};

Expand Down
9 changes: 5 additions & 4 deletions modules/home-manager/server/shell/zsh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
# defaultKeymap = "vim";

initExtra = ''
# Variables
export LS_COLORS="$(vivid generate gruvbox-dark)";
export COPILOT_API_KEY="$(cat ${config.sops.secrets."tokens/copilot".path})"
export CACHIX_AUTH_TOKEN="$(cat ${config.sops.secrets."tokens/cachix".path})"
# Disable all sounds
unsetopt BEEP
Expand All @@ -65,10 +70,6 @@
echo " { config = config.nixpkgs.config; };"
}
# Variables
export LS_COLORS="$(vivid generate gruvbox-dark)";
export COPILOT_API_KEY="$(cat ${config.sops.secrets."tokens/copilot".path})"
## Autocompletions
# tailscale
# eval "tailscale completion zsh &> ~/.config/zsh/_tailscale"
Expand Down
64 changes: 64 additions & 0 deletions modules/nixos/environment/amd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
pkgs,
config,
lib,
...
}: {
options = {
amd.enable = lib.mkEnableOption "Setup amd tools";
};

config = lib.mkIf config.amd.enable {
boot.initrd.kernelModules = ["amdgpu"];

services.xserver.videoDrivers = ["amdgpu"];

environment.systemPackages =
(with pkgs; [
amdgpu_top
clinfo
])
++ (with pkgs.rocmPackages; [
rocminfo
]);

hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages =
(with pkgs; [
amdvlk
])
++ (with pkgs.rocmPackages; [
clr.icd
]);
};

systemd.tmpfiles.rules = let
rocmEnv = pkgs.symlinkJoin {
name = "rocm-combined";
paths = with pkgs.rocmPackages; [
clr
hipcc
hipsolver
hipblas
rocblas
rocalution
rocfft
rocm-runtime
rocrand
rocsparse
rocsolver
rccl
# miopen
];
};
in [
"L+ /opt/rocm - - - - ${rocmEnv}"
"L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}"
];
# systemd.tmpfiles.rules = [
# ];
};
}
14 changes: 14 additions & 0 deletions modules/nixos/environment/cachix.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
pkgs,
lib,
config,
...
}: {
options.cachix.enable = lib.mkEnableOption "Use cachix to manage nix caches for packages";

config = lib.mkIf config.cachix.enable {
environment.systemPackages = with pkgs; [
cachix
];
};
}
8 changes: 8 additions & 0 deletions modules/nixos/environment/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{lib, ...}: {
imports = [
./packages.nix
./cachix.nix
./firefox.nix
./fonts.nix
./ld.nix
Expand All @@ -10,9 +11,16 @@
./python.nix

./wayland.nix

./amd.nix
./intel.nix
];

cachix.enable = lib.mkDefault true;
chrome.enable = lib.mkDefault true;
firefox.enable = lib.mkDefault true;
steam.enable = lib.mkDefault true;

amd.enable = lib.mkDefault false;
intel.enable = lib.mkDefault false;
}
16 changes: 16 additions & 0 deletions modules/nixos/environment/intel.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
pkgs,
config,
lib,
...
}: {
options = {
intel.enable = lib.mkEnableOption "Setup intel tools";
};

config = lib.mkIf config.intel.enable {
environment.systemPackages = with pkgs; [
intel-gpu-tools
];
};
}
Loading

0 comments on commit afdb98f

Please sign in to comment.