inital commit of my moddified zaney os flake

This commit is contained in:
installer 2024-08-20 12:58:53 -04:00
commit 7df5fa6a97
93 changed files with 15664 additions and 0 deletions

45
CHANGELOG.md Normal file
View File

@ -0,0 +1,45 @@
## 🗒️ Changelog
**ZaneyOS 2.0**
With this new update of ZaneyOS it is a big rewrite of how things are being done. This update fixes many issues that you guys were facing. As well as makes things a little easier to understand. You now have a lot being stored inside the specific host directory, making use of modules, condensing seperate files down, etc.
My hope is that with this update your ability to grasp the flake and expand it to what you need is much improved. I want to thank everyone for being so supportive!
- Most configuration put into specific hosts directories for the best portability.
- Using modules to condense configuration complexity.
- Simplified options and the complexity around understanding their implementation.
- Rewrote the documentation for improved readability.
**ZaneyOS 2.1**
Simple bug fixes.
- Fixed Waybar icons to make them look a bit better.
- Centered the Wofi window always.
- Should have fixed some Steam issues, but I have had some crashes due to Steam so be aware of that.
- The flake got an update, so all the packages are fresh.
**ZaneyOS 2.2**
This release has a big theming change as well as including the move back to rofi. It is a massive improvement in many ways.
- Revert the switch from rofi to wofi. Rofi is just better.
- Switch from Nix Colors to Stylix. It can build colorschemes from a wallpaper.
- Simplified the notification center.
- Improved emoji selection menu and options.
- Adding fine-cmdline plugin for Neovim.
- Removed theme changing scripts as the theme is generated by the image set with stylix.image in the config.nix file.
- Starship is now setup in the config.nix file.
- Switched from SDDM to tuigreet and greetd.
- Added Plymouth for better looking booting.
- Improve the fonts being installed and properly separate them from regular packages.
- Separated Neovim configuration for readability.
- Updated flake and added fix for popups going to wrkspc 1 in Hyprland.
- Removed a few of the packages that aren't necessary and smartd by default.
- Removed unnecessary Hyprland input in flake as home manager doesn't use it.
- Turned off nfs by default
- Hyprland plugins are now disabled in the config by default.
- Fastfetch is now replacing neofetch.
- Btop is back baby!
- Switching to Brave as the default to protect user privacy.
- Replaced lsd with eza for a better looking experience.

32
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,32 @@
# Contributing Guidelines
👋 Hello there! We're thrilled that you're considering contributing to our project. Before you start, please take a moment to read our guidelines.
## Table of Contents
- [How Can I Contribute?](#how-can-i-contribute)
- [Reporting Bugs](#reporting-bugs)
- [Suggesting Enhancements](#suggesting-enhancements)
- [Code Contribution](#code-contribution)
## Code of Conduct
None. Don't be a turd and we'll be just fine 'round here. 🤠
## How Can I Contribute?
### Reporting Bugs
Found a bug? Please ensure the bug was not already reported by searching our [issues](../../issues). If not, open a new issue and fill out the template provided.
### Suggesting Enhancements
Have an idea for an enhancement? We'd love to hear it! Open an issue and include [Feature Request].
### Code Contribution
1. Fork the repository.
2. Create a new branch for your feature/fix: `git checkout -b feature-branch`
3. Make your changes and commit: `git commit -m 'Add new feature'`
4. Push to your fork: `git push origin feature-branch`
5. Open a pull request with a clear title and description.

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Tyler Kelley
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

106
README.md Normal file
View File

@ -0,0 +1,106 @@
<div align="center">
## ZaneyOS 🟰 Best ❄️ NixOS Configs
ZaneyOS is a simple way of reproducing my configuration on any NixOS system. This includes the wallpaper, scripts, applications, config files, and more.
<img align="center" width="80%" src="https://gitlab.com/Zaney/zaneyos/-/raw/main/config/demo.png" />
**Inspiration for the Waybar config [here](https://github.com/justinlime/dotfiles).**
</div>
> **This project has a [Wiki](https://zaney.org/zaneyos-2.2/). Find out how to use ZaneyOS here!**
> **I have put a lot of effort into the [documentation](https://zaney.org/zaneyos-2.2/) so it should be accurate. However, please if you notice that something is wrong with it create an issue or reach out to me on Discord.**
#### 🍖 Requirements
- You must be running on NixOS.
- The zaneyos folder (this repo) is expected to be in your home directory.
- Must have installed using GPT & UEFI. Systemd-boot is what is supported, for GRUB you will have to brave the internet for a how-to. ☺️
- Manually editing your host specific files. The host is the specific computer your installing on.
#### 🎹 Pipewire, Spotify, & Notification Menu Controls
- We are using the latest and greatest audio solution for Linux. If you like listening to music Spotify comes pre-installed out of the box. Not to mention you will have media and volume controls in the notification center available in the top bar.
#### 🏇 Optimized Workflow, tmpfs For Speed, & Simple Yet Elegant Neovim
- Using scratchpads with Hyprland for increased functionality and effeciency.
- A tmpfs for the /tmp directory is created improving rebuild time and reducing strain on hdd/ssd.
- No massive Neovim project here. This is my simple, easy to understand, yet incredible Neovim setup. You can grep recursively through entire folders and find specific files without ever leaving the text editor!
#### 🖥️ Multi Host & User Configuration
- You can now define separate settings for different host machines and users!
- Easily specify extra packages for your users in the users.nix file.
- Easy to understand file structure and simple, but encompassing, configuratiion.
#### 👼 An Incredible Community Focused On Support
- The entire idea of ZaneyOS is to make NixOS an approachable space that is actually a great community that you want to be in.
- Many people who are patient and happy to spend their free time helping you are running ZaneyOS. Feel free to reach out on the Discord for any help with anything.
<div align="center">
Please do yourself a favor and [read the wiki](https://zaney.org/zaneyos-2.2/).
</div>
#### 📦 How To Install Packages?
- You can search the [Nix Packages](https://search.nixos.org/packages?) & [Options](https://search.nixos.org/options?) pages for what a package may be named or if it has options available that take care of configuration hurdles you may face.
- To add a package there are the sections for it in config.nix and users.nix in your host folder. One is for programs available system wide and the other for your users environment only.
#### 🙋 Having Issues / Questions?
- Please feel free to raise an issue on the repo, please label a feature request with the title beginning with [feature request], thank you!
- Contact me on [Discord](https://discord.gg/2cRdBs8) as well, for a potentially faster response.
### ⬇️ Install
#### 📜 Script:
This is the easiest and recommended way of starting out. The script is not meant to allow you to change every option that you can in the flake or help you install extra packages. It is simply here so you can get my configuration installed with as little chances of breakages and then fiddle to your hearts content!
Simply copy this and run it:
```
nix-shell -p git curl
sh <(curl -L https://gitlab.com/Zaney/zaneyos/-/raw/main/install-zaneyos.sh)
```
#### 🦽 Manual:
Run this command to ensure Git & Vim are installed:
```
nix-shell -p git vim
```
Clone this repo & enter it:
```
git clone https://gitlab.com/zaney/zaneyos.git
cd zaneyos
```
- *You should stay in this folder for the rest of the install*
Create the host folder for your machine(s)
```
cp -r hosts/default hosts/<your-desired-hostname>
```
**🪧🪧🪧 Edit options.nix 🪧🪧🪧**
Generate your hardware.nix like so:
```
nixos-generate-config --show-hardware-config > hosts/<your-desired-hostname>/hardware.nix
```
Run this to enable flakes and install the flake replacing hostname with whatever you put as the hostname:
```
NIX_CONFIG="experimental-features = nix-command flakes"
sudo nixos-rebuild switch --flake .#hostname
```
Now when you want to rebuild the configuration you have access to an alias called flake-rebuild that will rebuild the flake!
Hope you enjoy!

BIN
config/demo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 KiB

1855
config/emoji.nix Normal file

File diff suppressed because it is too large Load Diff

BIN
config/face.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@ -0,0 +1,113 @@
{
programs.fastfetch = {
enable = true;
settings = {
display = {
color = {
keys = "35";
output = "90";
};
};
logo = {
source = ./nixos.png;
type = "kitty-direct";
height = 15;
width = 30;
padding = {
top = 3;
left = 3;
};
};
modules = [
"break"
{
type = "custom";
format = "Hardware";
}
{
type = "cpu";
key = " ";
}
{
type = "gpu";
key = " 󰍛 ";
}
{
type = "memory";
key = " 󰑭 ";
}
{
type = "custom";
format = "";
}
"break"
{
type = "custom";
format = "Software";
}
{
type = "custom";
format = " OS -> ZaneyOS 2.2";
}
{
type = "kernel";
key = " ";
}
{
type = "packages";
key = " 󰏖 ";
}
{
type = "shell";
key = " ";
}
"break"
{
type = "wm";
key = " WM";
}
{
type = "wmtheme";
key = " 󰉼 ";
}
{
type = "terminal";
key = " ";
}
{
type = "custom";
format = "";
}
"break"
{
type = "custom";
format = "Uptime / Age";
}
{
type = "command";
key = " ";
text = #bash
''
birth_install=$(stat -c %W /)
current=$(date +%s)
delta=$((current - birth_install))
delta_days=$((delta / 86400))
echo $delta_days days
'';
}
{
type = "uptime";
key = " ";
}
{
type = "custom";
format = "";
}
"break"
];
};
};
}

BIN
config/fastfetch/nixos.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

208
config/hyprland.nix Normal file
View File

@ -0,0 +1,208 @@
{
lib,
username,
host,
config,
...
}:
let
inherit (import ../hosts/${host}/variables.nix)
browser
terminal
extraMonitorSettings
keyboardLayout
;
in
with lib;
{
wayland.windowManager.hyprland = {
enable = true;
xwayland.enable = true;
systemd.enable = true;
extraConfig =
let
modifier = "SUPER";
in
concatStrings [
''
env = NIXOS_OZONE_WL, 1
env = NIXPKGS_ALLOW_UNFREE, 1
env = XDG_CURRENT_DESKTOP, Hyprland
env = XDG_SESSION_TYPE, wayland
env = XDG_SESSION_DESKTOP, Hyprland
env = GDK_BACKEND, wayland, x11
env = CLUTTER_BACKEND, wayland
env = QT_QPA_PLATFORM=wayland;xcb
env = QT_WAYLAND_DISABLE_WINDOWDECORATION, 1
env = QT_AUTO_SCREEN_SCALE_FACTOR, 1
env = SDL_VIDEODRIVER, x11
env = MOZ_ENABLE_WAYLAND, 1
exec-once = dbus-update-activation-environment --systemd --all
exec-once = systemctl --user import-environment QT_QPA_PLATFORMTHEME WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once = killall -q swww;sleep .5 && swww init
exec-once = killall -q waybar;sleep .5 && waybar
exec-once = killall -q swaync;sleep .5 && swaync
exec-once = nm-applet --indicator
exec-once = lxqt-policykit-agent
exec-once = sleep 1.5 && swww img /home/${username}/Pictures/Wallpapers/beautifulmountainscape.jpg
monitor=,preferred,auto,1
${extraMonitorSettings}
general {
gaps_in = 6
gaps_out = 8
border_size = 2
layout = dwindle
resize_on_border = true
col.active_border = rgb(${config.stylix.base16Scheme.base08}) rgb(${config.stylix.base16Scheme.base0C}) 45deg
col.inactive_border = rgb(${config.stylix.base16Scheme.base01})
}
input {
kb_layout = ${keyboardLayout}
kb_options = grp:alt_shift_toggle
kb_options = caps:super
follow_mouse = 1
touchpad {
natural_scroll = true
disable_while_typing = true
scroll_factor = 0.8
}
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
accel_profile = flat
}
windowrule = noborder,^(wofi)$
windowrule = center,^(wofi)$
windowrule = center,^(steam)$
windowrule = float, nm-connection-editor|blueman-manager
windowrule = float, swayimg|vlc|Viewnior|pavucontrol
windowrule = float, nwg-look|qt5ct|mpv
windowrule = float, zoom
windowrulev2 = stayfocused, title:^()$,class:^(steam)$
windowrulev2 = minsize 1 1, title:^()$,class:^(steam)$
windowrulev2 = opacity 0.9 0.7, class:^(Brave)$
windowrulev2 = opacity 0.9 0.7, class:^(thunar)$
gestures {
workspace_swipe = true
workspace_swipe_fingers = 3
}
misc {
initial_workspace_tracking = 0
mouse_move_enables_dpms = true
key_press_enables_dpms = false
}
animations {
enabled = yes
bezier = wind, 0.05, 0.9, 0.1, 1.05
bezier = winIn, 0.1, 1.1, 0.1, 1.1
bezier = winOut, 0.3, -0.3, 0, 1
bezier = liner, 1, 1, 1, 1
animation = windows, 1, 6, wind, slide
animation = windowsIn, 1, 6, winIn, slide
animation = windowsOut, 1, 5, winOut, slide
animation = windowsMove, 1, 5, wind, slide
animation = border, 1, 1, liner
animation = fade, 1, 10, default
animation = workspaces, 1, 5, wind
}
decoration {
rounding = 10
drop_shadow = true
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
blur {
enabled = true
size = 5
passes = 3
new_optimizations = on
ignore_opacity = off
}
}
plugin {
hyprtrails {
}
}
dwindle {
pseudotile = true
preserve_split = true
}
bind = ${modifier},Return,exec,${terminal}
bind = ${modifier}SHIFT,Return,exec,rofi-launcher
bind = ${modifier}SHIFT,W,exec,web-search
bind = ${modifier}ALT,W,exec,wallsetter
bind = ${modifier}SHIFT,N,exec,swaync-client -rs
bind = ${modifier},W,exec,${browser}
bind = ${modifier},E,exec,emopicker9000
bind = ${modifier},S,exec,screenshootin
bind = ${modifier},D,exec,discord
bind = ${modifier},O,exec,obs
bind = ${modifier},C,exec,hyprpicker -a
bind = ${modifier},G,exec,gimp
bind = ${modifier}SHIFT,G,exec,godot4
bind = ${modifier},T,exec,thunar
bind = ${modifier},M,exec,spotify
bind = ${modifier},Q,killactive,
bind = ${modifier},P,pseudo,
bind = ${modifier}SHIFT,I,togglesplit,
bind = ${modifier},F,fullscreen,
bind = ${modifier}SHIFT,F,togglefloating,
bind = ${modifier}SHIFT,C,exit,
bind = ${modifier}SHIFT,left,movewindow,l
bind = ${modifier}SHIFT,right,movewindow,r
bind = ${modifier}SHIFT,up,movewindow,u
bind = ${modifier}SHIFT,down,movewindow,d
bind = ${modifier}SHIFT,h,movewindow,l
bind = ${modifier}SHIFT,l,movewindow,r
bind = ${modifier}SHIFT,k,movewindow,u
bind = ${modifier}SHIFT,j,movewindow,d
bind = ${modifier},left,movefocus,l
bind = ${modifier},right,movefocus,r
bind = ${modifier},up,movefocus,u
bind = ${modifier},down,movefocus,d
bind = ${modifier},h,movefocus,l
bind = ${modifier},l,movefocus,r
bind = ${modifier},k,movefocus,u
bind = ${modifier},j,movefocus,d
bind = ${modifier},1,workspace,1
bind = ${modifier},2,workspace,2
bind = ${modifier},3,workspace,3
bind = ${modifier},4,workspace,4
bind = ${modifier},5,workspace,5
bind = ${modifier},6,workspace,6
bind = ${modifier},7,workspace,7
bind = ${modifier},8,workspace,8
bind = ${modifier},9,workspace,9
bind = ${modifier},0,workspace,10
bind = ${modifier}SHIFT,SPACE,movetoworkspace,special
bind = ${modifier},SPACE,togglespecialworkspace
bind = ${modifier}SHIFT,1,movetoworkspace,1
bind = ${modifier}SHIFT,2,movetoworkspace,2
bind = ${modifier}SHIFT,3,movetoworkspace,3
bind = ${modifier}SHIFT,4,movetoworkspace,4
bind = ${modifier}SHIFT,5,movetoworkspace,5
bind = ${modifier}SHIFT,6,movetoworkspace,6
bind = ${modifier}SHIFT,7,movetoworkspace,7
bind = ${modifier}SHIFT,8,movetoworkspace,8
bind = ${modifier}SHIFT,9,movetoworkspace,9
bind = ${modifier}SHIFT,0,movetoworkspace,10
bind = ${modifier}CONTROL,right,workspace,e+1
bind = ${modifier}CONTROL,left,workspace,e-1
bind = ${modifier},mouse_down,workspace, e+1
bind = ${modifier},mouse_up,workspace, e-1
bindm = ${modifier},mouse:272,movewindow
bindm = ${modifier},mouse:273,resizewindow
bind = ALT,Tab,cyclenext
bind = ALT,Tab,bringactivetotop
bind = ,XF86AudioRaiseVolume,exec,wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
bind = ,XF86AudioLowerVolume,exec,wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
binde = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bind = ,XF86AudioPlay, exec, playerctl play-pause
bind = ,XF86AudioPause, exec, playerctl play-pause
bind = ,XF86AudioNext, exec, playerctl next
bind = ,XF86AudioPrev, exec, playerctl previous
bind = ,XF86MonBrightnessDown,exec,brightnessctl set 5%-
bind = ,XF86MonBrightnessUp,exec,brightnessctl set +5%
''
];
};
}

88
config/neovim.nix Normal file
View File

@ -0,0 +1,88 @@
{ pkgs, inputs, ... }:
let
finecmdline = pkgs.vimUtils.buildVimPlugin {
name = "fine-cmdline";
src = inputs.fine-cmdline;
};
in
{
programs = {
neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
withNodeJs = true;
extraPackages = with pkgs; [
lua-language-server
gopls
xclip
wl-clipboard
luajitPackages.lua-lsp
nil
rust-analyzer
#nodePackages.bash-language-server
yaml-language-server
pyright
marksman
];
plugins = with pkgs.vimPlugins; [
alpha-nvim
auto-session
bufferline-nvim
dressing-nvim
indent-blankline-nvim
nui-nvim
finecmdline
nvim-treesitter.withAllGrammars
lualine-nvim
nvim-autopairs
nvim-web-devicons
nvim-cmp
nvim-surround
nvim-lspconfig
cmp-nvim-lsp
cmp-buffer
luasnip
cmp_luasnip
friendly-snippets
lspkind-nvim
comment-nvim
nvim-ts-context-commentstring
plenary-nvim
neodev-nvim
luasnip
telescope-nvim
todo-comments-nvim
nvim-tree-lua
telescope-fzf-native-nvim
vim-tmux-navigator
];
extraConfig = ''
set noemoji
nnoremap : <cmd>FineCmdline<CR>
'';
extraLuaConfig = ''
${builtins.readFile ./nvim/options.lua}
${builtins.readFile ./nvim/keymaps.lua}
${builtins.readFile ./nvim/plugins/alpha.lua}
${builtins.readFile ./nvim/plugins/autopairs.lua}
${builtins.readFile ./nvim/plugins/auto-session.lua}
${builtins.readFile ./nvim/plugins/comment.lua}
${builtins.readFile ./nvim/plugins/cmp.lua}
${builtins.readFile ./nvim/plugins/lsp.lua}
${builtins.readFile ./nvim/plugins/nvim-tree.lua}
${builtins.readFile ./nvim/plugins/telescope.lua}
${builtins.readFile ./nvim/plugins/todo-comments.lua}
${builtins.readFile ./nvim/plugins/treesitter.lua}
${builtins.readFile ./nvim/plugins/fine-cmdline.lua}
require("ibl").setup()
require("bufferline").setup{}
require("lualine").setup({
icons_enabled = true,
})
'';
};
};
}

15
config/nvim/keymaps.lua Normal file
View File

@ -0,0 +1,15 @@
local keymap = vim.keymap
-- use jk to exit insert mode
keymap.set("i", "jk", "<ESC>", { desc = "Exit insert mode with jk" })
-- clear search highlights
keymap.set("n", "<leader>nh", ":nohl<CR>", { desc = "Clear search highlights" })
-- window management
keymap.set("n", "<leader>sv", "<C-w>v", { desc = "Split window vertically" }) -- split window vertically
keymap.set("n", "<leader>sh", "<C-w>s", { desc = "Split window horizontally" }) -- split window horizontally
keymap.set("n", "<leader>se", "<C-w>=", { desc = "Make splits equal size" }) -- make split windows equal width & height
keymap.set("n", "<leader>sx", "<cmd>close<CR>", { desc = "Close current split" }) -- close current split window
keymap.set("n", "<leader>to", "<cmd>tabnew<CR>", { desc = "Open new tab" }) -- open new tab
keymap.set("n", "<leader>tx", "<cmd>tabclose<CR>", { desc = "Close current tab" }) -- close current tab
keymap.set("n", "<leader>tn", "<cmd>tabn<CR>", { desc = "Go to next tab" }) -- go to next tab
keymap.set("n", "<leader>tp", "<cmd>tabp<CR>", { desc = "Go to previous tab" }) -- go to previous tab
keymap.set("n", "<leader>tf", "<cmd>tabnew %<CR>", { desc = "Open current buffer in new tab" }) -- move current buffer to new tab

21
config/nvim/options.lua Normal file
View File

@ -0,0 +1,21 @@
local opt = vim.opt
opt.number = true
opt.relativenumber = true
opt.tabstop = 2
opt.shiftwidth = 2
opt.expandtab = true
opt.autoindent = true
opt.wrap = false
opt.ignorecase = true
opt.smartcase = true
opt.termguicolors = true
opt.background = "dark"
opt.signcolumn = "yes"
opt.mouse = "a"
opt.cursorline = true
opt.backspace = "indent,eol,start"
opt.clipboard:append("unnamedplus")
opt.splitright = true
opt.splitbelow = true
opt.swapfile = false
vim.g.mapleader = " "

View File

@ -0,0 +1,30 @@
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
-- Set header
dashboard.section.header.val = {
" ",
" ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ",
" ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ",
" ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ",
" ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ",
" ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ",
" ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ",
" ",
}
-- Set menu
dashboard.section.buttons.val = {
dashboard.button("e", " > New File", "<cmd>ene<CR>"),
dashboard.button("SPC fe", " > Toggle file explorer", "<cmd>NvimTreeToggle<CR>"),
dashboard.button("SPC ff", "󰱼 > Find File", "<cmd>Telescope find_files<CR>"),
dashboard.button("SPC lg", " > Find Word", "<cmd>Telescope live_grep<CR>"),
dashboard.button("SPC wr", "󰁯 > Restore Session For Current Directory", "<cmd>SessionRestore<CR>"),
dashboard.button("q", " > Quit NVIM", "<cmd>qa<CR>"),
}
-- Send config to alpha
alpha.setup(dashboard.opts)
-- Disable folding on alpha buffer
vim.cmd([[autocmd FileType alpha setlocal nofoldenable]])

View File

@ -0,0 +1,11 @@
local auto_session = require("auto-session")
auto_session.setup({
auto_restore_enabled = false,
auto_session_suppress_dirs = { "~/", "~/Dev/", "~/Downloads", "~/Documents", "~/Desktop/" },
})
local keymap = vim.keymap
keymap.set("n", "<leader>wr", "<cmd>SessionRestore<CR>", { desc = "Restore session for cwd" }) -- restore last workspace session for current directory
keymap.set("n", "<leader>ws", "<cmd>SessionSave<CR>", { desc = "Save session for auto session root dir" }) -- save workspace session for current working directory

View File

@ -0,0 +1,20 @@
local autopairs = require("nvim-autopairs")
-- configure autopairs
autopairs.setup({
check_ts = true, -- enable treesitter
ts_config = {
lua = { "string" }, -- don't add pairs in lua string treesitter nodes
javascript = { "template_string" }, -- don't add pairs in javscript template_string treesitter nodes
java = false, -- don't check treesitter on java
},
})
-- import nvim-autopairs completion functionality
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
-- import nvim-cmp plugin (completions plugin)
local cmp = require("cmp")
-- make autopairs and completion work together
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())

View File

@ -0,0 +1,41 @@
local cmp = require("cmp")
local luasnip = require("luasnip")
local lspkind = require("lspkind")
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup({
completion = {
completeopt = "menu,menuone,preview,noselect",
},
snippet = { -- configure how nvim-cmp interacts with snippet engine
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
["<C-e>"] = cmp.mapping.abort(), -- close completion window
["<CR>"] = cmp.mapping.confirm({ select = false }),
}),
-- sources for autocompletion
sources = cmp.config.sources({
{ name = "nvim_lsp" }, -- language servers
{ name = "luasnip" }, -- snippets
{ name = "buffer" }, -- text within current buffer
{ name = "path" }, -- file system paths
}),
-- configure lspkind for vs-code like pictograms in completion menu
formatting = {
format = lspkind.cmp_format({
maxwidth = 50,
ellipsis_char = "...",
}),
},
})

View File

@ -0,0 +1,9 @@
local comment = require("Comment")
local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim")
-- enable comment
comment.setup({
-- for commenting tsx, jsx, svelte, html files
pre_hook = ts_context_commentstring.create_pre_hook(),
})

View File

@ -0,0 +1,33 @@
require('fine-cmdline').setup({
cmdline = {
enable_keymaps = true,
smart_history = true,
prompt = '> '
},
popup = {
position = {
row = '10%',
col = '50%',
},
size = {
width = '60%',
},
border = {
style = 'rounded',
},
win_options = {
winhighlight = 'Normal:Normal,FloatBorder:FloatBorder',
},
},
hooks = {
before_mount = function(input)
-- code
end,
after_mount = function(input)
-- code
end,
set_keymaps = function(imap, feedkeys)
-- code
end
}
})

View File

@ -0,0 +1,8 @@
local lspconfig = require("lspconfig")
require'lspconfig'.pyright.setup{}
require'lspconfig'.nil_ls.setup{}
require'lspconfig'.marksman.setup{}
require'lspconfig'.rust_analyzer.setup{}
require'lspconfig'.yamlls.setup{}
require'lspconfig'.bashls.setup{}

View File

@ -0,0 +1,47 @@
local nvimtree = require("nvim-tree")
-- recommended settings from nvim-tree documentation
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
nvimtree.setup({
view = {
width = 35,
relativenumber = true,
},
-- change folder arrow icons
renderer = {
indent_markers = {
enable = true,
},
icons = {
glyphs = {
folder = {
arrow_closed = "", -- arrow when folder is closed
arrow_open = "", -- arrow when folder is open
},
},
},
},
-- disable window_picker for
-- explorer to work well with
-- window splits
actions = {
open_file = {
window_picker = {
enable = false,
},
},
},
filters = {
custom = { ".DS_Store" },
},
git = {
ignore = false,
},
})
-- set keymaps
local keymap = vim.keymap -- for conciseness
keymap.set("n", "<leader>fe", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle file explorer" }) -- toggle file explorer

View File

@ -0,0 +1,20 @@
require('telescope').setup({
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
}
}
})
require('telescope').load_extension('fzf')
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>lg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
vim.keymap.set("n", "<leader>ft", "<cmd>TodoTelescope<cr>", { desc = "Find todos" })

View File

@ -0,0 +1,14 @@
local todo_comments = require("todo-comments")
-- set keymaps
local keymap = vim.keymap -- for conciseness
keymap.set("n", "]t", function()
todo_comments.jump_next()
end, { desc = "Next todo comment" })
keymap.set("n", "[t", function()
todo_comments.jump_prev()
end, { desc = "Previous todo comment" })
todo_comments.setup()

View File

@ -0,0 +1,9 @@
require('nvim-treesitter.configs').setup {
ensure_installed = {},
auto_install = false,
highlight = { enable = true },
indent = { enable = true },
}

View File

@ -0,0 +1,11 @@
{ ... }:
{
home.file.".config/rofi/config-emoji.rasi".text = ''
@import "~/.config/rofi/config-long.rasi"
entry {
width: 45%;
placeholder: "🔎 Search Emoji's 👀";
}
'';
}

View File

@ -0,0 +1,18 @@
{ ... }:
{
home.file.".config/rofi/config-long.rasi".text = ''
@import "~/.config/rofi/config.rasi"
window {
width: 50%;
}
entry {
placeholder: "🔎 Search ";
}
listview {
columns: 1;
lines: 8;
scrollbar: true;
}
'';
}

214
config/rofi/rofi.nix Normal file
View File

@ -0,0 +1,214 @@
{ pkgs, config, ... }:
{
programs = {
rofi = {
enable = true;
package = pkgs.rofi-wayland;
extraConfig = {
modi = "drun,filebrowser,run";
show-icons = true;
icon-theme = "Papirus";
location = 0;
font = "JetBrainsMono Nerd Font Mono 12";
drun-display-format = "{icon} {name}";
display-drun = " Apps";
display-run = " Run";
display-filebrowser = " File";
};
theme =
let
inherit (config.lib.formats.rasi) mkLiteral;
in
{
"*" = {
bg = mkLiteral "#${config.stylix.base16Scheme.base00}";
bg-alt = mkLiteral "#${config.stylix.base16Scheme.base09}";
foreground = mkLiteral "#${config.stylix.base16Scheme.base01}";
selected = mkLiteral "#${config.stylix.base16Scheme.base08}";
active = mkLiteral "#${config.stylix.base16Scheme.base0B}";
text-selected = mkLiteral "#${config.stylix.base16Scheme.base00}";
text-color = mkLiteral "#${config.stylix.base16Scheme.base05}";
border-color = mkLiteral "#${config.stylix.base16Scheme.base0F}";
urgent = mkLiteral "#${config.stylix.base16Scheme.base0E}";
};
"window" = {
width = mkLiteral "50%";
transparency = "real";
orientation = mkLiteral "vertical";
cursor = mkLiteral "default";
spacing = mkLiteral "0px";
border = mkLiteral "2px";
border-color = "@border-color";
border-radius = mkLiteral "20px";
background-color = mkLiteral "@bg";
};
"mainbox" = {
padding = mkLiteral "15px";
enabled = true;
orientation = mkLiteral "vertical";
children = map mkLiteral [
"inputbar"
"listbox"
];
background-color = mkLiteral "transparent";
};
"inputbar" = {
enabled = true;
padding = mkLiteral "10px 10px 200px 10px";
margin = mkLiteral "10px";
background-color = mkLiteral "transparent";
border-radius = "25px";
orientation = mkLiteral "horizontal";
children = map mkLiteral [
"entry"
"dummy"
"mode-switcher"
];
background-image = mkLiteral ''url("~/Pictures/Wallpapers/beautifulmountainscape.jpg", width)'';
};
"entry" = {
enabled = true;
expand = false;
width = mkLiteral "20%";
padding = mkLiteral "10px";
border-radius = mkLiteral "12px";
background-color = mkLiteral "@selected";
text-color = mkLiteral "@text-selected";
cursor = mkLiteral "text";
placeholder = "🖥 Search ";
placeholder-color = mkLiteral "inherit";
};
"listbox" = {
spacing = mkLiteral "10px";
padding = mkLiteral "10px";
background-color = mkLiteral "transparent";
orientation = mkLiteral "vertical";
children = map mkLiteral [
"message"
"listview"
];
};
"listview" = {
enabled = true;
columns = 2;
lines = 6;
cycle = true;
dynamic = true;
scrollbar = false;
layout = mkLiteral "vertical";
reverse = false;
fixed-height = false;
fixed-columns = true;
spacing = mkLiteral "10px";
background-color = mkLiteral "transparent";
border = mkLiteral "0px";
};
"dummy" = {
expand = true;
background-color = mkLiteral "transparent";
};
"mode-switcher" = {
enabled = true;
spacing = mkLiteral "10px";
background-color = mkLiteral "transparent";
};
"button" = {
width = mkLiteral "5%";
padding = mkLiteral "12px";
border-radius = mkLiteral "12px";
background-color = mkLiteral "@text-selected";
text-color = mkLiteral "@text-color";
cursor = mkLiteral "pointer";
};
"button selected" = {
background-color = mkLiteral "@selected";
text-color = mkLiteral "@text-selected";
};
"scrollbar" = {
width = mkLiteral "4px";
border = 0;
handle-color = mkLiteral "@border-color";
handle-width = mkLiteral "8px";
padding = 0;
};
"element" = {
enabled = true;
spacing = mkLiteral "10px";
padding = mkLiteral "10px";
border-radius = mkLiteral "12px";
background-color = mkLiteral "transparent";
cursor = mkLiteral "pointer";
};
"element normal.normal" = {
background-color = mkLiteral "inherit";
text-color = mkLiteral "inherit";
};
"element normal.urgent" = {
background-color = mkLiteral "@urgent";
text-color = mkLiteral "@foreground";
};
"element normal.active" = {
background-color = mkLiteral "@active";
text-color = mkLiteral "@foreground";
};
"element selected.normal" = {
background-color = mkLiteral "@selected";
text-color = mkLiteral "@text-selected";
};
"element selected.urgent" = {
background-color = mkLiteral "@urgent";
text-color = mkLiteral "@text-selected";
};
"element selected.active" = {
background-color = mkLiteral "@urgent";
text-color = mkLiteral "@text-selected";
};
"element alternate.normal" = {
background-color = mkLiteral "transparent";
text-color = mkLiteral "inherit";
};
"element alternate.urgent" = {
background-color = mkLiteral "transparent";
text-color = mkLiteral "inherit";
};
"element alternate.active" = {
background-color = mkLiteral "transparent";
text-color = mkLiteral "inherit";
};
"element-icon" = {
background-color = mkLiteral "transparent";
text-color = mkLiteral "inherit";
size = mkLiteral "36px";
cursor = mkLiteral "inherit";
};
"element-text" = {
background-color = mkLiteral "transparent";
font = "JetBrainsMono Nerd Font Mono 12";
text-color = mkLiteral "inherit";
cursor = mkLiteral "inherit";
vertical-align = mkLiteral "0.5";
horizontal-align = mkLiteral "0.0";
};
"message" = {
background-color = mkLiteral "transparent";
border = mkLiteral "0px";
};
"textbox" = {
padding = mkLiteral "12px";
border-radius = mkLiteral "10px";
background-color = mkLiteral "@bg-alt";
text-color = mkLiteral "@bg";
vertical-align = mkLiteral "0.5";
horizontal-align = mkLiteral "0.0";
};
"error-message" = {
padding = mkLiteral "12px";
border-radius = mkLiteral "20px";
background-color = mkLiteral "@bg-alt";
text-color = mkLiteral "@bg";
};
};
};
};
}

312
config/swaync.nix Normal file
View File

@ -0,0 +1,312 @@
{ config, ... }:
{
home.file.".config/swaync/config.json".text = ''
{
"$schema": "/etc/xdg/swaync/configSchema.json",
"positionX": "right",
"positionY": "top",
"control-center-margin-top": 10,
"control-center-margin-bottom": 10,
"control-center-margin-right": 10,
"control-center-margin-left": 10,
"notification-icon-size": 64,
"notification-body-image-height": 100,
"notification-body-image-width": 200,
"timeout": 10,
"timeout-low": 5,
"timeout-critical": 0,
"fit-to-screen": false,
"control-center-width": 500,
"control-center-height": 1025,
"notification-window-width": 500,
"keyboard-shortcuts": true,
"image-visibility": "when-available",
"transition-time": 200,
"hide-on-clear": false,
"hide-on-action": true,
"script-fail-notify": true,
"widgets": [
"title",
"mpris",
"volume",
"backlight",
"dnd",
"notifications"
],
"widget-config": {
"title": {
"text": "Notification Center",
"clear-all-button": true,
"button-text": "󰆴 Clear All"
},
"dnd": {
"text": "Do Not Disturb"
},
"label": {
"max-lines": 1,
"text": "Notification Center"
},
"mpris": {
"image-size": 96,
"image-radius": 7
},
"volume": {
"label": "󰕾"
},
"backlight": {
"label": "󰃟"
},
}
}
'';
home.file.".config/swaync/style.css".text = ''
* {
font-family: JetBrainsMono Nerd Font Mono;
font-weight: bold;
}
.control-center .notification-row:focus,
.control-center .notification-row:hover {
opacity: 0.9;
background: #${config.stylix.base16Scheme.base00}
}
.notification-row {
outline: none;
margin: 10px;
padding: 0;
}
.notification {
background: transparent;
padding: 0;
margin: 0px;
}
.notification-content {
background: #${config.stylix.base16Scheme.base00};
padding: 10px;
border-radius: 5px;
border: 2px solid #${config.stylix.base16Scheme.base0D};
margin: 0;
}
.notification-default-action {
margin: 0;
padding: 0;
border-radius: 5px;
}
.close-button {
background: #${config.stylix.base16Scheme.base08};
color: #${config.stylix.base16Scheme.base00};
text-shadow: none;
padding: 0;
border-radius: 5px;
margin-top: 5px;
margin-right: 5px;
}
.close-button:hover {
box-shadow: none;
background: #${config.stylix.base16Scheme.base0D};
transition: all .15s ease-in-out;
border: none
}
.notification-action {
border: 2px solid #${config.stylix.base16Scheme.base0D};
border-top: none;
border-radius: 5px;
}
.notification-default-action:hover,
.notification-action:hover {
color: #${config.stylix.base16Scheme.base0B};
background: #${config.stylix.base16Scheme.base0B}
}
.notification-default-action {
border-radius: 5px;
margin: 0px;
}
.notification-default-action:not(:only-child) {
border-bottom-left-radius: 7px;
border-bottom-right-radius: 7px
}
.notification-action:first-child {
border-bottom-left-radius: 10px;
background: #${config.stylix.base16Scheme.base00}
}
.notification-action:last-child {
border-bottom-right-radius: 10px;
background: #${config.stylix.base16Scheme.base00}
}
.inline-reply {
margin-top: 8px
}
.inline-reply-entry {
background: #${config.stylix.base16Scheme.base00};
color: #${config.stylix.base16Scheme.base05};
caret-color: #${config.stylix.base16Scheme.base05};
border: 1px solid #${config.stylix.base16Scheme.base09};
border-radius: 5px
}
.inline-reply-button {
margin-left: 4px;
background: #${config.stylix.base16Scheme.base00};
border: 1px solid #${config.stylix.base16Scheme.base09};
border-radius: 5px;
color: #${config.stylix.base16Scheme.base05}
}
.inline-reply-button:disabled {
background: initial;
color: #${config.stylix.base16Scheme.base03};
border: 1px solid transparent
}
.inline-reply-button:hover {
background: #${config.stylix.base16Scheme.base00}
}
.body-image {
margin-top: 6px;
background-color: #${config.stylix.base16Scheme.base05};
border-radius: 5px
}
.summary {
font-size: 16px;
font-weight: 700;
background: transparent;
color: rgba(158, 206, 106, 1);
text-shadow: none
}
.time {
font-size: 16px;
font-weight: 700;
background: transparent;
color: #${config.stylix.base16Scheme.base05};
text-shadow: none;
margin-right: 18px
}
.body {
font-size: 15px;
font-weight: 400;
background: transparent;
color: #${config.stylix.base16Scheme.base05};
text-shadow: none
}
.control-center {
background: #${config.stylix.base16Scheme.base00};
border: 2px solid #${config.stylix.base16Scheme.base0C};
border-radius: 5px;
}
.control-center-list {
background: transparent
}
.control-center-list-placeholder {
opacity: .5
}
.floating-notifications {
background: transparent
}
.blank-window {
background: alpha(black, 0)
}
.widget-title {
color: #${config.stylix.base16Scheme.base0B};
background: #${config.stylix.base16Scheme.base00};
padding: 5px 10px;
margin: 10px 10px 5px 10px;
font-size: 1.5rem;
border-radius: 5px;
}
.widget-title>button {
font-size: 1rem;
color: #${config.stylix.base16Scheme.base05};
text-shadow: none;
background: #${config.stylix.base16Scheme.base00};
box-shadow: none;
border-radius: 5px;
}
.widget-title>button:hover {
background: #${config.stylix.base16Scheme.base08};
color: #${config.stylix.base16Scheme.base00};
}
.widget-dnd {
background: #${config.stylix.base16Scheme.base00};
padding: 5px 10px;
margin: 10px 10px 5px 10px;
border-radius: 5px;
font-size: large;
color: #${config.stylix.base16Scheme.base0B};
}
.widget-dnd>switch {
border-radius: 5px;
/* border: 1px solid #${config.stylix.base16Scheme.base0B}; */
background: #${config.stylix.base16Scheme.base0B};
}
.widget-dnd>switch:checked {
background: #${config.stylix.base16Scheme.base08};
border: 1px solid #${config.stylix.base16Scheme.base08};
}
.widget-dnd>switch slider {
background: #${config.stylix.base16Scheme.base00};
border-radius: 5px
}
.widget-dnd>switch:checked slider {
background: #${config.stylix.base16Scheme.base00};
border-radius: 5px
}
.widget-label {
margin: 10px 10px 5px 10px;
}
.widget-label>label {
font-size: 1rem;
color: #${config.stylix.base16Scheme.base05};
}
.widget-mpris {
color: #${config.stylix.base16Scheme.base05};
padding: 5px 10px;
margin: 10px 10px 5px 10px;
border-radius: 5px;
}
.widget-mpris > box > button {
border-radius: 5px;
}
.widget-mpris-player {
padding: 5px 10px;
margin: 10px
}
.widget-mpris-title {
font-weight: 700;
font-size: 1.25rem
}
.widget-mpris-subtitle {
font-size: 1.1rem
}
.widget-menubar>box>.menu-button-bar>button {
border: none;
background: transparent
}
.topbar-buttons>button {
border: none;
background: transparent
}
.widget-volume {
background: #${config.stylix.base16Scheme.base01};
padding: 5px;
margin: 10px 10px 5px 10px;
border-radius: 5px;
font-size: x-large;
color: #${config.stylix.base16Scheme.base05};
}
.widget-volume>box>button {
background: #${config.stylix.base16Scheme.base0B};
border: none
}
.per-app-volume {
background-color: #${config.stylix.base16Scheme.base00};
padding: 4px 8px 8px;
margin: 0 8px 8px;
border-radius: 5px;
}
.widget-backlight {
background: #${config.stylix.base16Scheme.base01};
padding: 5px;
margin: 10px 10px 5px 10px;
border-radius: 5px;
font-size: x-large;
color: #${config.stylix.base16Scheme.base05}
}
'';
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

277
config/waybar.nix Normal file
View File

@ -0,0 +1,277 @@
{
pkgs,
lib,
host,
config,
...
}:
let
betterTransition = "all 0.3s cubic-bezier(.55,-0.68,.48,1.682)";
inherit (import ../hosts/${host}/variables.nix) clock24h;
in
with lib;
{
# Configure & Theme Waybar
programs.waybar = {
enable = true;
package = pkgs.waybar;
settings = [
{
layer = "top";
position = "top";
modules-center = [ "hyprland/workspaces" ];
modules-left = [
"custom/startmenu"
"hyprland/window"
"pulseaudio"
"cpu"
"memory"
"idle_inhibitor"
];
modules-right = [
"custom/hyprbindings"
"custom/notification"
"custom/exit"
"battery"
"tray"
"clock"
];
"hyprland/workspaces" = {
format = "{name}";
format-icons = {
default = " ";
active = " ";
urgent = " ";
};
on-scroll-up = "hyprctl dispatch workspace e+1";
on-scroll-down = "hyprctl dispatch workspace e-1";
};
"clock" = {
format = if clock24h == true then '' {:L%H:%M}'' else '' {:L%I:%M %p}'';
tooltip = true;
tooltip-format = "<big>{:%A, %d.%B %Y }</big>\n<tt><small>{calendar}</small></tt>";
};
"hyprland/window" = {
max-length = 22;
separate-outputs = false;
rewrite = {
"" = " 🙈 No Windows? ";
};
};
"memory" = {
interval = 5;
format = " {}%";
tooltip = true;
};
"cpu" = {
interval = 5;
format = " {usage:2}%";
tooltip = true;
};
"disk" = {
format = " {free}";
tooltip = true;
};
"network" = {
format-icons = [
"󰤯"
"󰤟"
"󰤢"
"󰤥"
"󰤨"
];
format-ethernet = " {bandwidthDownOctets}";
format-wifi = "{icon} {signalStrength}%";
format-disconnected = "󰤮";
tooltip = false;
};
"tray" = {
spacing = 12;
};
"pulseaudio" = {
format = "{icon} {volume}% {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = " {icon} {format_source}";
format-muted = " {format_source}";
format-source = " {volume}%";
format-source-muted = "";
format-icons = {
headphone = "";
hands-free = "";
headset = "";
phone = "";
portable = "";
car = "";
default = [
""
""
""
];
};
on-click = "sleep 0.1 && pavucontrol";
};
"custom/exit" = {
tooltip = false;
format = "";
on-click = "sleep 0.1 && wlogout";
};
"custom/startmenu" = {
tooltip = false;
format = "";
# exec = "rofi -show drun";
on-click = "sleep 0.1 && rofi-launcher";
};
"custom/hyprbindings" = {
tooltip = false;
format = "󱕴";
on-click = "sleep 0.1 && list-hypr-bindings";
};
"idle_inhibitor" = {
format = "{icon}";
format-icons = {
activated = "";
deactivated = "";
};
tooltip = "true";
};
"custom/notification" = {
tooltip = false;
format = "{icon} {}";
format-icons = {
notification = "<span foreground='red'><sup></sup></span>";
none = "";
dnd-notification = "<span foreground='red'><sup></sup></span>";
dnd-none = "";
inhibited-notification = "<span foreground='red'><sup></sup></span>";
inhibited-none = "";
dnd-inhibited-notification = "<span foreground='red'><sup></sup></span>";
dnd-inhibited-none = "";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "sleep 0.1 && task-waybar";
escape = true;
};
"battery" = {
states = {
warning = 30;
critical = 15;
};
format = "{icon} {capacity}%";
format-charging = "󰂄 {capacity}%";
format-plugged = "󱘖 {capacity}%";
format-icons = [
"󰁺"
"󰁻"
"󰁼"
"󰁽"
"󰁾"
"󰁿"
"󰂀"
"󰂁"
"󰂂"
"󰁹"
];
on-click = "";
tooltip = false;
};
}
];
style = concatStrings [
''
* {
font-family: JetBrainsMono Nerd Font Mono;
font-size: 16px;
border-radius: 0px;
border: none;
min-height: 0px;
}
window#waybar {
background: rgba(0,0,0,0);
}
#workspaces {
color: #${config.stylix.base16Scheme.base00};
background: #${config.stylix.base16Scheme.base01};
margin: 4px 4px;
padding: 5px 5px;
border-radius: 16px;
}
#workspaces button {
font-weight: bold;
padding: 0px 5px;
margin: 0px 3px;
border-radius: 16px;
color: #${config.stylix.base16Scheme.base00};
background: linear-gradient(45deg, #${config.stylix.base16Scheme.base08}, #${config.stylix.base16Scheme.base0D});
opacity: 0.5;
transition: ${betterTransition};
}
#workspaces button.active {
font-weight: bold;
padding: 0px 5px;
margin: 0px 3px;
border-radius: 16px;
color: #${config.stylix.base16Scheme.base00};
background: linear-gradient(45deg, #${config.stylix.base16Scheme.base08}, #${config.stylix.base16Scheme.base0D});
transition: ${betterTransition};
opacity: 1.0;
min-width: 40px;
}
#workspaces button:hover {
font-weight: bold;
border-radius: 16px;
color: #${config.stylix.base16Scheme.base00};
background: linear-gradient(45deg, #${config.stylix.base16Scheme.base08}, #${config.stylix.base16Scheme.base0D});
opacity: 0.8;
transition: ${betterTransition};
}
tooltip {
background: #${config.stylix.base16Scheme.base00};
border: 1px solid #${config.stylix.base16Scheme.base08};
border-radius: 12px;
}
tooltip label {
color: #${config.stylix.base16Scheme.base08};
}
#window, #pulseaudio, #cpu, #memory, #idle_inhibitor {
font-weight: bold;
margin: 4px 0px;
margin-left: 7px;
padding: 0px 18px;
background: #${config.stylix.base16Scheme.base04};
color: #${config.stylix.base16Scheme.base00};
border-radius: 24px 10px 24px 10px;
}
#custom-startmenu {
color: #${config.stylix.base16Scheme.base0B};
background: #${config.stylix.base16Scheme.base02};
font-size: 28px;
margin: 0px;
padding: 0px 30px 0px 15px;
border-radius: 0px 0px 40px 0px;
}
#custom-hyprbindings, #network, #battery,
#custom-notification, #tray, #custom-exit {
font-weight: bold;
background: #${config.stylix.base16Scheme.base0F};
color: #${config.stylix.base16Scheme.base00};
margin: 4px 0px;
margin-right: 7px;
border-radius: 10px 24px 10px 24px;
padding: 0px 18px;
}
#clock {
font-weight: bold;
color: #0D0E15;
background: linear-gradient(90deg, #${config.stylix.base16Scheme.base0E}, #${config.stylix.base16Scheme.base0C});
margin: 0px;
padding: 0px 15px 0px 30px;
border-radius: 0px 0px 0px 40px;
}
''
];
};
}

103
config/wlogout.nix Normal file
View File

@ -0,0 +1,103 @@
{ config, ... }:
{
programs.wlogout = {
enable = true;
layout = [
{
label = "shutdown";
action = "sleep 1; systemctl poweroff";
text = "Shutdown";
keybind = "s";
}
{
"label" = "reboot";
"action" = "sleep 1; systemctl reboot";
"text" = "Reboot";
"keybind" = "r";
}
{
"label" = "logout";
"action" = "sleep 1; hyprctl dispatch exit";
"text" = "Exit";
"keybind" = "e";
}
{
"label" = "suspend";
"action" = "sleep 1; systemctl suspend";
"text" = "Suspend";
"keybind" = "u";
}
{
"label" = "lock";
"action" = "sleep 1; hyprlock";
"text" = "Lock";
"keybind" = "l";
}
{
"label" = "hibernate";
"action" = "sleep 1; systemctl hibernate";
"text" = "Hibernate";
"keybind" = "h";
}
];
style = ''
* {
font-family: "JetBrainsMono NF", FontAwesome, sans-serif;
background-image: none;
transition: 20ms;
}
window {
background-color: rgba(12, 12, 12, 0.1);
}
button {
color: #${config.stylix.base16Scheme.base05};
font-size:20px;
background-repeat: no-repeat;
background-position: center;
background-size: 25%;
border-style: solid;
background-color: rgba(12, 12, 12, 0.3);
border: 3px solid #${config.stylix.base16Scheme.base05};
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
button:focus,
button:active,
button:hover {
color: #${config.stylix.base16Scheme.base0B};
background-color: rgba(12, 12, 12, 0.5);
border: 3px solid #${config.stylix.base16Scheme.base0B};
}
#logout {
margin: 10px;
border-radius: 20px;
background-image: image(url("icons/logout.png"));
}
#suspend {
margin: 10px;
border-radius: 20px;
background-image: image(url("icons/suspend.png"));
}
#shutdown {
margin: 10px;
border-radius: 20px;
background-image: image(url("icons/shutdown.png"));
}
#reboot {
margin: 10px;
border-radius: 20px;
background-image: image(url("icons/reboot.png"));
}
#lock {
margin: 10px;
border-radius: 20px;
background-image: image(url("icons/lock.png"));
}
#hibernate {
margin: 10px;
border-radius: 20px;
background-image: image(url("icons/hibernate.png"));
}
'';
};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
config/wlogout/lock.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
config/wlogout/logout.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
config/wlogout/reboot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
config/wlogout/shutdown.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
config/wlogout/suspend.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

295
flake.lock Normal file
View File

@ -0,0 +1,295 @@
{
"nodes": {
"base16": {
"inputs": {
"fromYaml": "fromYaml"
},
"locked": {
"lastModified": 1708890466,
"narHash": "sha256-LlrC09LoPi8OPYOGPXegD72v+//VapgAqhbOFS3i8sc=",
"owner": "SenchoPens",
"repo": "base16.nix",
"rev": "665b3c6748534eb766c777298721cece9453fdae",
"type": "github"
},
"original": {
"owner": "SenchoPens",
"repo": "base16.nix",
"type": "github"
}
},
"base16-fish": {
"flake": false,
"locked": {
"lastModified": 1622559957,
"narHash": "sha256-PebymhVYbL8trDVVXxCvZgc0S5VxI7I1Hv4RMSquTpA=",
"owner": "tomyun",
"repo": "base16-fish",
"rev": "2f6dd973a9075dabccd26f1cded09508180bf5fe",
"type": "github"
},
"original": {
"owner": "tomyun",
"repo": "base16-fish",
"type": "github"
}
},
"base16-foot": {
"flake": false,
"locked": {
"lastModified": 1696725948,
"narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=",
"owner": "tinted-theming",
"repo": "base16-foot",
"rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-foot",
"type": "github"
}
},
"base16-helix": {
"flake": false,
"locked": {
"lastModified": 1720809814,
"narHash": "sha256-numb3xigRGnr/deF7wdjBwVg7fpbTH7reFDkJ75AJkY=",
"owner": "tinted-theming",
"repo": "base16-helix",
"rev": "34f41987bec14c0f3f6b2155c19787b1f6489625",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-helix",
"type": "github"
}
},
"base16-kitty": {
"flake": false,
"locked": {
"lastModified": 1665001328,
"narHash": "sha256-aRaizTYPpuWEcvoYE9U+YRX+Wsc8+iG0guQJbvxEdJY=",
"owner": "kdrag0n",
"repo": "base16-kitty",
"rev": "06bb401fa9a0ffb84365905ffbb959ae5bf40805",
"type": "github"
},
"original": {
"owner": "kdrag0n",
"repo": "base16-kitty",
"type": "github"
}
},
"base16-tmux": {
"flake": false,
"locked": {
"lastModified": 1696725902,
"narHash": "sha256-wDPg5elZPcQpu7Df0lI5O8Jv4A3T6jUQIVg63KDU+3Q=",
"owner": "tinted-theming",
"repo": "base16-tmux",
"rev": "c02050bebb60dbb20cb433cd4d8ce668ecc11ba7",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-tmux",
"type": "github"
}
},
"base16-vim": {
"flake": false,
"locked": {
"lastModified": 1716150083,
"narHash": "sha256-ZMhnNmw34ogE5rJZrjRv5MtG3WaqKd60ds2VXvT6hEc=",
"owner": "tinted-theming",
"repo": "base16-vim",
"rev": "6e955d704d046b0dc3e5c2d68a2a6eeffd2b5d3d",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-vim",
"type": "github"
}
},
"fine-cmdline": {
"flake": false,
"locked": {
"lastModified": 1721082103,
"narHash": "sha256-SMmOzDhkRBBPCuXXZFUxog6YWRQ2tdlJuJGjYlyNTgk=",
"owner": "VonHeikemen",
"repo": "fine-cmdline.nvim",
"rev": "aec9efebf6f4606a5204d49ffa3ce2eeb7e08a3e",
"type": "github"
},
"original": {
"owner": "VonHeikemen",
"repo": "fine-cmdline.nvim",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"fromYaml": {
"flake": false,
"locked": {
"lastModified": 1689549921,
"narHash": "sha256-iX0pk/uB019TdBGlaJEWvBCfydT6sRq+eDcGPifVsCM=",
"owner": "SenchoPens",
"repo": "fromYaml",
"rev": "11fbbbfb32e3289d3c631e0134a23854e7865c84",
"type": "github"
},
"original": {
"owner": "SenchoPens",
"repo": "fromYaml",
"type": "github"
}
},
"gnome-shell": {
"flake": false,
"locked": {
"lastModified": 1713702291,
"narHash": "sha256-zYP1ehjtcV8fo+c+JFfkAqktZ384Y+y779fzmR9lQAU=",
"owner": "GNOME",
"repo": "gnome-shell",
"rev": "0d0aadf013f78a7f7f1dc984d0d812971864b934",
"type": "github"
},
"original": {
"owner": "GNOME",
"ref": "46.1",
"repo": "gnome-shell",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1723015306,
"narHash": "sha256-jQnFEtH20/OsDPpx71ntZzGdRlpXhUENSQCGTjn//NA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "b3d5ea65d88d67d4ec578ed11d4d2d51e3de525e",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"stylix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1715930644,
"narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1722813957,
"narHash": "sha256-IAoYyYnED7P8zrBFMnmp7ydaJfwTnwcnqxUElC1I26Y=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "cb9a96f23c491c081b38eab96d22fa958043c9fa",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1714912032,
"narHash": "sha256-clkcOIkg8G4xuJh+1onLG4HPMpbtzdLv4rHxFzgsH9c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ee4a6e0f566fe5ec79968c57a9c2c3c25f2cf41d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"fine-cmdline": "fine-cmdline",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"stylix": "stylix"
}
},
"stylix": {
"inputs": {
"base16": "base16",
"base16-fish": "base16-fish",
"base16-foot": "base16-foot",
"base16-helix": "base16-helix",
"base16-kitty": "base16-kitty",
"base16-tmux": "base16-tmux",
"base16-vim": "base16-vim",
"flake-compat": "flake-compat",
"gnome-shell": "gnome-shell",
"home-manager": "home-manager_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1722946882,
"narHash": "sha256-mxtnMye8gs82tdQbVC+g6v3aPOZlH150f9WyntHIkTg=",
"owner": "danth",
"repo": "stylix",
"rev": "5853f1a8bd072f2ebabfc3de3973084353cf6f1e",
"type": "github"
},
"original": {
"owner": "danth",
"repo": "stylix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

50
flake.nix Normal file
View File

@ -0,0 +1,50 @@
{
description = "ZaneyOS";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
stylix.url = "github:danth/stylix";
fine-cmdline = {
url = "github:VonHeikemen/fine-cmdline.nvim";
flake = false;
};
};
outputs =
{ nixpkgs, home-manager, ... }@inputs:
let
system = "aarch64-linux";
host = "nixbook";
username = "zaney";
in
{
nixosConfigurations = {
"${host}" = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit system;
inherit inputs;
inherit username;
inherit host;
};
modules = [
./hosts/${host}/config.nix
inputs.stylix.nixosModules.stylix
home-manager.nixosModules.home-manager
{
home-manager.extraSpecialArgs = {
inherit username;
inherit inputs;
inherit host;
};
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup";
home-manager.users.${username} = import ./hosts/${host}/home.nix;
}
];
};
};
};
}

484
hosts/default/config.nix Normal file
View File

@ -0,0 +1,484 @@
{
config,
pkgs,
host,
username,
options,
...
}:
let
inherit (import ./variables.nix) keyboardLayout;
in
{
imports = [
./hardware.nix
./users.nix
../../modules/amd-drivers.nix
../../modules/nvidia-drivers.nix
../../modules/nvidia-prime-drivers.nix
../../modules/intel-drivers.nix
../../modules/vm-guest-services.nix
../../modules/local-hardware-clock.nix
];
boot = {
# Kernel
kernelPackages = pkgs.linuxPackages_zen;
# This is for OBS Virtual Cam Support
kernelModules = [ "v4l2loopback" ];
extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ];
# Needed For Some Steam Games
kernel.sysctl = {
"vm.max_map_count" = 2147483642;
};
# Bootloader.
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
# Make /tmp a tmpfs
tmp = {
useTmpfs = false;
tmpfsSize = "30%";
};
# Appimage Support
binfmt.registrations.appimage = {
wrapInterpreterInShell = false;
interpreter = "${pkgs.appimage-run}/bin/appimage-run";
recognitionType = "magic";
offset = 0;
mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff'';
magicOrExtension = ''\x7fELF....AI\x02'';
};
plymouth.enable = true;
};
# Styling Options
stylix = {
enable = true;
image = ../../config/wallpapers/beautifulmountainscape.jpg;
# base16Scheme = {
# base00 = "232136";
# base01 = "2a273f";
# base02 = "393552";
# base03 = "6e6a86";
# base04 = "908caa";
# base05 = "e0def4";
# base06 = "e0def4";
# base07 = "56526e";
# base08 = "eb6f92";
# base09 = "f6c177";
# base0A = "ea9a97";
# base0B = "3e8fb0";
# base0C = "9ccfd8";
# base0D = "c4a7e7";
# base0E = "f6c177";
# base0F = "56526e";
# };
polarity = "dark";
opacity.terminal = 0.8;
cursor.package = pkgs.bibata-cursors;
cursor.name = "Bibata-Modern-Ice";
cursor.size = 24;
fonts = {
monospace = {
package = pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; };
name = "JetBrainsMono Nerd Font Mono";
};
sansSerif = {
package = pkgs.montserrat;
name = "Montserrat";
};
serif = {
package = pkgs.montserrat;
name = "Montserrat";
};
sizes = {
applications = 12;
terminal = 15;
desktop = 11;
popups = 12;
};
};
};
# Extra Module Options
drivers.amdgpu.enable = true;
drivers.nvidia.enable = false;
drivers.nvidia-prime = {
enable = false;
intelBusID = "";
nvidiaBusID = "";
};
drivers.intel.enable = false;
vm.guest-services.enable = false;
local.hardware-clock.enable = false;
# Enable networking
networking.networkmanager.enable = true;
networking.hostName = host;
networking.timeServers = options.networking.timeServers.default ++ [ "pool.ntp.org" ];
# Set your time zone.
time.timeZone = "America/New_York";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
programs = {
firefox.enable = false;
starship = {
enable = true;
settings = {
add_newline = false;
buf = {
symbol = " ";
};
c = {
symbol = " ";
};
directory = {
read_only = " 󰌾";
};
docker_context = {
symbol = " ";
};
fossil_branch = {
symbol = " ";
};
git_branch = {
symbol = " ";
};
golang = {
symbol = " ";
};
hg_branch = {
symbol = " ";
};
hostname = {
ssh_symbol = " ";
};
lua = {
symbol = " ";
};
memory_usage = {
symbol = "󰍛 ";
};
meson = {
symbol = "󰔷 ";
};
nim = {
symbol = "󰆥 ";
};
nix_shell = {
symbol = " ";
};
nodejs = {
symbol = " ";
};
ocaml = {
symbol = " ";
};
package = {
symbol = "󰏗 ";
};
python = {
symbol = " ";
};
rust = {
symbol = " ";
};
swift = {
symbol = " ";
};
zig = {
symbol = " ";
};
};
};
dconf.enable = true;
seahorse.enable = true;
fuse.userAllowOther = true;
mtr.enable = true;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
virt-manager.enable = true;
steam = {
enable = true;
gamescopeSession.enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
};
thunar = {
enable = true;
plugins = with pkgs.xfce; [
thunar-archive-plugin
thunar-volman
];
};
};
nixpkgs.config.allowUnfree = true;
users = {
mutableUsers = true;
};
environment.systemPackages = with pkgs; [
libreoffice
vim
wget
killall
eza
git
cmatrix
lolcat
htop
librewolf
libvirt
lxqt.lxqt-policykit
lm_sensors
unzip
unrar
libnotify
v4l-utils
ydotool
duf
ncdu
wl-clipboard
pciutils
ffmpeg
socat
cowsay
ripgrep
lshw
bat
pkg-config
meson
hyprpicker
ninja
brightnessctl
virt-viewer
swappy
appimage-run
networkmanagerapplet
yad
inxi
playerctl
nh
nixfmt-rfc-style
discord
libvirt
swww
grim
slurp
file-roller
swaynotificationcenter
imv
mpv
gimp
pavucontrol
tree
spotify
neovide
greetd.tuigreet
];
fonts = {
packages = with pkgs; [
noto-fonts-emoji
noto-fonts-cjk
font-awesome
symbola
material-icons
];
};
environment.variables = {
ZANEYOS_VERSION = "2.2";
ZANEYOS = "true";
};
# Extra Portal Configuration
xdg.portal = {
enable = true;
wlr.enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal
];
configPackages = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-hyprland
pkgs.xdg-desktop-portal
];
};
# Services to start
services = {
xserver = {
enable = false;
xkb = {
layout = "${keyboardLayout}";
variant = "colemak";
};
};
greetd = {
enable = true;
vt = 3;
settings = {
default_session = {
# Wayland Desktop Manager is installed only for user ryan via home-manager!
user = username;
# .wayland-session is a script generated by home-manager, which links to the current wayland compositor(sway/hyprland or others).
# with such a vendor-no-locking script, we can switch to another wayland compositor without modifying greetd's config here.
# command = "$HOME/.wayland-session"; # start a wayland session directly without a login manager
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland"; # start Hyprland with a TUI login manager
};
};
};
smartd = {
enable = false;
autodetect = true;
};
libinput.enable = true;
fstrim.enable = true;
gvfs.enable = true;
openssh.enable = true;
flatpak.enable = false;
printing = {
enable = true;
drivers = [
# pkgs.hplipWithPlugin
];
};
gnome.gnome-keyring.enable = true;
avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
ipp-usb.enable = true;
syncthing = {
enable = false;
user = "${username}";
dataDir = "/home/${username}";
configDir = "/home/${username}/.config/syncthing";
};
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
rpcbind.enable = false;
nfs.server.enable = false;
};
systemd.services.flatpak-repo = {
path = [ pkgs.flatpak ];
script = ''
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
'';
};
hardware.sane = {
enable = true;
extraBackends = [ pkgs.sane-airscan ];
disabledDefaultBackends = [ "escl" ];
};
# Extra Logitech Support
hardware.logitech.wireless.enable = false;
hardware.logitech.wireless.enableGraphical = false;
# Bluetooth Support
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
services.blueman.enable = true;
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
# Security / Polkit
security.rtkit.enable = true;
security.polkit.enable = true;
security.polkit.extraConfig = ''
polkit.addRule(function(action, subject) {
if (
subject.isInGroup("users")
&& (
action.id == "org.freedesktop.login1.reboot" ||
action.id == "org.freedesktop.login1.reboot-multiple-sessions" ||
action.id == "org.freedesktop.login1.power-off" ||
action.id == "org.freedesktop.login1.power-off-multiple-sessions"
)
)
{
return polkit.Result.YES;
}
})
'';
security.pam.services.swaylock = {
text = ''
auth include login
'';
};
# Optimization settings and garbage collection automation
nix = {
settings = {
auto-optimise-store = true;
experimental-features = [
"nix-command"
"flakes"
];
substituters = [ "https://hyprland.cachix.org" ];
trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ];
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
# Virtualization / Containers
virtualisation.libvirtd.enable = true;
virtualisation.podman = {
enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
# OpenGL
hardware.graphics = {
enable = true;
};
console.keyMap = "${keyboardLayout}";
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
}

View File

@ -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 = [ "xhci_pci" "ehci_pci" "ahci" "nvme" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/c537152e-ea4f-4bb7-b453-088612e0024a";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/DA7B-269C";
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.enp7s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

245
hosts/default/home.nix Normal file
View File

@ -0,0 +1,245 @@
{
pkgs,
username,
host,
...
}:
let
inherit (import ./variables.nix) gitUsername gitEmail;
in
{
# Home Manager Settings
home.username = "${username}";
home.homeDirectory = "/home/${username}";
home.stateVersion = "23.11";
# Import Program Configurations
imports = [
../../config/emoji.nix
../../config/fastfetch
../../config/hyprland.nix
../../config/neovim.nix
../../config/rofi/rofi.nix
../../config/rofi/config-emoji.nix
../../config/rofi/config-long.nix
../../config/swaync.nix
../../config/waybar.nix
../../config/wlogout.nix
../../config/fastfetch
];
# Place Files Inside Home Directory
home.file."Pictures/Wallpapers" = {
source = ../../config/wallpapers;
recursive = true;
};
home.file.".config/wlogout/icons" = {
source = ../../config/wlogout;
recursive = true;
};
home.file.".face.icon".source = ../../config/face.jpg;
home.file.".config/face.jpg".source = ../../config/face.jpg;
home.file.".config/swappy/config".text = ''
[Default]
save_dir=/home/${username}/Pictures/Screenshots
save_filename_format=swappy-%Y%m%d-%H%M%S.png
show_panel=false
line_size=5
text_size=20
text_font=Ubuntu
paint_mode=brush
early_exit=true
fill_shape=false
'';
# Install & Configure Git
programs.git = {
enable = true;
userName = "${gitUsername}";
userEmail = "${gitEmail}";
};
# Create XDG Dirs
xdg = {
userDirs = {
enable = true;
createDirectories = true;
};
};
dconf.settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = [ "qemu:///system" ];
uris = [ "qemu:///system" ];
};
};
# Styling Options
stylix.targets.waybar.enable = false;
stylix.targets.rofi.enable = false;
stylix.targets.hyprland.enable = false;
gtk = {
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
gtk3.extraConfig = {
gtk-application-prefer-dark-theme = 1;
};
gtk4.extraConfig = {
gtk-application-prefer-dark-theme = 1;
};
};
qt = {
enable = true;
style.name = "adwaita-dark";
platformTheme.name = "gtk3";
};
# Scripts
home.packages = [
(import ../../scripts/emopicker9000.nix { inherit pkgs; })
(import ../../scripts/task-waybar.nix { inherit pkgs; })
(import ../../scripts/squirtle.nix { inherit pkgs; })
(import ../../scripts/nvidia-offload.nix { inherit pkgs; })
(import ../../scripts/wallsetter.nix {
inherit pkgs;
inherit username;
})
(import ../../scripts/web-search.nix { inherit pkgs; })
(import ../../scripts/rofi-launcher.nix { inherit pkgs; })
(import ../../scripts/screenshootin.nix { inherit pkgs; })
(import ../../scripts/list-hypr-bindings.nix {
inherit pkgs;
inherit host;
})
];
services = {
hypridle = {
settings = {
general = {
after_sleep_cmd = "hyprctl dispatch dpms on";
ignore_dbus_inhibit = false;
lock_cmd = "hyprlock";
};
listener = [
{
timeout = 900;
on-timeout = "hyprlock";
}
{
timeout = 1200;
on-timeout = "hyprctl dispatch dpms off";
on-resume = "hyprctl dispatch dpms on";
}
];
};
};
};
programs = {
gh.enable = true;
btop = {
enable = true;
settings = {
vim_keys = true;
};
};
kitty = {
enable = true;
package = pkgs.kitty;
settings = {
scrollback_lines = 2000;
wheel_scroll_min_lines = 1;
window_padding_width = 4;
confirm_os_window_close = 0;
};
extraConfig = ''
tab_bar_style fade
tab_fade 1
active_tab_font_style bold
inactive_tab_font_style bold
'';
};
starship = {
enable = true;
package = pkgs.starship;
};
bash = {
enable = true;
enableCompletion = true;
profileExtra = ''
#if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" = 1 ]; then
# exec Hyprland
#fi
'';
initExtra = ''
fastfetch
if [ -f $HOME/.bashrc-personal ]; then
source $HOME/.bashrc-personal
fi
'';
shellAliases = {
sv = "sudo nvim";
fr = "nh os switch --hostname ${host} /home/${username}/zaneyos";
fu = "nh os switch --hostname ${host} --update /home/${username}/zaneyos";
zu = "sh <(curl -L https://gitlab.com/Zaney/zaneyos/-/raw/main/install-zaneyos.sh)";
ncg = "nix-collect-garbage --delete-old && sudo nix-collect-garbage -d && sudo /run/current-system/bin/switch-to-configuration boot";
v = "nvim";
cat = "bat";
ls = "eza --icons";
ll = "eza -lh --icons --grid --group-directories-first";
la = "eza -lah --icons --grid --group-directories-first";
".." = "cd ..";
};
};
home-manager.enable = true;
hyprlock = {
enable = true;
settings = {
general = {
disable_loading_bar = true;
grace = 10;
hide_cursor = true;
no_fade_in = false;
};
background = [
{
path = "/home/${username}/Pictures/Wallpapers/zaney-wallpaper.jpg";
blur_passes = 3;
blur_size = 8;
}
];
image = [
{
path = "/home/${username}/.config/face.jpg";
size = 150;
border_size = 4;
border_color = "rgb(0C96F9)";
rounding = -1; # Negative means circle
position = "0, 200";
halign = "center";
valign = "center";
}
];
input-field = [
{
size = "200, 50";
position = "0, -80";
monitor = "";
dots_center = true;
fade_on_empty = false;
font_color = "rgb(CFE6F4)";
inner_color = "rgb(657DC2)";
outer_color = "rgb(0D0E15)";
outline_thickness = 5;
placeholder_text = "Password...";
shadow_passes = 2;
}
];
};
};
};
}

38
hosts/default/users.nix Normal file
View File

@ -0,0 +1,38 @@
{
pkgs,
username,
...
}:
let
inherit (import ./variables.nix) gitUsername;
in
{
users.users = {
"${username}" = {
homeMode = "755";
isNormalUser = true;
description = "${gitUsername}";
extraGroups = [
"networkmanager"
"wheel"
"libvirtd"
"scanner"
"lp"
];
shell = pkgs.bash;
ignoreShellProgramCheck = true;
packages = with pkgs; [
];
};
# "newuser" = {
# homeMode = "755";
# isNormalUser = true;
# description = "New user account";
# extraGroups = [ "networkmanager" "wheel" "libvirtd" ];
# shell = pkgs.bash;
# ignoreShellProgramCheck = true;
# packages = with pkgs; [];
# };
};
}

View File

@ -0,0 +1,16 @@
{
# Git Configuration ( For Pulling Software Repos )
gitUsername = "batvin123";
gitEmail = "batvin123@protonmail.com";
# Hyprland Settings
extraMonitorSettings = "";
# Waybar Settings
clock24h = false;
# Program Options
browser = "librewolf"; # Set Default Browser (google-chrome-stable for google-chrome)
terminal = "kitty"; # Set Default System Terminal
keyboardLayout = "us";
}

481
hosts/nixbook/config.nix Normal file
View File

@ -0,0 +1,481 @@
{
config,
pkgs,
host,
username,
options,
lib,
...
}:
let
inherit (import ./variables.nix) keyboardLayout;
in
{
imports = [
./hardware.nix
./users.nix
../../modules/amd-drivers.nix
../../modules/apple-silicon-support
../../modules/nvidia-drivers.nix
../../modules/nvidia-prime-drivers.nix
../../modules/intel-drivers.nix
../../modules/vm-guest-services.nix
../../modules/local-hardware-clock.nix
];
boot = {
# Kernel
kernelPackages = lib.mkDefault pkgs.linuxPackages_zen;
# This is for OBS Virtual Cam Support
kernelModules = [ "v4l2loopback" ];
extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ];
# Needed For Some Steam Games
kernel.sysctl = {
"vm.max_map_count" = 2147483642;
};
# Bootloader.
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
# Make /tmp a tmpfs
tmp = {
useTmpfs = false;
tmpfsSize = "30%";
};
# Appimage Support
binfmt.registrations.appimage = {
wrapInterpreterInShell = false;
interpreter = "${pkgs.appimage-run}/bin/appimage-run";
recognitionType = "magic";
offset = 0;
mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff'';
magicOrExtension = ''\x7fELF....AI\x02'';
};
plymouth.enable = true;
};
# Styling Options
stylix = {
enable = true;
image = ../../config/wallpapers/beautifulmountainscape.jpg;
# base16Scheme = {
# base00 = "232136";
# base01 = "2a273f";
# base02 = "393552";
# base03 = "6e6a86";
# base04 = "908caa";
# base05 = "e0def4";
# base06 = "e0def4";
# base07 = "56526e";
# base08 = "eb6f92";
# base09 = "f6c177";
# base0A = "ea9a97";
# base0B = "3e8fb0";
# base0C = "9ccfd8";
# base0D = "c4a7e7";
# base0E = "f6c177";
# base0F = "56526e";
# };
polarity = "dark";
opacity.terminal = 0.8;
cursor.package = pkgs.bibata-cursors;
cursor.name = "Bibata-Modern-Ice";
cursor.size = 24;
fonts = {
monospace = {
package = pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; };
name = "JetBrainsMono Nerd Font Mono";
};
sansSerif = {
package = pkgs.montserrat;
name = "Montserrat";
};
serif = {
package = pkgs.montserrat;
name = "Montserrat";
};
sizes = {
applications = 12;
terminal = 15;
desktop = 11;
popups = 12;
};
};
};
# Extra Module Options
drivers.amdgpu.enable = false;
drivers.nvidia.enable = false;
drivers.nvidia-prime = {
enable = false;
intelBusID = "";
nvidiaBusID = "";
};
drivers.intel.enable = false;
vm.guest-services.enable = false;
local.hardware-clock.enable = false;
# Apple Hardware
hardware.asahi.useExperimentalGPUDriver = true;
hardware.asahi.peripheralFirmwareDirectory = ../../modules/firmware;
# Enable networking
networking.wireless.iwd = {
enable = true;
settings.General.EnableNetworkConfiguration = true;
};
networking.hostName = host;
networking.timeServers = options.networking.timeServers.default ++ [ "pool.ntp.org" ];
# Set your time zone.
time.timeZone = "America/Chicago";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
programs = {
firefox.enable = false;
starship = {
enable = true;
settings = {
add_newline = false;
buf = {
symbol = " ";
};
c = {
symbol = " ";
};
directory = {
read_only = " 󰌾";
};
docker_context = {
symbol = " ";
};
fossil_branch = {
symbol = " ";
};
git_branch = {
symbol = " ";
};
golang = {
symbol = " ";
};
hg_branch = {
symbol = " ";
};
hostname = {
ssh_symbol = " ";
};
lua = {
symbol = " ";
};
memory_usage = {
symbol = "󰍛 ";
};
meson = {
symbol = "󰔷 ";
};
nim = {
symbol = "󰆥 ";
};
nix_shell = {
symbol = " ";
};
nodejs = {
symbol = " ";
};
ocaml = {
symbol = " ";
};
package = {
symbol = "󰏗 ";
};
python = {
symbol = " ";
};
rust = {
symbol = " ";
};
swift = {
symbol = " ";
};
zig = {
symbol = " ";
};
};
};
dconf.enable = true;
seahorse.enable = true;
fuse.userAllowOther = true;
mtr.enable = true;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
virt-manager.enable = true;
thunar = {
enable = true;
plugins = with pkgs.xfce; [
thunar-archive-plugin
thunar-volman
];
};
};
nixpkgs.config.allowUnfree = true;
users = {
mutableUsers = true;
};
environment.systemPackages = with pkgs; [
vim
wget
killall
eza
git
cmatrix
lolcat
htop
brave
libvirt
lxqt.lxqt-policykit
lm_sensors
unzip
unrar
libnotify
v4l-utils
ydotool
duf
ncdu
wl-clipboard
pciutils
ffmpeg
socat
cowsay
ripgrep
lshw
bat
pkg-config
meson
hyprpicker
ninja
brightnessctl
virt-viewer
swappy
appimage-run
yad
inxi
playerctl
nh
nixfmt-rfc-style
libvirt
swww
grim
slurp
file-roller
swaynotificationcenter
imv
mpv
gimp
pavucontrol
tree
neovide
greetd.tuigreet
];
fonts = {
packages = with pkgs; [
noto-fonts-emoji
noto-fonts-cjk
font-awesome
symbola
material-icons
];
};
environment.variables = {
ZANEYOS_VERSION = "2.2";
ZANEYOS = "true";
};
# Extra Portal Configuration
xdg.portal = {
enable = true;
wlr.enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal
];
configPackages = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-hyprland
pkgs.xdg-desktop-portal
];
};
# Services to start
services = {
xserver = {
enable = false;
xkb = {
layout = "${keyboardLayout}";
variant = "";
};
};
greetd = {
enable = true;
vt = 3;
settings = {
default_session = {
# Wayland Desktop Manager is installed only for user ryan via home-manager!
user = username;
# .wayland-session is a script generated by home-manager, which links to the current wayland compositor(sway/hyprland or others).
# with such a vendor-no-locking script, we can switch to another wayland compositor without modifying greetd's config here.
# command = "$HOME/.wayland-session"; # start a wayland session directly without a login manager
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland"; # start Hyprland with a TUI login manager
};
};
};
smartd = {
enable = false;
autodetect = true;
};
libinput.enable = true;
fstrim.enable = true;
gvfs.enable = true;
openssh.enable = true;
flatpak.enable = false;
printing = {
enable = true;
drivers = [
# pkgs.hplipWithPlugin
];
};
gnome.gnome-keyring.enable = true;
avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
ipp-usb.enable = true;
syncthing = {
enable = false;
user = "${username}";
dataDir = "/home/${username}";
configDir = "/home/${username}/.config/syncthing";
};
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
rpcbind.enable = false;
nfs.server.enable = false;
};
systemd.services.flatpak-repo = {
path = [ pkgs.flatpak ];
script = ''
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
'';
};
hardware.sane = {
enable = true;
extraBackends = [ pkgs.sane-airscan ];
disabledDefaultBackends = [ "escl" ];
};
# Extra Logitech Support
hardware.logitech.wireless.enable = false;
hardware.logitech.wireless.enableGraphical = false;
# Bluetooth Support
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
services.blueman.enable = true;
hardware.pulseaudio.enable = false;
# Security / Polkit
security.rtkit.enable = true;
security.polkit.enable = true;
security.polkit.extraConfig = ''
polkit.addRule(function(action, subject) {
if (
subject.isInGroup("users")
&& (
action.id == "org.freedesktop.login1.reboot" ||
action.id == "org.freedesktop.login1.reboot-multiple-sessions" ||
action.id == "org.freedesktop.login1.power-off" ||
action.id == "org.freedesktop.login1.power-off-multiple-sessions"
)
)
{
return polkit.Result.YES;
}
})
'';
security.pam.services.swaylock = {
text = ''
auth include login
'';
};
# Optimization settings and garbage collection automation
nix = {
settings = {
auto-optimise-store = true;
experimental-features = [
"nix-command"
"flakes"
];
substituters = [ "https://hyprland.cachix.org" ];
trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ];
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
# Virtualization / Containers
virtualisation.libvirtd.enable = true;
virtualisation.podman = {
enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
# OpenGL
hardware.graphics = {
enable = true;
enable32Bit = false;
};
console.keyMap = "${keyboardLayout}";
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
}

View File

@ -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 = [ "usb_storage" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/7b6ca8e3-c599-4d4b-802b-a4b20d865f69";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/FDE1-1C12";
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.enu1u2u1c2.useDHCP = lib.mkDefault true;
# networking.interfaces.wlan0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
}

244
hosts/nixbook/home.nix Normal file
View File

@ -0,0 +1,244 @@
{
pkgs,
username,
host,
...
}:
let
inherit (import ./variables.nix) gitUsername gitEmail;
in
{
# Home Manager Settings
home.username = "${username}";
home.homeDirectory = "/home/${username}";
home.stateVersion = "23.11";
# Import Program Configurations
imports = [
../../config/emoji.nix
../../config/hyprland.nix
../../config/neovim.nix
../../config/rofi/rofi.nix
../../config/rofi/config-emoji.nix
../../config/rofi/config-long.nix
../../config/swaync.nix
../../config/waybar.nix
../../config/wlogout.nix
../../config/fastfetch
];
# Place Files Inside Home Directory
home.file."Pictures/Wallpapers" = {
source = ../../config/wallpapers;
recursive = true;
};
home.file.".config/wlogout/icons" = {
source = ../../config/wlogout;
recursive = true;
};
home.file.".face.icon".source = ../../config/face.jpg;
home.file.".config/face.jpg".source = ../../config/face.jpg;
home.file.".config/swappy/config".text = ''
[Default]
save_dir=/home/${username}/Pictures/Screenshots
save_filename_format=swappy-%Y%m%d-%H%M%S.png
show_panel=false
line_size=5
text_size=20
text_font=Ubuntu
paint_mode=brush
early_exit=true
fill_shape=false
'';
# Install & Configure Git
programs.git = {
enable = true;
userName = "${gitUsername}";
userEmail = "${gitEmail}";
};
# Create XDG Dirs
xdg = {
userDirs = {
enable = true;
createDirectories = true;
};
};
dconf.settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = [ "qemu:///system" ];
uris = [ "qemu:///system" ];
};
};
# Styling Options
stylix.targets.waybar.enable = false;
stylix.targets.rofi.enable = false;
stylix.targets.hyprland.enable = false;
gtk = {
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
gtk3.extraConfig = {
gtk-application-prefer-dark-theme = 1;
};
gtk4.extraConfig = {
gtk-application-prefer-dark-theme = 1;
};
};
qt = {
enable = true;
style.name = "adwaita-dark";
platformTheme.name = "gtk3";
};
# Scripts
home.packages = [
(import ../../scripts/emopicker9000.nix { inherit pkgs; })
(import ../../scripts/task-waybar.nix { inherit pkgs; })
(import ../../scripts/squirtle.nix { inherit pkgs; })
(import ../../scripts/nvidia-offload.nix { inherit pkgs; })
(import ../../scripts/wallsetter.nix {
inherit pkgs;
inherit username;
})
(import ../../scripts/web-search.nix { inherit pkgs; })
(import ../../scripts/rofi-launcher.nix { inherit pkgs; })
(import ../../scripts/screenshootin.nix { inherit pkgs; })
(import ../../scripts/list-hypr-bindings.nix {
inherit pkgs;
inherit host;
})
];
services = {
hypridle = {
settings = {
general = {
after_sleep_cmd = "hyprctl dispatch dpms on";
ignore_dbus_inhibit = false;
lock_cmd = "hyprlock";
};
listener = [
{
timeout = 900;
on-timeout = "hyprlock";
}
{
timeout = 1200;
on-timeout = "hyprctl dispatch dpms off";
on-resume = "hyprctl dispatch dpms on";
}
];
};
};
};
programs = {
gh.enable = true;
btop = {
enable = true;
settings = {
vim_keys = true;
};
};
kitty = {
enable = true;
package = pkgs.kitty;
settings = {
scrollback_lines = 2000;
wheel_scroll_min_lines = 1;
window_padding_width = 4;
confirm_os_window_close = 0;
};
extraConfig = ''
tab_bar_style fade
tab_fade 1
active_tab_font_style bold
inactive_tab_font_style bold
'';
};
starship = {
enable = true;
package = pkgs.starship;
};
bash = {
enable = true;
enableCompletion = true;
profileExtra = ''
#if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" = 1 ]; then
# exec Hyprland
#fi
'';
initExtra = ''
fastfetch
if [ -f $HOME/.bashrc-personal ]; then
source $HOME/.bashrc-personal
fi
'';
shellAliases = {
sv = "sudo nvim";
fr = "nh os switch --hostname ${host} /home/${username}/zaneyos";
fu = "nh os switch --hostname ${host} --update /home/${username}/zaneyos";
zu = "sh <(curl -L https://gitlab.com/Zaney/zaneyos/-/raw/main/install-zaneyos.sh)";
ncg = "nix-collect-garbage --delete-old && sudo nix-collect-garbage -d && sudo /run/current-system/bin/switch-to-configuration boot";
v = "nvim";
cat = "bat";
ls = "eza --icons";
ll = "eza -lh --icons --grid --group-directories-first";
la = "eza -lah --icons --grid --group-directories-first";
".." = "cd ..";
};
};
home-manager.enable = true;
hyprlock = {
enable = true;
settings = {
general = {
disable_loading_bar = true;
grace = 10;
hide_cursor = true;
no_fade_in = false;
};
background = [
{
path = "/home/${username}/Pictures/Wallpapers/zaney-wallpaper.jpg";
blur_passes = 3;
blur_size = 8;
}
];
image = [
{
path = "/home/${username}/.config/face.jpg";
size = 150;
border_size = 4;
border_color = "rgb(0C96F9)";
rounding = -1; # Negative means circle
position = "0, 200";
halign = "center";
valign = "center";
}
];
input-field = [
{
size = "200, 50";
position = "0, -80";
monitor = "";
dots_center = true;
fade_on_empty = false;
font_color = "rgb(CFE6F4)";
inner_color = "rgb(657DC2)";
outer_color = "rgb(0D0E15)";
outline_thickness = 5;
placeholder_text = "Password...";
shadow_passes = 2;
}
];
};
};
};
}

40
hosts/nixbook/users.nix Normal file
View File

@ -0,0 +1,40 @@
{
pkgs,
username,
...
}:
let
inherit (import ./variables.nix) gitUsername;
in
{
users.users = {
"${username}" = {
homeMode = "755";
isNormalUser = true;
description = "${gitUsername}";
extraGroups = [
"networkmanager"
"wheel"
"libvirtd"
"scanner"
"lp"
];
shell = pkgs.bash;
ignoreShellProgramCheck = true;
packages = with pkgs; [
webcord
zeroad
];
};
# "newuser" = {
# homeMode = "755";
# isNormalUser = true;
# description = "New user account";
# extraGroups = [ "networkmanager" "wheel" "libvirtd" ];
# shell = pkgs.bash;
# ignoreShellProgramCheck = true;
# packages = with pkgs; [];
# };
};
}

View File

@ -0,0 +1,18 @@
{
# Git Configuration ( For Pulling Software Repos )
gitUsername = "Tyler Kelley";
gitEmail = "tylerzanekelley@gmail.com";
# Hyprland Settings
extraMonitorSettings = "
monitor=eDP-1,2560x1600@60,0x0,1.25
";
# Waybar Settings
clock24h = false;
# Program Options
browser = "brave"; # Set Default Browser (google-chrome-stable for google-chrome)
terminal = "kitty"; # Set Default System Terminal
keyboardLayout = "us";
}

93
install-zaneyos.sh Executable file
View File

@ -0,0 +1,93 @@
#!/usr/bin/env bash
if [ -n "$(grep -i nixos < /etc/os-release)" ]; then
echo "Verified this is NixOS."
echo "-----"
else
echo "This is not NixOS or the distribution information is not available."
exit
fi
if command -v git &> /dev/null; then
echo "Git is installed, continuing with installation."
echo "-----"
else
echo "Git is not installed. Please install Git and try again."
echo "Example: nix-shell -p git"
exit
fi
echo "Default options are in brackets []"
echo "Just press enter to select the default"
sleep 2
echo "-----"
echo "Ensure In Home Directory"
cd || exit
echo "-----"
read -rp "Enter Your New Hostname: [ default ] " hostName
if [ -z "$hostName" ]; then
hostName="default"
fi
echo "-----"
backupname=$(date "+%Y-%m-%d-%H-%M-%S")
if [ -d "zaneyos" ]; then
echo "ZaneyOS exists, backing up to .config/zaneyos-backups folder."
if [ -d ".config/zaneyos-backups" ]; then
echo "Moving current version of ZaneyOS to backups folder."
mv "$HOME"/zaneyos .config/zaneyos-backups/"$backupname"
sleep 1
else
echo "Creating the backups folder & moving ZaneyOS to it."
mkdir -p .config/zaneyos-backups
mv "$HOME"/zaneyos .config/zaneyos-backups/"$backupname"
sleep 1
fi
else
echo "Thank you for choosing ZaneyOS."
echo "I hope you find your time here enjoyable!"
fi
echo "-----"
echo "Cloning & Entering ZaneyOS Repository"
git clone https://git.ascosilinux.com/batvin321/zaneyos-modified.git
cd zaneyos || exit
mkdir hosts/"$hostName"
cp hosts/default/*.nix hosts/"$hostName"
git config --global user.name "installer"
git config --global user.email "installer@gmail.com"
git add .
sed -i "/^\s*host[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$hostName\"/" ./flake.nix
read -rp "Enter your keyboard layout: [ us ] " keyboardLayout
if [ -z "$keyboardLayout" ]; then
keyboardLayout="us"
fi
sed -i "/^\s*keyboardLayout[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$keyboardLayout\"/" ./hosts/$hostName/variables.nix
echo "-----"
installusername=$(echo $USER)
sed -i "/^\s*username[[:space:]]*=[[:space:]]*\"/s/\"\(.*\)\"/\"$installusername\"/" ./flake.nix
echo "-----"
echo "Generating The Hardware Configuration"
sudo nixos-generate-config --show-hardware-config > ./hosts/$hostName/hardware.nix
echo "-----"
echo "Setting Required Nix Settings Then Going To Install"
NIX_CONFIG="experimental-features = nix-command flakes"
echo "-----"
sudo nixos-rebuild switch --flake ~/zaneyos/#${hostName}

20
modules/amd-drivers.nix Normal file
View File

@ -0,0 +1,20 @@
{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.drivers.amdgpu;
in
{
options.drivers.amdgpu = {
enable = mkEnableOption "Enable AMD Drivers";
};
config = mkIf cfg.enable {
systemd.tmpfiles.rules = [ "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" ];
services.xserver.videoDrivers = [ "amdgpu" ];
};
}

View File

@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./modules/default.nix
];
}

View File

@ -0,0 +1,55 @@
{ config, pkgs, lib, ... }:
let
pkgs' = config.hardware.asahi.pkgs;
bootM1n1 = pkgs'.m1n1.override {
isRelease = true;
withTools = false;
customLogo = config.boot.m1n1CustomLogo;
};
bootUBoot = pkgs'.uboot-asahi.override {
m1n1 = bootM1n1;
};
bootFiles = {
"m1n1/boot.bin" = pkgs.runCommand "boot.bin" {} ''
cat ${bootM1n1}/build/m1n1.bin > $out
cat ${config.boot.kernelPackages.kernel}/dtbs/apple/*.dtb >> $out
cat ${bootUBoot}/u-boot-nodtb.bin.gz >> $out
if [ -n "${config.boot.m1n1ExtraOptions}" ]; then
echo '${config.boot.m1n1ExtraOptions}' >> $out
fi
'';
};
in {
config = lib.mkIf config.hardware.asahi.enable {
# install m1n1 with the boot loader
boot.loader.grub.extraFiles = bootFiles;
boot.loader.systemd-boot.extraFiles = bootFiles;
# ensure the installer has m1n1 in the image
system.extraDependencies = lib.mkForce [ bootM1n1 bootUBoot ];
system.build.m1n1 = bootFiles."m1n1/boot.bin";
};
options.boot = {
m1n1ExtraOptions = lib.mkOption {
type = lib.types.str;
default = "";
description = ''
Append extra options to the m1n1 boot binary. Might be useful for fixing
display problems on Mac minis.
https://github.com/AsahiLinux/m1n1/issues/159
'';
};
m1n1CustomLogo = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
description = ''
Custom logo to build into m1n1. The path must point to a 256x256 PNG.
'';
};
};
}

View File

@ -0,0 +1,69 @@
{ config, pkgs, lib, ... }:
{
imports = [
./kernel
./mesa
./peripheral-firmware
./boot-m1n1
./sound
];
config = let
cfg = config.hardware.asahi;
in lib.mkIf cfg.enable {
nixpkgs.overlays = lib.mkBefore [ cfg.overlay ];
hardware.asahi.pkgs =
if cfg.pkgsSystem != "aarch64-linux"
then
import (pkgs.path) {
crossSystem.system = "aarch64-linux";
localSystem.system = cfg.pkgsSystem;
overlays = [ cfg.overlay ];
}
else pkgs;
};
options.hardware.asahi = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Enable the basic Asahi Linux components, such as kernel and boot setup.
'';
};
pkgsSystem = lib.mkOption {
type = lib.types.str;
default = "aarch64-linux";
description = ''
System architecture that should be used to build the major Asahi
packages, if not the default aarch64-linux. This allows installing from
a cross-built ISO without rebuilding them during installation.
'';
};
pkgs = lib.mkOption {
type = lib.types.raw;
description = ''
Package set used to build the major Asahi packages. Defaults to the
ambient set if not cross-built, otherwise re-imports the ambient set
with the system defined by `hardware.asahi.pkgsSystem`.
'';
};
overlay = lib.mkOption {
type = lib.mkOptionType {
name = "nixpkgs-overlay";
description = "nixpkgs overlay";
check = lib.isFunction;
merge = lib.mergeOneOption;
};
default = import ../packages/overlay.nix;
defaultText = "overlay provided with the module";
description = ''
The nixpkgs overlay for asahi packages.
'';
};
};
}

View File

@ -0,0 +1,107 @@
# the Asahi Linux kernel and options that must go along with it
{ config, pkgs, lib, ... }:
{
config = lib.mkIf config.hardware.asahi.enable {
boot.kernelPackages = let
pkgs' = config.hardware.asahi.pkgs;
in
pkgs'.linux-asahi.override {
_kernelPatches = config.boot.kernelPatches;
withRust = config.hardware.asahi.withRust;
};
# we definitely want to use CONFIG_ENERGY_MODEL, and
# schedutil is a prerequisite for using it
# source: https://www.kernel.org/doc/html/latest/scheduler/sched-energy.html
powerManagement.cpuFreqGovernor = lib.mkOverride 800 "schedutil";
boot.initrd.includeDefaultModules = false;
boot.initrd.availableKernelModules = [
# list of initrd modules stolen from
# https://github.com/AsahiLinux/asahi-scripts/blob/f461f080a1d2575ae4b82879b5624360db3cff8c/initcpio/install/asahi
"apple-mailbox"
"nvme_apple"
"pinctrl-apple-gpio"
"macsmc"
"macsmc-rtkit"
"i2c-pasemi-platform"
"tps6598x"
"apple-dart"
"dwc3"
"dwc3-of-simple"
"xhci-pci"
"pcie-apple"
"gpio_macsmc"
"phy-apple-atc"
"nvmem_apple_efuses"
"spi-apple"
"spi-hid-apple"
"spi-hid-apple-of"
"rtc-macsmc"
"simple-mfd-spmi"
"spmi-apple-controller"
"nvmem_spmi_mfd"
"apple-dockchannel"
"dockchannel-hid"
"apple-rtkit-helper"
# additional stuff necessary to boot off USB for the installer
# and if the initrd (i.e. stage 1) goes wrong
"usb-storage"
"xhci-plat-hcd"
"usbhid"
"hid_generic"
];
boot.kernelParams = [
"earlycon"
"console=ttySAC0,115200n8"
"console=tty0"
"boot.shell_on_fail"
# Apple's SSDs are slow (~dozens of ms) at processing flush requests which
# slows down programs that make a lot of fsync calls. This parameter sets
# a delay in ms before actually flushing so that such requests can be
# coalesced. Be warned that increasing this parameter above zero (default
# is 1000) has the potential, though admittedly unlikely, risk of
# UNBOUNDED data corruption in case of power loss!!!! Don't even think
# about it on desktops!!
"nvme_apple.flush_interval=0"
];
# U-Boot does not support EFI variables
boot.loader.efi.canTouchEfiVariables = lib.mkForce false;
# U-Boot does not support switching console mode
boot.loader.systemd-boot.consoleMode = "0";
# GRUB has to be installed as removable if the user chooses to use it
boot.loader.grub = lib.mkDefault {
efiSupport = true;
efiInstallAsRemovable = true;
device = "nodev";
};
# autosuspend was enabled as safe for the PCI SD card reader
# "Genesys Logic, Inc GL9755 SD Host Controller [17a0:9755] (rev 01)"
# by recent systemd versions, but this has a "negative interaction"
# with our kernel/SoC and causes random boot hangs. disable it!
services.udev.extraHwdb = ''
pci:v000017A0d00009755*
ID_AUTOSUSPEND=0
'';
};
imports = [
(lib.mkRemovedOptionModule [ "hardware" "asahi" "addEdgeKernelConfig" ]
"All edge kernel config options are now the default.")
];
options.hardware.asahi.withRust = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Build the Asahi Linux kernel with Rust support.
'';
};
}

View File

@ -0,0 +1,78 @@
{ options, config, pkgs, lib, ... }:
{
config = let
isMode = mode: (config.hardware.asahi.useExperimentalGPUDriver
&& config.hardware.asahi.experimentalGPUInstallMode == mode);
in lib.mkIf config.hardware.asahi.enable (lib.mkMerge [
{
# required for proper DRM setup even without GPU driver
services.xserver.config = ''
Section "OutputClass"
Identifier "appledrm"
MatchDriver "apple"
Driver "modesetting"
Option "PrimaryGPU" "true"
EndSection
'';
}
(lib.mkIf config.hardware.asahi.useExperimentalGPUDriver (
# install the drivers
if builtins.hasAttr "graphics" options.hardware then {
hardware.graphics.package = config.hardware.asahi.pkgs.mesa-asahi-edge.drivers;
} else { # for 24.05
hardware.opengl.package = config.hardware.asahi.pkgs.mesa-asahi-edge.drivers;
})
)
(lib.mkIf config.hardware.asahi.useExperimentalGPUDriver {
# required for in-kernel GPU driver
hardware.asahi.withRust = true;
})
(lib.mkIf (isMode "replace") {
# replace the Mesa linked into system packages with the Asahi version
# without rebuilding them to avoid rebuilding the world.
system.replaceRuntimeDependencies = [
{ original = pkgs.mesa;
replacement = config.hardware.asahi.pkgs.mesa-asahi-edge;
}
];
})
(lib.mkIf (isMode "overlay") {
# replace the Mesa used in Nixpkgs with the Asahi version using an overlay,
# which requires rebuilding the world but ensures it is done faithfully
# (and in a way compatible with pure evaluation)
nixpkgs.overlays = [
(final: prev: {
# prevent cross-built Mesas that might be evaluated using this config (e.g. Steam emulation via box64) from using the special Asahi Mesa
mesa = if prev.targetPlatform.isAarch64 then final.mesa-asahi-edge else prev.mesa;
})
];
})
]);
options.hardware.asahi.useExperimentalGPUDriver = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Use the experimental Asahi Mesa GPU driver.
Do not report issues using this driver under NixOS to the Asahi project.
'';
};
options.hardware.asahi.experimentalGPUInstallMode = lib.mkOption {
type = lib.types.enum [ "driver" "replace" "overlay" ];
default = "replace";
description = ''
Mode to use to install the experimental GPU driver into the system.
driver: install only as a driver, do not replace system Mesa.
Causes issues with certain programs like Plasma Wayland.
replace (default): use replaceRuntimeDependencies to replace system Mesa with Asahi Mesa.
Does not work in pure evaluation context (i.e. in flakes by default).
overlay: overlay system Mesa with Asahi Mesa
Requires rebuilding the world.
'';
};
}

View File

@ -0,0 +1,69 @@
{ config, pkgs, lib, ... }:
{
config = lib.mkIf config.hardware.asahi.enable {
assertions = lib.mkIf config.hardware.asahi.extractPeripheralFirmware [
{ assertion = config.hardware.asahi.peripheralFirmwareDirectory != null;
message = ''
Asahi peripheral firmware extraction is enabled but the firmware
location appears incorrect.
'';
}
];
hardware.firmware = let
pkgs' = config.hardware.asahi.pkgs;
in
lib.mkIf ((config.hardware.asahi.peripheralFirmwareDirectory != null)
&& config.hardware.asahi.extractPeripheralFirmware) [
(pkgs.stdenv.mkDerivation {
name = "asahi-peripheral-firmware";
nativeBuildInputs = [ pkgs'.asahi-fwextract pkgs.cpio ];
buildCommand = ''
mkdir extracted
asahi-fwextract ${config.hardware.asahi.peripheralFirmwareDirectory} extracted
mkdir -p $out/lib/firmware
cat extracted/firmware.cpio | cpio -id --quiet --no-absolute-filenames
mv vendorfw/* $out/lib/firmware
'';
})
];
};
options.hardware.asahi = {
extractPeripheralFirmware = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Automatically extract the non-free non-redistributable peripheral
firmware necessary for features like Wi-Fi.
'';
};
peripheralFirmwareDirectory = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = lib.findFirst (path: builtins.pathExists (path + "/all_firmware.tar.gz")) null
[
# path when the system is operating normally
/boot/asahi
# path when the system is mounted in the installer
/mnt/boot/asahi
];
description = ''
Path to the directory containing the non-free non-redistributable
peripheral firmware necessary for features like Wi-Fi. Ordinarily, this
will automatically point to the appropriate location on the ESP. Flake
users and those interested in maximum purity will want to copy those
files elsewhere and specify this manually.
Currently, this consists of the files `all-firmware.tar.gz` and
`kernelcache*`. The official Asahi Linux installer places these files
in the `asahi` directory of the EFI system partition when creating it.
'';
};
};
}

View File

@ -0,0 +1,71 @@
{ config, options, pkgs, lib, ... }:
{
options.hardware.asahi = {
setupAsahiSound = lib.mkOption {
type = lib.types.bool;
default = config.hardware.asahi.enable;
description = ''
Set up the Asahi DSP components so that the speakers and headphone jack
work properly and safely.
'';
};
};
config = let
cfg = config.hardware.asahi;
asahi-audio = pkgs.asahi-audio; # the asahi-audio we use
# php override works around build failure: https://github.com/NixOS/nixpkgs/pull/330895
lsp-plugins = pkgs.lsp-plugins.override { php = pkgs.php82; }; # the lsp-plugins we use
lsp-plugins-is-safe = (pkgs.lib.versionAtLeast lsp-plugins.version "1.2.14");
lv2Path = lib.makeSearchPath "lib/lv2" [ lsp-plugins pkgs.bankstown-lv2 ];
in lib.mkIf (cfg.setupAsahiSound && cfg.enable) (lib.mkMerge [
{
# can't be used by Asahi sound infrastructure
hardware.pulseaudio.enable = false;
# enable pipewire to run real-time and avoid audible glitches
security.rtkit.enable = true;
# set up pipewire with the supported capabilities (instead of pulseaudio)
# and asahi-audio configs and plugins
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
configPackages = [ asahi-audio ];
extraLv2Packages = [ lsp-plugins pkgs.bankstown-lv2 ];
wireplumber = {
enable = true;
configPackages = [ asahi-audio ];
extraLv2Packages = [ lsp-plugins pkgs.bankstown-lv2 ];
};
};
# set up enivronment so that UCM configs are used as well
environment.variables.ALSA_CONFIG_UCM2 = "${pkgs.alsa-ucm-conf-asahi}/share/alsa/ucm2";
systemd.user.services.pipewire.environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2;
systemd.user.services.wireplumber.environment.ALSA_CONFIG_UCM2 = config.environment.variables.ALSA_CONFIG_UCM2;
# enable speakersafetyd to protect speakers
systemd.packages = lib.mkAssert lsp-plugins-is-safe
"lsp-plugins is unpatched/outdated and speakers cannot be safely enabled"
[ pkgs.speakersafetyd ];
services.udev.packages = [ pkgs.speakersafetyd ];
# asahi-sound requires wireplumber 0.5.2 or above
# https://github.com/AsahiLinux/asahi-audio/commit/29ec1056c18193ffa09a990b1b61ed273e97fee6
assertions = [
{
assertion = lib.versionAtLeast pkgs.wireplumber.version "0.5.2";
message = "wireplumber >= 0.5.2 is required for sound with nixos-apple-silicon.";
}
];
}
]);
}

View File

@ -0,0 +1,19 @@
{ lib
, fetchFromGitHub
, alsa-ucm-conf }:
(alsa-ucm-conf.overrideAttrs (oldAttrs: rec {
version = "5";
src_asahi = fetchFromGitHub {
# tracking: https://src.fedoraproject.org/rpms/alsa-ucm-asahi
owner = "AsahiLinux";
repo = "alsa-ucm-conf-asahi";
rev = "v${version}";
hash = "sha256-daUNz5oUrPfSMO0Tqq/WbtiLHMOtPeQQlI+juGrhTxw=";
};
postInstall = oldAttrs.postInstall or "" + ''
cp -r ${src_asahi}/ucm2 $out/share/alsa
'';
}))

View File

@ -0,0 +1,37 @@
{ stdenv
, lib
, fetchFromGitHub
}:
stdenv.mkDerivation rec {
pname = "asahi-audio";
# tracking: https://src.fedoraproject.org/rpms/asahi-audio
version = "2.2";
src = fetchFromGitHub {
owner = "AsahiLinux";
repo = "asahi-audio";
rev = "v${version}";
hash = "sha256-5YBQibt/dfJb9/TzF6rczeQE3ySm0SeewhZrgublu2E=";
};
preBuild = ''
export PREFIX=$out
readarray -t configs < <(\
find . \
-name '*.conf' -or \
-name '*.json' -or \
-name '*.lua'
)
substituteInPlace "''${configs[@]}" --replace \
"/usr/share/asahi-audio" \
"$out/asahi-audio"
'';
postInstall = ''
# no need to link the asahi-audio dir globally
mv $out/share/asahi-audio $out
'';
}

View File

@ -0,0 +1,32 @@
{ lib
, python3
, fetchFromGitHub
, gzip
, gnutar
, lzfse
}:
python3.pkgs.buildPythonApplication rec {
pname = "asahi-fwextract";
version = "0.7.5";
# tracking version: https://packages.fedoraproject.org/pkgs/asahi-installer/python3-asahi_firmware/
src = fetchFromGitHub {
owner = "AsahiLinux";
repo = "asahi-installer";
rev = "v${version}";
hash = "sha256-lGZFvB1zK+5MYhy2DgAHNUUG4EJPDGlIJ8MfdnDm4Ak=";
};
postPatch = ''
substituteInPlace asahi_firmware/img4.py \
--replace 'liblzfse.so' '${lzfse}/lib/liblzfse.so'
substituteInPlace asahi_firmware/update.py \
--replace '"tar"' '"${gnutar}/bin/tar"' \
--replace '"xf"' '"-x", "-I", "${gzip}/bin/gzip", "-f"'
'';
nativeBuildInputs = [ python3.pkgs.setuptools ];
doCheck = false;
}

View File

@ -0,0 +1,40 @@
From 0fcdbacd8b06c24f5761a0cf9cb0c43cad05c19b Mon Sep 17 00:00:00 2001
From: Thomas Watson <twatson52@icloud.com>
Date: Mon, 26 Feb 2024 19:51:12 -0600
Subject: [PATCH] fs/fcntl: accept more values as F_DUPFD_CLOEXEC args
libwebrtc doesn't pass anything as the arg to this function so the
minimum fd ends up as random garbage. If it's bigger than the maximum
fd, which is likely, then the duplication fails, and libwebrtc breaks.
The previous patch (081abc5fa701738699705a6c0a41c824df77cb37) rejects
args >= 1024 (the default soft max fd) and instead subtitutes a minimum
fd of 0 to allow such requests to succeed.
However, gnulib's test suite can pass the following values and expects
them to fail; this patch prevents those from succeeding:
* -1 (hard-coded)
* 1024 (`ulimit -n` value by default)
* 1048576 (`ulimit -n` value in Nix build sandbox)
Hopefully the garbage values libwebrtc passes do not match very often.
---
fs/fcntl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/fcntl.c b/fs/fcntl.c
index f18f87419445..65a6861476ec 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -326,7 +326,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
err = f_dupfd(argi, filp, 0);
break;
case F_DUPFD_CLOEXEC:
- if (arg >= 1024)
+ if ((arg > 1024) && (argi != 1048576) && (argi != -1))
argi = 0; /* Lol libwebrtc */
err = f_dupfd(argi, filp, O_CLOEXEC);
break;
--
2.43.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,122 @@
{ lib
, pkgs
, callPackage
, writeShellScriptBin
, writeText
, linuxPackagesFor
, withRust ? false
, _kernelPatches ? [ ]
}:
let
i = builtins.elemAt;
# parse <OPT> [ymn]|foo style configuration as found in a patch's extraConfig
# into a list of k, v tuples
parseExtraConfig = config:
let
lines =
builtins.filter (s: s != "") (lib.strings.splitString "\n" config);
parseLine = line: let
t = lib.strings.splitString " " line;
join = l: builtins.foldl' (a: b: "${a} ${b}")
(builtins.head l) (builtins.tail l);
v = if (builtins.length t) > 2 then join (builtins.tail t) else (i t 1);
in [ "CONFIG_${i t 0}" v ];
in map parseLine lines;
# parse <OPT>=lib.kernel.(yes|module|no)|lib.kernel.freeform "foo"
# style configuration as found in a patch's extraStructuredConfig into
# a list of k, v tuples
parseExtraStructuredConfig = config: lib.attrsets.mapAttrsToList
(k: v: [ "CONFIG_${k}" (v.tristate or v.freeform) ] ) config;
parsePatchConfig = { extraConfig ? "", extraStructuredConfig ? {}, ... }:
(parseExtraConfig extraConfig) ++
(parseExtraStructuredConfig extraStructuredConfig);
# parse CONFIG_<OPT>=[ymn]|"foo" style configuration as found in a config file
# into a list of k, v tuples
parseConfig = config:
let
parseLine = builtins.match ''(CONFIG_[[:upper:][:digit:]_]+)=(([ymn])|"([^"]*)")'';
# get either the [ymn] option or the "foo" option; whichever matched
t = l: let v = (i l 2); in [ (i l 0) (if v != null then v else (i l 3)) ];
lines = lib.strings.splitString "\n" config;
in map t (builtins.filter (l: l != null) (map parseLine lines));
origConfigfile = ./config;
linux-asahi-pkg = { stdenv, lib, fetchFromGitHub, fetchpatch, linuxKernel,
rustPlatform, rustc, rustfmt, rust-bindgen, ... } @ args:
let
origConfigText = builtins.readFile origConfigfile;
# extraConfig from all patches in order
extraConfig =
lib.fold (patch: ex: ex ++ (parsePatchConfig patch)) [] _kernelPatches;
# config file text for above
extraConfigText = let
text = k: v: if (v == "y") || (v == "m") || (v == "n")
then "${k}=${v}" else ''${k}="${v}"'';
in (map (t: text (i t 0) (i t 1)) extraConfig);
# final config as a text file path
configfile = if extraConfig == [] then origConfigfile else
writeText "config" ''
${origConfigText}
# Patches
${lib.strings.concatStringsSep "\n" extraConfigText}
'';
# final config as an attrset
configAttrs = let
makePair = t: lib.nameValuePair (i t 0) (i t 1);
configList = (parseConfig origConfigText) ++ extraConfig;
in builtins.listToAttrs (map makePair (lib.lists.reverseList configList));
# used to (ostensibly) keep compatibility for those running stable versions of nixos
rustOlder = version: withRust && (lib.versionOlder rustc.version version);
bindgenOlder = version: withRust && (lib.versionOlder rust-bindgen.unwrapped.version version);
# used to fix issues when nixpkgs gets ahead of the kernel
rustAtLeast = version: withRust && (lib.versionAtLeast rustc.version version);
bindgenAtLeast = version: withRust && (lib.versionAtLeast rust-bindgen.unwrapped.version version);
in
(linuxKernel.manualConfig rec {
inherit stdenv lib;
version = "6.9.12-asahi";
modDirVersion = version;
extraMeta.branch = "6.9";
src = fetchFromGitHub {
# tracking: https://github.com/AsahiLinux/linux/tree/asahi-wip (w/ fedora verification)
owner = "AsahiLinux";
repo = "linux";
rev = "asahi-6.9.12-1";
hash = "sha256-LCMrG+RVONK/eIvygRExaVvY/ATV3IfvSsFbVsHVu48=";
};
kernelPatches = [
{ name = "coreutils-fix";
patch = ./0001-fs-fcntl-accept-more-values-as-F_DUPFD_CLOEXEC-args.patch;
}
] ++ _kernelPatches;
inherit configfile;
# hide Rust support from the nixpkgs infra to avoid it re-adding the rust packages.
# we can't use it until it's in stable and until we've evaluated the cross-compilation impact.
config = configAttrs // { "CONFIG_RUST" = "n"; };
} // (args.argsOverride or {})).overrideAttrs (old: if withRust then {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [
rust-bindgen
rustfmt
rustc
];
RUST_LIB_SRC = rustPlatform.rustLibSrc;
} else {});
linux-asahi = (callPackage linux-asahi-pkg { });
in lib.recurseIntoAttrs (linuxPackagesFor linux-asahi)

View File

@ -0,0 +1,101 @@
{ stdenv
, buildPackages
, lib
, fetchFromGitHub
, python3
, dtc
, imagemagick
, isRelease ? false
, withTools ? true
, withChainloading ? false
, rust-bin ? null
, customLogo ? null
}:
assert withChainloading -> rust-bin != null;
let
pyenv = python3.withPackages (p: with p; [
construct
pyserial
]);
rustenv = rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal.override {
targets = [ "aarch64-unknown-none-softfloat" ];
});
in stdenv.mkDerivation rec {
pname = "m1n1";
version = "1.4.14";
src = fetchFromGitHub {
# tracking: https://src.fedoraproject.org/rpms/m1n1
owner = "AsahiLinux";
repo = "m1n1";
rev = "v${version}";
hash = "sha256-bhX6qtyiKgSpBic4q3jNu9Xi+SOw21JC4sBI44YHKK0=";
fetchSubmodules = true;
};
makeFlags = [ "ARCH=${stdenv.cc.targetPrefix}" ]
++ lib.optional isRelease "RELEASE=1"
++ lib.optional withChainloading "CHAINLOADING=1";
nativeBuildInputs = [
dtc
buildPackages.gcc
] ++ lib.optional withChainloading rustenv
++ lib.optional (customLogo != null) imagemagick;
postPatch = ''
substituteInPlace proxyclient/m1n1/asm.py \
--replace 'aarch64-linux-gnu-' 'aarch64-unknown-linux-gnu-' \
--replace 'TOOLCHAIN = ""' 'TOOLCHAIN = "'$out'/toolchain-bin/"'
'';
preConfigure = lib.optionalString (customLogo != null) ''
pushd data &>/dev/null
ln -fs ${customLogo} bootlogo_256.png
if [[ "$(magick identify bootlogo_256.png)" != 'bootlogo_256.png PNG 256x256'* ]]; then
echo "Custom logo is not a 256x256 PNG"
exit 1
fi
rm bootlogo_128.png
convert bootlogo_256.png -resize 128x128 bootlogo_128.png
patchShebangs --build ./makelogo.sh
./makelogo.sh
popd &>/dev/null
'';
installPhase = ''
runHook preInstall
mkdir -p $out/build
cp build/m1n1.bin $out/build
'' + (lib.optionalString withTools ''
mkdir -p $out/{bin,script,toolchain-bin}
cp -r proxyclient $out/script
cp -r tools $out/script
for toolpath in $out/script/proxyclient/tools/*.py; do
tool=$(basename $toolpath .py)
script=$out/bin/m1n1-$tool
cat > $script <<EOF
#!/bin/sh
${pyenv}/bin/python $toolpath "\$@"
EOF
chmod +x $script
done
GCC=${buildPackages.gcc}
BINUTILS=${buildPackages.binutils-unwrapped}
ln -s $GCC/bin/${stdenv.cc.targetPrefix}gcc $out/toolchain-bin/
ln -s $GCC/bin/${stdenv.cc.targetPrefix}ld $out/toolchain-bin/
ln -s $BINUTILS/bin/${stdenv.cc.targetPrefix}objcopy $out/toolchain-bin/
ln -s $BINUTILS/bin/${stdenv.cc.targetPrefix}objdump $out/toolchain-bin/
ln -s $GCC/bin/${stdenv.cc.targetPrefix}nm $out/toolchain-bin/
'') + ''
runHook postInstall
'';
}

View File

@ -0,0 +1,49 @@
{ lib
, fetchFromGitLab
, pkgs
, meson
, llvmPackages
}:
# don't bother to provide Darwin deps
((pkgs.callPackage ./vendor { OpenGL = null; Xplugin = null; }).override {
galliumDrivers = [ "swrast" "asahi" ];
vulkanDrivers = [ "swrast" ];
enableGalliumNine = false;
# libclc and other OpenCL components are needed for geometry shader support on Apple Silicon
enableOpenCL = true;
}).overrideAttrs (oldAttrs: {
# version must be the same length (i.e. no unstable or date)
# so that system.replaceRuntimeDependencies can work
version = "24.2.0";
src = fetchFromGitLab {
# tracking: https://pagure.io/fedora-asahi/mesa/commits/asahi
domain = "gitlab.freedesktop.org";
owner = "asahi";
repo = "mesa";
rev = "asahi-20240727";
hash = "sha256-XXhmiedwJwjKTZeApDE/GdAzIteteoi78J4LJ3WBJsY=";
};
mesonFlags =
# remove flag to configure xvmc functionality as having it
# breaks the build because that no longer exists in Mesa 23
(lib.filter (x: !(lib.hasPrefix "-Dxvmc-libs-path=" x)) oldAttrs.mesonFlags) ++ [
# we do not build any graphics drivers these features can be enabled for
"-Dgallium-va=disabled"
"-Dgallium-vdpau=disabled"
"-Dgallium-xa=disabled"
# does not make any sense
"-Dandroid-libbacktrace=disabled"
"-Dintel-rt=disabled"
# do not want to add the dependencies
"-Dlibunwind=disabled"
"-Dlmsensors=disabled"
];
# replace patches with ones tweaked slightly to apply to this version
patches = [
./disk_cache-include-dri-driver-path-in-cache-key.patch
./opencl.patch
];
})

View File

@ -0,0 +1,67 @@
Author: David McFarland <corngood@gmail.com>
Date: Mon Aug 6 15:52:11 2018 -0300
[PATCH] disk_cache: include dri driver path in cache key
This fixes invalid cache hits on NixOS where all shared library
timestamps in /nix/store are zero.
diff --git a/meson_options.txt b/meson_options.txt
index 512e05d..93001da 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -513,6 +513,13 @@ option(
description : 'Enable direct rendering in GLX and EGL for DRI',
)
+option(
+ 'disk-cache-key',
+ type : 'string',
+ value : '',
+ description : 'Mesa cache key.'
+)
+
option('egl-lib-suffix',
type : 'string',
value : '',
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index 8298f9d..e622133 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -226,8 +226,10 @@ disk_cache_type_create(const char *gpu_name,
/* Create driver id keys */
size_t id_size = strlen(driver_id) + 1;
+ size_t key_size = strlen(DISK_CACHE_KEY) + 1;
size_t gpu_name_size = strlen(gpu_name) + 1;
cache->driver_keys_blob_size += id_size;
+ cache->driver_keys_blob_size += key_size;
cache->driver_keys_blob_size += gpu_name_size;
/* We sometimes store entire structs that contains a pointers in the cache,
@@ -248,6 +250,7 @@ disk_cache_type_create(const char *gpu_name,
uint8_t *drv_key_blob = cache->driver_keys_blob;
DRV_KEY_CPY(drv_key_blob, &cache_version, cv_size)
DRV_KEY_CPY(drv_key_blob, driver_id, id_size)
+ DRV_KEY_CPY(drv_key_blob, DISK_CACHE_KEY, key_size)
DRV_KEY_CPY(drv_key_blob, gpu_name, gpu_name_size)
DRV_KEY_CPY(drv_key_blob, &ptr_size, ptr_size_size)
DRV_KEY_CPY(drv_key_blob, &driver_flags, driver_flags_size)
diff --git a/src/util/meson.build b/src/util/meson.build
index c0c1b9d..442163c 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -268,7 +268,12 @@ _libmesa_util = static_library(
include_directories : [inc_util, include_directories('format')],
dependencies : deps_for_libmesa_util,
link_with: [libmesa_util_sse41],
- c_args : [c_msvc_compat_args],
+ c_args : [
+ c_msvc_compat_args,
+ '-DDISK_CACHE_KEY="@0@"'.format(
+ get_option('disk-cache-key')
+ ),
+ ],
gnu_symbol_visibility : 'hidden',
build_by_default : false
)

View File

@ -0,0 +1,84 @@
From bbd0f154183e4d26a14bb005f6afc636629c201e Mon Sep 17 00:00:00 2001
From: Thomas Watson <twatson52@icloud.com>
Date: Sat, 16 Dec 2023 20:46:51 -0600
Subject: [PATCH] opencl.patch from nixpkgs
f416128e90ac75bec060e8b9435fe9c38423c036
---
meson.build | 2 +-
meson_options.txt | 6 ++++++
src/gallium/targets/opencl/meson.build | 6 +++---
src/gallium/targets/rusticl/meson.build | 3 +--
4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/meson.build b/meson.build
index 552ff196aa8..9e10156b875 100644
--- a/meson.build
+++ b/meson.build
@@ -1829,7 +1829,7 @@ endif
dep_clang = null_dep
if with_clc
- llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
+ llvm_libdir = get_option('clang-libdir')
dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)
diff --git a/meson_options.txt b/meson_options.txt
index c76fa6d3382..d2021f55634 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,6 +1,12 @@
# Copyright © 2017-2019 Intel Corporation
# SPDX-License-Identifier: MIT
+option(
+ 'clang-libdir',
+ type : 'string',
+ value : '',
+ description : 'Locations to search for clang libraries.'
+)
option(
'platforms',
type : 'array',
diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
index 7c14135898e..cbcd67cc443 100644
--- a/src/gallium/targets/opencl/meson.build
+++ b/src/gallium/targets/opencl/meson.build
@@ -39,7 +39,8 @@ if dep_llvm.version().version_compare('>=10.0.0')
polly_isl_dep = cpp.find_library('PollyISL', dirs : llvm_libdir, required : false)
endif
-dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)
+clang_libdir = get_option('clang-libdir')
+dep_clang = cpp.find_library('clang-cpp', dirs : clang_libdir, required : false)
# meson will return clang-cpp from system dirs if it's not found in llvm_libdir
linker_rpath_arg = '-Wl,--rpath=@0@'.format(llvm_libdir)
@@ -123,8 +124,7 @@ if with_opencl_icd
configuration : _config,
input : 'mesa.icd.in',
output : 'mesa.icd',
- install : true,
- install_tag : 'runtime',
+ install : false,
install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
)
diff --git a/src/gallium/targets/rusticl/meson.build b/src/gallium/targets/rusticl/meson.build
index b2963fe6dfa..2f784bdccd4 100644
--- a/src/gallium/targets/rusticl/meson.build
+++ b/src/gallium/targets/rusticl/meson.build
@@ -76,8 +76,7 @@ configure_file(
configuration : _config,
input : 'rusticl.icd.in',
output : 'rusticl.icd',
- install : true,
- install_tag : 'runtime',
+ install : false,
install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
)
--
2.40.1

View File

@ -0,0 +1,17 @@
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 8770863eb7c..537f0af112c 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -886,10 +886,11 @@ __glXInitialize(Display * dpy)
Bool zink = False;
Bool try_zink = False;
+ const char *env = getenv("MESA_LOADER_DRIVER_OVERRIDE");
+
#if defined(GLX_DIRECT_RENDERING) && (!defined(GLX_USE_APPLEGL) || defined(GLX_USE_APPLE))
Bool glx_direct = !debug_get_bool_option("LIBGL_ALWAYS_INDIRECT", false);
Bool glx_accel = !debug_get_bool_option("LIBGL_ALWAYS_SOFTWARE", false);
- const char *env = getenv("MESA_LOADER_DRIVER_OVERRIDE");
zink = env && !strcmp(env, "zink");
try_zink = False;

View File

@ -0,0 +1,545 @@
{ lib
, OpenGL
, Xplugin
, bison
, buildPackages
, directx-headers
, elfutils
, expat
, fetchCrate
, fetchurl
, file
, flex
, glslang
, intltool
, jdupes
, libdrm
, libffi
, libglvnd
, libomxil-bellagio
, libunwind
, libva-minimal
, libvdpau
, llvmPackages
, lm_sensors
, meson
, ninja
, openssl
, pkg-config
, python3Packages
, rust-bindgen
, rust-cbindgen
, rustPlatform
, rustc
, spirv-llvm-translator
, stdenv
, udev
, valgrind-light
, vulkan-loader
, wayland
, wayland-protocols
, wayland-scanner
, xcbutilkeysyms
, xorg
, zstd
, withValgrind ?
lib.meta.availableOn stdenv.hostPlatform valgrind-light
&& !valgrind-light.meta.broken
, withLibunwind ? lib.meta.availableOn stdenv.hostPlatform libunwind
, enableGalliumNine ? stdenv.isLinux
, enableOSMesa ? stdenv.isLinux
, enableOpenCL ? stdenv.isLinux && stdenv.isx86_64
, enableTeflon ? stdenv.isLinux && stdenv.isAarch64 # currently only supports aarch64 SoCs, may change in the future
, enablePatentEncumberedCodecs ? true
, galliumDrivers ?
if stdenv.isLinux
then [
"d3d12" # WSL emulated GPU (aka Dozen)
"iris" # new Intel (Broadwell+)
"kmsro" # special "render only" driver for GPUs without a display controller
"nouveau" # Nvidia
"radeonsi" # new AMD (GCN+)
"r300" # very old AMD
"r600" # less old AMD
"swrast" # software renderer (aka LLVMPipe)
"svga" # VMWare virtualized GPU
"virgl" # QEMU virtualized GPU (aka VirGL)
"zink" # generic OpenGL over Vulkan, experimental
] ++ lib.optionals (stdenv.isAarch64 || stdenv.isAarch32) [
"etnaviv" # Vivante GPU designs (mostly NXP/Marvell SoCs)
"freedreno" # Qualcomm Adreno (all Qualcomm SoCs)
"lima" # ARM Mali 4xx
"panfrost" # ARM Mali Midgard and up (T/G series)
"vc4" # Broadcom VC4 (Raspberry Pi 0-3)
] ++ lib.optionals stdenv.isAarch64 [
"tegra" # Nvidia Tegra SoCs
"v3d" # Broadcom VC5 (Raspberry Pi 4)
] ++ lib.optionals stdenv.hostPlatform.isx86 [
"crocus" # Intel legacy, x86 only
"i915" # Intel extra legacy, x86 only
]
else [ "auto" ]
, vulkanDrivers ?
if stdenv.isLinux
then [
"amd" # AMD (aka RADV)
"intel" # new Intel (aka ANV)
"microsoft-experimental" # WSL virtualized GPU (aka DZN/Dozen)
"nouveau" # Nouveau (aka NVK)
"swrast" # software renderer (aka Lavapipe)
] ++ lib.optionals (stdenv.hostPlatform.isAarch -> lib.versionAtLeast stdenv.hostPlatform.parsed.cpu.version "6") [
# QEMU virtualized GPU (aka VirGL)
# Requires ATOMIC_INT_LOCK_FREE == 2.
"virtio"
] ++ lib.optionals stdenv.isAarch64 [
"broadcom" # Broadcom VC5 (Raspberry Pi 4, aka V3D)
"freedreno" # Qualcomm Adreno (all Qualcomm SoCs)
"imagination-experimental" # PowerVR Rogue (currently N/A)
"panfrost" # ARM Mali Midgard and up (T/G series)
] ++ lib.optionals stdenv.hostPlatform.isx86 [
"intel_hasvk" # Intel Haswell/Broadwell, "legacy" Vulkan driver (https://www.phoronix.com/news/Intel-HasVK-Drop-Dead-Code)
]
else [ "auto" ]
, eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" ]
, vulkanLayers ? lib.optionals (!stdenv.isDarwin) [ # No Vulkan support on Darwin
"device-select"
"overlay"
"intel-nullhw"
]
}:
# When updating this package, please verify at least these build (assuming x86_64-linux):
# nix build .#mesa .#pkgsi686Linux.mesa .#pkgsCross.aarch64-multiplatform.mesa .#pkgsMusl.mesa
let
version = "24.1.1";
hash = "sha256-ADiCbG9+iNkLTOb3GRkvpYyn3t9O3KoRdM972SDvieo=";
# Release calendar: https://www.mesa3d.org/release-calendar.html
# Release frequency: https://www.mesa3d.org/releasing.html#schedule
branch = lib.versions.major version;
withLibdrm = lib.meta.availableOn stdenv.hostPlatform libdrm;
haveWayland = lib.elem "wayland" eglPlatforms;
haveZink = lib.elem "zink" galliumDrivers;
haveDozen = (lib.elem "d3d12" galliumDrivers) || (lib.elem "microsoft-experimental" vulkanDrivers);
rustDeps = [
{
pname = "paste";
version = "1.0.14";
hash = "sha256-+J1h7New5MEclUBvwDQtTYJCHKKqAEOeQkuKy+g0vEc=";
}
{
pname = "proc-macro2";
version = "1.0.70";
hash = "sha256-e4ZgyZUTu5nAtaH5QVkLelqJQX/XPj/rWkzf/g2c+1g=";
}
{
pname = "quote";
version = "1.0.33";
hash = "sha256-VWRCZJO0/DJbNu0/V9TLaqlwMot65YjInWT9VWg57DY=";
}
{
pname = "syn";
version = "2.0.39";
hash = "sha256-Mjen2L/omhVbhU/+Ao65mogs3BP3fY+Bodab3uU63EI=";
}
{
pname = "unicode-ident";
version = "1.0.12";
hash = "sha256-KX8NqYYw6+rGsoR9mdZx8eT1HIPEUUyxErdk2H/Rlj8=";
}
];
copyRustDep = dep: ''
cp -R --no-preserve=mode,ownership ${fetchCrate dep} subprojects/${dep.pname}-${dep.version}
cp -R subprojects/packagefiles/${dep.pname}/* subprojects/${dep.pname}-${dep.version}/
'';
copyRustDeps = lib.concatStringsSep "\n" (builtins.map copyRustDep rustDeps);
needNativeCLC = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
self = stdenv.mkDerivation {
pname = "mesa";
inherit version;
src = fetchurl {
urls = [
"https://archive.mesa3d.org/mesa-${version}.tar.xz"
"https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
"ftp://ftp.freedesktop.org/pub/mesa/mesa-${version}.tar.xz"
"ftp://ftp.freedesktop.org/pub/mesa/${version}/mesa-${version}.tar.xz"
"ftp://ftp.freedesktop.org/pub/mesa/older-versions/${branch}.x/${version}/mesa-${version}.tar.xz"
];
inherit hash;
};
patches = [
./opencl.patch
] ++ lib.optionals stdenv.isDarwin [
# Reorder things to make it build on Darwin again
# Submitted upstream: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29592
# FIXME: remove when merged or otherwise addressed
./darwin.patch
];
postPatch = ''
patchShebangs .
# The drirc.d directory cannot be installed to $drivers as that would cause a cyclic dependency:
substituteInPlace src/util/xmlconfig.c --replace \
'DATADIR "/drirc.d"' '"${placeholder "out"}/share/drirc.d"'
substituteInPlace src/util/meson.build --replace \
"get_option('datadir')" "'${placeholder "out"}/share'"
substituteInPlace src/amd/vulkan/meson.build --replace \
"get_option('datadir')" "'${placeholder "out"}/share'"
${copyRustDeps}
'';
outputs = [
"out" "dev" "drivers"
] ++ lib.optionals enableOSMesa [
"osmesa"
] ++ lib.optionals stdenv.isLinux [
"driversdev"
] ++ lib.optionals enableTeflon [
"teflon"
] ++ lib.optionals enableOpenCL [
"opencl"
] ++ lib.optionals haveDozen [
# the Dozen drivers depend on libspirv2dxil, but link it statically, and
# libspirv2dxil itself is pretty chonky, so relocate it to its own output in
# case anything wants to use it at some point
"spirv2dxil"
];
# Keep build-ids so drivers can use them for caching, etc.
# Also some drivers segfault without this.
separateDebugInfo = true;
# Needed to discover llvm-config for cross
preConfigure = ''
PATH=${llvmPackages.libllvm.dev}/bin:$PATH
'';
mesonFlags = [
"--sysconfdir=/etc"
"--datadir=${placeholder "drivers"}/share" # Vendor files
# Don't build in debug mode
# https://gitlab.freedesktop.org/mesa/mesa/blob/master/docs/meson.html#L327
(lib.mesonBool "b_ndebug" true)
(lib.mesonOption "dri-search-path" "${libglvnd.driverLink}/lib/dri")
(lib.mesonOption "platforms" (lib.concatStringsSep "," eglPlatforms))
(lib.mesonOption "gallium-drivers" (lib.concatStringsSep "," galliumDrivers))
(lib.mesonOption "vulkan-drivers" (lib.concatStringsSep "," vulkanDrivers))
(lib.mesonOption "dri-drivers-path" "${placeholder "drivers"}/lib/dri")
(lib.mesonOption "vdpau-libs-path" "${placeholder "drivers"}/lib/vdpau")
(lib.mesonOption "omx-libs-path" "${placeholder "drivers"}/lib/bellagio")
(lib.mesonOption "va-libs-path" "${placeholder "drivers"}/lib/dri")
(lib.mesonOption "d3d-drivers-path" "${placeholder "drivers"}/lib/d3d")
(lib.mesonBool "gallium-nine" enableGalliumNine) # Direct3D in Wine
(lib.mesonBool "osmesa" enableOSMesa) # used by wine
(lib.mesonBool "teflon" enableTeflon) # TensorFlow frontend
(lib.mesonEnable "microsoft-clc" false) # Only relevant on Windows (OpenCL 1.2 API on top of D3D12)
# To enable non-mesa gbm backends to be found (e.g. Nvidia)
(lib.mesonOption "gbm-backends-path" "${libglvnd.driverLink}/lib/gbm:${placeholder "out"}/lib/gbm")
# meson auto_features enables these features, but we do not want them
(lib.mesonEnable "android-libbacktrace" false)
] ++ lib.optionals stdenv.isLinux [
(lib.mesonEnable "glvnd" true)
(lib.mesonBool "install-intel-clc" true)
(lib.mesonEnable "intel-rt" stdenv.isx86_64)
(lib.mesonOption "clang-libdir" "${llvmPackages.clang-unwrapped.lib}/lib")
] ++ lib.optionals stdenv.isDarwin [
# Disable features that are explicitly unsupported on the platform
(lib.mesonEnable "gbm" false)
(lib.mesonEnable "xlib-lease" false)
(lib.mesonEnable "egl" false)
(lib.mesonEnable "gallium-vdpau" false)
(lib.mesonEnable "gallium-va" false)
(lib.mesonEnable "gallium-xa" false)
(lib.mesonEnable "lmsensors" false)
# Dont build with glvnd support to make sure Mesa builds libGL on Darwin
(lib.mesonEnable "glvnd" false)
# This gets enabled by mesonAutoFeatures and fails on aarch64-darwin,
# which makes no sense because Darwin has neither Intel nor RT, but OK
(lib.mesonEnable "intel-rt" false)
] ++ lib.optionals enableOpenCL [
# Clover, old OpenCL frontend
(lib.mesonOption "gallium-opencl" "icd")
(lib.mesonBool "opencl-spirv" true)
# Rusticl, new OpenCL frontend
(lib.mesonBool "gallium-rusticl" true)
] ++ lib.optionals (!withValgrind) [
(lib.mesonEnable "valgrind" false)
] ++ lib.optionals (!withLibunwind) [
(lib.mesonEnable "libunwind" false)
]
++ lib.optionals enablePatentEncumberedCodecs [
(lib.mesonOption "video-codecs" "all")
] ++ lib.optionals (vulkanLayers != []) [
(lib.mesonOption "vulkan-layers" (builtins.concatStringsSep "," vulkanLayers))
] ++ lib.optionals needNativeCLC [
(lib.mesonOption "intel-clc" "system")
];
strictDeps = true;
buildInputs = with xorg; [
expat
glslang
libffi
libglvnd
libvdpau
llvmPackages.libllvm
openssl
zstd
] ++ (with xorg; [
libX11
libXext
libXfixes
libXrandr
libXt
libXvMC
libpthreadstubs
libxcb
libxshmfence
xcbutilkeysyms
xorgproto
]) ++ lib.optionals withLibunwind [
libunwind
] ++ [
python3Packages.python # for shebang
] ++ lib.optionals haveWayland [
wayland
wayland-protocols
] ++ lib.optionals stdenv.isLinux [
libomxil-bellagio
libva-minimal
llvmPackages.clang-unwrapped
llvmPackages.libclc
lm_sensors
spirv-llvm-translator
udev
] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform elfutils) [
elfutils
] ++ lib.optionals enableOpenCL [
llvmPackages.clang
] ++ lib.optionals withValgrind [
valgrind-light
] ++ lib.optionals haveZink [
vulkan-loader
] ++ lib.optionals haveDozen [
directx-headers
];
depsBuildBuild = [
pkg-config
] ++ lib.optionals (!stdenv.isDarwin) [
# Adding this unconditionally makes x86_64-darwin pick up an older
# toolchain, as we explicitly call Mesa with 11.0 stdenv, but buildPackages
# is still 10.something, and Mesa can't build with that.
# FIXME: figure this out, or figure out how to get rid of Mesa on Darwin,
# whichever is easier.
buildPackages.stdenv.cc
];
nativeBuildInputs = [
meson
pkg-config
ninja
intltool
bison
flex
file
python3Packages.python
python3Packages.packaging
python3Packages.pycparser
python3Packages.mako
python3Packages.ply
jdupes
glslang
rustc
rust-bindgen
rust-cbindgen
rustPlatform.bindgenHook
] ++ lib.optionals haveWayland [
wayland-scanner
] ++ lib.optionals needNativeCLC [
buildPackages.mesa.driversdev
];
disallowedRequisites = lib.optionals needNativeCLC [
buildPackages.mesa.driversdev
];
propagatedBuildInputs = (with xorg; [
libXdamage
libXxf86vm
]) ++ lib.optionals withLibdrm [
libdrm
] ++ lib.optionals stdenv.isDarwin [
OpenGL
Xplugin
];
doCheck = false;
postInstall = ''
# Some installs don't have any drivers so this directory is never created.
mkdir -p $drivers $osmesa
'' + lib.optionalString stdenv.isLinux ''
mkdir -p $drivers/lib
if [ -n "$(shopt -s nullglob; echo "$out/lib/libxatracker"*)" -o -n "$(shopt -s nullglob; echo "$out/lib/libvulkan_"*)" ]; then
# move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
mv -t $drivers/lib \
$out/lib/libpowervr_rogue* \
$out/lib/libxatracker* \
$out/lib/libvulkan_*
fi
if [ -n "$(shopt -s nullglob; echo "$out"/lib/lib*_mesa*)" ]; then
# Move other drivers to a separate output
mv -t $drivers/lib $out/lib/lib*_mesa*
fi
# Update search path used by glvnd
for js in $drivers/share/glvnd/egl_vendor.d/*.json; do
substituteInPlace "$js" --replace '"libEGL_' '"'"$drivers/lib/libEGL_"
done
# Update search path used by Vulkan (it's pointing to $out but
# drivers are in $drivers)
for js in $drivers/share/vulkan/icd.d/*.json; do
substituteInPlace "$js" --replace "$out" "$drivers"
done
'' + lib.optionalString enableOpenCL ''
# Move OpenCL stuff
mkdir -p $opencl/lib
mv -t "$opencl/lib/" \
$out/lib/gallium-pipe \
$out/lib/lib*OpenCL*
# We construct our own .icd files that contain absolute paths.
mkdir -p $opencl/etc/OpenCL/vendors/
echo $opencl/lib/libMesaOpenCL.so > $opencl/etc/OpenCL/vendors/mesa.icd
echo $opencl/lib/libRusticlOpenCL.so > $opencl/etc/OpenCL/vendors/rusticl.icd
'' + lib.optionalString enableOSMesa ''
# move libOSMesa to $osmesa, as it's relatively big
mkdir -p $osmesa/lib
mv -t $osmesa/lib/ $out/lib/libOSMesa*
'' + lib.optionalString (vulkanLayers != []) ''
mv -t $drivers/lib $out/lib/libVkLayer*
for js in $drivers/share/vulkan/{im,ex}plicit_layer.d/*.json; do
substituteInPlace "$js" --replace '"libVkLayer_' '"'"$drivers/lib/libVkLayer_"
done
'' + lib.optionalString haveDozen ''
mkdir -p $spirv2dxil/{bin,lib}
mv -t $spirv2dxil/lib $out/lib/libspirv_to_dxil*
mv -t $spirv2dxil/bin $out/bin/spirv2dxil
'';
postFixup = lib.optionalString stdenv.isLinux ''
# set the default search path for DRI drivers; used e.g. by X server
for pc in lib/pkgconfig/{dri,d3d}.pc; do
[ -f "$dev/$pc" ] && substituteInPlace "$dev/$pc" --replace "$drivers" "${libglvnd.driverLink}"
done
# remove pkgconfig files for GL/EGL; they are provided by libGL.
rm -f $dev/lib/pkgconfig/{gl,egl}.pc
# Move development files for libraries in $drivers to $driversdev
mkdir -p $driversdev/include
mv $dev/include/xa_* $dev/include/d3d* -t $driversdev/include || true
mkdir -p $driversdev/lib/pkgconfig
for pc in lib/pkgconfig/{xatracker,d3d}.pc; do
if [ -f "$dev/$pc" ]; then
substituteInPlace "$dev/$pc" --replace $out $drivers
mv $dev/$pc $driversdev/$pc
fi
done
moveToOutput bin/intel_clc $driversdev
# Don't depend on build python
patchShebangs --host --update $out/bin/*
# NAR doesn't support hard links, so convert them to symlinks to save space.
jdupes --hard-links --link-soft --recurse "$drivers"
# add RPATH so the drivers can find the moved libgallium and libdricore9
# moved here to avoid problems with stripping patchelfed files
for lib in $drivers/lib/*.so* $drivers/lib/*/*.so*; do
if [[ ! -L "$lib" ]]; then
patchelf --set-rpath "$(patchelf --print-rpath $lib):$drivers/lib" "$lib"
fi
done
# add RPATH here so Zink can find libvulkan.so
${lib.optionalString haveZink ''
patchelf --add-rpath ${vulkan-loader}/lib $drivers/lib/dri/zink_dri.so
''}
${lib.optionalString enableTeflon ''
moveToOutput lib/libteflon.so $teflon
''}
'';
env.NIX_CFLAGS_COMPILE = toString (
lib.optionals stdenv.isDarwin [
"-fno-common"
] ++ lib.optionals enableOpenCL [
"-UPIPE_SEARCH_DIR"
"-DPIPE_SEARCH_DIR=\"${placeholder "opencl"}/lib/gallium-pipe\""
]);
passthru = {
inherit (libglvnd) driverLink;
inherit llvmPackages;
libdrm = if withLibdrm then libdrm else null;
tests = lib.optionalAttrs stdenv.isLinux {
devDoesNotDependOnLLVM = stdenv.mkDerivation {
name = "mesa-dev-does-not-depend-on-llvm";
buildCommand = ''
echo ${self.dev} >>$out
'';
disallowedRequisites = [ llvmPackages.llvm self.drivers ];
};
};
};
meta = {
description = "Open source 3D graphics library";
longDescription = ''
The Mesa project began as an open-source implementation of the OpenGL
specification - a system for rendering interactive 3D graphics. Over the
years the project has grown to implement more graphics APIs, including
OpenGL ES (versions 1, 2, 3), OpenCL, OpenMAX, VDPAU, VA API, XvMC, and
Vulkan. A variety of device drivers allows the Mesa libraries to be used
in many different environments ranging from software emulation to
complete hardware acceleration for modern GPUs.
'';
homepage = "https://www.mesa3d.org/";
changelog = "https://www.mesa3d.org/relnotes/${version}.html";
license = with lib.licenses; [ mit ]; # X11 variant, in most files
platforms = lib.platforms.mesaPlatforms;
badPlatforms = []; # Load bearing for libGL meta on Darwin.
maintainers = with lib.maintainers; [ primeos vcunat ]; # Help is welcome :)
};
};
in self

View File

@ -0,0 +1,66 @@
diff --git a/meson.build b/meson.build
index fbb0b29322d..b4825056449 100644
--- a/meson.build
+++ b/meson.build
@@ -1805,7 +1805,7 @@ endif
dep_clang = null_dep
if with_clc
- llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
+ llvm_libdir = get_option('clang-libdir')
dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)
diff --git a/meson_options.txt b/meson_options.txt
index e885ba61a8a..591ed957c85 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -23,6 +23,12 @@ option(
description : 'the window system EGL assumes for EGL_DEFAULT_DISPLAY',
)
+option(
+ 'clang-libdir',
+ type : 'string',
+ value : '',
+ description : 'Locations to search for clang libraries.'
+)
option(
'android-stub',
type : 'boolean',
diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
index 7c14135898e..74dc6850603 100644
--- a/src/gallium/targets/opencl/meson.build
+++ b/src/gallium/targets/opencl/meson.build
@@ -39,7 +39,8 @@ if dep_llvm.version().version_compare('>=10.0.0')
polly_isl_dep = cpp.find_library('PollyISL', dirs : llvm_libdir, required : false)
endif
-dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)
+clang_libdir = get_option('clang-libdir')
+dep_clang = cpp.find_library('clang-cpp', dirs : clang_libdir, required : false)
# meson will return clang-cpp from system dirs if it's not found in llvm_libdir
linker_rpath_arg = '-Wl,--rpath=@0@'.format(llvm_libdir)
@@ -123,7 +124,7 @@ if with_opencl_icd
configuration : _config,
input : 'mesa.icd.in',
output : 'mesa.icd',
- install : true,
+ install : false,
install_tag : 'runtime',
install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
)
diff --git a/src/gallium/targets/rusticl/meson.build b/src/gallium/targets/rusticl/meson.build
index b2963fe6dfa..99d6d801b94 100644
--- a/src/gallium/targets/rusticl/meson.build
+++ b/src/gallium/targets/rusticl/meson.build
@@ -76,7 +76,7 @@ configure_file(
configuration : _config,
input : 'rusticl.icd.in',
output : 'rusticl.icd',
- install : true,
+ install : false,
install_tag : 'runtime',
install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
)

View File

@ -0,0 +1,9 @@
final: prev: {
linux-asahi = final.callPackage ./linux-asahi { };
m1n1 = final.callPackage ./m1n1 { };
uboot-asahi = final.callPackage ./uboot-asahi { };
asahi-fwextract = final.callPackage ./asahi-fwextract { };
mesa-asahi-edge = final.callPackage ./mesa-asahi-edge { };
alsa-ucm-conf-asahi = final.callPackage ./alsa-ucm-conf-asahi { inherit (prev) alsa-ucm-conf; };
asahi-audio = final.callPackage ./asahi-audio { };
}

View File

@ -0,0 +1,43 @@
{ lib
, fetchFromGitHub
, buildUBoot
, m1n1
}:
(buildUBoot rec {
src = fetchFromGitHub {
# tracking: https://pagure.io/fedora-asahi/uboot-tools/commits/main
owner = "AsahiLinux";
repo = "u-boot";
rev = "c134629a8bc448e979967bf0632fdd5bb42ee1d7";
hash = "sha256-EPdpyvblkvQrMCiPjX3Bnqp8s/3Yd/gYM1PQu4PDMhs=";
};
version = "2024.04-4-asahi";
defconfig = "apple_m1_defconfig";
extraMeta.platforms = [ "aarch64-linux" ];
filesToInstall = [
"u-boot-nodtb.bin.gz"
"m1n1-u-boot.bin"
];
extraConfig = ''
CONFIG_IDENT_STRING=" ${version}"
CONFIG_VIDEO_FONT_4X6=n
CONFIG_VIDEO_FONT_8X16=n
CONFIG_VIDEO_FONT_SUN12X22=n
CONFIG_VIDEO_FONT_16X32=y
'';
}).overrideAttrs (o: {
# nixos's downstream patches are not applicable
patches = [
];
# DTC= flag somehow breaks DTC compilation so we remove it
makeFlags = builtins.filter (s: (!(lib.strings.hasPrefix "DTC=" s))) o.makeFlags;
preInstall = ''
# compress so that m1n1 knows U-Boot's size and can find things after it
gzip -n u-boot-nodtb.bin
cat ${m1n1}/build/m1n1.bin arch/arm/dts/t[68]*.dtb u-boot-nodtb.bin.gz > m1n1-u-boot.bin
'';
})

Binary file not shown.

Binary file not shown.

31
modules/intel-drivers.nix Normal file
View File

@ -0,0 +1,31 @@
{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.drivers.intel;
in
{
options.drivers.intel = {
enable = mkEnableOption "Enable Intel Graphics Drivers";
};
config = mkIf cfg.enable {
nixpkgs.config.packageOverrides = pkgs: {
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
};
# OpenGL
hardware.opengl = {
extraPackages = with pkgs; [
intel-media-driver
vaapiIntel
vaapiVdpau
libvdpau-va-gl
];
};
};
}

View File

@ -0,0 +1,17 @@
{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.local.hardware-clock;
in
{
options.local.hardware-clock = {
enable = mkEnableOption "Change Hardware Clock To Local Time";
};
config = mkIf cfg.enable { time.hardwareClockInLocalTime = true; };
}

View File

@ -0,0 +1,41 @@
{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.drivers.nvidia;
in
{
options.drivers.nvidia = {
enable = mkEnableOption "Enable Nvidia Drivers";
};
config = mkIf cfg.enable {
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
# Modesetting is required.
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
powerManagement.enable = false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
# Currently alpha-quality/buggy, so false is currently the recommended setting.
open = false;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
};
}

View File

@ -0,0 +1,37 @@
{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.drivers.nvidia-prime;
in
{
options.drivers.nvidia-prime = {
enable = mkEnableOption "Enable Nvidia Prime Hybrid GPU Offload";
intelBusID = mkOption {
type = types.str;
default = "PCI:1:0:0";
};
nvidiaBusID = mkOption {
type = types.str;
default = "PCI:0:2:0";
};
};
config = mkIf cfg.enable {
hardware.nvidia = {
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
# Make sure to use the correct Bus ID values for your system!
intelBusId = "${cfg.intelBusID}";
nvidiaBusId = "${cfg.nvidiaBusID}";
};
};
};
}

View File

@ -0,0 +1,21 @@
{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.vm.guest-services;
in
{
options.vm.guest-services = {
enable = mkEnableOption "Enable Virtual Machine Guest Services";
};
config = mkIf cfg.enable {
services.qemuGuest.enable = true;
services.spice-vdagentd.enable = true;
services.spice-webdavd.enable = true;
};
}

18
scripts/emopicker9000.nix Normal file
View File

@ -0,0 +1,18 @@
{ pkgs }:
pkgs.writeShellScriptBin "emopicker9000" ''
# Get user selection via wofi from emoji file.
chosen=$(cat $HOME/.config/.emoji | ${pkgs.rofi-wayland}/bin/rofi -i -dmenu -config ~/.config/rofi/config-emoji.rasi | awk '{print $1}')
# Exit if none chosen.
[ -z "$chosen" ] && exit
# If you run this command with an argument, it will automatically insert the
# character. Otherwise, show a message that the emoji has been copied.
if [ -n "$1" ]; then
${pkgs.ydotool}/bin/ydotool type "$chosen"
else
printf "$chosen" | ${pkgs.wl-clipboard}/bin/wl-copy
${pkgs.libnotify}/bin/notify-send "'$chosen' copied to clipboard." &
fi
''

62
scripts/list-hypr-bindings.nix Executable file
View File

@ -0,0 +1,62 @@
{ pkgs, host, ... }:
let
inherit (import ../hosts/${host}/variables.nix) terminal browser;
in
pkgs.writeShellScriptBin "list-hypr-bindings" ''
yad --width=800 --height=650 \
--center \
--fixed \
--title="Hyprland Keybindings" \
--no-buttons \
--list \
--column=Key: \
--column=Description: \
--column=Command: \
--timeout=90 \
--timeout-indicator=right \
" = Windows/Super/CAPS LOCK" "Modifier Key, used for keybindings" "Doesn't really execute anything by itself." \
" + ENTER" "Terminal" "${terminal}" \
" + SHIFT + ENTER" "App Launcher" "rofi" \
" + ALT + W" "Change Wallpaper" "wallsetter" \
" + Q" "Kill Focused Window" "killactive" \
" + SHIFT + W" "Search Websites Like Nix Packages" "web-search" \
" + SHIFT + N" "Reload SwayNC Styling" "swaync-client -rs" \
" + W" "Launch Web Browser" "${browser}" \
" + E" "Launch Emoji Selector" "emopicker9000" \
" + S" "Take Screenshot" "screenshootin" \
" + D" "Launch Discord" "discord" \
" + O" "Launch OBS" "obs" \
" + G" "Launch GIMP" "gimp" \
" + N" "Launch New File Browser Window" "thunar" \
" + M" "Launch Spotify" "spotify" \
" + P" "Pseudo Tiling" "pseudo" \
" + SHIFT + I" "Toggle Split Direction" "togglesplit" \
" + F" "Toggle Focused Fullscreen" "fullscreen" \
" + SHIFT + F" "Toggle Focused Floating" "fullscreen" \
" + SHIFT + C" "Quit / Exit Hyprland" "exit" \
" + Left" "Move Focus To Window On The Left" "movefocus,l" \
" + Right" "Move Focus To Window On The Right" "movefocus,r" \
" + Up" "Move Focus To Window On The Up" "movefocus,u" \
" + Down" "Move Focus To Window On The Down" "movefocus,d" \
" + SHIFT + Left" "Move Focused Window Left" "movewindow,l" \
" + SHIFT + Right" "Move Focused Window Right" "movewindow,r" \
" + SHIFT + Up" "Move Focused Window Up" "movewindow,u" \
" + SHIFT + Down" "Move Focused Window Down" "movewindow,d" \
" + H" "Move Focus To Window On The Left" "movefocus,l" \
" + L" "Move Focus To Window On The Right" "movefocus,r" \
" + K" "Move Focus To Window On The Up" "movefocus,u" \
" + J" "Move Focus To Window On The Down" "movefocus,d" \
" + SHIFT + H" "Move Focused Window Left" "movewindow,l" \
" + SHIFT + L" "Move Focused Window Right" "movewindow,r" \
" + SHIFT + K" "Move Focused Window Up" "movewindow,u" \
" + SHIFT + J" "Move Focused Window Down" "movewindow,d" \
" + SPACE" "Toggle Special Workspace" "togglespecialworkspace" \
" + SHIFT + SPACE" "Send Focused Window To Special Workspace" "movetoworkspace,special" \
" + 1-0" "Move To Workspace 1 - 10" "workspace,X" \
" + SHIFT + 1-0" "Move Focused Window To Workspace 1 - 10" "movetoworkspace,X" \
" + MOUSE_LEFT" "Move/Drag Window" "movewindow" \
" + MOUSE_RIGHT" "Resize Window" "resizewindow" \
"ALT + TAB" "Cycle Window Focus + Bring To Front" "cyclenext & bringactivetotop" \
""
''

View File

@ -0,0 +1,9 @@
{ pkgs }:
pkgs.writeShellScriptBin "nvidia-offload" ''
export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
exec "$@"
''

10
scripts/rofi-launcher.nix Normal file
View File

@ -0,0 +1,10 @@
{ pkgs }:
pkgs.writeShellScriptBin "rofi-launcher" ''
if pgrep -x "rofi" > /dev/null; then
# Rofi is running, kill it
pkill -x rofi
exit 0
fi
rofi -show drun
''

View File

@ -0,0 +1,5 @@
{ pkgs }:
pkgs.writeShellScriptBin "screenshootin" ''
grim -g "$(slurp)" - | swappy -f -
''

23
scripts/squirtle.nix Normal file
View File

@ -0,0 +1,23 @@
{ pkgs }:
pkgs.writeShellScriptBin "squirtle" ''
echo "

  
  
  



 
 
 
 
 
 
 
 
 
 
"
''

6
scripts/task-waybar.nix Normal file
View File

@ -0,0 +1,6 @@
{ pkgs }:
pkgs.writeShellScriptBin "task-waybar" ''
sleep 0.1
${pkgs.swaynotificationcenter}/bin/swaync-client -t &
''

24
scripts/wallsetter.nix Normal file
View File

@ -0,0 +1,24 @@
{ pkgs, ... }:
pkgs.writeShellScriptBin "wallsetter" ''
TIMEOUT=720
for pid in $(pidof -o %PPID -x wallsetter); do
kill $pid
done
if ! [ -d ~/Pictures/Wallpapers ]; then notify-send -t 5000 "~/Pictures/Wallpapers does not exist" && exit 1; fi
if [ $(ls -1 ~/Pictures/Wallpapers | wc -l) -lt 1 ]; then notify-send -t 9000 "The wallpaper folder is expected to have more than 1 image. Exiting Wallsetter." && exit 1; fi
while true; do
while [ "$WALLPAPER" == "$PREVIOUS" ]; do
WALLPAPER=$(find ~/Pictures/Wallpapers -name '*' | awk '!/.git/' | tail -n +2 | shuf -n 1)
done
PREVIOUS=$WALLPAPER
${pkgs.swww}/bin/swww img "$WALLPAPER" --transition-type random --transition-step 1 --transition-fps 60
sleep $TIMEOUT
done
''

43
scripts/web-search.nix Normal file
View File

@ -0,0 +1,43 @@
{ pkgs }:
pkgs.writeShellScriptBin "web-search" ''
declare -A URLS
URLS=(
["🌎 Search"]="https://search.brave.com/search?q="
[" Unstable Packages"]="https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query="
["🎞 YouTube"]="https://www.youtube.com/results?search_query="
["🦥 Arch Wiki"]="https://wiki.archlinux.org/title/"
["🐃 Gentoo Wiki"]="https://wiki.gentoo.org/index.php?title="
)
# List for rofi
gen_list() {
for i in "''${!URLS[@]}"
do
echo "$i"
done
}
main() {
# Pass the list to rofi
platform=$( (gen_list) | ${pkgs.wofi}/bin/wofi -dmenu )
if [[ -n "$platform" ]]; then
query=$( (echo ) | ${pkgs.wofi}/bin/wofi -dmenu )
if [[ -n "$query" ]]; then
url=''${URLS[$platform]}$query
xdg-open "$url"
else
exit
fi
else
exit
fi
}
main
exit 0
''