Gdm setup, attempted to set up grub theming
This commit is contained in:
		
					parent
					
						
							
								e555c40b2c
							
						
					
				
			
			
				commit
				
					
						01c5fe433b
					
				
			
		
					 15 changed files with 205 additions and 21 deletions
				
			
		|  | @ -51,4 +51,4 @@ Here's some things you might want to check out: | |||
|   - [Starship](https://starship.rs/) - shell prompt | ||||
| - [Zathura](https://pwmt.org/projects/zathura/) - pdf viewer | ||||
| - [Ranger](https://github.com/ranger/ranger) - file manager | ||||
| - [Firefox](https://www.mozilla.org/en-US/firefox/) - web browser | ||||
| - [Firefox](https://www.mozilla.org/en-US/firefox/) - web browserreadme | ||||
|  |  | |||
|  | @ -2,7 +2,6 @@ | |||
|   "LuaSnip": { "branch": "master", "commit": "9bff06b570df29434a88f9c6a9cea3b21ca17208" }, | ||||
|   "abbreinder.nvim": { "branch": "main", "commit": "5b2b5ff08a9ada42238d733aeebc6d3d96314d77" }, | ||||
|   "abbremand.nvim": { "branch": "main", "commit": "d633341f632b0b2666dfc6dfe6b9842ba1610a1d" }, | ||||
|   "catppuccin": { "branch": "main", "commit": "c3697149f825ff73665491223b5df1efae28f687" }, | ||||
|   "clipboard-image.nvim": { "branch": "main", "commit": "d1550dc26729b7954f95269952e90471b838fa25" }, | ||||
|   "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, | ||||
|   "cmp-cmdline": { "branch": "main", "commit": "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063" }, | ||||
|  | @ -48,6 +47,7 @@ | |||
|   "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, | ||||
|   "purescript-vim": { "branch": "main", "commit": "82348352e6568fcc0385bd7c99a8ead3a479feea" }, | ||||
|   "rasi.vim": { "branch": "main", "commit": "eac9969cf935cd4380987dc99bfa10d69d3f34a6" }, | ||||
|   "rose-pine": { "branch": "main", "commit": "845a6ad5443e3559dde42910c4523a5835c9233b" }, | ||||
|   "scrap.nvim": { "branch": "main", "commit": "16db44ae9403ec9c4b140394f294475d1af80a18" }, | ||||
|   "smart-splits.nvim": { "branch": "master", "commit": "fdd158ce7554dc830fb86e0fe952cd9476cdf726" }, | ||||
|   "telescope-file-browser.nvim": { "branch": "master", "commit": "304508fb7bea78e3c0eeddd88c4837501e403ae8" }, | ||||
|  |  | |||
|  | @ -43,6 +43,12 @@ | |||
|           "lua" | ||||
|         ], | ||||
|         "path": "./snippets/lua/core.json" | ||||
|       }, | ||||
|       { | ||||
|         "language": [ | ||||
|           "nix" | ||||
|         ], | ||||
|         "path": "./snippets/nix/core.json" | ||||
|       } | ||||
|     ] | ||||
|   } | ||||
|  |  | |||
							
								
								
									
										14
									
								
								dotfiles/vscode-snippets/snippets/nix/core.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								dotfiles/vscode-snippets/snippets/nix/core.json
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,14 @@ | |||
| { | ||||
|   "Fetch from GitHub": { | ||||
|     "prefix": "fetchFromGitHub", | ||||
|     "description": "Fetch a repo from github", | ||||
|     "body": [ | ||||
|       "pkgs.fetchFromGitHub {", | ||||
|       "\towner = \"$1\";", | ||||
|       "\trepo = \"$2\";", | ||||
|       "\trev = \"\";", | ||||
|       "\tsha256 = \"\";", | ||||
|       "}$0" | ||||
|     ] | ||||
|   } | ||||
| } | ||||
|  | @ -1,5 +1,6 @@ | |||
| # Configuration pieces included on all (nixos) hosts | ||||
| { inputs, outputs, lib, colorscheme, ... }: { | ||||
| { inputs, outputs, lib, colorscheme, ... }: | ||||
| let | ||||
|   imports = [ | ||||
|     inputs.agenix.nixosModule | ||||
|     inputs.base16.nixosModule | ||||
|  | @ -11,6 +12,10 @@ | |||
|     ./locale.nix | ||||
|     ./wireless | ||||
|   ]; | ||||
| in | ||||
| { | ||||
|   # Import all modules defined in modules/nixos | ||||
|   imports = builtins.attrValues outputs.nixosModules ++ imports; | ||||
| 
 | ||||
|   age.identityPaths = [ | ||||
|     "/etc/ssh/ssh_host_ed25519_key" | ||||
|  |  | |||
							
								
								
									
										7
									
								
								hosts/nixos/common/optional/gdm.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								hosts/nixos/common/optional/gdm.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| { | ||||
|   services.xserver = { | ||||
|     enable = true; | ||||
|     displayManager.gdm.enable = true; | ||||
|   }; | ||||
| } | ||||
| 
 | ||||
							
								
								
									
										8
									
								
								hosts/nixos/common/optional/sddm.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								hosts/nixos/common/optional/sddm.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| # Not using this for now, because I cannot get any theme to fucking work with it for some reason :( | ||||
| { | ||||
|   services.xserver = { | ||||
|     enable = true; | ||||
|     displayManager.sddm.enable = true; | ||||
|   }; | ||||
| } | ||||
| 
 | ||||
|  | @ -16,19 +16,8 @@ | |||
|     # Proper wallpaper zooming | ||||
|     desktopManager.wallpaper.mode = "fill"; | ||||
| 
 | ||||
|     displayManager = { | ||||
|       # make xmonad session the default | ||||
|       defaultSession = "none+xmonad"; | ||||
| 
 | ||||
|       # enable startx | ||||
|       # startx.enable = true; | ||||
|       sddm.enable = true; | ||||
| 
 | ||||
|       # autoLogin = { | ||||
|       #   enable = true; | ||||
|       #   user = "adrielus"; | ||||
|       # }; | ||||
|     }; | ||||
|     # Make xmonad session the default | ||||
|     displayManager.defaultSession = "none+xmonad"; | ||||
|   }; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -31,4 +31,6 @@ | |||
|       version = 2; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   boot.loader.grub.base16.enable = true; | ||||
| } | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
|     ../common/optional/pipewire.nix | ||||
|     ../common/optional/touchpad.nix | ||||
|     ../common/optional/xserver.nix | ||||
|     ../common/optional/gdm.nix | ||||
|     ../common/optional/xmonad | ||||
| 
 | ||||
|     ./hardware-configuration.nix | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ | |||
|   # example = import ./example.nix; | ||||
|   discord = import ./discord.nix; | ||||
|   fonts = import ./fonts.nix; | ||||
|   manage-fonts = import ./manage-fonts.nix; | ||||
|   firefox = import ./firefox; | ||||
|   satellite-dev = import ./satellite-dev.nix; | ||||
| } | ||||
|  |  | |||
|  | @ -25,9 +25,4 @@ in { | |||
|     monospace = mkFontOption "monospace"; | ||||
|     regular = mkFontOption "regular"; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf cfg.enable { | ||||
|     fonts.fontconfig.enable = true; | ||||
|     home.packages = [ cfg.monospace.package cfg.regular.package ]; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
							
								
								
									
										12
									
								
								modules/home-manager/manage-fonts.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								modules/home-manager/manage-fonts.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| # Actually installs the fonts and whatnot. | ||||
| # In a different file so the main module  | ||||
| # can also be included in my nixos config. | ||||
| { lib, config, ... }: | ||||
| let   cfg = config.fontProfiles; | ||||
|   in | ||||
| { | ||||
|   config = lib.mkIf cfg.enable { | ||||
|     fonts.fontconfig.enable = true; | ||||
|     home.packages = [ cfg.monospace.package cfg.regular.package ]; | ||||
|   }; | ||||
| } | ||||
|  | @ -2,4 +2,5 @@ | |||
| 
 | ||||
| { | ||||
|   # example = import ./example.nix; | ||||
|   grub-theming = import ./grub-theming.nix; | ||||
| } | ||||
|  |  | |||
							
								
								
									
										143
									
								
								modules/nixos/grub-theming.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										143
									
								
								modules/nixos/grub-theming.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,143 @@ | |||
| { pkgs, config, lib, ... }: | ||||
| 
 | ||||
| with config.scheme.withHashtag; | ||||
| 
 | ||||
| let | ||||
|   fontProfiles = { | ||||
|     enable = true; | ||||
| 
 | ||||
|     monospace = { | ||||
|       family = "FiraCode Nerd Font"; | ||||
|       package = pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; }; | ||||
|     }; | ||||
| 
 | ||||
|     regular = { | ||||
|       family = "Fira Sans"; | ||||
|       package = pkgs.fira; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   # See [this file](https://github.com/danth/stylix/blob/master/stylix/pixel.nix) | ||||
|   # Generate a PNG image containing a named color | ||||
|   pixel = color: | ||||
|     pkgs.runCommand "${color}-pixel.png" | ||||
|       { | ||||
|         color = config.scheme.withHashtag.${color}; | ||||
|       } "${pkgs.imagemagick}/bin/convert xc:$color png32:$out"; | ||||
| 
 | ||||
|   # Grub requires fonts to be converted to "PFF2 format" | ||||
|   # This function takes a font { name, package } and produces a .pf2 file | ||||
|   mkGrubFont = font: | ||||
|     pkgs.runCommand "${font.package.name}.pf2" | ||||
|       { | ||||
|         FONTCONFIG_FILE = | ||||
|           pkgs.makeFontsConf { fontDirectories = [ font.package ]; }; | ||||
|       } '' | ||||
|       # Use fontconfig to select the correct .ttf or .otf file based on name | ||||
|       font=$( | ||||
|         ${pkgs.fontconfig}/bin/fc-match -v "${font.family}" \ | ||||
|         | grep "file:" | cut -d '"' -f 2 | ||||
|       ) | ||||
| 
 | ||||
|       # Convert to .pf2 | ||||
|       ${pkgs.grub2}/bin/grub-mkfont $font --output $out --size 17 | ||||
|     ''; | ||||
| 
 | ||||
| in | ||||
| { | ||||
|   options.boot.loader.grub.base16 = { | ||||
|     enable = lib.mkOption { | ||||
|       description = "Whether to generate base16 grub theme"; | ||||
|       type = lib.types.bool; | ||||
|       default = false; | ||||
|     }; | ||||
| 
 | ||||
|     useImage = lib.mkOption { | ||||
|       description = "Whether to use your wallpaper image as the GRUB background."; | ||||
|       type = lib.types.bool; | ||||
|       default = false; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config.boot.loader.grub = lib.mkIf config.boot.loader.grub.base16.enable { | ||||
|     backgroundColor = base00; | ||||
| 
 | ||||
|     # Need to override the NixOS splash, this will match the background | ||||
|     splashImage = pixel "base00"; | ||||
| 
 | ||||
|     # This font will be used for the GRUB terminal | ||||
|     font = toString (mkGrubFont fontProfiles.monospace); | ||||
| 
 | ||||
|     # TODO: Include OS icons | ||||
|     theme = | ||||
|       let font = fontProfiles.regular; | ||||
|       in | ||||
|       pkgs.runCommand "stylix-grub" | ||||
|         { | ||||
|           themeTxt = '' | ||||
|             desktop-image: "background.png" | ||||
|             desktop-image-scale-method: "crop" | ||||
|             desktop-color: "${base00}" | ||||
| 
 | ||||
|             title-text: "" | ||||
| 
 | ||||
|             terminal-left: "10%" | ||||
|             terminal-top: "20%" | ||||
|             terminal-width: "80%" | ||||
|             terminal-height: "60%" | ||||
| 
 | ||||
|             + progress_bar { | ||||
|               left = 25% | ||||
|               top = 80%+20  # 20 pixels below boot menu | ||||
|               width = 50% | ||||
|               height = 30 | ||||
| 
 | ||||
|               id = "__timeout__" | ||||
|               show_text = true | ||||
|               font = "${font.family}" | ||||
|               text = "@TIMEOUT_NOTIFICATION_MIDDLE@" | ||||
| 
 | ||||
|               border_color = "${base00}" | ||||
|               bg_color = "${base00}" | ||||
|               fg_color = "${base0B}" | ||||
|               text_color = "${base05}" | ||||
|             } | ||||
| 
 | ||||
|             + boot_menu { | ||||
|               left = 25% | ||||
|               top = 20% | ||||
|               width = 50% | ||||
|               height = 60% | ||||
|               menu_pixmap_style = "background_*.png" | ||||
| 
 | ||||
|               item_height = 40 | ||||
|               item_icon_space = 8 | ||||
|               item_spacing = 0 | ||||
|               item_padding = 0 | ||||
|               item_font = "${font.family}" | ||||
|               item_color = "${base05}" | ||||
| 
 | ||||
|               selected_item_color = "${base01}" | ||||
|               selected_item_pixmap_style = "selection_*.png" | ||||
|             } | ||||
|           ''; | ||||
|           passAsFile = [ "themeTxt" ]; | ||||
|         } '' | ||||
|         mkdir $out | ||||
|         cp $themeTxtPath $out/theme.txt | ||||
| 
 | ||||
|         ${if config.boot.loader.grub.base16.useImage | ||||
|         # Make sure the background image is .png by asking to convert it | ||||
|         then | ||||
|           # TODO: this doesn't work because I have no wallpaper module | ||||
|           "${pkgs.imagemagick}/bin/convert ${config.stylix.image} png32:$out/background.png" | ||||
|         else | ||||
|           "cp ${pixel "base00"} $out/background.png"} | ||||
| 
 | ||||
|         cp ${pixel "base01"} $out/background_c.png | ||||
|         cp ${pixel "base0B"} $out/selection_c.png | ||||
| 
 | ||||
|         cp ${mkGrubFont font} $out/sans_serif.pf2 | ||||
|       ''; | ||||
|   }; | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Matei Adriel
				Matei Adriel