Compare commits

..

1 commit

Author SHA1 Message Date
6c4377f7e1 Add emacs 2024-05-28 20:46:24 +02:00
39 changed files with 2188 additions and 430 deletions

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
result
*.swp
*.qcow2
.idea/

View file

@ -10,6 +10,31 @@ nixos-rebuild switch --flake flake_path_directory#hostname
nix flake update --extra-experimental-features "nix-command flakes"
```
## Configure VM
Configure VM
```nix
users.users.<user>.initialPassword = "<password>";
virtualisation.vmVariant = {
# following configuration is added only when building VM with build-vm
virtualisation = {
memorySize = <RAM in MiB>; # Use 8192MiB memory.
cores = <CPU Core number>;
# And more here https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/virtualisation/qemu-vm.nix
};
};
```
Build
```bash
nixos-rebuild build-vm --flake .#nixos-test
```
Run
```bash
./result/bin/run-nixos-vm-vm
```
## Show changements between revisions
@ -47,6 +72,36 @@ error: cached failure of attribute 'nixosConfigurations.perso-desktop.config.sys
sudo rm -fr /root/.cache/nix/
```
## If package is marked as insecure
Example:
> error: Package 'nix-2.16.2' in /nix/store/nra828scc8qs92b9pxra5csqzffb6hpl-source/pkgs/tools/package-management/nix/default.nix:229 is marked as insecure, refusing to evaluate.
>
> Known issues:
> - CVE-2024-27297
```bash
nix path-info -r /run/current-system | grep nix-2.16.2
```
Result:
> [...]
>
> /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2
>
> [...]
```bash
nix-store -q --referrers /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2
```
Result:
> /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2
>
> /nix/store/72pfc05339izcwqhlbs8441brrdasas7-nix-2.16.2-dev
>
> /nix/store/ln2z5d5izn8icm3wx94ci13ad19lzjhr-nixd-1.2.3
nixd is not up to date and require nix 2.16.2
## To limit resources use during build

36
flake.lock generated
View file

@ -12,11 +12,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1723293904,
"narHash": "sha256-b+uqzj+Wa6xgMS9aNbX4I+sXeb5biPDi39VgvSFqFvU=",
"lastModified": 1716561646,
"narHash": "sha256-UIGtLO89RxKt7RF2iEgPikSdU53r6v/6WYB0RW3k89I=",
"owner": "ryantm",
"repo": "agenix",
"rev": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41",
"rev": "c2fc0762bbe8feb06a2e59a364fa81b3a57671c9",
"type": "github"
},
"original": {
@ -251,11 +251,11 @@
]
},
"locked": {
"lastModified": 1726036828,
"narHash": "sha256-ZQHbpyti0jcAKnwQY1lwmooecLmSG6wX1JakQ/eZNeM=",
"lastModified": 1716736760,
"narHash": "sha256-h3RmnNknKYtVA+EvUSra6QAwfZjC2q1G8YA7W0gat8Y=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "8a1671642826633586d12ac3158e463c7a50a112",
"rev": "5d151429e1e79107acf6d06dcc5ace4e642ec239",
"type": "github"
},
"original": {
@ -345,11 +345,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1725983898,
"narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=",
"lastModified": 1716509168,
"narHash": "sha256-4zSIhSRRIoEBwjbPm3YiGtbd8HDWzFxJjw5DYSDy1n8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43",
"rev": "bfb7a882678e518398ce9a31a881538679f6f092",
"type": "github"
},
"original": {
@ -375,21 +375,6 @@
"type": "github"
}
},
"nur": {
"locked": {
"lastModified": 1726059953,
"narHash": "sha256-uuqSnIgC2g3W6wk6Of1HvOFgFvo5Q+h0469VwMzDaBI=",
"owner": "nix-community",
"repo": "NUR",
"rev": "72296d37a29541a017e545c8f4e2c5c37dbaba59",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NUR",
"type": "github"
}
},
"ob-racket": {
"flake": false,
"locked": {
@ -493,8 +478,7 @@
"nix-doom-emacs": "nix-doom-emacs",
"nix-flatpak": "nix-flatpak",
"nix-straight": "nix-straight",
"nixpkgs": "nixpkgs",
"nur": "nur"
"nixpkgs": "nixpkgs"
}
},
"rotate-text": {

View file

@ -3,7 +3,6 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nur.url = github:nix-community/NUR;
home-manager = {
url = "github:nix-community/home-manager";
@ -36,7 +35,6 @@
outputs = inputs@{
nixpkgs,
nur,
home-manager,
agenix,
nix-flatpak,
@ -59,7 +57,6 @@
./hosts/${s.name}/configuration.nix
home-manager.nixosModules.home-manager
agenix.nixosModules.default
{ nixpkgs.overlays = [ nur.overlay ]; }
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;

View file

@ -13,6 +13,10 @@
kitty.enable = true;
};
editors = {
vscode.enable = true;
};
shell = {
zsh.enable = true;
atuin.enable = true;

View file

@ -20,10 +20,6 @@
networking.hostName = "nixos-desktop-perso"; # Define your hostname.
modules.system = {
apps = {
steam.enable = true;
};
desktop = {
plasma.enable = true;
};
@ -38,9 +34,5 @@
printing.enable = true;
waydroid.enable = true;
};
server = {
distrobox.enable = true;
};
};
}

View file

@ -8,12 +8,15 @@
modules.home = {
apps = {
chromium.enable = true;
firefox.enable = true;
flatpak.enable = true;
jetbrainsToolbox.enable = true;
kitty.enable = true;
};
editors = {
vscode.enable = true;
};
shell = {
zsh.enable = true;
atuin.enable = true;

View file

@ -13,6 +13,10 @@
kitty.enable = true;
};
editors = {
vscode.enable = true;
};
shell = {
zsh.enable = true;
atuin.enable = true;

View file

@ -19,18 +19,18 @@
networking.hostName = "nixos-laptop-pro"; # Define your hostname.
# hardware.nvidia.prime = {
# offload = {
# enable = true;
# enableOffloadCmd = true;
# };
#
# # Make sure to use the correct Bus ID values for your system!
# # information bus: pci@0000:00:02.0
# intelBusId = "PCI:0:2:0";
# # information bus: pci@0000:01:00.0
# nvidiaBusId = "PCI:1:0:0";
# };
hardware.nvidia.prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
# Make sure to use the correct Bus ID values for your system!
# information bus: pci@0000:00:02.0
intelBusId = "PCI:0:2:0";
# information bus: pci@0000:01:00.0
nvidiaBusId = "PCI:1:0:0";
};
modules.system = {
desktop = {
@ -47,9 +47,5 @@
printing.enable = true;
waydroid.enable = true;
};
server = {
distrobox.enable = true;
};
};
}

View file

@ -8,12 +8,15 @@
modules.home = {
apps = {
chromium.enable = true;
firefox.enable = true;
flatpak.enable = true;
jetbrainsToolbox.enable = true;
kitty.enable = true;
};
editors = {
vscode.enable = true;
};
shell = {
zsh.enable = true;
atuin.enable = true;

View file

@ -1,5 +0,0 @@
{ ... }:
{
nix.settings.experimental-features = [ "nix-command" "flakes" ];
}

View file

@ -1,9 +1,8 @@
{ ... }:
{ config, pkgs, ... }:
{
imports = [
./chromium
./firefox
./flatpak
./jetbrainsToolbox
./kitty

View file

@ -1,44 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.modules.home.apps.firefox;
in
{
options.modules.home.apps.firefox = {
enable = mkEnableOption ''
Enable firefox with my custom configurations
'';
};
config = mkIf cfg.enable {
programs.firefox = {
enable = true;
nativeMessagingHosts = [
pkgs.kdePackages.plasma-browser-integration
];
profiles = {
perso = {
id = 0;
name = "Perso";
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
ublock-origin
bitwarden
floccus
plasma-integration
istilldontcareaboutcookies
darkreader
];
settings = {
# Enable multi-pip
"media.videocontrols.picture-in-picture.allow-multiple" = true;
};
};
};
};
};
}

View file

@ -12,6 +12,7 @@ in
};
config = mkIf cfg.enable {
services.flatpak = {
enable = true;
@ -20,15 +21,22 @@ in
packages = [
# Gaming
{ appId = "com.discordapp.Discord"; origin = "flathub"; }
{ appId = "com.valvesoftware.Steam"; origin = "flathub"; }
{ appId = "net.lutris.Lutris"; origin = "flathub"; }
# Pro
{ appId = "com.slack.Slack"; origin = "flathub"; }
{ appId = "com.skype.Client"; origin = "flathub"; }
{ appId = "org.mozilla.Thunderbird"; origin = "flathub"; }
{ appId = "ch.protonmail.protonmail-bridge"; origin = "flathub"; }
{ appId = "org.kde.neochat"; origin = "flathub"; }
# Loisir
{ appId = "com.spotify.Client"; origin = "flathub"; }
{ appId = "io.gitlab.news_flash.NewsFlash"; origin = "flathub"; }
{ appId = "org.videolan.VLC"; origin = "flathub"; }
{ appId = "com.obsproject.Studio"; origin = "flathub"; }
{ appId = "io.github.achetagames.epic_asset_manager"; origin = "flathub"; }
];
};
};

View file

@ -11,6 +11,6 @@ in
'';
};
config = mkIf cfg.enable {
home.packages = with pkgs; [jetbrains-toolbox graalvm-ce];
home.packages = with pkgs; [jetbrains-toolbox];
};
}

View file

@ -2,7 +2,6 @@
{
imports = [
../common.nix
./apps
./editors
./desktop
@ -17,5 +16,6 @@
};
programs.home-manager.enable = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
}

View file

@ -26,7 +26,6 @@ in
userTasks = {};
# Waiting https://github.com/nix-community/home-manager/pull/5640 to support multi-profiles support
extensions = with pkgs; with vscode-extensions; [
# Nix
bbenoist.nix

View file

@ -13,20 +13,10 @@ in
config = mkIf cfg.enable {
programs.git = {
enable = true;
lfs.enable = true;
userName = "Florian RICHER";
userEmail = "florian.richer@protonmail.com";
signing = {
signByDefault = true;
key = "B19E3F4A2D806AB4793FDF2FC73D37CBED7BFC77";
};
extraConfig = {
url."https://invent.kde.org/".insteadOf = "kde:";
url."ssh://git@invent.kde.org/".pushInsteadOf = "kde:";
};
# signing.signByDefault = true;
};
};
}

View file

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

View file

@ -1,22 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.modules.system.apps.steam;
in
{
options.modules.system.apps.steam = {
enable = mkEnableOption ''
Enable steam with my custom configurations
'';
};
config = mkIf cfg.enable {
programs.steam = {
enable = true;
extraPackages = with pkgs; [ gamescope ];
extraCompatPackages = with pkgs; [ proton-ge-bin ];
};
hardware.steam-hardware.enable = true;
};
}

View file

@ -1,10 +1,6 @@
{ pkgs, ... }:
{
imports = [
../common.nix
];
# Set your time zone.
time.timeZone = "Europe/Paris";
@ -25,39 +21,13 @@
nixpkgs.config.allowUnfree = true;
services.udev.packages = [ pkgs.yubikey-personalization ];
services.pcscd.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim
nixd
# Usefull tools to debug
gdb
lldb
gammaray # QT Inspector
yubikey-manager
# Usefull for automatic informations collect software like KDE
vulkan-tools # For vulkaninfo command
wayland-utils # For wayland-info command
glxinfo
clinfo
aha
usbutils
pciutils
];
services.fwupd.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.florian = {
isNormalUser = true;
@ -67,10 +37,6 @@
services.flatpak.enable = true; # Important can't be enabled from home-manager
# Downloads and provides debug symbols and source code for nix derivations to gdb and other debuginfod-capable debuggers as needed.
# Require https://github.com/symphorien/nixseparatedebuginfod?tab=readme-ov-file#gdb
services.nixseparatedebuginfod.enable = true;
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary

View file

@ -2,7 +2,6 @@
{
imports = [
./apps
./desktop
./hardware
./server

View file

@ -26,6 +26,17 @@ in
environment.systemPackages = with pkgs; with kdePackages; [
krfb # Use by kdeconnect for virtualmonitorplugin "krfb-virtualmonitor"
discover
# Usefull for automatic informations collect software like KDE
vulkan-tools # For vulkaninfo command
wayland-utils # For wayland-info command
glxinfo
clinfo
];
# Uncomment when kwin is available in nixpkgs and NVIDIA 555
nixpkgs.overlays = [
(import ../../../../overlays/kwin)
];
};
}

View file

@ -11,51 +11,41 @@ in
'';
};
config = mkIf cfg.enable {
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = ["nvidia"];
hardware = {
graphics = {
enable = true;
enable32Bit = true;
};
hardware.nvidia = {
# Modesetting is required.
modesetting.enable = true;
nvidia-container-toolkit.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;
nvidia = {
# Modesetting is required.
modesetting.enable = true;
# 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;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
# Enable this if you have graphical corruption issues or application crashes after waking
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
# of just the bare essentials.
powerManagement.enable = true;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
# 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 = true;
# 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.latest;
};
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.beta;
};
# boot.extraModprobeConfig = ''
# options nvidia NVreg_EnableGpuFirmware=0
# '';
};
}

View file

@ -12,6 +12,7 @@ in
};
config = mkIf cfg.enable {
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {

View file

@ -2,9 +2,7 @@
{
imports = [
./distrobox
./docker
./ollama
./openssh
];
}

View file

@ -1,17 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.modules.system.server.distrobox;
in
{
options.modules.system.server.distrobox = {
enable = mkEnableOption ''
Enable distrobox with my custom configurations
'';
};
config = mkIf cfg.enable {
modules.system.server.docker.enable = true;
environment.systemPackages = with pkgs; [ distrobox ];
};
}

View file

@ -13,8 +13,7 @@ in
config = mkIf cfg.enable {
virtualisation.docker = {
enable = true;
enableNvidia = config.modules.system.hardware.nvidia.enable;
};
users.users.florian.extraGroups = [ "docker" ];
};
}

View file

@ -1,21 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.modules.system.server.ollama;
nvidiaEnabled = config.modules.system.hardware.nvidia.enable;
in
{
options.modules.system.server.ollama = {
enable = mkEnableOption ''
Enable ollama with my custom configurations
'';
};
config = mkIf cfg.enable {
services.ollama = {
enable = true;
acceleration = if nvidiaEnabled then "cuda" else null;
};
};
}

View file

2027
overlays/kwin/5511.patch Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,9 @@
self: super: {
kdePackages = super.kdePackages.overrideScope (kde-self: kde-super: rec {
kwin = kde-super.kwin.overrideAttrs (oldAttrs: rec {
patches = oldAttrs.patches ++ [
./5511.patch # https://invent.kde.org/plasma/kwin/-/merge_requests/5511
];
});
});
}

View file

@ -1,30 +0,0 @@
## If package is marked as insecure
Example:
> error: Package 'nix-2.16.2' in /nix/store/nra828scc8qs92b9pxra5csqzffb6hpl-source/pkgs/tools/package-management/nix/default.nix:229 is marked as insecure, refusing to evaluate.
>
> Known issues:
> - CVE-2024-27297
```bash
nix path-info -r /run/current-system | grep nix-2.16.2
```
Result:
> [...]
>
> /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2
>
> [...]
```bash
nix-store -q --referrers /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2
```
Result:
> /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2
>
> /nix/store/72pfc05339izcwqhlbs8441brrdasas7-nix-2.16.2-dev
>
> /nix/store/ln2z5d5izn8icm3wx94ci13ad19lzjhr-nixd-1.2.3
nixd is not up to date and require nix 2.16.2

View file

@ -1,24 +0,0 @@
# Required for kde-builder command
if [[ $PATH != *".local/bin"* ]]; then
export PATH="$HOME/.local/bin:$PATH"
fi
# Workaround for NixOS
# ENVs have nix store references and made conflict during build or run of KDE Apps, Shells, Frameworks
alias new_shell="env -u PATH -u QML2_IMPORT_PATH -u QT_PLUGIN_PATH -u NIXPKGS_QT6_QML_IMPORT_PATH -u XDG_CONFIG_DIRS bash -l"
alias build_plasma_mobile="kde-builder plasma-mobile plasma-settings plasma-desktop kactivitymanagerd"
function run_mobile() {
source "$HOME/kde/build/plasma-mobile/prefix.sh"
QT_QPA_PLATFORM=offscreen plasma-mobile-envmanager --apply-settings
# Environment variables
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export QT_QUICK_CONTROLS_MOBILE=1
export PLASMA_PLATFORM=phone:handheld
export QT_QUICK_CONTROLS_STYLE=org.kde.breeze
QT_QPA_PLATFORM=wayland dbus-run-session kwin_wayland --xwayland "plasmashell -p org.kde.plasma.mobileshell" --width 360 --height 720
}

View file

@ -1,20 +0,0 @@
#!/bin/bash
if ! grep -Fxq "source ~/.kde_bashrc" ~/.bashrc
then
cp .kde_bashrc ~/.kde_bashrc
echo "source ~/.kde_bashrc" > ~/.bashrc
source ~/.bashrc
fi
echo "Installing kde-builder"
curl 'https://invent.kde.org/sdk/kde-builder/-/raw/master/scripts/initial_setup.sh?ref_type=heads' > ~/initial_setup.sh
bash ~/initial_setup.sh && rm ~/initial_setup.sh
echo "Run initial setup from kde-builder"
kde-builder --initial-setup
echo "Install missing dependencies"
sudo dnf install qt6-*-devel librsvg2-devel
echo "Configuration DONE"

View file

@ -1,6 +0,0 @@
[kdedev]
image=quay.io/fedora/fedora:latest
home="${HOME}/.distrobox_home/kdedev"
nvidia=true
root=false
pull=true

View file

@ -1,19 +0,0 @@
# How to develop on KDE
## First configuration
1. `distrobox assemble`
> You can add --replace to recreate distrobox container
2. `distrobox enter kdedev`
3. `bash configure.sh`
4. `kde-builder run solid`
> You use NixOS ? It's necessary to run `new_shell` alias before.
> The alias unset all nixos env variables with nix store references to avoid conflicts with build or run of KDE Shells/Apps/Tools.
## Usefull config in ~/.config/kdesrc-buildrc
Autogenerate editor configuration
- generate-clion-project-config
- generate-vscode-project-config
- generate-qtcreator-project-config

View file

@ -1,36 +0,0 @@
# Example for ollama
```nix
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.modules.system.server.ollama;
nvidiaEnabled = config.modules.system.hardware.nvidia.enable;
nixpkgsPr = builtins.fetchTarball {
url = "https://github.com/abysssol/nixpkgs/archive/ollama-driver-runpath.tar.gz";
sha256 = "1ixfvdpi2v4r9yrkvqnfk9whs8lyjhrkdph47bcznh8ak9aipr8p";
};
in
{
disabledModules = [ "services/misc/ollama.nix" ];
imports = [
(import "${nixpkgsPr}/nixos/modules/services/misc/ollama.nix")
];
options.modules.system.server.ollama = {
enable = mkEnableOption ''
Enable ollama with my custom configurations
'';
};
config = mkIf cfg.enable {
services.ollama = {
enable = true;
package = (import nixpkgsPr { inherit (pkgs) system; config.allowUnfree = true; }).ollama;
acceleration = if nvidiaEnabled then "cuda" else null;
};
};
}
```

View file

@ -1,24 +0,0 @@
## Configure VM
Configure VM
```nix
users.users.<user>.initialPassword = "<password>";
virtualisation.vmVariant = {
# following configuration is added only when building VM with build-vm
virtualisation = {
memorySize = <RAM in MiB>; # Use 8192MiB memory.
cores = <CPU Core number>;
# And more here https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/virtualisation/qemu-vm.nix
};
};
```
Build
```bash
nixos-rebuild build-vm --flake .#nixos-test
```
Run
```bash
./result/bin/run-nixos-vm-vm
```