From e9441f563ba59b5ee66f51470b1f8e71dcae0171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20SALVI?= Date: Tue, 22 Jul 2025 02:30:15 +0200 Subject: [PATCH] First commit --- TODO.md | 14 + customiso.nix | 65 +++ flake.lock | 88 ++++ flake.nix | 59 +++ hosts/home-nix/disk-config.nix | 68 +++ hosts/home-nix/hardware-configuration.nix | 149 ++++++ hosts/test-kvm/disk-config.nix | 105 ++++ hosts/test-kvm/hardware-configuration.nix | 29 ++ modules/common/default.nix | 81 ++++ modules/default.nix | 34 ++ modules/desktop/X11/config/qwerty-fr | 62 +++ modules/desktop/X11/config/xinitrc | 35 ++ modules/desktop/X11/default.nix | 36 ++ modules/desktop/X11/i3/config/colors | 15 + modules/desktop/X11/i3/config/config | 136 ++++++ modules/desktop/X11/i3/config/screen-home-nix | 41 ++ modules/desktop/X11/i3/config/screen-test-kvm | 40 ++ modules/desktop/X11/i3/default.nix | 23 + modules/desktop/X11/picom/config/picom.conf | 436 +++++++++++++++++ modules/desktop/X11/picom/default.nix | 12 + modules/desktop/X11/polybar/config/colors.ini | 7 + modules/desktop/X11/polybar/config/config.ini | 218 +++++++++ .../X11/polybar/config/imap_creds.example | 4 + modules/desktop/X11/polybar/config/mailbox.sh | 35 ++ .../X11/polybar/config/screen-home-nix.ini | 63 +++ .../X11/polybar/config/screen-test-kvm.ini | 31 ++ modules/desktop/X11/polybar/default.nix | 18 + modules/desktop/common/default.nix | 32 ++ modules/desktop/default.nix | 54 +++ modules/desktop/dunst/config/dunstrc | 457 ++++++++++++++++++ modules/desktop/dunst/default.nix | 13 + modules/desktop/gaming/default.nix | 18 + .../desktop/kitty/config/current-theme.conf | 80 +++ modules/desktop/kitty/config/kitty.conf | 51 ++ modules/desktop/kitty/default.nix | 13 + modules/desktop/nvidia/default.nix | 28 ++ modules/desktop/printers/default.nix | 27 ++ modules/desktop/rofi/config/colors.rasi | 28 ++ modules/desktop/rofi/config/config.rasi | 152 ++++++ modules/desktop/rofi/config/disconnect.rasi | 12 + modules/desktop/rofi/config/launcher.rasi | 123 +++++ modules/desktop/rofi/default.nix | 83 ++++ modules/desktop/sound/default.nix | 20 + modules/desktop/virt-manager/default.nix | 22 + .../desktop/wayland/config/hypr/frappe.conf | 77 +++ .../desktop/wayland/config/hypr/hyprland.conf | 327 +++++++++++++ .../desktop/wayland/config/hypr/hyprlock.conf | 100 ++++ .../wayland/config/hypr/hyprpaper.conf | 2 + .../desktop/wayland/config/scripts/update.sh | 26 + .../desktop/wayland/config/waybar/colors.css | 26 + .../wayland/config/waybar/config.jsonc | 101 ++++ .../desktop/wayland/config/waybar/style.css | 116 +++++ modules/desktop/wayland/default.nix | 40 ++ modules/grub/default.nix | 16 + modules/libvirt/default.nix | 26 + modules/networking/default.nix | 8 + modules/networking/home-nix.nix | 57 +++ modules/networking/openfortivpn.nix | 81 ++++ modules/networking/test-kvm.nix | 8 + modules/sops/default.nix | 70 +++ modules/ssh/default.nix | 29 ++ modules/sshd/default.nix | 15 + modules/tty/config/gitprompt.sh | 31 ++ modules/tty/config/inputrc | 26 + modules/tty/default.nix | 56 +++ modules/user/default.nix | 46 ++ 66 files changed, 4401 insertions(+) create mode 100644 TODO.md create mode 100644 customiso.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hosts/home-nix/disk-config.nix create mode 100644 hosts/home-nix/hardware-configuration.nix create mode 100644 hosts/test-kvm/disk-config.nix create mode 100644 hosts/test-kvm/hardware-configuration.nix create mode 100644 modules/common/default.nix create mode 100644 modules/default.nix create mode 100644 modules/desktop/X11/config/qwerty-fr create mode 100644 modules/desktop/X11/config/xinitrc create mode 100644 modules/desktop/X11/default.nix create mode 100644 modules/desktop/X11/i3/config/colors create mode 100644 modules/desktop/X11/i3/config/config create mode 100644 modules/desktop/X11/i3/config/screen-home-nix create mode 100644 modules/desktop/X11/i3/config/screen-test-kvm create mode 100644 modules/desktop/X11/i3/default.nix create mode 100644 modules/desktop/X11/picom/config/picom.conf create mode 100644 modules/desktop/X11/picom/default.nix create mode 100644 modules/desktop/X11/polybar/config/colors.ini create mode 100644 modules/desktop/X11/polybar/config/config.ini create mode 100644 modules/desktop/X11/polybar/config/imap_creds.example create mode 100755 modules/desktop/X11/polybar/config/mailbox.sh create mode 100644 modules/desktop/X11/polybar/config/screen-home-nix.ini create mode 100644 modules/desktop/X11/polybar/config/screen-test-kvm.ini create mode 100644 modules/desktop/X11/polybar/default.nix create mode 100644 modules/desktop/common/default.nix create mode 100644 modules/desktop/default.nix create mode 100644 modules/desktop/dunst/config/dunstrc create mode 100644 modules/desktop/dunst/default.nix create mode 100644 modules/desktop/gaming/default.nix create mode 100644 modules/desktop/kitty/config/current-theme.conf create mode 100644 modules/desktop/kitty/config/kitty.conf create mode 100644 modules/desktop/kitty/default.nix create mode 100644 modules/desktop/nvidia/default.nix create mode 100644 modules/desktop/printers/default.nix create mode 100644 modules/desktop/rofi/config/colors.rasi create mode 100644 modules/desktop/rofi/config/config.rasi create mode 100644 modules/desktop/rofi/config/disconnect.rasi create mode 100644 modules/desktop/rofi/config/launcher.rasi create mode 100644 modules/desktop/rofi/default.nix create mode 100644 modules/desktop/sound/default.nix create mode 100644 modules/desktop/virt-manager/default.nix create mode 100644 modules/desktop/wayland/config/hypr/frappe.conf create mode 100644 modules/desktop/wayland/config/hypr/hyprland.conf create mode 100644 modules/desktop/wayland/config/hypr/hyprlock.conf create mode 100644 modules/desktop/wayland/config/hypr/hyprpaper.conf create mode 100755 modules/desktop/wayland/config/scripts/update.sh create mode 100644 modules/desktop/wayland/config/waybar/colors.css create mode 100644 modules/desktop/wayland/config/waybar/config.jsonc create mode 100644 modules/desktop/wayland/config/waybar/style.css create mode 100644 modules/desktop/wayland/default.nix create mode 100644 modules/grub/default.nix create mode 100644 modules/libvirt/default.nix create mode 100644 modules/networking/default.nix create mode 100644 modules/networking/home-nix.nix create mode 100644 modules/networking/openfortivpn.nix create mode 100644 modules/networking/test-kvm.nix create mode 100644 modules/sops/default.nix create mode 100644 modules/ssh/default.nix create mode 100644 modules/sshd/default.nix create mode 100644 modules/tty/config/gitprompt.sh create mode 100644 modules/tty/config/inputrc create mode 100644 modules/tty/default.nix create mode 100644 modules/user/default.nix diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..f84b992 --- /dev/null +++ b/TODO.md @@ -0,0 +1,14 @@ +# TODO + +## Neovim in a module + +## Gaming +ICD fails when vulkaninfo --summary +refactor +lutris GTK error +gamescope doesn't work + +## Move old scripts + +## Ansible +install ansible with vsphere sdk diff --git a/customiso.nix b/customiso.nix new file mode 100644 index 0000000..d6c88f5 --- /dev/null +++ b/customiso.nix @@ -0,0 +1,65 @@ +{ + pkgs, + modulesPath, + lib, + ... +}: +{ + imports = [ + "${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix" + ./modules/system/common + ]; + + # use the latest Linux kernel + boot.kernelPackages = pkgs.linuxPackages_latest; + + users.users = { + beastie = { + isNormalUser = true; + hashedPassword = ""; + description = "Admin account"; + extraGroups = [ + "wheel" + ]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAKMJ3TkEmRQcX7RQijNa2km6a2xXJk6M6FERh7C9nTJ" + ]; + + }; + }; + + security.sudo = { + enable = true; + extraRules = [ + { + users = [ "beastie" ]; + host = "ALL"; + runAs = "ALL:ALL"; + commands = [ + { + command = "ALL"; + options = [ "NOPASSWD" ]; + } + ]; + } + ]; + }; + + environment.systemPackages = [ + pkgs.openfortivpn + ]; + + # Needed for https://github.com/NixOS/nixpkgs/issues/58959 + boot.supportedFilesystems = lib.mkForce [ + "btrfs" + "reiserfs" + "vfat" + "f2fs" + "xfs" + "ntfs" + "cifs" + "nfs" + ]; +} + +#nixos-generate --format iso --configuration ./customiso.nix -o ~/Downloads/nixos.iso diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b123a59 --- /dev/null +++ b/flake.lock @@ -0,0 +1,88 @@ +{ + "nodes": { + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1752718651, + "narHash": "sha256-PkaR0qmyP9q/MDN3uYa+RLeBA0PjvEQiM0rTDDBXkL8=", + "owner": "nix-community", + "repo": "disko", + "rev": "d5ad4485e6f2edcc06751df65c5e16572877db88", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "mysecrets": { + "flake": false, + "locked": { + "lastModified": 1753141577, + "narHash": "sha256-MNbm7KCEqML5l72GppVoxXX03UtVGIzUsgaW+A+FBDQ=", + "ref": "main", + "rev": "c1edf4983cba959f93daa9c7ef0c1acbd958c755", + "shallow": true, + "type": "git", + "url": "ssh://gitea@git.unixyourbrain.org/beastie/nixos-secrets.git" + }, + "original": { + "ref": "main", + "shallow": true, + "type": "git", + "url": "ssh://gitea@git.unixyourbrain.org/beastie/nixos-secrets.git" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1752364307, + "narHash": "sha256-o0Cm4fhz/ukV/excbnwkRB2sqknenkb/0T4pcgXjrp0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b6071be3c0d9404113988e5e253eb6d71d1ddbef", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "disko": "disko", + "mysecrets": "mysecrets", + "nixpkgs": "nixpkgs", + "sops-nix": "sops-nix" + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1752544651, + "narHash": "sha256-GllP7cmQu7zLZTs9z0J2gIL42IZHa9CBEXwBY9szT0U=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "2c8def626f54708a9c38a5861866660395bb3461", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..25167c7 --- /dev/null +++ b/flake.nix @@ -0,0 +1,59 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + sops-nix = { + url = "github:Mic92/sops-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + mysecrets = { + url = "git+ssh://gitea@git.unixyourbrain.org/beastie/nixos-secrets.git?ref=main&shallow=1"; + flake = false; + }; + }; + + outputs = + { ... }@inputs: + let + mkSystem = + pkgs: system: hostname: username: + pkgs.lib.nixosSystem { + inherit system; + pkgs = import pkgs { + inherit system; + config.allowUnfree = true; + }; + specialArgs = { + inherit hostname username inputs; + #hostname = hostname; + #username = username; + }; # For system modules + modules = [ + # General configuration, for all machines + inputs.sops-nix.nixosModules.sops + inputs.disko.nixosModules.disko + ./hosts/${hostname}/disk-config.nix + ./hosts/${hostname}/hardware-configuration.nix + ./modules + ]; + }; + + in + { + nixosConfigurations = { + #nixos-anywhere -- --flake './#test-kvm' --generate-hardware-config nixos-generate-config ./hosts/test-kvm/hardware-configuration.nix --target-host root@192.168.122.204 + test-kvm = mkSystem inputs.nixpkgs "x86_64-linux" "test-kvm" "beastie"; + #live-usb = mkSystem inputs.nixpkgs "x86_64-linux" "live-usb" "beastie"; + #nixos-rebuild switch --flake ./#home-nix --sudo + home-nix = mkSystem inputs.nixpkgs "x86_64-linux" "home-nix" "beastie"; + }; + }; +} diff --git a/hosts/home-nix/disk-config.nix b/hosts/home-nix/disk-config.nix new file mode 100644 index 0000000..e73e2b0 --- /dev/null +++ b/hosts/home-nix/disk-config.nix @@ -0,0 +1,68 @@ +{ + # disko.devices = { + # disk = { + # main = { + # type = "disk"; + # device = "/dev/sdb"; + # content = { + # type = "gpt"; + # partitions = { + # ESP = { + # size = "512M"; + # type = "EF00"; + # content = { + # type = "filesystem"; + # format = "vfat"; + # mountpoint = "/boot"; + # mountOptions = [ "umask=0077" ]; + # }; + # }; + # SYS = { + # size = "100%"; + # type = "8309"; + # content = { + # type = "luks"; + # name = "rootfs"; + # settings = { + # allowDiscards = true; + # + # }; + # content = { + # type = "btrfs"; + # extraArgs = [ "-f --nodiscard --label root" ]; + # subvolumes = { + # "@" = { + # mountpoint = "/"; + # mountOptions = [ "defaults" "ssd" "compress=zstd" "autodefrag" "noatime" "nodiscard" ]; + # }; + # "@root" = { + # mountpoint = "/root"; + # mountOptions = [ "defaults" "ssd" "compress=zstd" "autodefrag" "noatime" "nodiscard" ]; + # }; + # "@home" = { + # mountpoint = "/home"; + # mountOptions = [ "defaults" "ssd" "compress=zstd" "autodefrag" "noatime" "nodiscard" ]; + # }; + # "@nix" = { + # mountpoint = "/nix"; + # mountOptions = [ "defaults" "ssd" "compress=zstd" "autodefrag" "noatime" "nodiscard" ]; + # }; + # "@var" = { + # mountpoint = "/var"; + # mountOptions = [ "defaults" "ssd" "compress=zstd" "autodefrag" "noatime" "nodiscard" ]; + # }; + # "@games" = { + # mountpoint = "/games"; + # mountOptions = [ "defaults" "ssd" "compress=zstd" "autodefrag" "noatime" "nodiscard" ]; + # }; + # }; + # }; + # }; + # }; + # }; + # }; + # }; + # }; + # }; +} +# sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --yes-wipe-all-disks --mode destroy,format,mount ./disko.nix diff --git a/hosts/home-nix/hardware-configuration.nix b/hosts/home-nix/hardware-configuration.nix new file mode 100644 index 0000000..d7a6a41 --- /dev/null +++ b/hosts/home-nix/hardware-configuration.nix @@ -0,0 +1,149 @@ +# 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, + modulesPath, + ... +}: + +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ehci_pci" + "ahci" + "nvme" + "usbhid" + "usb_storage" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/2271e57f-0b57-4ab7-8238-b84b01974cc8"; + fsType = "btrfs"; + options = [ + "subvol=@" + "defaults" + "ssd" + "compress=zstd" + "autodefrag" + "noatime" + "nodiscard" + ]; + }; + + boot.initrd.luks.devices."rootfs".device = "/dev/disk/by-uuid/77601e4d-358d-49ba-b6e5-f3a68f05060a"; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/9EF7-6EB2"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; + + fileSystems."/games" = { + device = "/dev/disk/by-uuid/2271e57f-0b57-4ab7-8238-b84b01974cc8"; + fsType = "btrfs"; + options = [ + "subvol=@games" + "defaults" + "ssd" + "compress=zstd" + "autodefrag" + "noatime" + "nodiscard" + ]; + }; + + fileSystems."/home" = { + device = "/dev/disk/by-uuid/2271e57f-0b57-4ab7-8238-b84b01974cc8"; + fsType = "btrfs"; + options = [ + "subvol=@home" + "defaults" + "ssd" + "compress=zstd" + "autodefrag" + "noatime" + "nodiscard" + ]; + }; + + fileSystems."/nix" = { + device = "/dev/disk/by-uuid/2271e57f-0b57-4ab7-8238-b84b01974cc8"; + fsType = "btrfs"; + options = [ + "subvol=@nix" + "defaults" + "ssd" + "compress=zstd" + "autodefrag" + "noatime" + "nodiscard" + ]; + }; + + fileSystems."/root" = { + device = "/dev/disk/by-uuid/2271e57f-0b57-4ab7-8238-b84b01974cc8"; + fsType = "btrfs"; + options = [ + "subvol=@root" + "defaults" + "ssd" + "compress=zstd" + "autodefrag" + "noatime" + "nodiscard" + ]; + }; + + fileSystems."/var" = { + device = "/dev/disk/by-uuid/2271e57f-0b57-4ab7-8238-b84b01974cc8"; + fsType = "btrfs"; + options = [ + "subvol=@var" + "defaults" + "ssd" + "compress=zstd" + "autodefrag" + "noatime" + "nodiscard" + ]; + }; + + environment.etc."crypttab".text = '' + datafs UUID=5ca962a7-537f-46ce-ba50-9cc9cefd012b /etc/lukskey + ''; + + fileSystems."/data" = { + device = "/dev/disk/by-uuid/a8ea6a7b-3733-40d8-bee8-45806aaacfe1"; + fsType = "btrfs"; + options = [ + "defaults" + "compress=zstd" + "autodefrag" + "noatime" + ]; + }; + 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/test-kvm/disk-config.nix b/hosts/test-kvm/disk-config.nix new file mode 100644 index 0000000..5492966 --- /dev/null +++ b/hosts/test-kvm/disk-config.nix @@ -0,0 +1,105 @@ +{ ... }: +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/vda"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; + }; + SYS = { + size = "100%"; + type = "8309"; + content = { + type = "luks"; + name = "rootfs"; + settings = { + allowDiscards = true; + + }; + content = { + type = "btrfs"; + extraArgs = [ "-f --nodiscard --label root" ]; + subvolumes = { + "@" = { + mountpoint = "/"; + mountOptions = [ + "defaults" + "ssd" + "compress=zstd" + "autodefrag" + "noatime" + ]; + }; + "@root" = { + mountpoint = "/root"; + mountOptions = [ + "defaults" + "ssd" + "compress=zstd" + "autodefrag" + "noatime" + ]; + }; + "@home" = { + mountpoint = "/home"; + mountOptions = [ + "defaults" + "ssd" + "compress=zstd" + "autodefrag" + "noatime" + ]; + }; + "@nix" = { + mountpoint = "/nix"; + mountOptions = [ + "defaults" + "ssd" + "compress=zstd" + "autodefrag" + "noatime" + ]; + }; + "@var" = { + mountpoint = "/var"; + mountOptions = [ + "defaults" + "ssd" + "compress=zstd" + "autodefrag" + "noatime" + ]; + }; + "@games" = { + mountpoint = "/games"; + mountOptions = [ + "defaults" + "ssd" + "compress=zstd" + "autodefrag" + "noatime" + ]; + }; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} +# sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --yes-wipe-all-disks --mode destroy,format,mount ./disko.nix diff --git a/hosts/test-kvm/hardware-configuration.nix b/hosts/test-kvm/hardware-configuration.nix new file mode 100644 index 0000000..ad3dec5 --- /dev/null +++ b/hosts/test-kvm/hardware-configuration.nix @@ -0,0 +1,29 @@ +# 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. +{ lib, modulesPath, ... }: +{ + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ + "ahci" + "xhci_pci" + "virtio_pci" + "sr_mod" + "virtio_blk" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/modules/common/default.nix b/modules/common/default.nix new file mode 100644 index 0000000..7d0088b --- /dev/null +++ b/modules/common/default.nix @@ -0,0 +1,81 @@ +{ + pkgs, + ... +}@attrs: +{ + ## Do not touch, read the fucking manual !!! + system.stateVersion = "25.05"; + + ## Keep kernel packages up to latest + boot.kernelPackages = pkgs.linuxPackages_latest; + + # Time Zone + time.timeZone = "Europe/Paris"; + + nix = { + settings = { + ## Enable flakes + experimental-features = [ + "nix-command" + "flakes" + ]; + ## Users trusted to use flake command + trusted-users = [ + "root" + "${attrs.username}" + ]; + }; + ## Grabage collection + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + }; + + services = { + locate = { + enable = true; + package = pkgs.plocate; + }; + }; + + environment.systemPackages = [ + pkgs.curl + pkgs.pciutils + pkgs.clinfo + pkgs.cargo + pkgs.git + pkgs.htop + pkgs.killall + pkgs.bind + pkgs.git + pkgs.jq + pkgs.openldap + pkgs.usbutils + pkgs.gnumake + pkgs.nixos-anywhere + pkgs.nixos-generators + pkgs.disko + pkgs.sops + pkgs.age + pkgs.ssh-to-age + pkgs.samba + pkgs.krb5 + pkgs.pam_krb5 + pkgs.gnumake + pkgs.keyutils + pkgs.cifs-utils + pkgs.neovim + pkgs.unzip + # Nvim with dependencies + pkgs.nodejs + pkgs.gcc + pkgs.shellcheck + pkgs.nixd + pkgs.nixfmt-rfc-style + pkgs.ansible-language-server + pkgs.ansible-lint + pkgs.lua-language-server + ]; +} diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..156bc3c --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,34 @@ +{ + modulesPath, + inputs, + lib, + ... +}@attrs: +let + hostname = "${attrs.hostname}"; + secrets = inputs.mysecrets; +in +{ + imports = + [ + (modulesPath + "/installer/scan/not-detected.nix") + + ./common + ./grub + ./networking + ./sops + ./sshd + ./tty + ./user + ] + ++ lib.optionals + (builtins.elem hostname [ + "test-kvm" + "home-nix" + ]) + [ + ./desktop + ./libvirt + ./ssh + ]; +} diff --git a/modules/desktop/X11/config/qwerty-fr b/modules/desktop/X11/config/qwerty-fr new file mode 100644 index 0000000..c055ffb --- /dev/null +++ b/modules/desktop/X11/config/qwerty-fr @@ -0,0 +1,62 @@ +partial alphanumeric_keys +xkb_symbols "qwerty-fr" +{ + include "us(basic)" + include "level3(ralt_switch)" + + name[Group1]= "US keyboard with french symbols - AltGr combination"; + + key { [ grave, asciitilde, dead_grave, dead_tilde ] }; + key { [ 1, exclam, onesuperior, exclamdown ] }; + key { [ 2, at, twosuperior, dead_doubleacute ] }; + key { [ 3, numbersign, ecircumflex, Ecircumflex ] }; + key { [ 4, dollar, EuroSign, dead_currency ] }; // FIXME: dead_currency has a different mapping than the one we want for qwerty-fr. Need to define a custom dead key instead. See Windows layout for dead key definition. + key { [ 5, percent, dead_macron, dead_abovedot ] }; + key { [ 6, asciicircum, dead_circumflex, dead_caron ] }; + key { [ 7, ampersand, ucircumflex, Ucircumflex ] }; + key { [ 8, asterisk, icircumflex, Icircumflex ] }; + key { [ 9, parenleft, ocircumflex, Ocircumflex ] }; + key { [ 0, parenright, oslash, Oslash ] }; + key { [ minus, underscore, endash, emdash ] }; + key { [ equal, plus, notequal, approxeq ] }; + + key { [ q, Q, acircumflex, Acircumflex ] }; + key { [ w, W, eacute, Eacute ] }; + key { [ e, E, egrave, Egrave ] }; + key { [ r, R, registered, copyright ] }; + key { [ t, T, thorn, THORN ] }; + key { [ y, Y, dead_invertedbreve, dead_breve ] }; + key { [ u, U, ugrave, Ugrave ] }; + key { [ i, I, igrave, Igrave ] }; + key { [ o, O, ograve, Ograve ] }; + key { [ p, P, oe, OE ] }; + key { [ bracketleft, braceleft, guillemotleft, leftdoublequotemark ] }; + key { [ bracketright, braceright, guillemotright, rightdoublequotemark ] }; + + key { [ a, A, agrave, Agrave ] }; + key { [ s, S, ae, AE ] }; + key { [ d, D, ediaeresis, Ediaeresis ] }; + key { [ f, F, VoidSymbol, VoidSymbol ] }; + key { [ g, G, dead_greek, VoidSymbol ] }; // FIXME: dead_greek has a different mapping than the one we want for qwerty-fr. Need to define a custom dead key instead. See Windows layout for dead key definition. + key { [ h, H, ydiaeresis, Ydiaeresis ] }; + key { [ j, J, udiaeresis, Udiaeresis ] }; + key { [ k, K, idiaeresis, Idiaeresis ] }; + key { [ l, L, odiaeresis, Odiaeresis ] }; + key { [ semicolon, colon, dead_acute, dead_abovering ] }; + key { [ apostrophe, quotedbl, dead_grave, dead_diaeresis ] }; + key { [ backslash, bar, VoidSymbol, doublelowquotemark ] }; // „ + + key { [ less, greater, lessthanequal, greaterthanequal ] }; + key { [ z, Z, adiaeresis, Adiaeresis ] }; + key { [ x, X, multiply, division ] }; + key { [ c, C, ccedilla, Ccedilla ] }; + key { [ v, V, VoidSymbol, VoidSymbol ] }; + key { [ b, B, ssharp, U1E9E ] }; // ß, ẞ (capital) + key { [ n, N, ntilde, Ntilde ] }; + key { [ m, M, VoidSymbol, VoidSymbol ] }; + key { [ comma, less, dead_cedilla, dead_ogonek ] }; + key { [ period, greater, periodcentered, ellipsis ] }; // ., >, ·, … + key { [ slash, question, rightsinglequotemark, questiondown ] }; // /, ?, ’, ¿ + key { [ space, space, nobreakspace, 0x100202F ] }; // espace insécable fine + +}; diff --git a/modules/desktop/X11/config/xinitrc b/modules/desktop/X11/config/xinitrc new file mode 100644 index 0000000..dfd13cf --- /dev/null +++ b/modules/desktop/X11/config/xinitrc @@ -0,0 +1,35 @@ +#!/bin/sh + +userresources=$HOME/.Xresources +usermodmap=$HOME/.Xmodmap +sysresources=/etc/X11/xinit/.Xresources +sysmodmap=/etc/X11/xinit/.Xmodmap + +# merge in defaults and keymaps + +if [ -f $sysresources ]; then + xrdb -merge $sysresources +fi + +if [ -f $sysmodmap ]; then + xmodmap $sysmodmap +fi + +if [ -f "$userresources" ]; then + xrdb -merge "$userresources" +fi + +if [ -f "$usermodmap" ]; then + xmodmap "$usermodmap" +fi + +# start some nice programs +if [ -d /etc/X11/xinit/xinitrc.d ] ; then + for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do + [ -x "$f" ] && . "$f" + done + unset f +fi + +numlockx & +exec i3 diff --git a/modules/desktop/X11/default.nix b/modules/desktop/X11/default.nix new file mode 100644 index 0000000..8102cb1 --- /dev/null +++ b/modules/desktop/X11/default.nix @@ -0,0 +1,36 @@ +{ + lib, + pkgs, + ... +}@args: +{ + services.xserver = { + enable = true; + displayManager.startx.enable = true; + xkb = { + layout = "qwerty-fr"; + extraLayouts.qwerty-fr = { + description = "QWERTY avec symboles et diacritiques français "; + languages = [ "eng" ]; + symbolsFile = ./config/qwerty-fr; + }; + }; + }; + environment.systemPackages = with pkgs; [ + numlockx + adwaita-icon-theme + xclip + flameshot + ]; + environment.etc = { + "X11/xinit/xinitrc".source = ./config/xinitrc; + }; + imports = + [ + ./i3 + ./polybar + ] + ++ lib.optionals args.isGpu [ + ./picom + ]; +} diff --git a/modules/desktop/X11/i3/config/colors b/modules/desktop/X11/i3/config/colors new file mode 100644 index 0000000..779411b --- /dev/null +++ b/modules/desktop/X11/i3/config/colors @@ -0,0 +1,15 @@ +set $fg #c6d0f5 +set $fgli #d4d8df +set $fglier #f6f7f9 +set $bg #303446 +set $bgli #323842 +set $bgda #21252b +set $bgdaer #1e2227 +set $black #51576d +set $red #e78284 +set $green #e5c890 +set $yellow #e5c890 +set $blue #8caaee +set $purple #f4b8e4 +set $cyan #81c8be +set $white #b5bfe2 diff --git a/modules/desktop/X11/i3/config/config b/modules/desktop/X11/i3/config/config new file mode 100644 index 0000000..0cdd8ba --- /dev/null +++ b/modules/desktop/X11/i3/config/config @@ -0,0 +1,136 @@ +set $mod Mod4 + +# Reload Restart config | moved to rofi +#bindsym $mod+c reload +bindsym $mod+r restart +bindsym $mod+e exit + +# Floating Modifier +floating_modifier $mod + +# Kill focused window +bindsym $mod+q kill + +# change focus +bindsym $mod+Up focus up +bindsym $mod+Down focus down +bindsym $mod+Left focus left +bindsym $mod+Right focus right + +# Move Focused +bindsym $mod+Control+Up move up +bindsym $mod+Control+Down move down +bindsym $mod+Control+Left move left +bindsym $mod+Control+Right move right + +bindsym $mod+o move container to output next + +# Resizing window +bindsym $mod+Shift+Up resize grow height 10 px or 10 ppt +bindsym $mod+Shift+Down resize shrink height 10 px or 10 ppt +bindsym $mod+Shift+Left resize shrink width 10 px or 10 ppt +bindsym $mod+Shift+Right resize grow width 10 px or 10 ppt + +# Workspace layout +bindsym $mod+space layout toggle splitv splith tabbed + +# Fullscreen +bindsym $mod+f fullscreen toggle + +# Flaoting +bindsym $mod+Shift+space floating toggle + +# Splitting +bindsym $mod+v split vertical +bindsym $mod+h split horizontal +bindsym $mod+Control+space split toggle + +# Volume control +bindsym F5 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% +bindsym F6 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% + +############## +# Workspaces # +############## + +include /etc/xdg/i3/screen + +########################### +#Design +########################### + +title_align center +default_border pixel 1 + +# Gaps +gaps inner 10px +smart_gaps off +gaps inner 5 + +#smart|ignore|leave_fullscreen +popup_during_fullscreen ignore + +# Font +set $font ComicShannsMono Nerd Font Bold +font pango:$font 11 + +#colors +#include /etc/xdg/i3/colors +set $fg #c6d0f5 +set $fgli #d4d8df +set $fglier #f6f7f9 +set $bg #303446 +set $bgli #323842 +set $bgda #21252b +set $bgdaer #1e2227 +set $black #51576d +set $red #e78284 +set $green #e5c890 +set $yellow #e5c890 +set $blue #8caaee +set $purple #f4b8e4 +set $cyan #81c8be +set $white #b5bfe2 + +# class border backgr. text indicator child_border +client.focused $blue $bg $blue $purple $blue +client.focused_inactive $bgda $bgli $fglier $bgda $bgda +client.unfocused $bgdaer $bg $fg $bgdaer $bgdaer +client.urgent $red $bg $fg $red $red +client.placeholder $bgdaer $bg $fg $bgdaer $bgdaer +client.background $bg + +########### +# Startup # +########### +#exec_always --no-startup-id /usr/local/share/dotfiles/scripts/wallpapers.sh +exec_always --no-startup-id "killall picom ; picom" +exec_always --no-startup-id "killall dunst ; dunst" +exec_always --no-startup-id "flameshot" +#exec_always --no-startup-id "killall nextcloud ; nextcloud" + +################# +# Apps shortcut # +################# +bindsym Print exec --no-startup-id flameshot gui + +include /etc/xdg/i3/rofi +bindsym $mod+l exec --no-startup-id /usr/local/share/dotfiles/scripts/disconnect.sh +bindsym $mod+b exec --no-startup-id /usr/local/share/dotfiles/scripts/bookmarks.sh +bindsym $mod+m exec --no-startup-id /usr/local/share/dotfiles/scripts/mpv.sh +bindsym $mod+g exec --no-startup-id /usr/local/share/dotfiles/scripts/search.sh +bindsym $mod+c exec --no-startup-id rofi -show calc -theme disconnect.rasi + +bindsym $mod+Shift+p exec --no-startup-id pavucontrol +bindsym $mod+Shift+d exec --no-startup-id discord --no-sandbox +bindsym $mod+Shift+f exec --no-startup-id firefox +bindsym $mod+Shift+s exec --no-startup-id steam + + +# Start a terminal +bindsym $mod+Return exec --no-startup-id kitty + +# Display help +for_window [instance="cheatsheet"] floating enable +for_window [instance="vncviewer"] floating enable +bindsym $mod+s exec --no-startup-id kitty --class cheatsheet /usr/local/share/dotfiles/scripts/i3wm_key_help.sh diff --git a/modules/desktop/X11/i3/config/screen-home-nix b/modules/desktop/X11/i3/config/screen-home-nix new file mode 100644 index 0000000..f0516f1 --- /dev/null +++ b/modules/desktop/X11/i3/config/screen-home-nix @@ -0,0 +1,41 @@ +set $monitor0 HDMI-0 +set $monitor1 HDMI-1 + +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" + +workspace $ws1 output $monitor0 +workspace $ws2 output $monitor0 +workspace $ws3 output $monitor0 +workspace $ws4 output $monitor0 +workspace $ws5 output $monitor1 +workspace $ws6 output $monitor1 +workspace $ws7 output $monitor1 +workspace $ws8 output $monitor1 + +bindsym $mod+mod2+KP_1 workspace $ws1 +bindsym $mod+mod2+KP_2 workspace $ws2 +bindsym $mod+mod2+KP_3 workspace $ws3 +bindsym $mod+mod2+KP_4 workspace $ws4 +bindsym $mod+mod2+KP_5 workspace $ws5 +bindsym $mod+mod2+KP_6 workspace $ws6 +bindsym $mod+mod2+KP_7 workspace $ws7 +bindsym $mod+mod2+KP_8 workspace $ws8 + +bindsym $mod+Control+mod2+KP_1 move container to workspace $ws1 +bindsym $mod+Control+mod2+KP_2 move container to workspace $ws2 +bindsym $mod+Control+mod2+KP_3 move container to workspace $ws3 +bindsym $mod+Control+mod2+KP_4 move container to workspace $ws4 +bindsym $mod+Control+mod2+KP_5 move container to workspace $ws5 +bindsym $mod+Control+mod2+KP_6 move container to workspace $ws6 +bindsym $mod+Control+mod2+KP_7 move container to workspace $ws7 +bindsym $mod+Control+mod2+KP_8 move container to workspace $ws8 + +exec --no-startup-id xrandr --output HDMI-1 --primary --right-of HDMI-0 +exec_always --no-startup-id "kill $(pgrep polybar) ; polybar main & polybar alt" diff --git a/modules/desktop/X11/i3/config/screen-test-kvm b/modules/desktop/X11/i3/config/screen-test-kvm new file mode 100644 index 0000000..fb55e02 --- /dev/null +++ b/modules/desktop/X11/i3/config/screen-test-kvm @@ -0,0 +1,40 @@ +set $monitor0 Virtual-1 + +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" + +workspace $ws1 output $monitor0 +workspace $ws2 output $monitor0 +workspace $ws3 output $monitor0 +workspace $ws4 output $monitor0 +workspace $ws5 output $monitor0 +workspace $ws6 output $monitor0 +workspace $ws7 output $monitor0 +workspace $ws8 output $monitor0 + +bindsym $mod+mod2+KP_1 workspace $ws1 +bindsym $mod+mod2+KP_2 workspace $ws2 +bindsym $mod+mod2+KP_3 workspace $ws3 +bindsym $mod+mod2+KP_4 workspace $ws4 +bindsym $mod+mod2+KP_5 workspace $ws5 +bindsym $mod+mod2+KP_6 workspace $ws6 +bindsym $mod+mod2+KP_7 workspace $ws7 +bindsym $mod+mod2+KP_8 workspace $ws8 + +bindsym $mod+Control+mod2+KP_1 move container to workspace $ws1 +bindsym $mod+Control+mod2+KP_2 move container to workspace $ws2 +bindsym $mod+Control+mod2+KP_3 move container to workspace $ws3 +bindsym $mod+Control+mod2+KP_4 move container to workspace $ws4 +bindsym $mod+Control+mod2+KP_5 move container to workspace $ws5 +bindsym $mod+Control+mod2+KP_6 move container to workspace $ws6 +bindsym $mod+Control+mod2+KP_7 move container to workspace $ws7 +bindsym $mod+Control+mod2+KP_8 move container to workspace $ws8 + +exec --no-startup-id xrandr --output Virtual-1 --primary --mode 1920x1080 +exec_always --no-startup-id "killall polybar ; polybar main" diff --git a/modules/desktop/X11/i3/default.nix b/modules/desktop/X11/i3/default.nix new file mode 100644 index 0000000..1176b6a --- /dev/null +++ b/modules/desktop/X11/i3/default.nix @@ -0,0 +1,23 @@ +{ + pkgs, + ... +}@attrs: +{ + environment.systemPackages = [ + pkgs.i3 + pkgs.i3lock + pkgs.i3-volume + pkgs.i3-gaps + pkgs.rofi + ]; + environment.etc = { + "xdg/i3/config".source = ./config/config; + "xdg/i3/colors".source = ./config/colors; + "xdg/i3/screen".source = ./config/screen-${attrs.hostname}; + "xdg/i3/rofi" = { + text = '' + bindsym $mod+d exec --no-startup-id ${pkgs.rofi}/bin/rofi -show drun -show-icons -config /etc/xdg/rofi/config.rasi + ''; + }; + }; +} diff --git a/modules/desktop/X11/picom/config/picom.conf b/modules/desktop/X11/picom/config/picom.conf new file mode 100644 index 0000000..5647a25 --- /dev/null +++ b/modules/desktop/X11/picom/config/picom.conf @@ -0,0 +1,436 @@ +################################# +# Shadows # +################################# + + +# Enabled client-side shadows on windows. Note desktop windows +# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow, +# unless explicitly requested using the wintypes option. +# +# shadow = false +#shadow = false; + +# The blur radius for shadows, in pixels. (defaults to 12) +# shadow-radius = 12 +#shadow-radius = 8; + +# The opacity of shadows. (0.0 - 1.0, defaults to 0.75) +# shadow-opacity = .75 + +# The left offset for shadows, in pixels. (defaults to -15) +# shadow-offset-x = -15 +#shadow-offset-x = -17; + +# The top offset for shadows, in pixels. (defaults to -15) +# shadow-offset-y = -15 +#shadow-offset-y = -17; + +# Red color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-red = 0 + +# Green color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-green = 0 + +# Blue color value of shadow (0.0 - 1.0, defaults to 0). +# shadow-blue = 0 + +# Hex string color value of shadow (#000000 - #FFFFFF, defaults to #000000). This option will override options set shadow-(red/green/blue) +# shadow-color = "#000000" + +# Specify a list of conditions of windows that should have no shadow. +# +# examples: +# shadow-exclude = "n:e:Notification"; +# +# shadow-exclude = [] +#shadow-exclude = [ +# "name = 'Notification'", +# "class_g = 'Conky'", +# "class_g ?= 'Notify-osd'", +# "class_g = 'Cairo-clock'", +# "_GTK_FRAME_EXTENTS@:c" +#]; + +# Specify a list of conditions of windows that should have no shadow painted over, such as a dock window. +# clip-shadow-above = [] + +# Specify a X geometry that describes the region in which shadow should not +# be painted in, such as a dock window region. Use +# shadow-exclude-reg = "x10+0+0" +# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on. +# +# shadow-exclude-reg = "" + +# Crop shadow of a window fully on a particular Xinerama screen to the screen. +# xinerama-shadow-crop = false + + +################################# +# Fading # +################################# + + +# Fade windows in/out when opening/closing and when opacity changes, +# unless no-fading-openclose is used. +# fading = false +fading = true; + +# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028) +# fade-in-step = 0.028 +fade-in-step = 0.03; + +# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03) +# fade-out-step = 0.03 +fade-out-step = 0.03; + +# The time between steps in fade step, in milliseconds. (> 0, defaults to 10) +# fade-delta = 10 + +# Specify a list of conditions of windows that should not be faded. +fade-exclude = [ +] + +# Do not fade on window open/close. +# no-fading-openclose = false + +# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc. +# no-fading-destroyed-argb = false + + +################################# +# Transparency / Opacity # +################################# + + +# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0) +# inactive-opacity = 1 +inactive-opacity = 0.75; + +# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default) +# frame-opacity = 1.0 +#frame-opacity = 0.75; + +# Let inactive opacity set by -i override the '_NET_WM_WINDOW_OPACITY' values of windows. +# inactive-opacity-override = true +inactive-opacity-override = false; + +# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0) +active-opacity = 0.95; + +# Dim inactive windows. (0.0 - 1.0, defaults to 0.0) +# inactive-dim = 0.0 + +# Specify a list of conditions of windows that should never be considered focused. +# focus-exclude = [] +#focus-exclude = [ +#]; + +# Use fixed inactive dim value, instead of adjusting according to window opacity. +# inactive-dim-fixed = 1.0 + +# Specify a list of opacity rules, in the format `PERCENT:PATTERN`, +# like `50:name *= "Firefox"`. picom-trans is recommended over this. +# Note we don't make any guarantee about possible conflicts with other +# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows. +# example: +#opacity-rule = [ "75:class_g = 'Polybar'" ]; +# +opacity-rule = [ + "100:class_g = 'firefox'", + "100:class_g = 'Chromium'", + "100:class_g = 'mpv'", + "100:class_g = 'dontstarve_steam_x64'", + "100:class_g = 'virt-manager'" +]; + +################################# +# Corners # +################################# + +# Sets the radius of rounded window corners. When > 0, the compositor will +# round the corners of windows. Does not interact well with +# `transparent-clipping`. +corner-radius = 0 + +# Exclude conditions for rounded corners. +rounded-corners-exclude = [ + "window_type = 'dock'", + "window_type = 'desktop'" +]; + + +################################# +# Background-Blurring # +################################# + + +# Parameters for background blurring, see the *BLUR* section for more information. +blur-method = "dual_kawase" +blur-size = 3 +# +blur-deviation = true +# +blur-strength = 3 + +# Blur background of semi-transparent / ARGB windows. +# Bad in performance, with driver-dependent behavior. +# The name of the switch may change without prior notifications. +# +# blur-background = true + +# Blur background of windows when the window frame is not opaque. +# Implies: +# blur-background +# Bad in performance, with driver-dependent behavior. The name may change. +# +# blur-background-frame = false + + +# Use fixed blur strength rather than adjusting according to window opacity. +# blur-background-fixed = false + + +# Specify the blur convolution kernel, with the following format: +# example: +# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"; +# +# blur-kern = "" +blur-kern = "3x3box"; + + +# Exclude conditions for background blur. +# blur-background-exclude = [] +blur-background-exclude = [ +# "window_type = 'dock'", + "class_g = 'mpv'", + "window_type = 'desktop'", + "_GTK_FRAME_EXTENTS@:c" +]; + +################################# +# General Settings # +################################# + +# Enable remote control via D-Bus. See the man page for more details. +# dbus = true + +# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers. +# daemon = false + +# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`. +# `xrender` is the default one. +# +backend = "glx" +# backend = "xrender"; + +# Enable/disable VSync. +# vsync = false +vsync = true; + +# Enable remote control via D-Bus. See the *D-BUS API* section below for more details. +# dbus = false + +# Try to detect WM windows (a non-override-redirect window with no +# child that has 'WM_STATE') and mark them as active. +# +# mark-wmwin-focused = false +mark-wmwin-focused = true; + +# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused. +# mark-ovredir-focused = false +mark-ovredir-focused = true; + +# Try to detect windows with rounded corners and don't consider them +# shaped windows. The accuracy is not very high, unfortunately. +# +# detect-rounded-corners = false +detect-rounded-corners = true; + +# Detect '_NET_WM_WINDOW_OPACITY' on client windows, useful for window managers +# not passing '_NET_WM_WINDOW_OPACITY' of client windows to frame windows. +# +# detect-client-opacity = false +detect-client-opacity = true; + +# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window, +# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy, +# provided that the WM supports it. +# +# use-ewmh-active-win = false + +# Unredirect all windows if a full-screen opaque window is detected, +# to maximize performance for full-screen windows. Known to cause flickering +# when redirecting/unredirecting windows. +# +# unredir-if-possible = false + +# Delay before unredirecting the window, in milliseconds. Defaults to 0. +# unredir-if-possible-delay = 0 + +# Conditions of windows that shouldn't be considered full-screen for unredirecting screen. +# unredir-if-possible-exclude = [] + +# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows +# in the same group focused at the same time. +# +# detect-transient = false +detect-transient = true; + +# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same +# group focused at the same time. This usually means windows from the same application +# will be considered focused or unfocused at the same time. +# 'WM_TRANSIENT_FOR' has higher priority if detect-transient is enabled, too. +# +# detect-client-leader = false + +# Resize damaged region by a specific number of pixels. +# A positive value enlarges it while a negative one shrinks it. +# If the value is positive, those additional pixels will not be actually painted +# to screen, only used in blur calculation, and such. (Due to technical limitations, +# with use-damage, those pixels will still be incorrectly painted to screen.) +# Primarily used to fix the line corruption issues of blur, +# in which case you should use the blur radius value here +# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`, +# with a 5x5 one you use `--resize-damage 2`, and so on). +# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly. +# +# resize-damage = 1 + +# Specify a list of conditions of windows that should be painted with inverted color. +# Resource-hogging, and is not well tested. +# +# invert-color-include = [] + +# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer. +# Might cause incorrect opacity when rendering transparent content (but never +# practically happened) and may not work with blur-background. +# My tests show a 15% performance boost. Recommended. +# +glx-no-stencil = true; + +# GLX backend: Avoid rebinding pixmap on window damage. +# Probably could improve performance on rapid window content changes, +# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.). +# Recommended if it works. +# +# glx-no-rebind-pixmap = false + +# Disable the use of damage information. +# This cause the whole screen to be redrawn every time, instead of the part of the screen +# has actually changed. Potentially degrades the performance, but might fix some artifacts. +# The opposing option is use-damage +# +# no-use-damage = false +use-damage = true; + +# Use X Sync fence to sync clients' draw calls, to make sure all draw +# calls are finished before picom starts drawing. Needed on nvidia-drivers +# with GLX backend for some users. +# +# xrender-sync-fence = false + +# GLX backend: Use specified GLSL fragment shader for rendering window +# contents. Read the man page for a detailed explanation of the interface. +# +# window-shader-fg = "default" + +# Use rules to set per-window shaders. Syntax is SHADER_PATH:PATTERN, similar +# to opacity-rule. SHADER_PATH can be "default". This overrides window-shader-fg. +# +# window-shader-fg-rule = [ +# "my_shader.frag:window_type != 'dock'" +# ] + +# Force all windows to be painted with blending. Useful if you +# have a glx-fshader-win that could turn opaque pixels transparent. +# +# force-win-blend = false + +# Do not use EWMH to detect fullscreen windows. +# Reverts to checking if a window is fullscreen based only on its size and coordinates. +# +# no-ewmh-fullscreen = false + +# Dimming bright windows so their brightness doesn't exceed this set value. +# Brightness of a window is estimated by averaging all pixels in the window, +# so this could comes with a performance hit. +# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0) +# +# max-brightness = 1.0 + +# Make transparent windows clip other windows like non-transparent windows do, +# instead of blending on top of them. +# +# transparent-clipping = false + +# Specify a list of conditions of windows that should never have transparent +# clipping applied. Useful for screenshot tools, where you need to be able to +# see through transparent parts of the window. +# +# transparent-clipping-exclude = [] + +# Set the log level. Possible values are: +# "trace", "debug", "info", "warn", "error" +# in increasing level of importance. Case doesn't matter. +# If using the "TRACE" log level, it's better to log into a file +# using *--log-file*, since it can generate a huge stream of logs. +# +# log-level = "debug" +log-level = "warn"; + +# Set the log file. +# If *--log-file* is never specified, logs will be written to stderr. +# Otherwise, logs will to written to the given file, though some of the early +# logs might still be written to the stderr. +# When setting this option from the config file, it is recommended to use an absolute path. +# +# log-file = "/path/to/your/log/file" + +# Show all X errors (for debugging) +# show-all-xerrors = false + +# Write process ID to a file. +# write-pid-path = "/path/to/your/log/file" + +# Window type settings +# +# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard: +# "unknown", "desktop", "dock", "toolbar", "menu", "utility", +# "splash", "dialog", "normal", "dropdown_menu", "popup_menu", +# "tooltip", "notification", "combo", and "dnd". +# +# Following per window-type options are available: :: +# +# fade, shadow::: +# Controls window-type-specific shadow and fade settings. +# +# opacity::: +# Controls default opacity of the window type. +# +# focus::: +# Controls whether the window of this type is to be always considered focused. +# (By default, all window types except "normal" and "dialog" has this on.) +# +# full-shadow::: +# Controls whether shadow is drawn under the parts of the window that you +# normally won't be able to see. Useful when the window has parts of it +# transparent, and you want shadows in those areas. +# +# clip-shadow-above::: +# Controls whether shadows that would have been drawn above the window should +# be clipped. Useful for dock windows that should have no shadow painted on top. +# +# redir-ignore::: +# Controls whether this type of windows should cause screen to become +# redirected again after been unredirected. If you have unredir-if-possible +# set, and doesn't want certain window to cause unnecessary screen redirection, +# you can set this to `true`. +# +wintypes: +{ + tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; }; + dock = { shadow = false; clip-shadow-above = true; } + dnd = { shadow = false; } +# popup_menu = { opacity = 0.8; } +# dropdown_menu = { opacity = 0.8; } +}; diff --git a/modules/desktop/X11/picom/default.nix b/modules/desktop/X11/picom/default.nix new file mode 100644 index 0000000..f11e37c --- /dev/null +++ b/modules/desktop/X11/picom/default.nix @@ -0,0 +1,12 @@ +{ + pkgs, + ... +}: +{ + environment.systemPackages = with pkgs; [ + picom + ]; + environment.etc = { + "xdg/picom/picom.conf".source = ./config/picom.conf; + }; +} diff --git a/modules/desktop/X11/polybar/config/colors.ini b/modules/desktop/X11/polybar/config/colors.ini new file mode 100644 index 0000000..83d0b74 --- /dev/null +++ b/modules/desktop/X11/polybar/config/colors.ini @@ -0,0 +1,7 @@ +[colors] +background = #cc303446 +background-alt = #21252b +foreground = #c6d0f5 +primary = #8caaee +alert = #e78284 +disabled = #b5bfe2 diff --git a/modules/desktop/X11/polybar/config/config.ini b/modules/desktop/X11/polybar/config/config.ini new file mode 100644 index 0000000..1a513e8 --- /dev/null +++ b/modules/desktop/X11/polybar/config/config.ini @@ -0,0 +1,218 @@ +;========================================================== +; +; +; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗ +; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗ +; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝ +; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗ +; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║ +; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ +; +; +; To learn more about how to configure Polybar +; go to https://github.com/polybar/polybar +; +; The README contains a lot of information +; +;========================================================== + +include-file = colors.ini +include-file = screen.ini + +[module/separator] +type = custom/text + +format =