Skip to content

Commit

Permalink
Add DNF5 support (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeeq authored Oct 10, 2024
1 parent a508441 commit 0b08478
Show file tree
Hide file tree
Showing 37 changed files with 1,016 additions and 60 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.retry
.vagrant
playbooks/dnf5
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ Contributions are what make the open source community such an amazing place to b
- <https://www.if-not-true-then-false.com/2015/fedora-nvidia-guide/>

```bash
### Install using .run installer (manually) ###
# Install DKMS to automatically install Nvidia driver when updating kernel
dnf install dkms kernel-devel kernel-headers gcc make acpid libglvnd-glx libglvnd-opengl libglvnd-devel pkgconfig vdpauinfo libva-vdpau-driver libva-utils
Expand Down Expand Up @@ -388,7 +389,45 @@ Contributions are what make the open source community such an amazing place to b
# If you fail to boot to Fedora, you can edit boot entry in grub by clicking "e" in grub bootmenu and in line starting with "linux ..." add at the end "init 3" to boot in multi-user.target (without graphical interface)
# If you are using Secure Boot, during installation of the NVIDIA drivers create new key pair (or use existing one), and if it's a new key pair then add them to UEFI key by executing
mokutil --import /usr/share/nvidia/nvidia-modsign-crt-${id}.der
mkdir -p /usr/share/uefimok/
cp -rfv /usr/share/nvidia/nvidia-modsign-crt-${id}.der /usr/share/uefimok/
cp -rfv /usr/share/nvidia/nvidia-modsign-key-${id}.key /usr/share/uefimok/
mokutil --import /usr/share/uefimok/nvidia-modsign-crt-${id}.der
bash NVIDIA-Linux-x86_64-550.107.02.run --module-signing-secret-key=/usr/share/uefimok/nvidia-modsign-key-${id}.key --module-signing-public-key=/usr/share/uefimok/nvidia-modsign-crt-${id}.der
### Install using packages from CUDA rpm repository ###
# Check latest available rpm repo (fedora40 is not available) - https://developer.download.nvidia.com/compute/cuda/repos/
distro=fedora39
dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/$distro/x86_64/cuda-$distro.repo
dnf -y install dkms
dnf -y module install nvidia-driver:open-dkms
dnf -y install nvidia-container-toolkit
# Make sure you're running desktop in X11 mode, wayland is a bit laggy still
# xorg.conf can be generated from nvidia-settings
# Enroll MOK key if you're using SecureBoot
## You can check by which key the kernel module is signed by, by executing: modinfo nvidia-drm, and then try to find it locally (i.e.: in dkms config file)
mokutil --import /var/lib/dkms/mok.pub
### Enabling wayland
## vi /etc/dracut.conf.d/nvidia.conf
force_drivers+=" nvidia nvidia_modeset nvidia_uvm nvidia_drm "
## vi /etc/modprobe.d/nvidia.conf
options nvidia_drm modeset=1 fbdev=1
##
mv /usr/lib/udev/rules.d/61-gdm.rules /root/61-gdm.rules
dracut -f
```

12. To fix purple'ish screen, enable OC and Fan control (I recommend to use GreenWithEnvy - gwe (installed using flatpak)) apply those changes to `/etc/X11/xorg.conf`:
Expand Down Expand Up @@ -480,6 +519,18 @@ flatpak override com.valvesoftware.Steam --filesystem=${PATH_TO_FILESYSTEM}
18. Terminator fails to open with an error `terminator:24:<module>:ModuleNotFoundError: No module named 'psutil'`, try reinstalling `dnf reinstall python3-psutil` to fix it
19. Enable tabs scrolling in firefox:
```
### about:config
# tabs mouse scrolling
toolkit.tabbox.switchByScrolling = true
# if google docs crashes, page jumps
gfx.canvas.accelerated = false
```
<!-- LICENSE -->
## License
Expand Down
1 change: 1 addition & 0 deletions playbooks/generic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
- apps/terraform
- apps/terragrunt
- apps/terraform-docs
- apps/azure-functions-core-tools
3 changes: 3 additions & 0 deletions playbooks/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ dnf_gui_pkgs:
- vlc
- wireshark

dnf_extra_pkgs: []

snap_apps: []

snap_classic_apps: []
Expand Down Expand Up @@ -167,6 +169,7 @@ vscode_extensions:
- eamodio.gitlens
- hashicorp.terraform
- hediet.vscode-drawio
- mhutchie.git-graph
- ms-azure-devops.azure-pipelines
- ms-azuretools.vscode-docker
- ms-dotnettools.csharp
Expand Down
11 changes: 9 additions & 2 deletions playbooks/group_vars/x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ architecture_common_name: "amd64"

# Flatpak is better for GUI applications
flatpak_apps:
# - name: com.valvesoftware.Steam
# remote: flathub
- name: com.valvesoftware.Steam
remote: flathub
# - name: com.skype.Client
# remote: flathub
# - name: org.signal.Signal
Expand All @@ -18,8 +18,15 @@ flatpak_apps:
remote: flathub
- name: com.discordapp.Discord
remote: flathub
- name: com.mastermindzh.tidal-hifi
remote: flathub
- name: com.leinardi.gwe
remote: flathub

# https://github.com/ishantanu/awesome-kubectl-plugins
krew_plugins:
- sniff
- hns

dnf_extra_pkgs:
- steam-devices
14 changes: 5 additions & 9 deletions playbooks/vms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
hosts: clevo
become: true
tasks:
- name: Upgrade all packages
ansible.builtin.dnf:
name: "*"
state: latest
update_cache: true
# - name: Clean DNF
# shell: dnf clean all

- import_tasks: roles/pkg_mgmt/dnf/tasks/dnf5.yml
- import_tasks: roles/pkg_mgmt/dnf/tasks/update.yml

- name: Check if reboot required
stat:
Expand All @@ -26,10 +26,6 @@
- reboot_required_file.stat.exists == true
- inventory_hostname != "mikeeClevo"

- name: Autoremove unneeded packages installed as dependencies
ansible.builtin.dnf:
autoremove: yes

- name: Set variables on an imported playbook
ansible.builtin.import_playbook: generic-core.yml
vars:
Expand Down
13 changes: 13 additions & 0 deletions roles/apps/azure-functions-core-tools/tasks/get_latest_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- name: Get latest version azure_functions_core_tools
shell: curl -Is https://github.com/Azure/azure-functions-core-tools/releases/latest | grep -i 'location:' | rev | cut -d'/' -f1 | rev
register: version
changed_when: false

- name: "Latest version of azure_functions_core_tools:"
debug:
var: version.stdout

- name: "Set fact with latest version of azure_functions_core_tools"
set_fact:
azure_functions_core_tools_version: "{{ version.stdout }}"
29 changes: 29 additions & 0 deletions roles/apps/azure-functions-core-tools/tasks/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
- name: Directory for azure_functions_core_tools
file:
path: "{{ item }}"
state: directory
loop:
- "/tmp/azure_functions_core_tools"
- "/opt/azure_functions_core_tools"

- name: Download azure_functions_core_tools binary
get_url:
url: "https://github.com/Azure/azure-functions-core-tools/releases/download/{{ azure_functions_core_tools_version }}/Azure.Functions.Cli.linux-x64.{{ azure_functions_core_tools_version }}.zip"
dest: /tmp/azure_functions_core_tools/azure_functions_core_tools.zip

- name: Unarchive a file that is already on the remote machine
unarchive:
src: /tmp/azure_functions_core_tools/azure_functions_core_tools.zip
dest: /opt/azure_functions_core_tools
remote_src: yes

- name: Set executable permissions
file:
path: "/opt/azure_functions_core_tools/{{ item }}"
mode: 0755
owner: root
group: root
loop:
- func
- gozip
3 changes: 3 additions & 0 deletions roles/apps/azure-functions-core-tools/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- include_tasks: setup.yml
when: ansible_architecture == "x86_64"
18 changes: 18 additions & 0 deletions roles/apps/azure-functions-core-tools/tasks/setup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Get installed version of azure_functions_core_tools
become: true
become_user: "{{ user_name }}"
shell: /opt/azure_functions_core_tools/func --version
register: installed_azure_functions_core_tools_version
changed_when: false
ignore_errors: true

- name: "Installed version of azure_functions_core_tools:"
debug:
var: installed_azure_functions_core_tools_version.stdout

- include_tasks: get_latest_version.yml
when: azure_functions_core_tools_version is not defined

- include_tasks: install.yml
when: installed_azure_functions_core_tools_version.stdout != azure_functions_core_tools_version
2 changes: 1 addition & 1 deletion roles/apps/docker/tasks/repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
ansible.builtin.replace:
path: /etc/yum.repos.d/docker-ce.repo
regexp: '\$releasever'
replace: '36'
replace: '40'
when: releasever_check.stdout == "rawhide"
2 changes: 1 addition & 1 deletion roles/apps/netcore_sdk/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

- name: netcore sdk
package:
name: "dotnet-sdk-6.0"
name: "dotnet-sdk-8.0"
state: present
4 changes: 3 additions & 1 deletion roles/apps/oh_my_zsh/templates/oh_my_zsh_zshrc.j2
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ plugins=(
ansible
fzf
dnf
z
colored-man-pages
{% if item != 'root' %}
vscode
terraform
Expand All @@ -29,7 +31,7 @@ plugins=(
source $ZSH/oh-my-zsh.sh

{% if item != 'root' %}
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$HOME/.cargo/bin:$PATH"
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$HOME/.cargo/bin:/opt/azure_functions_core_tools:$PATH"
{% endif %}

# Extracting Dockerfile from image
Expand Down
2 changes: 1 addition & 1 deletion roles/apps/vagrant/tasks/install_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
when: vagrant_version is not defined

# name: "https://releases.hashicorp.com/vagrant/{{ version.stdout }}/vagrant_{{ version.stdout }}_x86_64.rpm"
- name: Install vagrant from hashcorp repo
- name: Install vagrant from hashicorp repo
dnf:
name: "https://releases.hashicorp.com/vagrant/{{ version.stdout }}/vagrant-{{ version.stdout }}-1.x86_64.rpm"
state: latest
Expand Down
1 change: 0 additions & 1 deletion roles/apps/vagrant/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
# Vagrant is not available for arm64 linux.
- include_tasks: install.yml
# when: ansible_architecture == "x86_64"
6 changes: 5 additions & 1 deletion roles/desktop/apps/vscode/files/work/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// path .vscode/settings.json
// sudo /bin/bash -c "echo \"$(whereis -b firefox | awk '{print $2}') -P WORK \\\"\\\$@\\\" \" > \"$(whereis -b firefox | awk '{print $2}')_WORK\""
// sudo chmod +x $(whereis -b firefox | awk '{print $2}')_WORK
{
"terminal.integrated.defaultProfile.linux": "zshWORK_VAR",
"terminal.integrated.profiles.linux" :{
Expand All @@ -23,5 +25,7 @@
"/home/mikee/.work_profiles/WORK_VAR/.kube/config"
],
"vs-kubernetes.kubeconfig": "/home/mikee/.work_profiles/WORK_VAR/.kube/config"
}
},
"ansible.python.interpreterPath": "/bin/python",
"workbench.externalBrowser": "firefox_WORK"
}
22 changes: 22 additions & 0 deletions roles/desktop/gnome/tasks/extensions_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,28 @@
label: "{{ item.item.item.json.name }}"
when: not item is skipped

- name: Generate schemas Gnome Shell extensions
become: true
become_user: "{{ user_name }}"
shell: glib-compile-schemas .
args:
chdir: ~/.local/share/gnome-shell/extensions/{{ item.item.item.json.uuid }}/schemas
loop: "{{ download_gnome_shell_extensions.results }}"
loop_control:
label: "{{ item.item.item.json.name }}"
when: not item is skipped
register: gnome_shell_extension_info

- name: Enable Gnome Shell extensions
become: true
become_user: "{{ user_name }}"
shell: gnome-extensions enable "{{ item.item.item.json.uuid }}"
loop: "{{ download_gnome_shell_extensions.results }}"
loop_control:
label: "{{ item.item.item.json.name }}"
when: not item is skipped
register: gnome_shell_extension_info

# - name: Enable Gnome Shell extensions
# become: true
# become_user: "{{ user_name }}"
Expand Down
19 changes: 18 additions & 1 deletion roles/desktop/gnome/tasks/gsettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
become_user: "{{ user_name }}"
dconf:
key: "/org/gnome/shell/favorite-apps"
value: "['google-chrome.desktop', 'firefox.desktop', 'terminator.desktop', 'code.desktop', 'com.discordapp.Discord.desktop', 'com.slack.Slack.desktop', 'com.skype.Client.desktop', 'keeweb.desktop', 'com.spotify.Client.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Software.desktop', 'org.gnome.tweaks.desktop', 'gnome-control-center.desktop']"
value: "['firefox.desktop', 'terminator.desktop', 'code.desktop', 'com.discordapp.Discord.desktop', 'com.slack.Slack.desktop', 'com.skype.Client.desktop', 'keeweb.desktop', 'com.spotify.Client.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Software.desktop', 'org.gnome.tweaks.desktop', 'gnome-control-center.desktop']"
state: present

# Alternate-tab is deprecated in Fedora 30
Expand Down Expand Up @@ -180,6 +180,23 @@
value: "false"
state: present

- name: "Disable workspaces only on primary screen"
become: true
become_user: "{{ user_name }}"
dconf:
key: "/org/gnome/mutter/workspaces-only-on-primary"
value: "false"
state: present

- name: "Set color-scheme to dark"
become: true
become_user: "{{ user_name }}"
dconf:
key: "/org/gnome/desktop/interface/color-scheme"
value: "'prefer-dark'"
state: present


# - name: "dash-to-dock position"
# become: true
# become_user: "{{ user_name }}"
Expand Down
1 change: 1 addition & 0 deletions roles/desktop/gnome/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@

- import_tasks: gsettings.yml
- import_tasks: extensions_manual.yml
# - import_tasks: extensions.yml
- import_tasks: remote_desktop.yml
23 changes: 23 additions & 0 deletions roles/pkg_mgmt/dnf/tasks/dnf5.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- name: Check dnf symlink target
stat:
path: /usr/bin/dnf
register: dnf_symlink

# - debug:
# var: dnf_symlink

- name: Install dnf5
dnf:
name: ["dnf5", "python3-libdnf5"]
state: present
# when: dnf_symlink.stat.lnk_target == "dnf-3"

- name: Create a symbolic link
ansible.builtin.file:
src: /usr/bin/dnf
dest: dnf5
owner: root
group: root
state: link
# when: dnf_symlink.stat.lnk_target == "dnf-3"
4 changes: 3 additions & 1 deletion roles/pkg_mgmt/dnf/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
---
- import_tasks: dnf5.yml
- import_tasks: repos.yml

- name: "[DNF] Install Apps"
dnf:
dnf5:
name: "{{ item }}"
state: present
with_items:
- "[{{ generic_pkgs }}]"
- "[{{ dnf_pkgs }}]"
- "[{{ dnf_gui_pkgs }}]"
- "[{{ dnf_extra_pkgs }}]"

- import_tasks: update.yml
tags:
Expand Down
Loading

0 comments on commit 0b08478

Please sign in to comment.