Refactoring the config

This commit is contained in:
Lyes Saadi 2024-11-10 18:06:07 +01:00
parent 9c3fc1879c
commit 0e866b1cb0
No known key found for this signature in database
GPG key ID: 17418538BAA17767
24 changed files with 355 additions and 304 deletions

View file

@ -0,0 +1,45 @@
{ nixpkgs-unstable, ... }:
{
imports =
[
./packages.nix
./system.nix
];
# Import local packages
nixpkgs.overlays = [
(final: prev: {
local = import ../../pkgs { pkgs = final; };
})
# Unstable
(final: prev: {
unstable = import nixpkgs-unstable {
system = prev.system;
};
})
];
nixpkgs.config.allowUnfree = true;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
nix.optimise.automatic = true;
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
# 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 = "22.11"; # Did you read the comment?
}

View file

@ -0,0 +1,32 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
# Utilities
neovim
helix
wget
ripgrep
eza
bat
tree
dust
pciutils
man-pages
man-pages-posix
python3
any-nix-shell
# Nix
home-manager
nix-index
direnv
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
}

38
modules/common/system.nix Normal file
View file

@ -0,0 +1,38 @@
{ pkgs, ... }:
{
# Time
time.timeZone = "Europe/Paris";
# Locale
i18n.defaultLocale = "fr_FR.UTF-8";
# Keyboard
console = {
font = "Lat2-Terminus16";
# keyMap = "fr";
useXkbConfig = true;
};
services.xserver.xkb.layout = "fr";
services.xserver.xkb.variant = "oss";
# Shell
programs.fish.enable = true;
programs.fish.promptInit = ''
any-nix-shell fish --info-right | source
'';
environment.shells = with pkgs; [ fish ];
# Environment Variables
environment.sessionVariables = {
EDITOR = "hx";
};
# Documentation
documentation.enable = true;
documentation.man.enable = true;
documentation.dev.enable = true;
# Fails for some reason
documentation.nixos.enable = true;
}

8
modules/default.nix Normal file
View file

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

View file

@ -0,0 +1,10 @@
{ ... }:
{
imports =
[
./networking.nix
./packages.nix
./system.nix
];
}

View file

@ -0,0 +1,62 @@
{ pkgs, lib, ... }:
{
# Networking
networking.networkmanager.enable = true;
networking.nameservers = [
"9.9.9.9"
"149.112.112.112"
"1.1.1.1#one.one.one.one"
"1.0.0.1#one.one.one.one"
"2620:fe::fe"
"2620:fe::9"
];
services.resolved = {
enable = true;
dnssec = "true";
domains = [ "~." ];
fallbackDns = [
"9.9.9.9"
"149.112.112.112"
"1.1.1.1#one.one.one.one"
"1.0.0.1#one.one.one.one"
"2620:fe::fe"
"2620:fe::9"
];
# extraConfig = ''
# DNSOverTLS=yes
# '';
};
# Captive portals
programs.captive-browser = {
enable = true;
interface = "wlp9s0";
};
# Firewall
networking.firewall.allowedTCPPorts = [ 24872 8998 ];
networking.firewall.allowedUDPPorts = [ 24872 8998 ];
# networking.firewall.enable = false;
# Network services
#services.openssh.enable = true;
#services.syncplay = {
# enable = true;
# port = 8998;
# extraArgs = [ "--password pouicbarilstepson123cassoulet" ];
#};
# Bluetooth
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
# KDE Connect
programs.kdeconnect = {
enable = true;
package = lib.mkDefault pkgs.gnomeExtensions.gsconnect;
};
}

View file

@ -0,0 +1,251 @@
{ pkgs, lib, config, ... }:
let
tex = (pkgs.texlive.combine { inherit (pkgs.texlive)
scheme-medium
lettre
wallpaper
lastpage
hyphenat
moresize
fontawesome5
montserrat
titlesec
ly1
footmisc
titling
frpseudocode
ebproof
comment;
});
in {
# Packages
environment.systemPackages = with pkgs; [
# Web
fragments
dropbox
varia
filezilla
whatip
epiphany
organicmaps
# Messaging
thunderbird-128
discord
vesktop
whatsapp-for-linux
# element-desktop
fractal
zoom-us
# Image
drawing
gimp
loupe
snapshot
# Video
mpv
vlc
syncplay
obs-studio
yt-dlp
handbrake
kooha
video-trimmer
# Audio
shortwave
gnome-podcasts
helvum
local.quadcastrgb
# Games
heroic
# cemu
prismlauncher
vvvvvv
ryujinx
# dolphin-emu
parsec-bin
# Reading
# calibre
papers
# Office
libreoffice
onlyoffice-bin
hunspell
hunspellDicts.fr-reforme1990
hunspellDicts.fr-any
hunspellDicts.fr-moderne
hunspellDicts.en_US
hunspellDicts.en_GB-ize
# Note taking
apostrophe
setzer
tex
pandoc
typst
tinymist
zotero
# Programming
git
git-lfs
vscode
unstable.zed-editor
gcc
rustup
python3
ocaml
ocamlPackages.ocaml-lsp
ocamlPackages.ocamlformat
opam
ledit
nodejs
nil
# Containers & VMs
toolbox
distrobox
gnome.gnome-boxes
# Virtualization
qemu
virt-manager
# System
gnome-firmware
# Utilities
impression
resources
gnome.file-roller
baobab
# Proton
protonmail-bridge-gui
protonmail-desktop
protonvpn-gui
unstable.proton-pass
# Customization
gnome.gnome-tweaks
gnome-extension-manager
adw-gtk3
paper-icon-theme
# gnomeExtensions.gsconnect
# Multimedia
pipewire.dev
pulseaudio
libopus
# Printing
hplipWithPlugin
];
# Flatpaks
services.flatpak = lib.mkIf (config?services.flatpak.packages) {
remotes = lib.mkOptionDefault [{
name = "gnome-nightly";
location = "https://nightly.gnome.org/gnome-nightly.flatpakrepo";
}];
packages = [
# Video
"org.nickvision.tubeconverter"
# Reading
"com.github.johnfactotum.Foliate"
# Science
"com.github.alexhuntley.Plots"
# Office
"com.belmoussaoui.Obfuscate"
"com.github.muriloventuroso.pdftricks"
"com.github.flxzt.rnote"
"com.github.jeromerobert.pdfarranger"
"garden.jamie.Morphosis"
# Utilities
"com.belmoussaoui.Decoder"
"io.github.nokse22.minitext"
"org.gnome.World.PikaBackup"
# Customization
"ca.desrt.dconf-editor"
"app.drey.Damask"
"com.github.GradienceTeam.Gradience"
"com.github.tchx84.Flatseal"
# Games
"com.usebottles.bottles"
"dev.tchx84.Gameeky"
"dev.tchx84.Gameeky.ThematicPack.FreedomValley"
"dev.tchx84.Gameeky.ThematicPack.Blasterman"
"dev.tchx84.Gameeky.ThematicPack.Wackman"
# Programming
{ appId = "org.gnome.Builder.Devel"; origin = "gnome-nightly"; }
"app.drey.Biblioteca"
];
uninstallUnmanaged = true;
update.onActivation = true;
update.auto.enable = true;
};
fonts = {
enableDefaultPackages = true;
packages = with pkgs; [
noto-fonts
noto-fonts-cjk-sans
noto-fonts-lgc-plus
noto-fonts-emoji
cantarell-fonts
twitter-color-emoji
(nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
];
fontDir.enable = true;
fontconfig = {
defaultFonts = {
sansSerif = [ "Cantarell" "Noto Sans" ];
monospace = [ "JetBrainsMono Nerd Font" ];
emoji = [ "Twitter Color Emoji" "Noto Color Emoji" ];
};
};
};
nixpkgs.overlays = [
# Version pins
(final: prev: {
dolphin-emu = prev.dolphin-emu.overrideAttrs (super: {
version = "2407";
commit = "b92e354389bb7c0bd114a8631b8af110d3cb3a14";
src = pkgs.fetchFromGitHub {
owner = "dolphin-emu";
repo = "dolphin";
rev = "heads/refs/tags/${final.dolphin-emu.version}";
hash = "sha256-8W4KyIj+rhDkWnQogjpzlEJVo3HJenfpWKimSyMGN7c=";
fetchSubmodules = true;
};
cmakeFlags = [
"-DDISTRIBUTOR=NixOS"
"-DDOLPHIN_WC_BRANCH=${final.dolphin-emu.src.rev}"
"-DDOLPHIN_WC_DESCRIBE=${final.dolphin-emu.version}"
"-DDOLPHIN_WC_REVISION=${final.dolphin-emu.commit}"
];
});
})
];
}

100
modules/desktop/system.nix Normal file
View file

@ -0,0 +1,100 @@
{ pkgs, ... }:
{
# Boot
boot.plymouth.enable = true;
# Filesystems
boot.supportedFilesystems = [ "ntfs" ];
# Firmware
services.fwupd.enable = true;
# Fingerprint
services.fprintd.enable = true;
security.pam.services.login.fprintAuth = false;
security.pam.services.gdm-fingerprint.text = ''
auth required pam_shells.so
auth requisite pam_nologin.so
auth requisite pam_faillock.so preauth
auth required ${pkgs.fprintd}/lib/security/pam_fprintd.so
auth optional pam_permit.so
auth required pam_env.so
auth [success=ok default=1] ${pkgs.gnome.gdm}/lib/security/pam_gdm.so
auth optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so
account include login
password required pam_deny.so
session include login
session optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so auto_start
'';
# Touchpad
services.libinput.enable = true;
# Printing
services.printing.enable = true;
services.avahi.enable = true;
services.avahi.nssmdns4 = true;
services.avahi.openFirewall = true;
# Graphics
services.xserver.enable = true;
programs.xwayland.enable = true;
environment.sessionVariables.NIXOS_OZONE_WL = "1";
# GNOME
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
environment.gnome.excludePackages = [ pkgs.evince ];
# KDE
# services.desktopManager.plasma6.enable = true;
# programs.ssh.askPassword = lib.mkForce "${pkgs.gnome.seahorse}/libexec/seahorse/ssh-askpass";
programs.dconf.enable = true;
services.flatpak.enable = true;
services.joycond.enable = true;
programs.joycond-cemuhook.enable = true;
# Firefox config
programs.firefox = {
enable = true;
package = (pkgs.wrapFirefox (pkgs.firefox-beta-unwrapped.override { pipewireSupport = true;}) {});
# Doesn't work ?
# languagePacks = [ "fr" "en-US" ];
};
xdg.portal.enable = true;
# Sound
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
#jack.enable = true;
};
# Virtualisation
virtualisation.libvirtd.enable = true;
# virtualisation.virtualbox.host.enable = true;
# virtualisation.virtualbox.host.enableExtensionPack = true;
# users.extraGroups.vboxusers.members = [ "lyes" ];
virtualisation.waydroid.enable = true;
# Containers
virtualisation.containers.enable = true;
virtualisation.podman = {
enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
extraPackages = [ pkgs.zfs ];
};
}

View file

@ -0,0 +1,12 @@
{ pkgs, ... }:
{
programs.steam.enable = true;
programs.steam.gamescopeSession.enable = true;
programs.gamemode.enable = true;
environment.systemPackages = with pkgs; [
mangohud
protonup
];
}

View file

@ -0,0 +1,39 @@
{ ... }:
{
# NVidia
services.xserver.videoDrivers = [ "nvidia" ];
hardware.graphics = {
enable = true;
enable32Bit = true;
};
hardware.nvidia = {
# Modesetting is needed for most wayland compositors
modesetting.enable = true;
# Use the open source version of the kernel module
# Only available on driver 515.43.04+
open = true;
# Enable the nvidia settings menu
nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU
# package = config.boot.kernelPackages.nvidiaPackages.vulkan_beta;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
# For containers
hardware.nvidia-container-toolkit.enable = true;
}

View file

@ -0,0 +1,15 @@
{ lib, ... }:
{
specialisation = {
gaming.configuration = {
hardware.nvidia = {
prime.sync.enable = lib.mkForce true;
prime.offload = {
enable = lib.mkForce false;
enableOffloadCmd = lib.mkForce false;
};
};
};
};
}

View file

@ -0,0 +1,23 @@
{ lib, ... }:
{
specialisation = {
kde-gaming.configuration = {
hardware.nvidia = {
prime.sync.enable = lib.mkForce true;
prime.offload = {
enable = lib.mkForce false;
enableOffloadCmd = lib.mkForce false;
};
};
# GNOME
services.xserver.displayManager.gdm.enable = lib.mkForce false;
services.xserver.desktopManager.gnome.enable = lib.mkForce false;
# KDE
services.desktopManager.plasma6.enable = true;
services.displayManager.sddm.enable = true;
};
};
}

View file

@ -0,0 +1,15 @@
{ lib, ... }:
{
specialisation = {
kde.configuration = {
# GNOME
services.xserver.displayManager.gdm.enable = lib.mkForce false;
services.xserver.desktopManager.gnome.enable = lib.mkForce false;
# KDE
services.desktopManager.plasma6.enable = true;
services.displayManager.sddm.enable = true;
};
};
}

View file

@ -0,0 +1,9 @@
{ lib, pkgs, ... }:
{
specialisation = {
old-kernel.configuration = {
boot.kernelPackages = lib.mkForce pkgs.linuxPackages_6_1;
};
};
}