diff --git a/README.md b/README.md index b00c0dc..811c0ab 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/dotfiles/neovim/lazy-lock.json b/dotfiles/neovim/lazy-lock.json index e43c37f..9071833 100644 --- a/dotfiles/neovim/lazy-lock.json +++ b/dotfiles/neovim/lazy-lock.json @@ -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" }, diff --git a/dotfiles/vscode-snippets/package.json b/dotfiles/vscode-snippets/package.json index 7735f3c..61995a7 100644 --- a/dotfiles/vscode-snippets/package.json +++ b/dotfiles/vscode-snippets/package.json @@ -43,6 +43,12 @@ "lua" ], "path": "./snippets/lua/core.json" + }, + { + "language": [ + "nix" + ], + "path": "./snippets/nix/core.json" } ] } diff --git a/dotfiles/vscode-snippets/snippets/nix/core.json b/dotfiles/vscode-snippets/snippets/nix/core.json new file mode 100644 index 0000000..bb242d5 --- /dev/null +++ b/dotfiles/vscode-snippets/snippets/nix/core.json @@ -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" + ] + } +} diff --git a/hosts/nixos/common/global/default.nix b/hosts/nixos/common/global/default.nix index e185aff..ce5fdfe 100644 --- a/hosts/nixos/common/global/default.nix +++ b/hosts/nixos/common/global/default.nix @@ -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" diff --git a/hosts/nixos/common/optional/gdm.nix b/hosts/nixos/common/optional/gdm.nix new file mode 100644 index 0000000..92258a0 --- /dev/null +++ b/hosts/nixos/common/optional/gdm.nix @@ -0,0 +1,7 @@ +{ + services.xserver = { + enable = true; + displayManager.gdm.enable = true; + }; +} + diff --git a/hosts/nixos/common/optional/sddm.nix b/hosts/nixos/common/optional/sddm.nix new file mode 100644 index 0000000..37473ed --- /dev/null +++ b/hosts/nixos/common/optional/sddm.nix @@ -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; + }; +} + diff --git a/hosts/nixos/common/optional/xmonad/default.nix b/hosts/nixos/common/optional/xmonad/default.nix index 7e5479c..83ac3e5 100644 --- a/hosts/nixos/common/optional/xmonad/default.nix +++ b/hosts/nixos/common/optional/xmonad/default.nix @@ -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"; }; } diff --git a/hosts/nixos/tethys/boot.nix b/hosts/nixos/tethys/boot.nix index d455409..2d48248 100644 --- a/hosts/nixos/tethys/boot.nix +++ b/hosts/nixos/tethys/boot.nix @@ -31,4 +31,6 @@ version = 2; }; }; + + boot.loader.grub.base16.enable = true; } diff --git a/hosts/nixos/tethys/default.nix b/hosts/nixos/tethys/default.nix index cdeca1e..f8eee9e 100644 --- a/hosts/nixos/tethys/default.nix +++ b/hosts/nixos/tethys/default.nix @@ -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 diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index d490d62..1fd898c 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.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; } diff --git a/modules/home-manager/fonts.nix b/modules/home-manager/fonts.nix index 5aadd85..19a0fd4 100644 --- a/modules/home-manager/fonts.nix +++ b/modules/home-manager/fonts.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 ]; - }; } diff --git a/modules/home-manager/manage-fonts.nix b/modules/home-manager/manage-fonts.nix new file mode 100644 index 0000000..b95f05f --- /dev/null +++ b/modules/home-manager/manage-fonts.nix @@ -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 ]; + }; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 238f0cd..7ef6c88 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -2,4 +2,5 @@ { # example = import ./example.nix; + grub-theming = import ./grub-theming.nix; } diff --git a/modules/nixos/grub-theming.nix b/modules/nixos/grub-theming.nix new file mode 100644 index 0000000..6a434ea --- /dev/null +++ b/modules/nixos/grub-theming.nix @@ -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 + ''; + }; +}