authorgravatar for nmarks413@gmail.comNatalie Marks <nmarks413@gmail.com> 2025-04-18 15:55:34-07:00
committergravatar for nmarks413@gmail.comNatalie Marks <nmarks413@gmail.com> 2025-04-18 15:55:34-07:00
log1c313955d56b5bbebc81411969d2727ea1e51ed5
treed0b4993741fff1041996772048d0454d9cc4c169
parent51df904a8171d871ed988399647f3b0037645c0c
signature Commit is signed but in an unrecognized format.

start modularizing things


24 files changed, 413 insertions(+), 218 deletions(-)

.DS_Store created
Binary files /dev/null and b/.DS_Store differ
flake.lock+30-9
...@@ -668,23 +668,43 @@...@@ -668,23 +668,43 @@
668 "type": "github"668 "type": "github"
669 }669 }
670 },670 },
671 "nh_darwin": {671 "nh": {
672 "inputs": {672 "inputs": {
673 "nixpkgs": [673 "nixpkgs": [
674 "nixpkgs"674 "nixpkgs"
675 ]675 ]
676 },676 },
677 "locked": {677 "locked": {
678 "lastModified": 1739410909,678 "lastModified": 1743682999,
679 "narHash": "sha256-wx0oBgnmh6K8PJGyASLAErnrIe8/1hZthVrkfoX+j/E=",679 "narHash": "sha256-bg+aAN8K90r3m/I+xXiXG0gawpbkshwlk93wxUN7KEk=",
680 "owner": "ToyVo",680 "owner": "viperML",
681 "repo": "nh_darwin",681 "repo": "nh",
682 "rev": "10c8d19efd0ed9f63708d1179468fbb2f2bd7f4e",682 "rev": "9e9a4590b38b62b28f07a1fae973ce7b6ca0687a",
683 "type": "github"683 "type": "github"
684 },684 },
685 "original": {685 "original": {
686 "owner": "ToyVo",686 "owner": "viperML",
687 "repo": "nh_darwin",687 "repo": "nh",
688 "type": "github"
689 }
690 },
691 "nix-index-database": {
692 "inputs": {
693 "nixpkgs": [
694 "nixpkgs"
695 ]
696 },
697 "locked": {
698 "lastModified": 1744518957,
699 "narHash": "sha256-RLBSWQfTL0v+7uyskC5kP6slLK1jvIuhaAh8QvB75m4=",
700 "owner": "nix-community",
701 "repo": "nix-index-database",
702 "rev": "4fc9ea78c962904f4ea11046f3db37c62e8a02fd",
703 "type": "github"
704 },
705 "original": {
706 "owner": "nix-community",
707 "repo": "nix-index-database",
688 "type": "github"708 "type": "github"
689 }709 }
690 },710 },
...@@ -920,7 +940,8 @@...@@ -920,7 +940,8 @@
920 "hyprland": "hyprland",940 "hyprland": "hyprland",
921 "hyprland-plugins": "hyprland-plugins",941 "hyprland-plugins": "hyprland-plugins",
922 "moonlight": "moonlight",942 "moonlight": "moonlight",
923 "nh_darwin": "nh_darwin",943 "nh": "nh",
944 "nix-index-database": "nix-index-database",
924 "nix-options-search": "nix-options-search",945 "nix-options-search": "nix-options-search",
925 "nixos-cosmic": "nixos-cosmic",946 "nixos-cosmic": "nixos-cosmic",
926 "nixpkgs": "nixpkgs_5",947 "nixpkgs": "nixpkgs_5",
flake.nix+43-57
...@@ -33,8 +33,6 @@...@@ -33,8 +33,6 @@
33 zig.url = "github:mitchellh/zig-overlay";33 zig.url = "github:mitchellh/zig-overlay";
34 zls.url = "github:zigtools/zls?rev=a26718049a8657d4da04c331aeced1697bc7652b";34 zls.url = "github:zigtools/zls?rev=a26718049a8657d4da04c331aeced1697bc7652b";
3535
36 # foundryvtt.url = "github:reckenrode/nix-foundryvtt";
37
38 moonlight = {36 moonlight = {
39 url = "github:moonlight-mod/moonlight"; # Add `/develop` to the flake URL to use nightly.37 url = "github:moonlight-mod/moonlight"; # Add `/develop` to the flake URL to use nightly.
40 inputs.nixpkgs.follows = "nixpkgs";38 inputs.nixpkgs.follows = "nixpkgs";
...@@ -44,90 +42,78 @@...@@ -44,90 +42,78 @@
44 inputs.nixpkgs.follows = "nixpkgs";42 inputs.nixpkgs.follows = "nixpkgs";
45 };43 };
4644
47 nh_darwin = {45 nh = {
48 url = "github:ToyVo/nh_darwin";46 url = "github:viperML/nh";
49 inputs.nixpkgs.follows = "nixpkgs";47 inputs.nixpkgs.follows = "nixpkgs";
50 };48 };
51 nix-options-search = {49 nix-options-search = {
52 url = "github:madsbv/nix-options-search";50 url = "github:madsbv/nix-options-search";
53 };51 };
5452
53 nix-index-database.url = "github:nix-community/nix-index-database";
54 nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
55
55 chinese-fonts-overlay = {56 chinese-fonts-overlay = {
56 url = "github:brsvh/chinese-fonts-overlay/main";57 url = "github:brsvh/chinese-fonts-overlay/main";
57 inputs.nixpkgs.follows = "nixpkgs";58 inputs.nixpkgs.follows = "nixpkgs";
58 };59 };
59 };60 };
60 outputs = {61 outputs = inputs @ {
61 self,
62 nixpkgs,62 nixpkgs,
63 nixpkgs-stable,
64 nix-options-search,
65 home-manager,
66 darwin,
67 hosts,
68 hyprland-plugins,
69 zig,
70 zls,
71 nixos-cosmic,63 nixos-cosmic,
72 nh_darwin,64 nix-index-database,
65 darwin,
73 ...66 ...
74 } @ inputs: let67 }: let
75 overlays = [68 overlays = [
76 inputs.zig.overlays.default69 inputs.zig.overlays.default
77 inputs.rust-overlay.overlays.default70 inputs.rust-overlay.overlays.default
78 inputs.chinese-fonts-overlay.overlays.default71 inputs.chinese-fonts-overlay.overlays.default
72 inputs.nh.overlays.default
79 ];73 ];
80 inherit (nixpkgs) lib;74 inherit (nixpkgs) lib;
75 mkIfElse = p: yes: no:
76 lib.mkMerge [
77 (lib.mkIf p yes)
78 (lib.mkIf (!p) no)
79 ];
80
81 user = "nmarks";
82
83 shared_modules = [
84 # {nixpkgs.overlays = overlays;}
85 # {programs.nix-index-database.comma.enable = true;}
86 # nixindex
87 # homemanagerModules
88 {
89 _module.args = {
90 inherit user;
91 inherit mkIfElse;
92 };
93 }
94 ];
81 in {95 in {
82 nixosConfigurations = {96 nixosConfigurations = {
83 nixos = lib.nixosSystem {97 nixos = lib.nixosSystem {
84 modules = [98 system = "x86_64-linux";
85 {nixpkgs.overlays = overlays;}99 modules =
86 hosts.nixosModule100 [
87 {101 ./hosts/desktop/configuration.nix
88 networking.stevenBlackHosts.enable = true;102 nixos-cosmic.nixosModules.default
89 }103 ]
90 ./hosts/desktop/configuration.nix104 ++ shared_modules;
91 home-manager.nixosModules.home-manager
92 {
93 home-manager = {
94 backupFileExtension = "hm-backup";
95 useGlobalPkgs = true;
96 useUserPackages = true;
97 users.nmarks = import ./hosts/desktop/home.nix;
98 };
99 home-manager.extraSpecialArgs = {
100 inherit hyprland-plugins;
101 inherit zls;
102 };
103 }
104 nixos-cosmic.nixosModules.default
105 ];
106 specialArgs = inputs;105 specialArgs = inputs;
107 };106 };
108 };107 };
109 darwinConfigurations = {108 darwinConfigurations = {
110 "Natalies-MacBook-Air" = darwin.lib.darwinSystem {109 "Natalies-MacBook-Air" = darwin.lib.darwinSystem {
111 system = "aarch64-darwin";110 system = "aarch64-darwin";
112 modules = [111 specialArgs = inputs;
113 {nixpkgs.overlays = overlays;}112 modules =
114 ./hosts/laptop/configuration.nix113 [
115 home-manager.darwinModules.home-manager114 ./hosts/laptop/configuration.nix
116 {115 ]
117 home-manager = {116 ++ shared_modules;
118 useGlobalPkgs = true;
119 useUserPackages = true;
120 users.nmarks = import ./hosts/laptop/home.nix;
121 };
122 home-manager.extraSpecialArgs = {
123 inherit zls;
124 };
125 users.users.nmarks.home = "/Users/nmarks";
126 }
127 ];
128 specialArgs = {
129 inherit inputs;
130 };
131 };117 };
132 };118 };
133 };119 };
hosts/.DS_Store created
Binary files /dev/null and b/hosts/.DS_Store differ
hosts/desktop/configuration.nix+7-116
...@@ -1,6 +1,3 @@...@@ -1,6 +1,3 @@
1#<BS> Edit this configuration file to define what should be installed on
2# your system. Help is available in the configuration.nix(5) man page
3# and in the NixOS manual (accessible by running ‘nixos-help’).
4{1{
5 self,2 self,
6 inputs,3 inputs,
...@@ -8,8 +5,14 @@...@@ -8,8 +5,14 @@
8 pkgs,5 pkgs,
9 ...6 ...
10}: {7}: {
11 nixpkgs.config.allowUnfree = true;8 imports = [
9 # Include the results of the hardware scan.
10 ./hardware-configuration.nix
1211
12 ../../modules/shared/nix.nix
13 ../../modules/nixos/nvidia.nix
14 ../../modules/nixos/boot.ni
15 ];
13 services.avahi = {16 services.avahi = {
14 enable = true;17 enable = true;
15 nssmdns4 = true;18 nssmdns4 = true;
...@@ -51,22 +54,6 @@...@@ -51,22 +54,6 @@
5154
52 nix.settings.trusted-users = ["root" "nmarks"];55 nix.settings.trusted-users = ["root" "nmarks"];
5356
54 nix.settings.experimental-features = ["nix-command" "flakes"];
55 nix.settings = {
56 substituters = [
57 "https://cache.nixos.org/"
58 "https://nix-community.cachix.org"
59 "https://cosmic.cachix.org/"
60 "https://cache.iog.io"
61 "https://cuda-maintainers.cachix.org"
62 ];
63 trusted-public-keys = [
64 "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
65 "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
66 "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="
67 "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
68 ];
69 };
70 programs.hyprland.enable = true;57 programs.hyprland.enable = true;
7158
72 programs.fish.enable = true;59 programs.fish.enable = true;
...@@ -109,89 +96,6 @@...@@ -109,89 +96,6 @@
109 nerd-fonts.iosevka96 nerd-fonts.iosevka
110 ];97 ];
11198
112 imports = [
113 # Include the results of the hardware scan.
114 ./hardware-configuration.nix
115 # inputs.foundryvtt.nixosModules.foundryvtt
116 ];
117
118 # Enable OpenGL
119 hardware.graphics = {
120 enable = true;
121 };
122 services.xserver.videoDrivers = ["nvidia"];
123
124 hardware.nvidia-container-toolkit.enable = true;
125 hardware.nvidia = {
126 forceFullCompositionPipeline = true;
127 # Modesetting is required.
128 modesetting.enable = true;
129
130 # Nvidia power management. Experimental, and can cause sleep/suspend to fail.
131 powerManagement.enable = false;
132 # Fine-grained power management. Turns off GPU when not in use.
133 # Experimental and only works on modern Nvidia GPUs (Turing or newer).
134 powerManagement.finegrained = false;
135
136 # Use the NVidia open source kernel module (not to be confused with the
137 # independent third-party "nouveau" open source driver).
138 # Support is limited to the Turing and later architectures. Full list of
139 # supported GPUs is at:
140 # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
141 # Only available from driver 515.43.04+
142 # Currently alpha-quality/buggy, so false is currently the recommended setting.
143 open = false;
144
145 # Enable the Nvidia settings menu,
146 # accessible via `nvidia-settings`.
147 nvidiaSettings = true;
148
149 # Optionally, you may need to select the appropriate driver version for your specific GPU.
150 package = config.boot.kernelPackages.nvidiaPackages.latest;
151 #Fixes a glitch
152 nvidiaPersistenced = true;
153
154 #Required for amdgpu and nvidia gpu pairings
155 # modesetting.enable = true;
156
157 prime = {
158 # offload.enable = true;
159 #sync.enable = true;
160
161 amdgpuBusId = "PCI:0f:00.0";
162
163 nvidiaBusId = "PCI:01:00.0";
164 };
165 };
166 # Bootloader.
167 #boot.loader.systemd-boot.enable = true;
168 #boot.loader.efi.canTouchEfiVariables = true;
169
170 boot.kernelPackages = pkgs.linuxPackages_latest;
171
172 boot.loader = {
173 # systemd-boot.enable = true;
174 efi = {
175 canTouchEfiVariables = true;
176 # assuming /boot is the mount point of the EFI partition in NixOS (as the installation section recommends).
177 efiSysMountPoint = "/boot/efi";
178 };
179 grub = {
180 enable = true;
181 device = "nodev";
182 theme = pkgs.catppuccin-grub;
183 useOSProber = true;
184 efiSupport = true;
185 };
186 };
187
188 boot.supportedFilesystems = ["ntfs"];
189 # Configure network proxy if necessary
190 # networking.proxy.default = "http://user:password@proxy:port/";
191 # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
192
193 # Enable networking
194
195 # Set your time zone.99 # Set your time zone.
196 time.timeZone = "America/Los_Angeles";100 time.timeZone = "America/Los_Angeles";
197101
...@@ -340,19 +244,6 @@...@@ -340,19 +244,6 @@
340 networkmanager.enable = true;244 networkmanager.enable = true;
341 firewall = {245 firewall = {
342 allowedTCPPorts = [22 80 443];246 allowedTCPPorts = [22 80 443];
343 #KDE Connect
344 # allowedTCPPortRanges = [
345 # {
346 # from = 1714;
347 # to = 1764;
348 # }
349 # ];
350 # allowedUDPPortRanges = [
351 # {
352 # from = 1714;
353 # to = 1764;
354 # }
355 # ];
356 enable = true;247 enable = true;
357 };248 };
358 interfaces.enp11s0.wakeOnLan = {249 interfaces.enp11s0.wakeOnLan = {
hosts/laptop/.DS_Store created
Binary files /dev/null and b/hosts/laptop/.DS_Store differ
hosts/laptop/configuration.nix+15-10
...@@ -1,27 +1,32 @@...@@ -1,27 +1,32 @@
1{1{
2 config,2 config,
3 pkgs,3 pkgs,
4 lib,
4 ...5 ...
5}: {6}: {
7 imports = [
8 ../../modules/shared/nix.nix
9 ./modules/icons.nix
10 ];
11
6 environment.systemPackages = with pkgs; [12 environment.systemPackages = with pkgs; [
7 home-manager
8 neovim13 neovim
9 pinentry_mac14 pinentry_mac
10 ];15 ];
1116
12 nixpkgs.config.allowUnfree = true;17 environment.customIcons = {
18 enable = true;
19 icons = [
20 {
21 path = "/Applications/Zen.app";
22 icon = "/Users/nmarks/.dotfiles/icons/Zen_icons/firefox.icns";
23 }
24 ];
25 };
1326
14 # Use a custom configuration.nix location.27 # Use a custom configuration.nix location.
15 #environment.darwinConfig = "$HOME/.dotfiles/hosts/laptop";28 #environment.darwinConfig = "$HOME/.dotfiles/hosts/laptop";
1629
17 # Auto upgrade nix package and the daemon service.
18 nix = {
19 package = pkgs.nix;
20 settings = {
21 "extra-experimental-features" = ["nix-command" "flakes"];
22 };
23 };
24
25 # Create /etc/zshrc that loads the nix-darwin environment.30 # Create /etc/zshrc that loads the nix-darwin environment.
26 programs = {31 programs = {
27 gnupg.agent.enable = true;32 gnupg.agent.enable = true;
hosts/laptop/home.nix+22-23
...@@ -1,36 +1,35 @@...@@ -1,36 +1,35 @@
1{1{
2 inputs,
3 config,2 config,
4 pkgs,3 pkgs,
5 lib,4 lib,
6 ghostty,
7 moonlight,
8 ...5 ...
9}: {6}: {
10 # Home Manager needs a bit of information about you and the paths it should7 programs = import ../shared/home-programs.nix {inherit config pkgs lib;};
11 # manage.
12 # This value determines the Home Manager release that your configuration is
13 # compatible with. This helps avoid breakage when a new Home Manager release
14 # introduces backwards incompatible changes.
15 #
16 # You should not change this value, even if you update Home Manager. If you do
17 # want to update the value, then make sure to first check the Home Manager
18 # release notes.
19 home.stateVersion = "23.05"; # Please read the comment before changing.
208
21 home.packages = pkgs.callPackage ../shared/packages.nix {};9 home = {
10 # Home Manager needs a bit of information about you and the paths it should
11 # manage.
12 # This value determines the Home Manager release that your configuration is
13 # compatible with. This helps avoid breakage when a new Home Manager release
14 # introduces backwards incompatible changes.
15 #
16 # You should not change this value, even if you update Home Manager. If you do
17 # want to update the value, then make sure to first check the Home Manager
18 # release notes.
19 stateVersion = "23.05"; # Please read the comment before changing.
2220
23 programs = import ../shared/home-programs.nix {inherit config pkgs lib;};21 packages = pkgs.callPackage ../shared/packages.nix {};
2422
25 home.sessionVariables = {23 sessionVariables = {
26 EDITOR = "nvim";24 EDITOR = "nvim";
27 VISUAL = "nvim";25 VISUAL = "nvim";
28 TERMINAL = "ghostty";26 TERMINAL = "ghostty";
29 BROWSER = "firefox";27 BROWSER = "firefox";
28 };
29 sessionPath = [
30 "$HOME/.emacs.d/bin"
31 ];
30 };32 };
31 home.sessionPath = [
32 "$HOME/.emacs.d/bin"
33 ];
3433
35 # Let Home Manager install and manage itself.34 # Let Home Manager install and manage itself.
36}35}
hosts/laptop/icons/.DS_Store created
Binary files /dev/null and b/hosts/laptop/icons/.DS_Store differ
hosts/laptop/icons/Zen_icons/Zen Browser - Dark Mono.icns created
Binary files /dev/null and b/hosts/laptop/icons/Zen_icons/Zen Browser - Dark Mono.icns differ
hosts/laptop/icons/Zen_icons/Zen Browser - Dark.icns created
Binary files /dev/null and b/hosts/laptop/icons/Zen_icons/Zen Browser - Dark.icns differ
hosts/laptop/icons/Zen_icons/Zen Browser - Inverted.icns created
Binary files /dev/null and b/hosts/laptop/icons/Zen_icons/Zen Browser - Inverted.icns differ
hosts/laptop/icons/Zen_icons/Zen Browser - Light Mono.icns created
Binary files /dev/null and b/hosts/laptop/icons/Zen_icons/Zen Browser - Light Mono.icns differ
hosts/laptop/icons/Zen_icons/Zen Browser - Light.icns created
Binary files /dev/null and b/hosts/laptop/icons/Zen_icons/Zen Browser - Light.icns differ
hosts/laptop/icons/Zen_icons/firefox.icns created
Binary files /dev/null and b/hosts/laptop/icons/Zen_icons/firefox.icns differ
hosts/laptop/modules/icons.nix created+61
...@@ -0,0 +1,61 @@
1{
2 lib,
3 config,
4 ...
5}: let
6 cfg = config.environment.customIcons;
7 inherit
8 (lib)
9 mkEnableOption
10 mkIf
11 mkMerge
12 mkOption
13 types
14 ;
15in {
16 options.environment.customIcons = {
17 enable = mkEnableOption "environment.customIcons";
18 clearCacheOnActivation = mkEnableOption "environment.customIcons.clearCacheOnActivation";
19
20 icons = mkOption {
21 type = types.listOf (
22 types.submodule {
23 options = {
24 path = mkOption {type = types.path;};
25 icon = mkOption {type = types.path;};
26 };
27 }
28 );
29 };
30 };
31
32 config = mkMerge [
33 (mkIf cfg.enable {
34 system.activationScripts.extraActivation.text = ''
35 echo -e "applying custom icons..."
36
37 ${
38 (builtins.concatStringsSep "\n\n" (
39 builtins.map (iconCfg: ''
40 osascript <<EOF >/dev/null
41 use framework "Cocoa"
42
43 set iconPath to "${iconCfg.icon}"
44 set destPath to "${iconCfg.path}"
45
46 set imageData to (current application's NSImage's alloc()'s initWithContentsOfFile:iconPath)
47 (current application's NSWorkspace's sharedWorkspace()'s setIcon:imageData forFile:destPath options:2)
48 EOF
49 '')
50 cfg.icons
51 ))
52 }
53
54 ${lib.optionalString cfg.clearCacheOnActivation ''
55 sudo rm -rf /Library/Caches/com.apple.iconservices.store
56 sudo find /private/var/folders/ -name com.apple.dock.iconcache -or -name com.apple.iconservices -or -name com.apple.iconservicesagent -exec rm -rf {} \; || true
57 killall Dock
58 ''}'';
59 })
60 ];
61}
hosts/shared/home-programs.nix+23-1
...@@ -26,6 +26,25 @@...@@ -26,6 +26,25 @@
26 bold_font auto";26 bold_font auto";
27 };27 };
2828
29 bat = {
30 enable = true;
31 extraPackages = with pkgs.bat-extras; [batdiff batman batgrep batwatch batpipe prettybat];
32 config = {
33 theme = "catpuccin";
34 };
35 themes = {
36 catpuccin = {
37 src = pkgs.fetchFromGitHub {
38 owner = "catppuccin";
39 repo = "bat";
40 hash = "sha256-6fWoCH90IGumAMc4buLRWL0N61op+AuMNN9CAR9/OdI=";
41 rev = "699f60fc8ec434574ca7451b444b880430319941";
42 };
43 file = "themes/Catppuccin Mocha.tmTheme";
44 };
45 };
46 };
47
29 hyfetch = {48 hyfetch = {
30 enable = true;49 enable = true;
31 settings = {50 settings = {
...@@ -63,7 +82,10 @@...@@ -63,7 +82,10 @@
63 shellAliases = {82 shellAliases = {
64 reboot-windows = "sudo efibootmgr --bootnext 0000; sudo reboot -h now";83 reboot-windows = "sudo efibootmgr --bootnext 0000; sudo reboot -h now";
65 };84 };
66 shellInit = "test -r '/Users/nmarks/.opam/opam-init/init.fish' && source '/Users/nmarks/.opam/opam-init/init.fish' > /dev/null 2> /dev/null; or true";85 shellInit = ''
86 test -r '/Users/nmarks/.opam/opam-init/init.fish' && source '/Users/nmarks/.opam/opam-init/init.fish' > /dev/null 2> /dev/null; or true
87 batman --export-env | source
88 '';
67 };89 };
68 home-manager.enable = true;90 home-manager.enable = true;
69}91}
hosts/shared/packages.nix-2
...@@ -32,7 +32,6 @@ with pkgs; [...@@ -32,7 +32,6 @@ with pkgs; [
32 #nix tools32 #nix tools
33 cachix33 cachix
34 direnv34 direnv
35 comma
36 nh35 nh
3736
38 #terminal stuff37 #terminal stuff
...@@ -44,7 +43,6 @@ with pkgs; [...@@ -44,7 +43,6 @@ with pkgs; [
44 neofetch43 neofetch
45 hyfetch44 hyfetch
46 fastfetch45 fastfetch
47 bat
48 eza46 eza
49 ollama47 ollama
50 uv48 uv
modules/nixos/boot.nix created+33
...@@ -0,0 +1,33 @@
1{pkgs, ...}: {
2 boot = {
3 kernelPackages = pkgs.linuxPackages_latest; # _zen, _hardened, _rt, _rt_latest, etc.
4 loader = {
5 efi = {
6 canTouchEfiVariables = true;
7 # assuming /boot is the mount point of the EFI partition in NixOS (as the installation section recommends).
8 efiSysMountPoint = "/boot/efi";
9 };
10 grub = {
11 enable = true;
12 device = "nodev";
13 theme = pkgs.catppuccin-grub;
14 useOSProber = true;
15 efiSupport = true;
16 };
17 };
18
19 #this is set to false by default for some reason
20 tmp.cleanOnBoot = true;
21
22 # Make boot screen quiet
23 kernelParams = [
24 "quiet"
25 "splash"
26 "rd.systemd.show_status=auto"
27 "rd.udev.log_level=3"
28 "udev.log_priority=3"
29 ];
30 consoleLogLevel = 0;
31 initrd.verbose = false;
32 };
33}
modules/nixos/nvidia.nix created+95
...@@ -0,0 +1,95 @@
1{
2 lib,
3 pkgs,
4 config,
5 ...
6}: let
7 nvidiaDriverChannel = config.boot.kernelPackages.nvidiaPackages.latest;
8in {
9 services.xserver.videoDrivers = ["nvidia"];
10
11 nixpkgs.config = {
12 nvidia.acceptLicense = true;
13 allowUnfree = true;
14 };
15 # Kernel parameters for better Wayland and Hyprland integration
16 boot.kernelParams = [
17 "nvidia-drm.modeset=1" # Enable mode setting for Wayland
18 "nvidia.NVreg_PreserveVideoMemoryAllocations=1" # Improves resume after sleep
19 ];
20
21 # Blacklist nouveau to avoid conflicts
22 boot.blacklistedKernelModules = ["nouveau"];
23
24 hardware = {
25 nvidia = {
26 forceFullCompositionPipeline = true; # Prevents screen tearing
27 # Modesetting is required.
28 modesetting.enable = true;
29
30 powerManagement = {
31 enable = true; # Power management
32 finegrained = true; # More precise power consumption control
33 };
34
35 # Use the NVidia open source kernel module (not to be confused with the
36 # independent third-party "nouveau" open source driver).
37 # Currently alpha-quality/buggy, so false is currently the recommended setting.
38 open = false;
39
40 # Environment variables for better compatibility
41 environment.variables = {
42 LIBVA_DRIVER_NAME = "nvidia"; # Hardware video acceleration
43 XDG_SESSION_TYPE = "wayland"; # Force Wayland
44 GBM_BACKEND = "nvidia-drm"; # Graphics backend for Wayland
45 __GLX_VENDOR_LIBRARY_NAME = "nvidia"; # Use Nvidia driver for GLX
46 WLR_NO_HARDWARE_CURSORS = "1"; # Fix for cursors on Wayland
47 NIXOS_OZONE_WL = "1"; # Wayland support for Electron apps
48 __GL_GSYNC_ALLOWED = "1"; # Enable G-Sync if available
49 __GL_VRR_ALLOWED = "1"; # Enable VRR (Variable Refresh Rate)
50 WLR_DRM_NO_ATOMIC = "1"; # Fix for some issues with Hyprland
51 NVD_BACKEND = "direct"; # Configuration for new driver
52 MOZ_ENABLE_WAYLAND = "1"; # Wayland support for Firefox
53 };
54
55 # Enable the Nvidia settings menu,
56 # accessible via `nvidia-settings`.
57 nvidiaSettings = true;
58
59 package = nvidiaDriverChannel;
60
61 #Fixes a glitch
62 nvidiaPersistenced = true;
63 };
64 nvidia-container-toolkit.enable = true;
65
66 graphics = {
67 enable = true;
68 package = nvidiaDriverChannel;
69 enable32Bit = true;
70 extraPackages = with pkgs; [
71 nvidia-vaapi-driver
72 vaapiVdpau
73 libvdpau-va-gl
74 mesa
75 egl-wayland
76 vulkan-loader
77 vulkan-validation-layers
78 libva
79 ];
80 };
81 };
82
83 nix.settings = {
84 substituters = ["https://cuda-maintainers.cachix.org"];
85 trusted-public-keys = [
86 "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
87 ];
88 };
89
90 environment.systemPackages = with pkgs; [
91 vulkan-tools
92 glxinfo
93 libva-utils # VA-API debugging tools
94 ];
95}
modules/shared/extras.nix created+14
...@@ -0,0 +1,14 @@
1{
2 pkgs,
3 config,
4 inputs,
5 hostName,
6 mkIfElse,
7 darwin,
8 ...
9}: {
10 networking = {
11 inherit hostName;
12 networkmanager = !darwin;
13 };
14}
modules/shared/home-manager.nix created+8
...@@ -0,0 +1,8 @@
1{inputs, ...}: {
2 home-manager = {
3 useGlobalPkgs = true;
4 useUserPackages = true;
5 backupFileExtension = "hm-backup";
6 extraSpecialArgs = {inherit inputs;};
7 };
8}
modules/shared/nix.nix created+39
...@@ -0,0 +1,39 @@
1{
2 config,
3 inputs,
4 ...
5}: {
6 nixpkgs.config = {
7 allowUnfree = true;
8 };
9
10 nix = {
11 nixPath = ["nixpkgs = ${inputs.nixpkgs}"];
12 extraOptions = ''
13 warn-dirty = false
14 '';
15
16 settings = {
17 auto-optimise-store = true;
18 experimental-features = ["nix-command" "flakes"];
19 substituters = [
20 "https://cache.nixos.org/?priority=10"
21
22 "https://nix-community.cachix.org"
23 "https://cosmic.cachix.org/"
24 "https://cache.iog.io"
25 ];
26 trusted-public-keys = [
27 "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
28 "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="
29 "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
30 ];
31 };
32 gc = {
33 automatic = true;
34 persistent = true;
35 dates = "weekly";
36 options = "--delete-older-than 7d";
37 };
38 };
39}
modules/shared/vars.nix created+23
...@@ -0,0 +1,23 @@
1{
2 inputs,
3 pkgs,
4 config,
5 lib,
6 mkIfElse,
7 ...
8}: let
9 darwin = pkgs.stdenv.isDarwin;
10 homemanagerModules = mkIfElse darwin inputs.home-manager.darwinModules inputs.home-manager.nixosModules;
11 nixindex = mkIfElse darwin inputs.nix-index-database.darwinModules.nix-index inputs.nix-index-database.nixosModules.nix-index;
12in {
13 config.var = {
14 inherit darwin homemanagerModules nixindex;
15 };
16
17 options = {
18 var = lib.mkOption {
19 type = lib.types.attrs;
20 default = {};
21 };
22 };
23}