Initial Changes - UNTESTED

This commit is contained in:
JaKooLit
2024-09-04 19:37:57 +09:00
parent 7fa4262b33
commit 2b89222b17
77 changed files with 14326 additions and 4 deletions

128
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
mail[at]ml4w.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

View File

@@ -0,0 +1,149 @@
# Commit Message Guidelines
A good commit message should be descriptive and provide context about the changes made. This makes it easier to understand and review the changes in the future.
Here are some guidelines for writing descriptive commit messages:
- Start with a short summary of the changes made in the commit.
- Use imperative mood for the summary, as if you're giving a command. For example, "Add feature" instead of "Added feature".
- Provide additional details in the commit message body, if necessary. This could include the reason for the change, the impact of the change, or any dependencies that were introduced or removed.
- Keep the message within 72 characters per line to ensure that it's easy to read in Git log output.
Examples of good commit messages:
- "Add authentication feature for user login"
- "Fix bug causing application to crash on startup"
- "Update documentation for API endpoints"
Remember, writing descriptive commit messages can save time and frustration in the future, and help others understand the changes made to the codebase.
## Commit Message Types
Here's a more comprehensive list of commit types that you can use:
`feat`: Adding a new feature to the project
```markdown
feat: Add multi-image upload support
```
`fix`: Fixing a bug or issue in the project
```markdown
fix: Fix bug causing application to crash on startup
```
`docs`: Updating documentation in the project
```markdown
docs: Update documentation for API endpoints
```
`style`: Making cosmetic or style changes to the project (such as changing colors or formatting code)
```markdown
style: Update colors and formatting
```
`refactor`: Making code changes that don't affect the behavior of the project, but improve its quality or maintainability
```markdown
refactor: Remove unused code
```
`test`: Adding or modifying tests for the project
```markdown
test: Add tests for new feature
```
`chore`: Making changes to the project that don't fit into any other category, such as updating dependencies or configuring the build system
```markdown
chore: Update dependencies
```
`perf`: Improving performance of the project
```markdown
perf: Improve performance of image processing
```
`security`: Addressing security issues in the project
```markdown
security: Update dependencies to address security issues
```
`merge`: Merging branches in the project
```markdown
merge: Merge branch 'feature/branch-name' into develop
```
`revert`: Reverting a previous commit
```markdown
revert: Revert "Add feature"
```
`build`: Making changes to the build system or dependencies of the project
```markdown
build: Update dependencies
```
`ci`: Making changes to the continuous integration (CI) system for the project
```markdown
ci: Update CI configuration
```
`config`: Making changes to configuration files for the project
```markdown
config: Update configuration files
```
`deploy`: Making changes to the deployment process for the project
```markdown
deploy: Update deployment scripts
```
`init`: Creating or initializing a new repository or project
```markdown
init: Initialize project
```
`move`: Moving files or directories within the project
```markdown
move: Move files to new directory
```
`rename`: Renaming files or directories within the project
```markdown
rename: Rename files
```
`remove`: Removing files or directories from the project
```markdown
remove: Remove files
```
`update`: Updating code, dependencies, or other components of the project
```markdown
update: Update code
```
These are just some examples, and you can create your own custom commit types as well. However, it's important to use them consistently and write clear, descriptive commit messages to make it easy for others to understand the changes you've made.
**Important:** If you are planning to use a custom commit message type other than the ones listed above, make sure to add it to this list so that others can understand it as well. Create a pull request to add it to this file.

70
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,70 @@
# Contributing to Community Standards
Thank you for your interest in contributing to Community Standards! We welcome any contributions, including bug fixes, feature enhancements, documentation improvements, and other general improvements.
## Getting Started
1. Fork the branch development repository to your GitHub account. This will create a copy of this repository in your account. You can make changes to this copy without affecting the original repository.
- For fork this repository, click the **Fork** button in the top right corner of this page or click [here](https://github.com/JaKooLit/Arch-Hyprland/fork).
- Make sure to uncheck the Copy the `main` branch only. This will copy the development branch and other branches (if any)
2. Clone your forked repository to your local machine.
- Use the following command to clone your forked repository to your local machine.
```bash
git clone --depth=1 -b development https://github.com/JaKooLit/Arch-Hyprland.git
```
3. Create a new branch for your changes.
- For example, to create a new branch named `your-branch-name`, use the following command.
```bash
git checkout -b your-branch-name
```
4. Make your changes and commit them with a descriptive commit message.
- For example, to commit your changes, use the following command and make sure to follow the [commit message guidelines](https://github.com/JaKooLit/Arch-Hyprland/blob/main/COMMIT_MESSAGE_GUIDELINES.md).
```bash
git commit -m "feat: add a new feature"
```
5. Push your changes to your forked repository.
- For example, to push your changes to your forked repository, use the following command.
```bash
git push origin your-branch-name
```
6. Submit a **pull request** to the development branch repository.
- For example, to create a pull request, use the following steps.
1. Go to your forked repository.
2. Click the **Compare & pull request** button next to your `your-branch-name` branch.
3. Add a title and description for your pull request.
4. Click **Create pull request** and remember to add the relevant labels with using the [pull request template](https://github.com/JaKooLit/Arch-Hyprland/blob/main/.github/PULL_REQUEST_TEMPLATE.md).
## Guidelines
- Follow the code style of the project.
- Update the **documentation** if necessary.
- Add tests if applicable.
- Make sure all tests pass or fully tested before submitting your changes.
- Keep your pull request focused and avoid including unrelated changes.
- Remember to follow the following files before submitting your changes.
- [bug_report.md](https://github.com/JaKooLit/Arch-Hyprland/blob/main/.github/ISSUE_TEMPLATE/bug_report.md) - Use this template to create a report to help us improve.
- [feature_request.md](https://github.com/JaKooLit/Arch-Hyprland/blob/main/.github/ISSUE_TEMPLATE/feature_request.md) - Use this template to suggest a feature for this project.
- [documentation_update.md](https://github.com/JaKooLit/Arch-Hyprland/blob/main/.github/ISSUE_TEMPLATE/documentation_update.md) - Use this template to propose a change to the documentation.
- [custom.md](https://github.com/JaKooLit/Arch-Hyprland/blob/main/.github/ISSUE_TEMPLATE/custom.md) - Use this template to submit a custom issue.
- [PULL_REQUEST_TEMPLATE.md](https://github.com/JaKooLit/Arch-Hyprland/blob/main/.github/PULL_REQUEST_TEMPLATE.md) - Use this template to submit a pull request.
- [COMMIT_MESSAGE_GUIDELINES.md](https://github.com/JaKooLit/Arch-Hyprland/blob/main/COMMIT_MESSAGE_GUIDELINES.md) - Read this file to learn about the commit message guidelines.
- [CONTRIBUTING.md](https://github.com/JaKooLit/Arch-Hyprland/blob/main/CONTRIBUTING.md) - Read this file to learn about the contributing guidelines.
- [LICENSE](https://github.com/JaKooLit/Arch-Hyprland/blob/main/LICENSE.md) - Read this file to learn about the license.
- [README.md](https://github.com/JaKooLit/Arch-Hyprland/blob/main/README.md) - Read this file to learn about the project.
## Contact
If you have any questions, feel free to contact via [GitHub Discussions](https://github.com/JaKooLit/Arch-Hyprland/discussions) or [Through Discord Server](https://discord.gg/V2SJ92vbEN)

View File

@@ -1,8 +1,5 @@
# NixOS-Hyprland
ITS A Work in Progress
NO Home Manager
Installer inspired from ZaneyOS
Installer inspired from ZaneyOS

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

219
config/hyprland.nix Normal file
View File

@@ -0,0 +1,219 @@
{
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
bezier = overshot, 0.05, 0.9, 0.1, 1.05
bezier = smoothOut, 0.5, 0, 0.99, 0.99
bezier = smoothIn, 0.5, -0.5, 0.68, 1.5
animation = windows, 1, 6, wind, slide
animation = windowsIn, 1, 5, winIn, slide
animation = windowsOut, 1, 3, smoothOut, slide
animation = windowsMove, 1, 5, wind, slide
animation = border, 1, 1, liner
animation = borderangle, 1, 180, liner, loop #used by rainbow borders and rotating colors
animation = fade, 1, 3, smoothOut
animation = workspaces, 1, 5, overshot
# animations for -git or version >0.42.0
#animation = workspacesIn, 1, 5, winIn, slide
#animation = workspacesOut, 1, 5, winOut, slide
}
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},D,exec,rofi-launcher
bind = ${modifier}SHIFT,S,exec,web-search
bind = ${modifier},W,exec,wallsetter
bind = ${modifier}SHIFT,N,exec,swaync-client -rs
#bind = ${modifier},W,exec,${browser}
bind = ${modifier}SHIFT,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 = CTRL ALT, Delete, exec, hyprctl dispatch exit 0
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": "center",
"positionY": "top",
"control-center-margin-top": 5,
"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": 400,
"control-center-height": 720,
"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

38
flake.nix Normal file
View File

@@ -0,0 +1,38 @@
{
description = "KooL's NixOS-Hyprland";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
#wallust.url = "git+https://codeberg.org/explosion-mental/wallust?ref=dev";
hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; # hyprland development
distro-grub-themes.url = "github:AdisonCavani/distro-grub-themes";
};
outputs =
inputs@{ self,nixpkgs, ... }:
let
system = "x86_64-linux";
host = "NixOS-Hyprland"
username = "ja"; e
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
};
in
{
nixosConfigurations = {
"${host}" = nixpkgs.lib.nixosSystem rec {
specialArgs = {
inherit system;
inherit inputs;
inherit username;
inherit host;
};
modules = [ ./${host}/configuration.nix ];
};
};
};
}

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

@@ -0,0 +1,467 @@
{
config, pkgs, host, username, host, options, inputs, ...}: 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 related stuff
boot = {
kernelPackages = pkgs.linuxPackages_latest; # Kernel
kernelParams = [
"systemd.mask=systemd-vconsole-setup.service"
"systemd.mask=dev-tpmrm0.device" #this is to mask that stupid 1.5 mins systemd bug
"nowatchdog"
"modprobe.blacklist=sp5100_tco" #watchdog for AMD
"modprobe.blacklist=iTCO_wdt" #watchdog for Intel
];
# 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 SystemD
loader.systemd-boot.enable = true;
loader.efi = {
#efiSysMountPoint = "/efi"; #this is if you have separate /efi partition
canTouchEfiVariables = true;
timeout = 1;
};
# Bootloader GRUB
#loader.grub = {
enable = true;
devices = [ "nodev" ];
efiSupport = true;
gfxmodeBios = "auto";
memtest86.enable = true;
extraGrubInstallArgs = [ "--bootloader-id=${host}" ];
configurationName = "${host}";
};
# 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;
};
# 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 = "Asia/Seoul";
# 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 = {
hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; #hyprland-git
portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland; # xdph
xwayland.enable = true;
};
xwayland.enable = true;
waybar.enable = true;
hyprlock.enable = true;
firefox.enable = true;
git.enable = true;
thunar.enable = true;
thunar.plugins = with pkgs.xfce; [
exo
mousepad
thunar-archive-plugin
thunar-volman
tumbler
];
dconf.enable = true;
seahorse.enable = true;
fuse.userAllowOther = true;
mtr.enable = true;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
virt-manager.enable = false;
#steam = {
# enable = true;
# gamescopeSession.enable = true;
# remotePlay.openFirewall = true;
# dedicatedServer.openFirewall = true;
#};
};
xdg.portal.enable = true;
xdg.portal.extraPortals = with pkgs; [
xdg-desktop-portal-gtk
];
nixpkgs.config.allowUnfree = true;
users = {
mutableUsers = true;
};
environment.systemPackages = with pkgs; [
# System Packages
baobab
btrfs-progs
cpufrequtils
duf
ffmpeg
glib #for gsettings to work
killall
libappindicator
libnotify
openssl #required by Rainbow borders
vim
wget
xdg-user-dirs
xdg-utils
fastfetch
(mpv.override {scripts = [mpvScripts.mpris];}) # with tray
ranger
# Hyprland Stuff | Laptop related stuff on a separate .nix
ags
btop
cava
cliphist
eog
gnome-system-monitor
file-roller
grim
gtk-engine-murrine #for gtk themes
hyprcursor # requires unstable channel
hypridle # requires unstable channel
inxi
jq
kitty
libsForQt5.qtstyleplugin-kvantum #kvantum
networkmanagerapplet
nwg-look # requires unstable channel
nvtopPackages.full
pamixer
pavucontrol
playerctl
polkit_gnome
pyprland
qt5ct
qt6ct
qt6.qtwayland
qt6Packages.qtstyleplugin-kvantum #kvantum
rofi-wayland
slurp
swappy
swaynotificationcenter
swww
unzip
wallust
wl-clipboard
wlogout
yad
#waybar # if wanted experimental next line
#(pkgs.waybar.overrideAttrs (oldAttrs: { mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];}))
]) ++ [
python-packages
];
# FONTS
fonts.packages = with pkgs; [
noto-fonts
fira-code
noto-fonts-cjk
jetbrains-mono
font-awesome
terminus_font
(nerdfonts.override {fonts = ["JetBrainsMono"];})
];
# Services to start
services = {
xserver = {
enable = false;
xkb = {
layout = "${keyboardLayout}";
variant = "";
};
};
greetd = {
enable = true;
vt = 3;
settings = {
default_session = {
user = username;
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland"; # start Hyprland with a TUI login manager
};
};
};
smartd = {
enable = false;
autodetect = true;
};
envfs.enable = true;
libinput.enable = true;
fstrim.enable = true;
gvfs.enable = true;
dbus.enable = true;
openssh.enable = false;
flatpak.enable = false;
#printing = {
# enable = false;
# 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;
wireplumber.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 stuff
hardware = {
bluetooth = {
enable = true;
powerOnBoot = true;
settings = {
General = {
Enable = "Source,Sink,Media,Socket";
Experimental = true;
};
};
};
#sane = {
#enable = true;
#extraBackends = [ pkgs.sane-airscan ];
#disabledDefaultBackends = [ "escl" ];
#};
# Extra Logitech Support
logitech.wireless.enable = false;
logitech.wireless.enableGraphical = false;
pulseaudio.enable = false; # Enable sound with pipewire.
# CPU Microcodes update
cpu.amd.updateMicrocode = true;
graphics = {
enable = true;
enable32Bit = true;
};
};
# Security / Polkit
security = {
pam.services.swaylock.text = "auth include login";
polkit.enable = true;
rtkit.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;
}
})
'';
# zram
zramSwap = {
enable = true;
priority = 100;
memoryPercent = 30;
swapDevices = 1;
};
# Cachix 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;
#};
console.keyMap = "${keyboardLayout}";
# SYSTEMD
systemd.services = {
NetworkManager-wait-online.enable = false;
firewalld.enable = true;
power-profiles-daemon = {
enable = true;
wantedBy = [ "multi-user.target" ];
};
};
systemd.extraConfig = ''
DefaultTimeoutStartSec=5s
DefaultTimeoutStopSec=5s
'';
# Masking sleep, hibernate, suspend
systemd = {
targets = {
sleep = {
enable = false;
unitConfig.DefaultDependencies = "no";
};
suspend = {
enable = false;
unitConfig.DefaultDependencies = "no";
};
hibernate = {
enable = false;
unitConfig.DefaultDependencies = "no";
};
"hybrid-sleep" = {
enable = false;
unitConfig.DefaultDependencies = "no";
};
};
};
services = {
blueman.enable = true;
#hardware.openrgb.enable = true;
#hardware.openrgb.motherboard = "amd";
};
# For Electron apps to use wayland
environment.sessionVariables.NIXOS_OZONE_WL = "1";
# 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;
}

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

@@ -0,0 +1,60 @@
{
pkgs,
username,
...
}:
let
inherit (import ./variables.nix) gitUsername;
in
{
users.users = {
"${username}" = {
homeMode = "755";
isNormalUser = true;
description = "${gitUsername}";
extraGroups = [
"networkmanager"
"wheel"
"libvirtd"
"scanner"
"lp"
"video"
"input"
"audio"
];
defaultUserShell = pkgs.zsh;
packages = with pkgs; [
];
};
environment.shells = with pkgs; [ zsh ];
};
environment.systemPackages = with pkgs; [
fzf
];
programs = {
# Zsh configuration
zsh = {
enable = true;
enableCompletion = true;
ohMyZsh = {
enable = true;
plugins = ["git"];
theme = "xiong-chiamiov-plus";
};
autosuggestions.enable = true;
syntaxHighlighting.enable = true;
promptInit = ''
#krabby random --no-mega --no-gmax --no-regional --no-title -s;
source <(fzf --zsh);
HISTFILE=~/.zsh_history;
HISTSIZE=10000;
SAVEHIST=10000;
setopt appendhistory;
'';
};
}

View File

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

168
install.sh Executable file
View File

@@ -0,0 +1,168 @@
#!/usr/bin/env bash
# Set some colors for output messages
OK="$(tput setaf 2)[OK]$(tput sgr0)"
ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)"
NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)"
WARN="$(tput setaf 166)[WARN]$(tput sgr0)"
CAT="$(tput setaf 6)[ACTION]$(tput sgr0)"
ORANGE=$(tput setaf 166)
YELLOW=$(tput setaf 3)
RESET=$(tput sgr0)
if [ -n "$(grep -i nixos < /etc/os-release)" ]; then
echo "Verified this is NixOS."
echo "-----"
else
echo "$ERROR This is not NixOS or the distribution information is not available."
exit
fi
if command -v git &> /dev/null; then
echo "$OK Git is installed, continuing with installation."
echo "-----"
else
echo "$ERROR Git is not installed. Please install Git and try again."
echo "Example: nix-shell -p git"
exit
fi
echo "$NOTE Default options are in brackets []"
echo "$NOTE Just press enter to select the default"
sleep 2
echo "-----"
echo "Ensure In Home Directory"
cd || exit
echo "-----"
read -rp "$CAT Enter Your New Hostname: [ default ] " hostName
if [ -z "$hostName" ]; then
hostName="default"
fi
echo "-----"
backupname=$(date "+%Y-%m-%d-%H-%M-%S")
if [ -d "NixOS-Hyprland" ]; then
echo "NixOS-Hyprland exists, backing up to NixOS-Hyprland-backups folder."
if [ -d "NixOS-Hyprland-backups" ]; then
echo "Moving current version of NixOS-Hyprland to backups folder."
mv "$HOME"/NixOS-Hyprland NixOS-Hyprland-backups/"$backupname"
sleep 1
else
echo "Creating the backups folder & moving NixOS-Hyprland to it."
mkdir -p NixOS-Hyprland-backups
mv "$HOME"/NixOS-Hyprland NixOS-Hyprland-backups/"$backupname"
sleep 1
fi
else
echo "$ORANGE Thank you for choosing KooL's NixOS-Hyprland"
echo "$ORANGE I hope you find your time here enjoyable!"
fi
echo "-----"
echo "Cloning & Entering NixOS-Hyprland Repository"
git clone --depth 1 https://github.com/JaKooLit/NixOS-Hyprland.git
cd NixOS-Hyprland || 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 "$CAT 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 ~/NixOS-Hyprland/#${hostName}
sleep 1
# GTK Themes and Icons installation
printf "Installing GTK-Themes and Icons..\n"
if [ -d "GTK-themes-icons" ]; then
echo "$NOTE GTK themes and Icons folder exist..deleting..."
rm -rf "GTK-themes-icons"
fi
echo "$NOTE Cloning GTK themes and Icons repository..."
if git clone https://github.com/JaKooLit/GTK-themes-icons.git ; then
cd GTK-themes-icons
chmod +x auto-extract.sh
./auto-extract.sh
cd ..
echo "$OK Extracted GTK Themes & Icons to ~/.icons & ~/.themes folders"
else
echo "$ERROR Download failed for GTK themes and Icons.."
fi
tar -xf "assets/Bibata-Modern-Ice.tar.xz" -C ~/.icons
echo "$OK Extracted Bibata-Modern-Ice.tar.xz to ~/.icons folder."
sleep 1
# KooL's Dots installation
printf "$NOTE Downloading Hyprland dots from main..\n"
if [ -d Hyprland-Dots ]; then
cd Hyprland-Dots
git stash
git pull
git stash apply
chmod +x copy.sh
./copy.sh
else
if git clone --depth 1 https://github.com/JaKooLit/Hyprland-Dots; then
cd Hyprland-Dots || exit 1
chmod +x copy.sh
./copy.sh
else
echo -e "$ERROR Can't download Hyprland-Dots"
fi
fi
# Check if hyprland is installed
if nix-env -q hyprland >/dev/null 2>&1; then
printf "\n${OK} Yey! Installation Completed.\n"
sleep 2
printf "\n${NOTE} You can start Hyprland by typing Hyprland (IF SDDM is not installed) (note the capital H!).\n"
printf "\n${NOTE} It is highly recommended to reboot your system.\n\n"
# Prompt user to reboot
read -rp "${CAT} Would you like to reboot now? (y/n): " HYP
if [[ "$HYP" =~ ^[Yy]$ ]]; then
sudo systemctl reboot
fi
else
# Print error message if neither package is installed
printf "\n${WARN} Hyprland failed to install. Please check Install-Logs...\n\n"
exit 1
fi

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;
};
}