diff --git a/flake.lock b/flake.lock index 53724e9..f6140e0 100644 --- a/flake.lock +++ b/flake.lock @@ -71,27 +71,6 @@ "type": "github" } }, - "copyparty": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1788281219, - "narHash": "sha256-UpYGQw2PZhZPCDKeFGKYA9vbBbwdXwhfyifUqwRw4lM=", - "owner": "9001", - "repo": "copyparty", - "rev": "704af697c78efd189cc56359f5a9aa17d2d74944", - "type": "github" - }, - "original": { - "owner": "9001", - "repo": "copyparty", - "type": "github" - } - }, "fenix": { "inputs": { "nixpkgs": [ @@ -115,22 +94,40 @@ "type": "github" } }, - "flake-utils": { + "flake-file": { "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "lastModified": 1790698230, + "narHash": "sha256-24oUHm2evb57Dgu46X41rLY9ue/au47nxbaUTo6lJVc=", + "owner": "vic", + "repo": "flake-file", + "rev": "91280a19eede3b3035e3889a3523c27e8fc07886", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "vic", + "repo": "flake-file", "type": "github" } }, - "flake-utils_2": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1788450739, + "narHash": "sha256-glZLQlzIn1fXH6PazR2iUmTo7kzzyYSshrWhLS9TqCU=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "31729ca8cbdb4fa927b34e5f4353e6a83f39e993", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { "inputs": { "systems": "systems" }, @@ -148,7 +145,7 @@ "type": "github" } }, - "flake-utils_3": { + "flake-utils_2": { "inputs": { "systems": "systems_2" }, @@ -166,7 +163,7 @@ "type": "github" } }, - "flake-utils_4": { + "flake-utils_3": { "inputs": { "systems": "systems_3" }, @@ -220,10 +217,25 @@ "type": "github" } }, + "import-tree": { + "locked": { + "lastModified": 1788467110, + "narHash": "sha256-ljEMTXP/rH0tOvDzc9gzwww6KcHRPRnEHzd9lK48V7s=", + "owner": "vic", + "repo": "import-tree", + "rev": "eb1b52eaecc57f7c136d07ae8a93e724dfecac46", + "type": "github" + }, + "original": { + "owner": "vic", + "repo": "import-tree", + "type": "github" + } + }, "jj-cz": { "inputs": { "alejandra": "alejandra", - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_2", "nixpkgs": [ "nixpkgs" ], @@ -302,6 +314,37 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1788057806, + "narHash": "sha256-DTQSMxzDWmT0zhguthvegnVkn7CFqGCv4IHCzk5ZUpM=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "596e2e3940e09b2abbeb03f75fa1828c57fcd72c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgsPinetab2Kernel": { + "locked": { + "lastModified": 1782467914, + "narHash": "sha256-pGvFkM8N0xEkIIXDe5YYfbEAvHrk4IxBrjB/x8OomhE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e73de5be04e0eff4190a1432b946d469c794e7b4", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e73de5be04e0eff4190a1432b946d469c794e7b4", + "type": "github" + } + }, "nixpkgsStable": { "locked": { "lastModified": 1782847189, @@ -319,7 +362,7 @@ }, "pumo-system-info": { "inputs": { - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_3", "nixpkgs": [ "nixpkgs" ], @@ -366,7 +409,7 @@ "nixpkgsStable" ], "nixpkgsUnstable": [ - "nixpkgs" + "nixpkgsPinetab2Kernel" ], "utils": [ "flake-utils" @@ -390,12 +433,15 @@ "root": { "inputs": { "caelestia-shell": "caelestia-shell", - "copyparty": "copyparty", - "flake-utils": "flake-utils_2", + "flake-file": "flake-file", + "flake-parts": "flake-parts", + "flake-utils": "flake-utils", "home-manager": "home-manager", + "import-tree": "import-tree", "jj-cz": "jj-cz", "nix-index-database": "nix-index-database", "nixpkgs": "nixpkgs", + "nixpkgsPinetab2Kernel": "nixpkgsPinetab2Kernel", "nixpkgsStable": "nixpkgsStable", "pumo-system-info": "pumo-system-info", "rockchip": "rockchip", diff --git a/flake.nix b/flake.nix index beefbc2..b543ae4 100644 --- a/flake.nix +++ b/flake.nix @@ -1,203 +1,79 @@ +# DO-NOT-EDIT. This file was auto-generated using github:denful/flake-file. +# Use `nix run .#write-flake` to regenerate it. { - description = "Home Manager configuration of phundrak"; + description = "NixOS and Home Manager configuration of phundrak"; + + outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules); + + nixConfig = { + extra-experimental-features = [ + "nix-command" + "flakes" + ]; + extra-substituters = [ + "https://phundrak.cachix.org?priority=10" + "https://nix-community.cachix.org?priority=20" + "https://cache.nixos.org?priority=40" + ]; + extra-trusted-public-keys = [ + "phundrak.cachix.org-1:osJAkYO0ioTOPqaQCIXMfIRz1/+YYlVFkup3R2KSexk=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + ]; + http-connections = 128; + }; inputs = { - nixpkgsStable.url = "nixpkgs/nixos-25.11"; - nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; - flake-utils.url = "github:numtide/flake-utils"; - - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - nix-index-database = { - url = "github:nix-community/nix-index-database"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - caelestia-shell = { url = "github:caelestia-dots/shell"; inputs.nixpkgs.follows = "nixpkgs"; }; - - copyparty = { - url = "github:9001/copyparty"; + flake-file.url = "github:vic/flake-file"; + flake-parts.url = "github:hercules-ci/flake-parts"; + flake-utils.url = "github:numtide/flake-utils"; + home-manager = { + url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; - + import-tree.url = "github:vic/import-tree"; jj-cz = { url = "git+https://labs.phundrak.com/phundrak/jj-cz?ref=develop"; inputs.nixpkgs.follows = "nixpkgs"; }; - + nix-index-database = { + url = "github:nix-community/nix-index-database"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + nixpkgsPinetab2Kernel.url = "github:nixos/nixpkgs/e73de5be04e0eff4190a1432b946d469c794e7b4"; + nixpkgsStable.url = "nixpkgs/nixos-25.11"; pumo-system-info = { url = "git+https://labs.phundrak.com/phundrak/pumo-system-info"; inputs.nixpkgs.follows = "nixpkgs"; }; - rockchip = { url = "github:raboof/nixos-rockchip/pinetab-linux-7.0"; - inputs.utils.follows = "flake-utils"; - inputs.nixpkgsStable.follows = "nixpkgsStable"; - inputs.nixpkgsUnstable.follows = "nixpkgs"; + inputs = { + nixpkgsStable.follows = "nixpkgsStable"; + nixpkgsUnstable.follows = "nixpkgsPinetab2Kernel"; + utils.follows = "flake-utils"; + }; }; - sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; - spicetify = { url = "github:Gerg-L/spicetify-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; - srvos = { url = "github:nix-community/srvos"; inputs.nixpkgs.follows = "nixpkgs"; }; - zen-browser = { url = "github:youwen5/zen-browser-flake"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - - nixConfig = { - extra-trusted-public-keys = [ - "marpa-local:XoO+dFN4PeauF52pYuy3Vh4Sdtl2qIdxu5aUasWKv6Q=" - "phundrak.cachix.org-1:osJAkYO0ioTOPqaQCIXMfIRz1/+YYlVFkup3R2KSexk=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - ]; - extra-substituters = [ - "http://marpa:5000?priority=5" - "https://phundrak.cachix.org?priority=10" - "https://nix-community.cachix.org?priority=20" - "https://cache.nixos.org?priority=40" - ]; - extra-experimental-features = [ - "nix-command" - "flakes" - ]; - http-connections = 128; - }; - - outputs = { - self, - nixpkgs, - flake-utils, - home-manager, - rockchip, - srvos, - ... - } @ inputs: - flake-utils.lib.eachDefaultSystem ( - system: let - inherit (self) outputs; - - pkgs = import nixpkgs {inherit system;}; - in { - formatter = pkgs.alejandra; - devShells.default = pkgs.mkShell { - buildInputs = [ - pkgs.nh - pkgs.jujutsu - pkgs.git - inputs.jj-cz.packages.${system}.default - ]; - }; - - packages = { - homeConfigurations = let - extraSpecialArgs = {inherit inputs outputs system;}; - pkgs = import nixpkgs {inherit system;}; - defaultUserModules = [ - inputs.sops-nix.homeManagerModules.sops - inputs.spicetify.homeManagerModules.default - inputs.caelestia-shell.homeManagerModules.default - ]; - withUserModules = modules: nixpkgs.lib.lists.flatten (defaultUserModules ++ [modules]); - in { - "phundrak@alys" = home-manager.lib.homeManagerConfiguration { - inherit extraSpecialArgs pkgs; - modules = withUserModules ./users/phundrak/host/alys.nix; - }; - "creug@elcafe" = home-manager.lib.homeManagerConfiguration { - inherit extraSpecialArgs pkgs; - modules = withUserModules ./users/creug/host/elcafe.nix; - }; - "phundrak@elcafe" = home-manager.lib.homeManagerConfiguration { - inherit extraSpecialArgs pkgs; - modules = withUserModules ./users/phundrak/host/elcafe.nix; - }; - "phundrak@gampo" = home-manager.lib.homeManagerConfiguration { - inherit extraSpecialArgs pkgs; - modules = withUserModules ./users/phundrak/host/gampo.nix; - }; - "phundrak@marpa" = home-manager.lib.homeManagerConfiguration { - inherit extraSpecialArgs pkgs; - modules = withUserModules ./users/phundrak/host/marpa.nix; - }; - "phundrak@NaroMk3" = home-manager.lib.homeManagerConfiguration { - inherit extraSpecialArgs pkgs; - modules = withUserModules ./users/phundrak/host/naromk3.nix; - }; - "phundrak@pinetab2" = home-manager.lib.homeManagerConfiguration { - inherit extraSpecialArgs pkgs; - modules = withUserModules ./users/phundrak/host/pinetab2.nix; - }; - "phundrak@tilo" = home-manager.lib.homeManagerConfiguration { - inherit extraSpecialArgs pkgs; - modules = withUserModules ./users/phundrak/host/tilo.nix; - }; - }; - - nixosConfigurations = let - specialArgs = {inherit inputs outputs;}; - defaultSystemModules = [ - inputs.sops-nix.nixosModules.sops - inputs.copyparty.nixosModules.default - ]; - withSystemModules = modules: nixpkgs.lib.lists.flatten (defaultSystemModules ++ [modules]); - pinetabConfig = import ./utils/pinetab.nix { - inherit nixpkgs rockchip specialArgs; - additionalModules = defaultSystemModules; - }; - in { - alys = nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = withSystemModules ./hosts/alys/configuration.nix; - }; - elcafe = nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = withSystemModules ./hosts/elcafe/configuration.nix; - }; - gampo = nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = withSystemModules ./hosts/gampo/configuration.nix; - }; - marpa = nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = withSystemModules ./hosts/marpa; - }; - NaroMk3 = nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = withSystemModules [ - srvos.nixosModules.server - srvos.nixosModules.hardware-hetzner-cloud - srvos.nixosModules.mixins-terminfo - ./hosts/naromk3 - ]; - }; - pinetab2 = pinetabConfig "x86_64-linux" ./hosts/pinetab2/gnome.nix; - tilo = nixpkgs.lib.nixosSystem { - inherit specialArgs; - modules = withSystemModules ./hosts/tilo/configuration.nix; - }; - }; - }; - } - ); } diff --git a/hosts/alys/configuration.nix b/hosts/alys/configuration.nix deleted file mode 100644 index 542fe8a..0000000 --- a/hosts/alys/configuration.nix +++ /dev/null @@ -1,41 +0,0 @@ -{inputs, ...}: { - imports = [ - ./hardware-configuration.nix - inputs.home-manager.nixosModules.default - ../../system - ]; - - mySystem = { - boot = { - kernel.hardened = true; - systemd-boot = false; - zram = { - enable = true; - memoryMax = 512; - }; - }; - dev.docker.enable = true; - networking = { - hostname = "alys"; - domain = "phundrak.com"; - id = "41157110"; - }; - packages.nix.gc.automatic = true; - services = { - endlessh.enable = true; - ssh = { - enable = true; - allowedUsers = ["phundrak"]; - passwordAuthentication = false; - }; - }; - users = { - root.disablePassword = true; - phundrak = { - enable = true; - trusted = true; - }; - }; - }; - system.stateVersion = "23.11"; -} diff --git a/hosts/alys/hardware-configuration.nix b/hosts/alys/hardware-configuration.nix deleted file mode 100644 index c03e0f2..0000000 --- a/hosts/alys/hardware-configuration.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - modulesPath, - lib, - ... -}: { - imports = [(modulesPath + "/profiles/qemu-guest.nix")]; - boot = { - loader.grub = { - efiSupport = true; - efiInstallAsRemovable = true; - device = "nodev"; - }; - initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi"]; - initrd.kernelModules = ["nvme"]; - }; - fileSystems = { - "/" = { - device = "/dev/vda1"; - fsType = "ext4"; - }; - "/boot" = { - device = "/dev/disk/by-uuid/F137-8D01"; - fsType = "vfat"; - }; - }; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; -} diff --git a/hosts/elcafe/configuration.nix b/hosts/elcafe/configuration.nix deleted file mode 100644 index f0599a5..0000000 --- a/hosts/elcafe/configuration.nix +++ /dev/null @@ -1,90 +0,0 @@ -{ - inputs, - config, - ... -}: { - imports = [ - ./hardware-configuration.nix - inputs.home-manager.nixosModules.default - ../../system - ]; - - sops.secrets = { - "elcafe/traefik/env".restartUnits = ["traefik.service"]; - "elcafe/traefik/dynamic".restartUnits = ["traefik.service"]; - # "elcafe/copyparty/passwords/creug" = { - # restartUnits = ["copyparty.service"]; - # owner = "creug"; - # }; - # "elcafe/copyparty/passwords/phundrak" = { - # restartUnits = ["copyparty.service"]; - # owner = "phundrak"; - # }; - }; - - mySystem = { - boot = { - kernel = { - hardened = true; - cpuVendor = "intel"; - }; - grub = { - enable = true; - device = "/dev/sdh"; - }; - zfs = { - enable = true; - pools = ["tank"]; - }; - }; - dev.docker = { - enable = true; - storage = "/tank/docker/"; - }; - misc.keymap = "fr"; - networking = { - hostname = "elcafe"; - id = "501c7fb9"; - }; - packages.nix.gc.automatic = true; - services = { - endlessh.enable = true; - ssh = { - enable = true; - allowedUsers = ["phundrak"]; - passwordAuthentication = true; - }; - traefik = { - enable = false; - environmentFiles = [config.sops.secrets."elcafe/traefik/env".path]; - dynamicConfigFile = config.sops.secrets."elcafe/traefik/dynamic".path; - }; - }; - users = { - root.disablePassword = true; - phundrak = { - enable = true; - trusted = true; - }; - creug = { - enable = true; - sudo = true; - }; - }; - }; - - # services.copyparty = import ./copyparty.nix { - # passwordFiles = { - # creug = config.sops.secrets."elcafe/copyparty/passwords/creug".path; - # phundrak = config.sops.secrets."elcafe/copyparty/passwords/phundrak".path; - # }; - # }; - - # 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. It's perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.11"; # Did you read the comment? -} diff --git a/hosts/elcafe/copyparty.nix b/hosts/elcafe/copyparty.nix deleted file mode 100644 index 19a16e2..0000000 --- a/hosts/elcafe/copyparty.nix +++ /dev/null @@ -1,23 +0,0 @@ -{passwordFiles}: { - enable = true; - user = "creug"; - group = "users"; - accounts = { - creug.passwordFile = passwordFiles.creug; - phundrak.passwordFile = passwordFiles.phundrak; - }; - volumes = { - "/plex" = { - path = "/plex"; - access.rwmd = ["creug" "phundrak"]; - flags = { - e2dsa = true; - e2ts = true; - xdev = true; - xvol = true; - dedup = true; - nohash = "\\.iso$"; - }; - }; - }; -} diff --git a/hosts/gampo/configuration.nix b/hosts/gampo/configuration.nix deleted file mode 100644 index 64301aa..0000000 --- a/hosts/gampo/configuration.nix +++ /dev/null @@ -1,88 +0,0 @@ -{ - config, - pkgs, - inputs, - ... -}: { - imports = [ - inputs.sops-nix.nixosModules.sops - ./hardware-configuration.nix - ../../system - ]; - - mySystem = { - boot = { - plymouth.enable = true; - kernel = { - cpuVendor = "intel"; - package = pkgs.linuxPackages; - }; - systemd-boot = true; - }; - desktop = { - hyprland.enable = true; - xserver = { - enable = true; - de = "gnome"; - }; - }; - dev.docker = { - enable = true; - podman.enable = true; - autoprune.enable = true; - }; - hardware = { - bluetooth.enable = true; - fingerprint.enable = true; - input = { - corne.allowHidAccess = true; - ibmTrackpoint.disable = true; - opentablet.enable = true; - }; - sound.enable = true; - }; - i18n.input.enable = true; - misc.keymap = "fr-bepo"; - networking = { - hostname = "gampo"; - id = "0630b33f"; - }; - packages = { - appimage.enable = true; - flatpak.enable = true; - nix = { - gc.automatic = true; - nix-ld.enable = true; - }; - }; - programs.steam.enable = true; - services = { - fwupd.enable = true; - ssh.enable = true; - }; - users = { - root.disablePassword = true; - phundrak = { - enable = true; - trusted = true; - }; - }; - }; - - sops.secrets.extraHosts = { - inherit (config.users.users.root) group; - owner = config.users.users.phundrak.name; - mode = "0440"; - }; - - security.rtkit.enable = true; - - # 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. It‘s perfectly fine and - # recommended to leave this value at the release version of the - # first install of this system. Before changing this value read - # the documentation for this option (e.g. man configuration.nix or - # on https://nixos.org/nixos/options.html). - system.stateVersion = "23.11"; # Did you read the comment? -} diff --git a/hosts/marpa/default.nix b/hosts/marpa/default.nix deleted file mode 100644 index d58e775..0000000 --- a/hosts/marpa/default.nix +++ /dev/null @@ -1,158 +0,0 @@ -{ - config, - inputs, - ... -}: { - imports = [ - inputs.sops-nix.nixosModules.sops - ./hardware-configuration.nix - ../../system - ]; - - fileSystems = { - "/home".options = [ - "compress=zstd:3" # Good balance of compression vs speed - "space_cache=v2" # Better performance - "noatime" # Don't update access times (less writes) - ]; - "/mnt/ai" = { - device = "/dev/disk/by-uuid/47e87286-caaa-4e43-b2fd-b9eceac90fe9"; - fsType = "btrfs"; - options = [ - "compress=zstd:3" # Good balance of compression vs speed - "space_cache=v2" # Better performance - "noatime" # Don't update access times (less writes) - ]; - }; - "/mnt/games" = { - device = "/dev/disk/by-uuid/a8453133-76dc-44bd-a825-444c3305fd9b"; - fsType = "btrfs"; - options = [ - "compress=zstd:3" # Good balance of compression vs speed - "space_cache=v2" # Better performance - "noatime" # Don't update access times (less writes) - ]; - }; - "/games" = { - device = "/dev/disk/by-uuid/77d32db8-2e85-4593-b6b8-55d4f9d14e1a"; - fsType = "ext4"; - }; - }; - - services.displayManager.autoLogin = { - user = "phundrak"; - enable = true; - }; - - mySystem = { - boot = { - plymouth.enable = true; - kernel = { - cpuVendor = "amd"; - v4l2loopback.enable = true; - extraModprobeConfig = '' - options snd_usb_audio vid=0x1235 pid=0x8212 device_setup=1 - ''; - }; - systemd-boot = true; - }; - desktop = { - hyprland.enable = true; - niri.enable = true; - waydroid.enable = true; - xserver = { - enable = true; - de = "gnome"; - }; - }; - dev = { - docker = { - enable = true; - podman.enable = true; - autoprune.enable = true; - }; - qemu.enable = true; - }; - hardware = { - amdgpu.enable = true; - bluetooth.enable = true; - input = { - corne.allowHidAccess = true; - opentablet.enable = true; - }; - sound = { - enable = true; - noisetorch = true; - jack = true; - scarlett.enable = true; - }; - }; - i18n.input.enable = true; - misc.keymap = "fr-bepo"; - networking = { - hostname = "marpa"; - id = "7EA4A111"; - firewall.openPortRanges = [ - { - # Sunshine - from = 1714; - to = 1764; - } - ]; - }; - packages = { - appimage.enable = true; - flatpak.enable = true; - nix.nix-ld.enable = true; - }; - programs.steam.enable = true; - services = { - fwupd.enable = true; - harmonia = { - enable = true; - signKeyPaths = [config.sops.secrets."marpa/nix-cache-priv-key".path]; - }; - languagetool.enable = true; - printing.enable = true; - ssh.enable = true; - sunshine = { - enable = true; - autostart = true; - }; - }; - users = { - root.disablePassword = true; - phundrak = { - enable = true; - trusted = true; - }; - }; - }; - - sops.secrets = { - "marpa/nix-cache-priv-key" = {}; - extraHosts = { - inherit (config.users.users.root) group; - owner = config.users.users.phundrak.name; - mode = "0440"; - }; - }; - - services.udev.extraHwdb = '' - mouse:usb:047d:80a6:* - LIBINPUT_MIDDLE_EMULATION_ENABLED=1 - ''; - - security = { - polkit.enable = true; - rtkit.enable = true; - }; - - # 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. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.11"; # Did you read the comment? -} diff --git a/hosts/marpa/services/default.nix b/hosts/marpa/services/default.nix deleted file mode 100644 index a15e5a1..0000000 --- a/hosts/marpa/services/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - # imports = [ - # ./logind.nix - # ../../../system - # ]; - # imports = [ - # ./logind.nix - # ../../../modules/ssh.nix - # ../../../modules/sunshine.nix - # ]; - - # modules = { - # sunshine = { - # enable = true; - # autostart = true; - # }; - # }; - # services = { - # blueman.enable = true; - # fwupd.enable = true; - # printing.enable = true; - # openssh.enable = true; - # }; -} diff --git a/hosts/marpa/services/gnome.nix b/hosts/marpa/services/gnome.nix deleted file mode 100644 index 0e4d129..0000000 --- a/hosts/marpa/services/gnome.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - services.xserver = { - enable = true; - displayManager.gdm.enable = true; - desktopManager.gnome.enable = true; - xkb = { - layout = "fr"; - variant = "bepo_afnor"; - }; - }; -} diff --git a/hosts/marpa/services/logind.nix b/hosts/marpa/services/logind.nix deleted file mode 100644 index d16793a..0000000 --- a/hosts/marpa/services/logind.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - services.logind = { - powerKey = "ignore"; - powerKeyLongPress = "ignore"; - }; -} diff --git a/hosts/naromk3/default.nix b/hosts/naromk3/default.nix deleted file mode 100644 index 609fade..0000000 --- a/hosts/naromk3/default.nix +++ /dev/null @@ -1,78 +0,0 @@ -{inputs, ...}: { - imports = [ - ./hardware-configuration.nix - inputs.home-manager.nixosModules.default - ../../system - ]; - - mySystem = { - boot = { - kernel = { - hardened = true; - cpuVendor = "amd"; - }; - grub = { - enable = true; - device = "/dev/sdb"; - }; - }; - dev.docker.enable = true; - misc.keymap = "fr-bepo"; - networking = { - hostname = "NaroMk3"; - id = "0003beef"; - firewall = { - openPorts = [ - 22 # Gitea SSH - 25 # SMTP - 80 # HTTP - 443 # HTTPS - 465 # SMTPS - 993 # IMAPS - ]; - }; - }; - packages.nix.gc.automatic = true; - services = { - endlessh.enable = false; - ssh = { - enable = true; - allowedUsers = ["phundrak"]; - passwordAuthentication = false; - port = 2222; # port 22 will be used by Gitea - }; - }; - users = { - root.disablePassword = true; - phundrak = { - enable = true; - trusted = true; - }; - }; - }; - - # This option defines the first version of NixOS you have installed - # on this particular machine, and is used to maintain compatibility - # with application data (e.g. databases) created on older NixOS - # versions. - # - # Most users should NEVER change this value after the initial - # install, for any reason, even if you've upgraded your system to a - # new NixOS release. - # - # This value does NOT affect the Nixpkgs version your packages and - # OS are pulled from, so changing it will NOT upgrade your system - - # see https://nixos.org/manual/nixos/stable/#sec-upgrading for how - # to actually do that. - # - # This value being lower than the current NixOS release does NOT - # mean your system is out of date, out of support, or vulnerable. - # - # Do NOT change this value unless you have manually inspected all - # the changes it would make to your configuration, and migrated your - # data accordingly. - # - # For more information, see `man configuration.nix` or - # https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion - system.stateVersion = "25.05"; # Did you read the comment? -} diff --git a/hosts/pinetab2/default.nix b/hosts/pinetab2/default.nix deleted file mode 100644 index 1b659bc..0000000 --- a/hosts/pinetab2/default.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ - config, - inputs, - ... -}: { - imports = [ - inputs.sops-nix.nixosModules.sops - ../../system/desktop - ../../system/dev - ../../system/hardware - ../../system/i18n - ../../system/misc.nix - ../../system/network - ../../system/packages - ../../system/security - ../../system/services - ../../system/users - ]; - - system.stateVersion = "25.11"; - # documentation.nixos.enable = false; - # nix.settings.trusted-users = ["root" "@wheel"]; - - mySystem = { - desktop = { - hyprland.enable = true; - niri.enable = true; - waydroid.enable = true; - xserver = { - enable = true; - de = "gnome"; - }; - }; - dev.docker = { - enable = true; - podman.enable = true; - autoprune.enable = true; - }; - hardware = { - bluetooth.enable = true; - input.opentablet.enable = true; - sound.enable = true; - }; - i18n.input.enable = true; - misc.keymap = "fr-bepo"; - networking = { - hostname = "pinetab2"; - id = "99a11b15"; - wifi.disablePowersave = true; - }; - packages = { - appimage.enable = true; - flatpak.enable = true; - nix = { - gc.automatic = true; - nix-ld.enable = true; - }; - }; - services.ssh.enable = true; - users = { - root.disablePassword = true; - phundrak = { - enable = true; - trusted = true; - }; - }; - }; - - sops.secrets.extraHosts = { - inherit (config.users.users.root) group; - owner = config.users.users.phundrak.name; - mode = "0440"; - }; -} diff --git a/hosts/pinetab2/gnome.nix b/hosts/pinetab2/gnome.nix deleted file mode 100644 index cd49212..0000000 --- a/hosts/pinetab2/gnome.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - pkgs, - config, - ... -}: { - # https://github.com/systemd/systemd/pull/35304#issuecomment-3855146191 - # gnome autorotate expects 'normal' is the _display panel_ normal, but - # mutter autoconfiguration rotates by 90deg. - # compensating with gdctl for now, though it would be better to 'properly' - # fix this. - services.udev = { - extraHwdb = '' - sensor:modalias:*sc7a20:* - ACCEL_MOUNT_MATRIX=1, 0, 0; 0, 0, 1; 0, 1, 0 - ''; - extraRules = '' - ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="1018", ATTRS{idProduct}=="1006", ENV{SYSTEMD_WANTS}+="landscape.service", TAG+="systemd" - ''; - }; - systemd.services.landscape = { - script = '' - ${pkgs.mutter}/bin/gdctl set --logical-monitor --primary --monitor=DSI-1 --transform normal - ''; - serviceConfig.User = "phundrak"; - serviceConfig.Type = "oneshot"; - environment = { - "DBUS_SESSION_BUS_ADDRESS" = "unix:path=/run/user/${toString config.users.users."phundrak".uid}/bus"; - }; - }; - environment.systemPackages = with pkgs; [ - gnomeExtensions.arc-menu - gnomeExtensions.dash-to-dock - gnomeExtensions.dash-to-panel - gnomeExtensions.gjs-osk - gnomeExtensions.one-window-wonderland - ]; -} diff --git a/hosts/tilo/configuration.nix b/hosts/tilo/configuration.nix deleted file mode 100644 index 7faf614..0000000 --- a/hosts/tilo/configuration.nix +++ /dev/null @@ -1,64 +0,0 @@ -{inputs, ...}: { - imports = [ - ./hardware-configuration.nix - inputs.home-manager.nixosModules.default - ../../system - ./services - ]; - - mySystem = { - boot = { - kernel = { - hardened = true; - cpuVendor = "amd"; - }; - zfs = { - enable = true; - pools = ["tank"]; - }; - }; - dev.docker.enable = true; - misc.keymap = "fr-bepo"; - networking = { - hostname = "tilo"; - id = "7110b33f"; - firewall = { - openPorts = [ - 80 # HTTP - 443 # HTTPS - 25565 # Minecraft - ]; - }; - }; - packages.nix.gc.automatic = true; - services = { - calibre.enable = true; - endlessh.enable = true; - jellyfin.enable = true; - plex = { - enable = true; - dataDir = "/tank/web/stacks/plex/plex-config"; - }; - ssh = { - enable = true; - allowedUsers = ["phundrak"]; - passwordAuthentication = false; - }; - }; - users = { - root.disablePassword = true; - phundrak = { - enable = true; - trusted = true; - }; - }; - }; - - # 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. It‘s 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 = "24.11"; # Did you read the comment? -} diff --git a/hosts/tilo/services/default.nix b/hosts/tilo/services/default.nix deleted file mode 100644 index 7be23ca..0000000 --- a/hosts/tilo/services/default.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - imports = [./nextcloud-cron.nix]; -} diff --git a/hosts/tilo/services/nextcloud-cron.nix b/hosts/tilo/services/nextcloud-cron.nix deleted file mode 100644 index a516701..0000000 --- a/hosts/tilo/services/nextcloud-cron.nix +++ /dev/null @@ -1,33 +0,0 @@ -{pkgs, ...}: { - systemd = { - timers."nextcloud-cron" = { - wantedBy = ["timers.target"]; - timerConfig = { - OnBootSec = "20m"; - OnUnitActiveSec = "20m"; - Unit = "nextcloud-cron.service"; - }; - }; - services."nextcloud-cron" = { - script = '' - CONTAINER_NAME="nextcloud-nextcloud-1" - - is_container_running() { - ${pkgs.docker}/bin/docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" 2>/dev/null | grep -q "true" - } - - while ! is_container_running; do - echo "Waiting for $CONTAINER_NAME to start..." - sleep 10 - done - - echo "$CONTAINER_NAME is running. Executing CRON job..." - ${pkgs.docker}/bin/docker exec -u www-data -it nextcloud-nextcloud-1 php /var/www/html/cron.php - ''; - serviceConfig = { - Type = "oneshot"; - User = "root"; - }; - }; - }; -} diff --git a/modules/boot/hardened.nix b/modules/boot/hardened.nix new file mode 100644 index 0000000..0a939b6 --- /dev/null +++ b/modules/boot/hardened.nix @@ -0,0 +1,44 @@ +{ + flake.modules.nixos.hardened = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.boot.kernel; + in { + options.mySystem.boot.kernel.hardened = mkEnableOption "Enables hardened Linux kernel"; + + config.boot = { + kernelModules = lists.optional cfg.hardened "tcp_bbr"; + kernel.sysctl = mkIf cfg.hardened { + "kernel.sysrq" = 0; # Disable magic SysRq key + # Ignore ICMP broadcasts to avoid participating in Smurf attacks + "net.ipv4.icmp_echo_ignore_broadcasts" = 1; + # Ignore bad ICMP errors + "net.ipv4.icmp_ignore_bogus_error_responses" = 1; + # SYN flood protection + "net.ipv4.tcp_syncookies" = 1; + # Do not accept ICMP redirects (prevent MITM attacks) + "net.ipv4.conf.all.accept_redirects" = 0; + "net.ipv4.conf.default_accept_redirects" = 0; + "net.ipv4.conf.all.secure_redirects" = 0; + "net.ipv4.conf.default.secure_redirects" = 0; + "net.ipv6.conf.all.accept_redirects" = 0; + "net.ipv6.conf.default.accept_redirects" = 0; + # Do not send ICMP redirects (we are not a router) + "net.ipv4.conf.all.send_redirects" = 0; + # Do not accept IP source route packets (we are not a router) + "net.ipv4.conf.all.accept_source_route" = 0; + "net.ipv6.conf.all.accept_source_route" = 0; + # Protect against tcp time-wait assassination hazards + "net.ipv4.tcp_rfc1337" = 1; + # Latency reduction + "net.ipv4.tcp_fastopen" = 3; + # Bufferfloat mitigations + "net.ipv4.tcp_congestion_control" = "bbr"; + "net.core.default_qdisc" = "cake"; + }; + }; + }; +} diff --git a/modules/boot/kernel.nix b/modules/boot/kernel.nix new file mode 100644 index 0000000..2b60312 --- /dev/null +++ b/modules/boot/kernel.nix @@ -0,0 +1,53 @@ +{config, ...}: let + flakeModules = config.flake.modules; +in { + flake.modules.nixos.kernel = { + pkgs, + config, + lib, + ... + }: + with lib; let + cfg = config.mySystem.boot.kernel; + in { + imports = [flakeModules.nixos.amdgpu]; + + options.mySystem.boot.kernel = { + package = mkOption { + type = types.raw; + default = pkgs.linuxPackages_zen; + }; + modules = mkOption { + type = types.listOf types.str; + default = []; + }; + cpuVendor = mkOption { + description = "Intel or AMD?"; + type = types.enum ["intel" "amd"]; + default = "amd"; + }; + v4l2loopback.enable = mkEnableOption "Enables v4l2loopback kernel module"; + extraModprobeConfig = mkOption { + type = types.lines; + default = ""; + example = '' + options snd_usb_audio vid=0x1235 pid=0x8212 device_setup=1 + ''; + }; + }; + + config.boot = { + initrd.kernelModules = lib.lists.singleton ( + if config.mySystem.hardware.amdgpu.enable + then "amdgpu" + else "i915" + ); + extraModprobeConfig = + strings.concatLines + ([cfg.extraModprobeConfig] + ++ lists.optional cfg.v4l2loopback.enable ''options v4l2loopback exclusive_caps=1 devices=1 video_nr=0 card_label="OBS Studio"''); + kernelPackages = cfg.package; + kernelModules = cfg.modules ++ ["kvm-${cfg.cpuVendor}"]; + }; + }; +} diff --git a/modules/boot/loader.nix b/modules/boot/loader.nix new file mode 100644 index 0000000..eb42974 --- /dev/null +++ b/modules/boot/loader.nix @@ -0,0 +1,45 @@ +{ + flake.modules.nixos.loader = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.boot; + in { + options.mySystem.boot = { + systemd-boot = mkOption { + type = types.bool; + default = !cfg.grub.enable; + description = "Does the system use systemd-boot?"; + }; + grub = { + enable = mkEnableOption "Does the system use GRUB? (Disables systemd-boot)"; + device = mkOption { + type = types.path; + description = "The GRUB device"; + default = ""; + }; + }; + zfs = { + enable = mkEnableOption "Enables ZFS"; + pools = mkOption { + type = types.listOf types.str; + default = []; + }; + }; + }; + + config.boot = { + loader = { + systemd-boot.enable = cfg.systemd-boot; + efi.canTouchEfiVariables = cfg.systemd-boot; + grub = mkIf cfg.grub.enable { + inherit (cfg.grub) enable device; + }; + }; + supportedFilesystems = mkIf cfg.zfs.enable ["zfs"]; + zfs.extraPools = mkIf cfg.zfs.enable cfg.zfs.pools; + }; + }; +} diff --git a/modules/boot/plymouth.nix b/modules/boot/plymouth.nix new file mode 100644 index 0000000..21333e0 --- /dev/null +++ b/modules/boot/plymouth.nix @@ -0,0 +1,35 @@ +{ + flake.modules.nixos.plymouth = { + pkgs, + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.boot.plymouth; + in { + options.mySystem.boot.plymouth.enable = mkEnableOption "Enables Plymouth at system boot"; + config.boot = mkIf cfg.enable { + plymouth = { + inherit (cfg) enable; + theme = "circle_hud"; + themePackages = with pkgs; [ + (adi1090x-plymouth-themes.override { + selected_themes = ["circle_hud"]; + }) + ]; + }; + consoleLogLevel = 3; + initrd.verbose = false; + kernelParams = [ + "quiet" + "splash" + "boot.shell_on_fail" + "udev.log_priority=3" + "rd.systemd.show_status=auto" + ]; + # Loader appears only if a key is pressed + loader.timeout = 0; + }; + }; +} diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..cb041bf --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,109 @@ +{ + inputs, + lib, + config, + ... +}: { + imports = [ + inputs.flake-parts.flakeModules.modules + inputs.flake-file.flakeModules.default + ]; + + options.flake.homeConfigurations = lib.mkOption { + type = lib.types.lazyAttrsOf lib.types.raw; + default = {}; + }; + + config = { + flake-file.inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgsPinetab2Kernel.url = "github:nixos/nixpkgs/e73de5be04e0eff4190a1432b946d469c794e7b4"; + rockchip = { + url = "github:raboof/nixos-rockchip/pinetab-linux-7.0"; + inputs.utils.follows = "flake-utils"; + inputs.nixpkgsStable.follows = "nixpkgsStable"; + inputs.nixpkgsUnstable.follows = "nixpkgsPinetab2Kernel"; + }; + }; + + systems = ["x86_64-linux" "aarch64-linux"]; + + flake.lib = { + mkNixos = system: name: { + ${name} = inputs.nixpkgs.lib.nixosSystem { + modules = [ + config.flake.modules.nixos.${name} + {nixpkgs.hostPlatform = lib.mkDefault system;} + ]; + }; + }; + + mkHome = system: userName: hostName: { + "${userName}@${hostName}" = inputs.home-manager.lib.homeManagerConfiguration { + pkgs = inputs.nixpkgs.legacyPackages.${system}; + extraSpecialArgs = { + inherit inputs; + bunBaseline = config.flake.packages.${system}.bun-baseline; + }; + modules = [config.flake.modules.homeManager."${userName}-${hostName}"]; + }; + }; + + mkPinetab = buildPlatform: variantModule: { + pinetab2 = inputs.nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + inputs.rockchip.nixosModules.sdImageRockchip + inputs.rockchip.nixosModules.dtOverlayPCIeFix + inputs.rockchip.nixosModules.noZFS + config.flake.modules.nixos.pinetab2-base + variantModule + { + rockchip.uBoot = inputs.rockchip.packages.${buildPlatform}.uBootPineTab2; + boot.kernelPackages = + inputs.rockchip.legacyPackages.${buildPlatform}.kernel_linux_7_0_pinetab_unstable; + hardware.firmware = [inputs.rockchip.packages.aarch64-linux.bes2600]; + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (inputs.nixpkgs.lib.getName pkg) ["bes2600-firmware"]; + } + ]; + }; + }; + }; + + flake.nixosConfigurations = lib.mkMerge [ + (config.flake.lib.mkNixos "x86_64-linux" "elcafe") + (config.flake.lib.mkNixos "x86_64-linux" "gampo") + (config.flake.lib.mkNixos "x86_64-linux" "marpa") + (config.flake.lib.mkNixos "x86_64-linux" "NaroMk3") + (config.flake.lib.mkNixos "x86_64-linux" "tilo") + (config.flake.lib.mkPinetab "x86_64-linux" config.flake.modules.nixos.pinetab2-gnome) + ]; + + flake.homeConfigurations = lib.mkMerge [ + (config.flake.lib.mkHome "x86_64-linux" "phundrak" "elcafe") + (config.flake.lib.mkHome "x86_64-linux" "phundrak" "gampo") + (config.flake.lib.mkHome "x86_64-linux" "phundrak" "marpa") + (config.flake.lib.mkHome "x86_64-linux" "phundrak" "NaroMk3") + (config.flake.lib.mkHome "x86_64-linux" "phundrak" "pinetab2") + (config.flake.lib.mkHome "x86_64-linux" "phundrak" "tilo") + (config.flake.lib.mkHome "x86_64-linux" "creug" "elcafe") + ]; + + perSystem = { + pkgs, + system, + ... + }: { + formatter = pkgs.alejandra; + devShells.default = pkgs.mkShell { + buildInputs = [ + pkgs.nh + pkgs.jujutsu + pkgs.git + inputs.jj-cz.packages.${system}.default + ]; + }; + }; + }; +} diff --git a/modules/desktop/hyprland-homeManager.nix b/modules/desktop/hyprland-homeManager.nix new file mode 100644 index 0000000..4c8ca81 --- /dev/null +++ b/modules/desktop/hyprland-homeManager.nix @@ -0,0 +1,185 @@ +{ + flake.modules.homeManager.hyprland = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.home.desktop.hyprland; + laptops = ["gampo"]; + caelestiaEnabled = config.home.desktop.caelestia.enable; + in { + options.home.desktop.hyprland = { + enable = mkEnableOption "Enables Hyprland"; + emacsPkg = mkOption { + type = types.package; + default = config.home.dev.editors.emacs.package or pkgs.emacs; + example = pkgs.emacs; + }; + host = mkOption { + type = types.enum ["gampo" "marpa"]; + description = '' + Which host is Hyprland running on. + + This helps determine the monitors layout and enable battery support in waybar. + ''; + }; + }; + + config = mkIf cfg.enable { + home.desktop = { + hyprpaper.enable = mkDefault (! caelestiaEnabled); + rofi.enable = mkDefault true; + swaync.enable = mkDefault (! caelestiaEnabled); + waybar = { + enable = mkDefault (! caelestiaEnabled); + battery = mkDefault (builtins.elem cfg.host laptops); + }; + wlsunset.enable = mkDefault true; + }; + services.blueman-applet.enable = ! caelestiaEnabled; + wayland.windowManager.hyprland = { + enable = true; + systemd.enable = false; + importantPrefixes = ["$left" "$right" "$up" "$down" "$menu"]; + settings = { + env = [ + "XMODIFIERS,@im=fcitx" + "XCURSOR_SIZE,12" + ]; + input = { + kb_layout = "fr,us"; + kb_variant = "bepo_afnor,"; + numlock_by_default = true; + follow_mouse = 1; + touchpad.natural_scroll = false; + sensitivity = "0"; + }; + device = { + name = "wacom-usb-bamboo-pad-finger"; + sensitivity = 0.5; + }; + monitor = + { + "marpa" = [ + "DP-1, 3440x1440@144, 1080x550, 1" + # "DP-1, 2560x1440@144, 1080x550, 1" # streaming + "DP-2, 2560x1080@60, 0x0, 1, transform, 1" + ]; + "gampo" = []; + }."${cfg.host}"; + general = { + gaps_in = 5; + gaps_out = 20; + border_size = 2; + "col.active_border" = "rgb(81a1c1) rgb(a3be8c) 45deg"; + "col.inactive_border" = "rgb(4c566a)"; + layout = "master"; + }; + master = { + orientation = "center"; + new_status = "inherit"; + }; + workspace = [ + "1, layoutopt:orientation:bottom" + "9, layoutopt:orientation:bottom" + "10, layoutopt:orientation:bottom" + ]; + decoration = { + rounding = 20; + }; + animations = { + enabled = true; + animation = [ + # "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + dwindle.preserve_split = true; + exec-once = + [ + "pactl load-module module-switch-on-connect" + "${pkgs.mpc}/bin/mpc stop" + "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" + "${pkgs.mozc}/lib/mozc/mozc_server" + "${pkgs.fcitx5}/bin/fcitx5 -d" + ] + ++ lib.lists.optional (! caelestiaEnabled) "${pkgs.networkmanagerapplet}/bin/nm-applet"; + }; + extraConfig = '' + device { + name = wacom-usb-bamboo-pad-finger + sensitivity = 0.5 + accel_profile = adaptive + } + + $left = c + $right = r + $up = s + $down = t + $menu = rofi -combi-modi drun,calc -show combi + + bind = SUPER, Return, exec, ${pkgs.kitty}/bin/kitty ${pkgs.tmux}/bin/tmux + bind = SUPER, Space, exec, ${pkgs.wlr-which-key}/bin/wlr-which-key + bind = , Print, exec, ${pkgs.wlr-which-key}/bin/wlr-which-key -k s + + bindl = , XF86AudioPlay, exec, playerctl play-pause + bindl = , XF86AudioPause, exec, playerctl pause + bindl = , XF86AudioStop, exec, playerctl stop + bindl = , XF86AudioPrev, exec, playerctl previous + bindl = , XF86AudioNext, exec, playerctl next + bindl = , XF86AudioForward, exec, playerctl position +1 + bindl = , XF86AudioRewind, exec, playerctl position -1 + bindl = , XF86AudioRaiseVolume, exec, pamixer -i 2 + bindl = , XF86AudioLowerVolume, exec, pamixer -d 2 + bindl = , XF86MonBrightnessUp, exec, xbacklight -perceived -inc 2 + bindl = , XF86MonBrightnessDown, exec, xbacklight -perceived -dec 2 + bindl = , XF86KbdBrightnessUp, exec, xbacklight -perceived -inc 2 + bindl = , XF86KbdBrightnessDown, exec, xbacklight -perceived -dec 2 + bind = SUPER, a, exec, hyprctl switchxkblayout glove80-keyboard next + bind = SUPER, $left, movefocus, l + bind = SUPER, $right, movefocus, r + bind = SUPER, $up, movefocus, u + bind = SUPER, $down, movefocus, d + bind = SUPER_SHIFT, $left, movewindow, l + bind = SUPER_SHIFT, $right, movewindow, r + bind = SUPER_SHIFT, $up, movewindow, u + bind = SUPER_SHIFT, $down, movewindow, d + bind = SUPER_CTRL_SHIFT, $left, moveworkspacetomonitor, e+0 +1 + bind = SUPER_CTRL_SHIFT, $right, moveworkspacetomonitor, e+0 -1 + bind = SUPER, Tab, cyclenext, + bind = SUPER_SHIFT, Tab, cyclenext, prev + bindm = SUPER, mouse:272, movewindow + bindm = SUPER, mouse:273, resizewindow + bind = SUPER, quotedbl, workspace, 1 + bind = SUPER, guillemotleft, workspace, 2 + bind = SUPER, guillemotright, workspace, 3 + bind = SUPER, parenleft, workspace, 4 + bind = SUPER, parenright, workspace, 5 + bind = SUPER, at, workspace, 6 + bind = SUPER, plus, workspace, 7 + bind = SUPER, minus, workspace, 8 + bind = SUPER, slash, workspace, 9 + bind = SUPER, asterisk, workspace, 10 + bind = SUPER, mouse_down, workspace, e+1 + bind = SUPER, mouse_up, workspace, e-1 + bind = SUPER_SHIFT, quotedbl, movetoworkspace, 1 + bind = SUPER_SHIFT, guillemotleft, movetoworkspace, 2 + bind = SUPER_SHIFT, guillemotright, movetoworkspace, 3 + bind = SUPER_SHIFT, parenleft, movetoworkspace, 4 + bind = SUPER_SHIFT, parenright, movetoworkspace, 5 + bind = SUPER_SHIFT, at, movetoworkspace, 6 + bind = SUPER_SHIFT, plus, movetoworkspace, 7 + bind = SUPER_SHIFT, minus, movetoworkspace, 8 + bind = SUPER_SHIFT, slash, movetoworkspace, 9 + bind = SUPER_SHIFT, asterisk, movetoworkspace, 10 + ''; + }; + }; + }; +} diff --git a/modules/desktop/hyprland-nixos.nix b/modules/desktop/hyprland-nixos.nix new file mode 100644 index 0000000..c024612 --- /dev/null +++ b/modules/desktop/hyprland-nixos.nix @@ -0,0 +1,16 @@ +{ + flake.modules.nixos.hyprland = { + config, + lib, + ... + }: + with lib; let + cfg = config.mySystem.desktop.hyprland; + in { + options.mySystem.desktop.hyprland.enable = mkEnableOption "Enables Hyprland"; + config.programs.hyprland = mkIf cfg.enable { + inherit (cfg) enable; + withUWSM = true; + }; + }; +} diff --git a/modules/desktop/niri.nix b/modules/desktop/niri.nix new file mode 100644 index 0000000..3c3f558 --- /dev/null +++ b/modules/desktop/niri.nix @@ -0,0 +1,15 @@ +{ + flake.modules.nixos.niri = { + config, + lib, + ... + }: + with lib; let + cfg = config.mySystem.desktop.niri; + in { + options.mySystem.desktop.niri.enable = mkEnableOption "Enables Niri"; + config.programs.niri = mkIf cfg.enable { + inherit (cfg) enable; + }; + }; +} diff --git a/modules/desktop/waydroid.nix b/modules/desktop/waydroid.nix new file mode 100644 index 0000000..9d69cde --- /dev/null +++ b/modules/desktop/waydroid.nix @@ -0,0 +1,20 @@ +{ + flake.modules.nixos.waydroid = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.mySystem.desktop.waydroid; + in { + options.mySystem.desktop.waydroid.enable = mkEnableOption "Enables Waydroid"; + config = mkIf cfg.enable { + virtualisation.waydroid = { + enable = cfg.enable; + package = pkgs.waydroid-nftables; + }; + environment.systemPackages = [pkgs.waydroid-helper]; + }; + }; +} diff --git a/modules/desktop/xserver.nix b/modules/desktop/xserver.nix new file mode 100644 index 0000000..1211c15 --- /dev/null +++ b/modules/desktop/xserver.nix @@ -0,0 +1,47 @@ +{ + flake.modules.nixos.xserver = { + config, + lib, + ... + }: + with lib; let + cfg = config.mySystem.desktop.xserver; + in { + options.mySystem.desktop.xserver = { + enable = mkEnableOption "Enables xserver"; + de = mkOption { + type = types.enum ["gnome" "kde"]; + default = "gnome"; + example = "kde"; + description = "Which DE to enable"; + }; + }; + config.services = mkIf cfg.enable { + displayManager = { + sddm.enable = mkIf (cfg.de == "kde") true; + gdm.enable = mkIf (cfg.de == "gnome") true; + }; + desktopManager = { + plasma6.enable = mkIf (cfg.de == "kde") true; + gnome.enable = mkIf (cfg.de == "gnome") true; + }; + + gnome = mkIf (cfg.de == "gnome") { + gnome-browser-connector.enable = true; + games.enable = false; + gnome-remote-desktop.enable = true; + gnome-online-accounts.enable = true; + sushi.enable = true; + }; + + xserver = { + inherit (cfg) enable; + videoDrivers = lists.optional config.mySystem.hardware.amdgpu.enable "amdgpu"; + xkb = { + layout = "fr"; + variant = "bepo_afnor"; + }; + }; + }; + }; +} diff --git a/modules/dev/qemu.nix b/modules/dev/qemu.nix new file mode 100644 index 0000000..0a7465a --- /dev/null +++ b/modules/dev/qemu.nix @@ -0,0 +1,35 @@ +{ + flake.modules.nixos.qemu = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.mySystem.dev.qemu; + in { + options.mySystem.dev.qemu = { + enable = mkEnableOption "Enable QEMU"; + users = mkOption { + type = types.listOf types.str; + default = ["phundrak"]; + example = ["user1" "user2"]; + }; + }; + config = mkIf cfg.enable { + programs.virt-manager.enable = true; + users.groups.libvirtd.members = cfg.users; + virtualisation = { + libvirtd.enable = true; + spiceUSBRedirection.enable = true; + }; + environment.systemPackages = with pkgs; [ + qemu + quickemu + swtpm + ]; + systemd.tmpfiles.rules = ["L+ /var/lib/qemu/firmware - - - - ${pkgs.qemu}/share/qemu/firmware"]; + boot.binfmt.emulatedSystems = ["aarch64-linux"]; + }; + }; +} diff --git a/modules/hardware/amdgpu.nix b/modules/hardware/amdgpu.nix new file mode 100644 index 0000000..a479d0a --- /dev/null +++ b/modules/hardware/amdgpu.nix @@ -0,0 +1,64 @@ +{ + flake.modules.nixos.amdgpu = { + pkgs, + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.hardware.amdgpu; + in { + options.mySystem.hardware.amdgpu.enable = mkEnableOption "Enables an AMD GPU configuration"; + config = mkIf cfg.enable { + hardware = { + graphics = { + enable = true; + enable32Bit = true; + extraPackages = with pkgs; [ + mesa # Mesa drivers for AMD GPUs + rocmPackages.clr # common language runtime for ROCm + rocmPackages.clr.icd # ROCm ICD for OpenCL + rocmPackages.rocblas # ROCm BLAS library + rocmPackages.hipblas # + rocmPackages.rpp # High-performance computer vision library + nvtopPackages.amd # GPU utilization monitoring + ]; + }; + amdgpu = { + initrd.enable = true; + opencl.enable = true; + }; + }; + environment.systemPackages = with pkgs; [ + clinfo + amdgpu_top + nvtopPackages.amd + ]; + systemd = { + packages = with pkgs; [lact]; + services.lactd.wantedBy = ["multi-user.target"]; + tmpfiles.rules = let + rocmEnv = pkgs.symlinkJoin { + name = "rocm-combined"; + paths = with pkgs.rocmPackages; [ + clr + clr.icd + rocblas + hipblas + rpp + ]; + }; + in [ + "L+ /opt/rocm - - - - ${rocmEnv}" + ]; + }; + environment.variables = { + ROCM_PATH = "/opt/rocm"; # Set ROCm path + HIP_VISIBLE_DEVICES = "1"; # Use only the eGPU (ID 1) + ROCM_VISIBLE_DEVICES = "1"; # Optional: ROCm equivalent for visibility + # LD_LIBRARY_PATH = "/opt/rocm/lib"; # Add ROCm libraries + HSA_OVERRIDE_GFX_VERSION = "10.3.0"; # Set GFX version override + }; + }; + }; +} diff --git a/modules/hardware/bluetooth.nix b/modules/hardware/bluetooth.nix new file mode 100644 index 0000000..f490d3b --- /dev/null +++ b/modules/hardware/bluetooth.nix @@ -0,0 +1,16 @@ +{ + flake.modules.nixos.bluetooth = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.hardware.bluetooth; + in { + options.mySystem.hardware.bluetooth.enable = mkEnableOption "Enable bluetooth"; + config = mkIf cfg.enable { + hardware.bluetooth.enable = cfg.enable; + services.blueman.enable = cfg.enable; + }; + }; +} diff --git a/modules/hardware/fingerprint.nix b/modules/hardware/fingerprint.nix new file mode 100644 index 0000000..2512f63 --- /dev/null +++ b/modules/hardware/fingerprint.nix @@ -0,0 +1,15 @@ +{ + flake.modules.nixos.fingerprint = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.hardware.fingerprint; + in { + options.mySystem.hardware.fingerprint.enable = mkEnableOption "Enable fingerprint reader"; + config = mkIf cfg.enable { + hardware.facter.detected.fingerprint.enable = cfg.enable; + }; + }; +} diff --git a/modules/hardware/firmware.nix b/modules/hardware/firmware.nix new file mode 100644 index 0000000..5c675e7 --- /dev/null +++ b/modules/hardware/firmware.nix @@ -0,0 +1,5 @@ +{ + flake.modules.nixos.firmware = {lib, ...}: { + hardware.enableAllFirmware = lib.mkDefault true; + }; +} diff --git a/modules/hardware/input/corne.nix b/modules/hardware/input/corne.nix new file mode 100644 index 0000000..ab3c644 --- /dev/null +++ b/modules/hardware/input/corne.nix @@ -0,0 +1,17 @@ +{ + flake.modules.nixos.corne = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.hardware.input.corne; + in { + options.mySystem.hardware.input.corne.allowHidAccess = mkEnableOption "Enable HID access to the corne keyboard"; + config.services.udev = mkIf cfg.allowHidAccess { + extraRules = '' + KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{serial}=="*vial:f64c2b3c*", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl" + ''; + }; + }; +} diff --git a/modules/hardware/input/ibm-trackpoint.nix b/modules/hardware/input/ibm-trackpoint.nix new file mode 100644 index 0000000..172b18c --- /dev/null +++ b/modules/hardware/input/ibm-trackpoint.nix @@ -0,0 +1,17 @@ +{ + flake.modules.nixos.ibm-trackpoint = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.hardware.input.ibmTrackpoint; + in { + options.mySystem.hardware.input.ibmTrackpoint.disable = mkEnableOption "Disable IBM’s trackpoint on ThinkPad"; + config.services.udev = mkIf cfg.disable { + extraRules = '' + ATTRS{name}=="*TPPS/2 IBM TrackPoint", ENV{ID_INPUT}="", ENV{ID_INPUT_MOUSE}="", ENV{ID_INPUT_POINTINGSTICK}="" + ''; + }; + }; +} diff --git a/modules/hardware/input/opentablet.nix b/modules/hardware/input/opentablet.nix new file mode 100644 index 0000000..652735b --- /dev/null +++ b/modules/hardware/input/opentablet.nix @@ -0,0 +1,19 @@ +{ + flake.modules.nixos.opentablet = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.hardware.input.opentablet; + in { + options.mySystem.hardware.input.opentablet.enable = mkEnableOption "Enables OpenTablet drivers"; + config = mkIf cfg.enable { + hardware.opentabletdriver = { + inherit (cfg) enable; + daemon.enable = true; + }; + boot.kernelModules = ["wacom"]; + }; + }; +} diff --git a/modules/hardware/input/trackball.nix b/modules/hardware/input/trackball.nix new file mode 100644 index 0000000..f3e1fa8 --- /dev/null +++ b/modules/hardware/input/trackball.nix @@ -0,0 +1,5 @@ +{ + flake.modules.nixos.trackball = { + services.libinput.mouse.middleEmulation = true; + }; +} diff --git a/modules/hardware/pinetab2.nix b/modules/hardware/pinetab2.nix new file mode 100644 index 0000000..556bf46 --- /dev/null +++ b/modules/hardware/pinetab2.nix @@ -0,0 +1,14 @@ +{ + flake.modules.nixos.pinetab2 = {lib, ...}: + with lib; { + options.mySystem.hardware.pinetab2.enable = mkEnableOption "Activate support for the PineTab2"; + config = { + boot.kernelParams = ["console=tty0" "console=ttyS2,1500000n8" "rootwait" "root=LABEL=NIXOS_SD" "rw"]; + hardware.sensor.iio.enable = true; + services.avahi = { + enable = true; + openFirewall = true; + }; + }; + }; +} diff --git a/modules/hardware/sound.nix b/modules/hardware/sound.nix new file mode 100644 index 0000000..0fd8ff8 --- /dev/null +++ b/modules/hardware/sound.nix @@ -0,0 +1,53 @@ +{ + flake.modules.nixos.sound = { + lib, + config, + pkgs, + ... + }: + with lib; let + cfg = config.mySystem.hardware.sound; + in { + options.mySystem.hardware.sound = { + enable = mkEnableOption "Whether to enable sounds with Pipewire"; + noisetorch = mkEnableOption "Whether to activate noisetorch support"; + scarlett.enable = mkEnableOption "Activate support for Scarlett sound card"; + alsa = mkOption { + type = types.bool; + example = true; + default = true; + description = "Whether to enable ALSA support with Pipewire"; + }; + jack = mkOption { + type = types.bool; + example = true; + default = false; + description = "Whether to enable JACK support with Pipewire"; + }; + package = mkOption { + type = types.package; + example = pkgs.pulseaudio; + default = pkgs.pulseaudioFull; + description = "Which base package to use for PulseAudio"; + }; + }; + + config = { + environment.systemPackages = mkIf cfg.scarlett.enable [pkgs.alsa-scarlett-gui]; + services = { + pipewire = mkIf cfg.enable { + enable = true; + alsa = mkIf cfg.alsa { + enable = mkDefault true; + support32Bit = mkDefault true; + }; + jack.enable = mkDefault cfg.jack; + }; + pulseaudio.enable = false; + }; + programs.noisetorch = mkIf cfg.enable { + enable = cfg.noisetorch; + }; + }; + }; +} diff --git a/modules/home/base.nix b/modules/home/base.nix new file mode 100644 index 0000000..35c71f9 --- /dev/null +++ b/modules/home/base.nix @@ -0,0 +1,40 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager.home-base = { + config, + lib, + ... + }: + with lib; let + cfg = config.home; + in { + imports = [ + m.basics + m.cli + m.desktop + m.dev + m.media + m.my-services + m.security + m.shell + ]; + + options.home = { + fullDesktop = mkEnableOption "Enable most modules"; + gpuType = mkOption { + type = types.nullOr (types.enum ["nvidia" "amd" "intel"]); + default = null; + example = "amd"; + }; + }; + config.home = { + cli.fullDesktop = mkDefault cfg.fullDesktop; + desktop.fullDesktop = mkDefault cfg.fullDesktop; + dev.fullDesktop = mkDefault cfg.fullDesktop; + media.fullDesktop = mkDefault cfg.fullDesktop; + security.fullDesktop = mkDefault cfg.fullDesktop; + myServices.fullDesktop = mkDefault cfg.fullDesktop; + }; + }; +} diff --git a/modules/home/basics.nix b/modules/home/basics.nix new file mode 100644 index 0000000..aebc73e --- /dev/null +++ b/modules/home/basics.nix @@ -0,0 +1,12 @@ +{ + flake.modules.homeManager.basics = { + programs = { + fd.enable = true; + fzf.enable = true; + home-manager.enable = true; + htop.enable = true; + jq.enable = true; + ripgrep.enable = true; + }; + }; +} diff --git a/users/modules/cli/scripts/askpass.nix b/modules/home/cli/_scripts/askpass.nix similarity index 100% rename from users/modules/cli/scripts/askpass.nix rename to modules/home/cli/_scripts/askpass.nix diff --git a/users/modules/cli/scripts/backup.nix b/modules/home/cli/_scripts/backup.nix similarity index 100% rename from users/modules/cli/scripts/backup.nix rename to modules/home/cli/_scripts/backup.nix diff --git a/users/modules/cli/scripts/keygen.nix b/modules/home/cli/_scripts/keygen.nix similarity index 100% rename from users/modules/cli/scripts/keygen.nix rename to modules/home/cli/_scripts/keygen.nix diff --git a/users/modules/cli/scripts/launch-with-emacsclient.nix b/modules/home/cli/_scripts/launch-with-emacsclient.nix similarity index 100% rename from users/modules/cli/scripts/launch-with-emacsclient.nix rename to modules/home/cli/_scripts/launch-with-emacsclient.nix diff --git a/users/modules/cli/scripts/launcher.nix b/modules/home/cli/_scripts/launcher.nix similarity index 100% rename from users/modules/cli/scripts/launcher.nix rename to modules/home/cli/_scripts/launcher.nix diff --git a/users/modules/cli/scripts/mp42webm.nix b/modules/home/cli/_scripts/mp42webm.nix similarity index 100% rename from users/modules/cli/scripts/mp42webm.nix rename to modules/home/cli/_scripts/mp42webm.nix diff --git a/users/modules/cli/scripts/plock.nix b/modules/home/cli/_scripts/plock.nix similarity index 100% rename from users/modules/cli/scripts/plock.nix rename to modules/home/cli/_scripts/plock.nix diff --git a/users/modules/cli/scripts/screenshot.nix b/modules/home/cli/_scripts/screenshot.nix similarity index 100% rename from users/modules/cli/scripts/screenshot.nix rename to modules/home/cli/_scripts/screenshot.nix diff --git a/users/modules/cli/scripts/sshbind.nix b/modules/home/cli/_scripts/sshbind.nix similarity index 100% rename from users/modules/cli/scripts/sshbind.nix rename to modules/home/cli/_scripts/sshbind.nix diff --git a/users/modules/cli/scripts/ytplay.nix b/modules/home/cli/_scripts/ytplay.nix similarity index 100% rename from users/modules/cli/scripts/ytplay.nix rename to modules/home/cli/_scripts/ytplay.nix diff --git a/modules/home/cli/bat.nix b/modules/home/cli/bat.nix new file mode 100644 index 0000000..ddb6baf --- /dev/null +++ b/modules/home/cli/bat.nix @@ -0,0 +1,26 @@ +{ + flake.modules.homeManager.bat = { + pkgs, + config, + lib, + ... + }: + with lib; let + cfg = config.home.cli.bat; + in { + options.home.cli.bat.extras = mkEnableOption "Enables extra packages for bat."; + config.programs.bat = { + enable = true; + config = { + theme = "Nord"; + map-syntax = [ + ".spacemacs*:Lisp" + ]; + }; + extraPackages = mkIf cfg.extras (with pkgs.bat-extras; [ + batman + batpipe + ]); + }; + }; +} diff --git a/modules/home/cli/btop.nix b/modules/home/cli/btop.nix new file mode 100644 index 0000000..45dd900 --- /dev/null +++ b/modules/home/cli/btop.nix @@ -0,0 +1,36 @@ +{ + flake.modules.homeManager.btop = { + pkgs, + config, + ... + }: let + inherit (config.home) gpuType; + in { + programs.btop = { + enable = true; + package = + if gpuType != null + then + pkgs.btop.override { + rocmSupport = gpuType == "amd"; + cudaSupport = gpuType == "nvidia"; + } + else pkgs.btop; + settings = { + color_theme = "${pkgs.btop}/share/btop/themes/nord.theme"; + cpu_bottom = false; + cpu_sensor = "auto"; + io_graph_combined = false; + io_mode = true; + only_physical = true; + proc_tree = true; + rounded_corners = true; + show_disks = true; + show_gpu_info = "on"; + show_uptime = true; + theme_background = true; + vim_keys = false; + }; + }; + }; +} diff --git a/modules/home/cli/cli.nix b/modules/home/cli/cli.nix new file mode 100644 index 0000000..2b93f33 --- /dev/null +++ b/modules/home/cli/cli.nix @@ -0,0 +1,33 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager.cli = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.cli; + in { + imports = [ + m.bat + m.btop + m.direnv + m.eza + m.mu + m.nh + m.nix-index + m.scripts + m.tealdeer + m.yt-dlp + ]; + + options.home.cli.fullDesktop = mkEnableOption "Enable all optional modules and options"; + config.home.cli = { + bat.extras = mkDefault cfg.fullDesktop; + mu.enable = mkDefault cfg.fullDesktop; + scripts.enable = mkDefault cfg.fullDesktop; + yt-dlp.enable = mkDefault cfg.fullDesktop; + }; + }; +} diff --git a/modules/home/cli/direnv.nix b/modules/home/cli/direnv.nix new file mode 100644 index 0000000..cad62d7 --- /dev/null +++ b/modules/home/cli/direnv.nix @@ -0,0 +1,12 @@ +{ + flake.modules.homeManager.direnv = { + programs.direnv = { + enable = true; + config.global = { + load_dotenv = true; + hide_env_diff = true; + }; + nix-direnv.enable = true; + }; + }; +} diff --git a/modules/home/cli/eza.nix b/modules/home/cli/eza.nix new file mode 100644 index 0000000..ae1b4b9 --- /dev/null +++ b/modules/home/cli/eza.nix @@ -0,0 +1,10 @@ +{ + flake.modules.homeManager.eza = { + programs.eza = { + enable = true; + colors = "auto"; + icons = "auto"; + git = true; + }; + }; +} diff --git a/modules/home/cli/mu.nix b/modules/home/cli/mu.nix new file mode 100644 index 0000000..9c8522f --- /dev/null +++ b/modules/home/cli/mu.nix @@ -0,0 +1,13 @@ +{ + flake.modules.homeManager.mu = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.cli.mu; + in { + options.home.cli.mu.enable = mkEnableOption "Enable mu"; + config.programs.mu.enable = cfg.enable; + }; +} diff --git a/modules/home/cli/nh.nix b/modules/home/cli/nh.nix new file mode 100644 index 0000000..50463eb --- /dev/null +++ b/modules/home/cli/nh.nix @@ -0,0 +1,22 @@ +{ + flake.modules.homeManager.nh = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.cli.nh; + in { + options.home.cli.nh.flake = mkOption { + type = types.path; + default = "/home/phundrak/.dotfiles"; + example = "/etc/nixos"; + }; + config.programs.nh = { + enable = true; + clean.enable = true; + clean.extraArgs = "--keep-since 15d --keep 5"; + inherit (cfg) flake; + }; + }; +} diff --git a/modules/home/cli/nix-index.nix b/modules/home/cli/nix-index.nix new file mode 100644 index 0000000..35870e4 --- /dev/null +++ b/modules/home/cli/nix-index.nix @@ -0,0 +1,17 @@ +{inputs, ...}: { + flake-file.inputs.nix-index-database = { + url = "github:nix-community/nix-index-database"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + flake.modules.homeManager.nix-index = { + imports = [ + inputs.nix-index-database.homeModules.nix-index + ]; + + programs = { + nix-index.enable = true; + nix-index-database.comma.enable = true; + }; + }; +} diff --git a/modules/home/cli/scripts.nix b/modules/home/cli/scripts.nix new file mode 100644 index 0000000..141dc33 --- /dev/null +++ b/modules/home/cli/scripts.nix @@ -0,0 +1,16 @@ +{ + flake.modules.homeManager.scripts = { + pkgs, + lib, + config, + ... + }: + with lib; let + cfg = config.home.cli.scripts; + scriptFiles = filesystem.listFilesRecursive ./_scripts; + scripts = map (file: (import file {inherit pkgs config;})) scriptFiles; + in { + options.home.cli.scripts.enable = mkEnableOption "Add custom scripts to PATH"; + config.home.packages = mkIf cfg.enable scripts; + }; +} diff --git a/modules/home/cli/tealdeer.nix b/modules/home/cli/tealdeer.nix new file mode 100644 index 0000000..9aae013 --- /dev/null +++ b/modules/home/cli/tealdeer.nix @@ -0,0 +1,8 @@ +{ + flake.modules.homeManager.tealdeer = { + programs.tealdeer = { + enable = true; + enableAutoUpdates = true; + }; + }; +} diff --git a/modules/home/cli/yt-dlp.nix b/modules/home/cli/yt-dlp.nix new file mode 100644 index 0000000..587ab5d --- /dev/null +++ b/modules/home/cli/yt-dlp.nix @@ -0,0 +1,20 @@ +{ + flake.modules.homeManager.yt-dlp = { + lib, + config, + ... + }: + with lib; let + cfg = config.home.cli.yt-dlp; + in { + options.home.cli.yt-dlp.enable = mkEnableOption "Enable yt-dlp"; + config.programs.yt-dlp = mkIf cfg.enable { + inherit (cfg) enable; + settings = { + embed-thumbnail = true; + embed-subs = true; + sub-langs = "all"; + }; + }; + }; +} diff --git a/modules/home/creug/default.nix b/modules/home/creug/default.nix new file mode 100644 index 0000000..4b324a6 --- /dev/null +++ b/modules/home/creug/default.nix @@ -0,0 +1,71 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager.creug = { + pkgs, + config, + lib, + ... + }: + with lib; let + cfg = config.home.creug; + in { + imports = [m.home-base]; + + options.home.creug = { + sshKey = { + content = mkOption { + type = types.nullOr types.str; + example = "ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; + default = null; + }; + file = mkOption { + type = with types; nullOr path; + default = "/home/creug/.ssh/id_ed25519.pub"; + }; + }; + }; + + config = { + nixpkgs.config.allowUnfree = true; + + home = { + username = "creug"; + homeDirectory = "/home/creug"; + packages = [pkgs.tree pkgs.ncdu]; + preferXdgDirectories = true; + + creug.sshKey.file = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; + + dev.vcs = { + name = "Creug"; + email = "gregory.foulachon@gmail.com"; + editor = "${pkgs.nano}/bin/nano"; + jj = { + enable = true; + cz = { + enable = true; + alias = true; + }; + }; + git.enable = true; + publicKey = cfg.sshKey; + }; + + security.ssh.enable = true; + + shell = { + bash.enable = true; + zsh.enable = true; + starship.enable = true; + tmux.enable = false; + zoxide.enable = false; + }; + + stateVersion = "24.11"; # Do not modify! + }; + + manual.manpages.enable = true; + }; + }; +} diff --git a/modules/home/creug/hosts/elcafe.nix b/modules/home/creug/hosts/elcafe.nix new file mode 100644 index 0000000..8cb2491 --- /dev/null +++ b/modules/home/creug/hosts/elcafe.nix @@ -0,0 +1,13 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager."creug-elcafe" = {...}: { + imports = [m.creug]; + + home = { + cli.nh.flake = "/home/creug/.dotfiles"; + dev.editors.emacs.enable = false; + creug.sshKey.content = builtins.readFile ../keys/id_elcafe.pub; + }; + }; +} diff --git a/users/creug/keys/id_elcafe.pub b/modules/home/creug/keys/id_elcafe.pub similarity index 100% rename from users/creug/keys/id_elcafe.pub rename to modules/home/creug/keys/id_elcafe.pub diff --git a/modules/home/desktop/caelestia.nix b/modules/home/desktop/caelestia.nix new file mode 100644 index 0000000..7e7cce5 --- /dev/null +++ b/modules/home/desktop/caelestia.nix @@ -0,0 +1,98 @@ +{inputs, ...}: { + flake-file.inputs.caelestia-shell = { + url = "github:caelestia-dots/shell"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + flake.modules.homeManager.caelestia = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.home.desktop.caelestia; + in { + imports = [inputs.caelestia-shell.homeManagerModules.default]; + + options.home.desktop.caelestia = { + enable = mkEnableOption "Enables Caelestia Shell"; + idleTimeout = mkOption { + description = "Idle duration in seconds before locking the session"; + default = 60 * 60; # an hour + type = types.int; + }; + }; + config.programs.caelestia = mkIf cfg.enable { + inherit (cfg) enable; + systemd = { + enable = true; + target = "graphical-session.target"; + environment = ["QT3_QPA_PLATFORMTHEME=gtk3"]; + }; + settings = { + paths.wallpaperDir = "~/Pictures/Wallpapers/nord"; + general = { + apps = { + terminal = ["kitty"]; + audio = ["pavucontrol"]; + playback = ["mpv"]; + explorer = ["${pkgs.nemo-with-extensions}/bin/nemo"]; + }; + idle = { + inhibitWhenAudio = true; + timeouts = [ + { + timeout = cfg.idleTimeout; + idleAction = "lock"; + } + ]; + }; + }; + background = { + desktopClock.enabled = true; + visualiser.enabled = true; + }; + dashboard = { + enabled = true; + showOnHover = true; + }; + launcher = { + enabled = true; + showOnHover = false; + useFuzzy = { + apps = true; + schemes = true; + wallpapers = true; + }; + }; + osd.enableMicrophone = true; + bar = { + status = { + showAudio = true; + showKbLayout = false; + }; + tray.compact = true; + }; + services = mkIf (config.home.gpuType != null) { + inherit (config.home) gpuType; + }; + session.commands = { + logout = ["uwsm" "stop"]; + shutdown = ["systemctl" "poweroff"]; + hibernate = ["systemctl" "hibernate"]; + reboot = ["systemctl" "reboot"]; + }; + utilities.toasts = { + capsLockChanged = false; + numLockChanged = false; + kbLayoutChanged = false; + }; + }; + cli = { + enable = true; + settings.theme.enableGtk = true; + }; + }; + }; +} diff --git a/modules/home/desktop/desktop.nix b/modules/home/desktop/desktop.nix new file mode 100644 index 0000000..83c3650 --- /dev/null +++ b/modules/home/desktop/desktop.nix @@ -0,0 +1,44 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager.desktop = { + lib, + config, + ... + }: + with lib; let + cfg = config.home.desktop; + in { + imports = [ + m.caelestia + m.firefox + m.hyprland + m.hyprpaper + m.kdeconnect + m.kitty + m.obs + m.rofi + m.spotify + m.swaync + m.theme + m.waybar + m.wl-kbptr + m.wlr-which-key + m.wlsunset + ]; + + options.home.desktop.fullDesktop = mkEnableOption "Enable options for graphical environments"; + config.home.desktop = { + firefox.enable = mkDefault cfg.fullDesktop; + hyprland.enable = mkDefault cfg.fullDesktop; + kdeconnect.enable = mkDefault cfg.fullDesktop; + kitty.enable = mkDefault cfg.fullDesktop; + obs.enable = mkDefault cfg.fullDesktop; + rofi.enable = mkDefault cfg.fullDesktop; + spotify.enable = mkDefault cfg.fullDesktop; + spotify.spicetify.enable = mkDefault cfg.fullDesktop; + theme.enable = mkDefault cfg.fullDesktop; + wlr-which-key.enable = mkDefault cfg.fullDesktop; + }; + }; +} diff --git a/modules/home/desktop/firefox.nix b/modules/home/desktop/firefox.nix new file mode 100644 index 0000000..964c69b --- /dev/null +++ b/modules/home/desktop/firefox.nix @@ -0,0 +1,78 @@ +{inputs, ...}: { + flake-file.inputs.zen-browser = { + url = "github:youwen5/zen-browser-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + flake.modules.homeManager.firefox = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.home.desktop.firefox; + inherit (pkgs.stdenv.hostPlatform) system; + zen = inputs.zen-browser.packages.${system}.default; + settingsToLines = settings: + concatStringsSep "\n" (mapAttrsToList (name: value: "set ${name} ${toString value}") settings); + in { + options.home.desktop.firefox = { + enable = mkEnableOption "enable Firefox"; + useZen = mkEnableOption "use Zen instead of Firefox"; + tridactyl = { + enable = mkEnableOption "enable Tridactyl"; + preConfig = mkOption { + description = "Lines to add to the beginning of tridactylrc"; + type = types.lines; + default = ""; + }; + config = mkOption { + type = with types; + attrsOf (oneOf [ + int + str + bool + ]); + description = "Tridactyl settings (converted to 'set key value' lines)"; + default = {}; + example = { + smoothscroll = true; + history = 1000; + }; + }; + extraConfig = mkOption { + description = "Extra lines to add to tridactylrc (for bindings, autocmds, etc)"; + type = types.lines; + default = ""; + }; + }; + }; + + config = mkIf cfg.enable { + home.sessionVariables.MOZ_ENABLE_WAYLAND = "1"; + programs.firefox = { + inherit (cfg) enable; + package = + if cfg.useZen + then zen + else pkgs.firefox; + nativeMessagingHosts = lists.optional cfg.tridactyl.enable pkgs.tridactyl-native; + configPath = ".mozilla/firefox"; + }; + xdg.configFile."tridactyl/tridactylrc" = mkIf cfg.tridactyl.enable { + text = concatStringsSep "\n" (filter (s: s != "") [ + cfg.tridactyl.preConfig + (settingsToLines (cfg.tridactyl.config + // { + browser = + if cfg.useZen + then "zen" + else "firefox"; + })) + cfg.tridactyl.extraConfig + ]); + }; + }; + }; +} diff --git a/modules/home/desktop/hyprpaper.nix b/modules/home/desktop/hyprpaper.nix new file mode 100644 index 0000000..5a154d9 --- /dev/null +++ b/modules/home/desktop/hyprpaper.nix @@ -0,0 +1,90 @@ +{ + flake.modules.homeManager.hyprpaper = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.home.desktop.hyprpaper; + in { + options.home.desktop.hyprpaper = { + enable = mkEnableOption "Enables Hyprpaper"; + default = mkOption { + type = types.str; + default = "/home/phundrak/Pictures/Wallpapers/nord/Nordic6.jpg"; + example = "/home/user/image.jpg"; + }; + wallpapers-dir = mkOption { + type = types.str; + default = "/home/phundrak/Pictures/Wallpapers/nord/"; + example = "/home/user/Pictures/"; + }; + rotation-interval = mkOption { + type = types.str; + default = "5m"; + example = "10m"; + description = "Interval between wallpaper rotations"; + }; + }; + config = mkIf cfg.enable { + services.hyprpaper = { + inherit (cfg) enable; + settings = { + ipc = "on"; + splash = false; + preload = cfg.default; + wallpaper = ", ${cfg.default}"; + }; + }; + systemd.user = { + services.hyprpaper-rotation = { + Unit = { + Description = "Rotate Hyprpaper wallpaper"; + After = "graphical-session.target"; + }; + Service = { + Type = "oneshot"; + ExecCondition = "${pkgs.procps}/bin/pidof Hyprland"; + ExecStart = "${config.home.homeDirectory}/.config/hypr/hyprpaper-rotate.sh"; + }; + }; + + timers.hyprpaper-rotation = { + Unit = { + Description = "Timer for rotating Hyprpaper wallpaper"; + }; + Timer = { + OnBootSec = cfg.rotation-interval; + OnUnitActiveSec = cfg.rotation-interval; + }; + Install = { + WantedBy = ["timers.target"]; + }; + }; + }; + home.file.".config/hypr/hyprpaper-rotate.sh" = { + text = '' + #!/usr/bin/env bash + set -euo pipefail + + WALLPAPER_DIR="${cfg.wallpapers-dir}" + + # Find a random wallpaper + WP=$(find "$WALLPAPER_DIR" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) | shuf -n 1) + + if [ -z "$WP" ]; then + echo "No wallpapers found in $WALLPAPER_DIR" + exit 1 + fi + + echo "Setting wallpaper to: $WP" + + # Load and set the wallpaper + ${pkgs.hyprland}/bin/hyprctl hyprpaper preload "$WP" && ${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ",$WP" + ''; + executable = true; + }; + }; + }; +} diff --git a/modules/home/desktop/kdeconnect.nix b/modules/home/desktop/kdeconnect.nix new file mode 100644 index 0000000..a6b52cd --- /dev/null +++ b/modules/home/desktop/kdeconnect.nix @@ -0,0 +1,16 @@ +{ + flake.modules.homeManager.kdeconnect = { + lib, + config, + ... + }: + with lib; let + cfg = config.home.desktop.kdeconnect; + in { + options.home.desktop.kdeconnect.enable = mkEnableOption "Enable KDE Connect"; + config.services.kdeconnect = mkIf cfg.enable { + enable = true; + indicator = true; + }; + }; +} diff --git a/modules/home/desktop/kitty.nix b/modules/home/desktop/kitty.nix new file mode 100644 index 0000000..4d8397f --- /dev/null +++ b/modules/home/desktop/kitty.nix @@ -0,0 +1,116 @@ +{ + flake.modules.homeManager.kitty = { + pkgs, + config, + lib, + ... + }: + with lib; let + cfg = config.home.desktop.kitty; + in { + options.home.desktop.kitty.enable = mkEnableOption "Enable kitty terminal"; + config.programs.kitty = mkIf cfg.enable { + inherit (cfg) enable; + themeFile = "Nord"; + font = { + package = pkgs.cascadia-code; + name = "Cascadia Code"; + size = 10; + }; + settings = { + enable_audio_bell = true; + visual_bell_duration = 0.1; + enabled_layouts = "fat,fat:mirrored=true,tall,tall:mirrored=true"; + kitty_mod = "ctrl+shift"; + disable_ligatures = "never"; + font_features = "Cascadia-Mono +onum +zero"; + cursor_shape = "block"; + scrollback_lines = "10000"; + mouse_hide_wait = 3.0; + detect_urls = true; + background_opacity = 0.7; + }; + keybindings = let + prefix = "kitty_mod+space"; + in { + "alt+c" = "copy_to_clipboard"; + "kitty_mod+c" = "copy_to_clipboard"; + "alt+v" = "paste_from_clipboard"; + "kitty_mod+v" = "paste_from_clipboard"; + + "${prefix}>s>c" = "show_scrollback"; + "${prefix}>s>down" = "scroll_line_down"; + "${prefix}>s>t" = "scroll_line_down"; + "${prefix}>s>up" = "scroll_line_up"; + "${prefix}>s>s" = "scroll_line_up"; + "${prefix}>s>end" = "scroll_end"; + "${prefix}>s>home" = "scroll_home"; + "${prefix}>s>page_down" = "scroll_page_down"; + "${prefix}>s>page_up" = "scroll_page_up"; + + "${prefix}>enter" = "new_window"; + "${prefix}>w>q" = "close_window"; + "${prefix}>w>p" = "next_window"; + "${prefix}>w>n" = "previous_window"; + "${prefix}>w>f" = "move_window_forward"; + "${prefix}>w>b" = "move_window_backward"; + "${prefix}>w>t" = "move_window_to_top"; + "${prefix}>w>r" = "start_resizing_window"; + "${prefix}>w>1" = "first_window"; + "${prefix}>w>2" = "second_window"; + "${prefix}>w>3" = "third_window"; + "${prefix}>w>4" = "fourth_window"; + "${prefix}>w>5" = "fifth_window"; + "${prefix}>w>6" = "sixth_window"; + "${prefix}>w>7" = "seventh_window"; + "${prefix}>w>8" = "eighth_window"; + "${prefix}>w>9" = "ninth_window"; + "${prefix}>w>0" = "tenth_window"; + + "${prefix}>tab>n" = "next_tab"; + "${prefix}>tab>p" = "previous_tab"; + "${prefix}>tab>c" = "new_tab"; + "${prefix}>tab>q" = "close_tab"; + "${prefix}>tab>shift+n" = "move_tab_backward"; + "${prefix}>tab>shift+p" = "move_tab_forward"; + "${prefix}>tab>t" = "set_tab_title"; + + "${prefix}>l" = "next_layout"; + + "${prefix}>f>equal" = "change_font_size all 0"; + "${prefix}>f>kp_add" = "change_font_size all +2.0"; + "${prefix}>f>plus" = "change_font_size all +2.0"; + "${prefix}>f>kp_subtract" = "change_font_size all -2.0"; + "${prefix}>f>minus" = "change_font_size all -2.0"; + + "${prefix}>shift+h" = "kitten hints"; + "${prefix}>h>p" = "kitten hints --type path --program -"; + "${prefix}>h>shift+p" = "kitten hints --type path"; + "${prefix}>h>l" = "kitten hints --type line --program -"; + "${prefix}>h>w" = "kitten hints --type word --program -"; + "${prefix}>h>h" = "kitten hints --type hash --program -"; + "${prefix}>h>n" = "kitten hints --type linenum"; + "${prefix}>h>y" = "kitten hints --type hyperlink"; + + "${prefix}>f10" = "toggle_maximized"; + "${prefix}>f11" = "toggle_fullscreen"; + + "${prefix}>a>equal" = "set_background_opacity 1"; + "${prefix}>a>d" = "set_background_opacity default"; + "${prefix}>a>plus" = "set_background_opacity +0.1"; + "${prefix}>a>up" = "set_background_opacity +0.1"; + "${prefix}>a>kp_add" = "set_background_opacity +0.1"; + "${prefix}>a>minus" = "set_background_opacity -0.1"; + "${prefix}>a>down" = "set_background_opacity -0.1"; + "${prefix}>a>kp_substract" = "set_background_opacity -0.1"; + + "${prefix}>delete" = "clear_terminal reset active"; + "${prefix}>escape" = "kitty_shell window"; + "${prefix}>f2" = "edit_config_file"; + "${prefix}>n" = "new_os_window"; + "${prefix}>o" = "pass_selection_to_program"; + "${prefix}>u" = "kitten unicode_input"; + }; + }; + }; +} diff --git a/modules/home/desktop/obs.nix b/modules/home/desktop/obs.nix new file mode 100644 index 0000000..4bc0aa5 --- /dev/null +++ b/modules/home/desktop/obs.nix @@ -0,0 +1,29 @@ +{ + flake.modules.homeManager.obs = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.home.desktop.obs; + obs-image-reaction = pkgs.callPackage ../../../packages/obs-image-reaction.nix {}; + in { + options.home.desktop.obs.enable = mkEnableOption "Enables OBS Studio"; + config.programs.obs-studio = mkIf cfg.enable { + inherit (cfg) enable; + plugins = with pkgs.obs-studio-plugins; [ + input-overlay + obs-backgroundremoval + obs-markdown + obs-mute-filter + obs-pipewire-audio-capture + obs-scale-to-sound + obs-source-clone + obs-source-record + obs-tuna + obs-image-reaction + ]; + }; + }; +} diff --git a/users/modules/desktop/rofi/image.jpg b/modules/home/desktop/rofi/image.jpg similarity index 100% rename from users/modules/desktop/rofi/image.jpg rename to modules/home/desktop/rofi/image.jpg diff --git a/modules/home/desktop/rofi/rofi.nix b/modules/home/desktop/rofi/rofi.nix new file mode 100644 index 0000000..b6ac804 --- /dev/null +++ b/modules/home/desktop/rofi/rofi.nix @@ -0,0 +1,109 @@ +{ + flake.modules.homeManager.rofi = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.home.desktop.rofi; + inherit (config.lib.formats.rasi) mkLiteral; + in { + options.home.desktop.rofi = { + enable = mkEnableOption "Enable Rofi"; + }; + config = mkIf cfg.enable { + home.packages = with pkgs; [rofi-bluetooth]; + programs.rofi = { + enable = true; + plugins = with pkgs; [ + rofi-calc + rofi-emoji + ]; + terminal = "${pkgs.kitty}/bin/kitty"; + location = "center"; + modes = ["drun" "emoji" "calc" "combi"]; + extraConfig.show-icons = true; + theme = { + "*" = { + font = "Cascadia Code 14"; + blur = true; + padding = mkLiteral "10px"; + background-color = mkLiteral "transparent"; + border-radius = mkLiteral "0px"; + }; + window = { + width = mkLiteral "1050px"; + height = mkLiteral "625px"; + location = mkLiteral "center"; + blur = true; + border = mkLiteral "2px"; + border-radius = mkLiteral "3px"; + border-color = mkLiteral "#61afef"; + background-color = mkLiteral "transparent"; + padding = mkLiteral "0px"; + margin = mkLiteral "30px 50px"; + }; + mainbox = { + orientation = mkLiteral "horizontal"; + children = map mkLiteral ["borderbox"]; + spacing = mkLiteral "0px"; + padding = mkLiteral "0px"; + }; + borderbox = { + orientation = mkLiteral "horizontal"; + children = map mkLiteral ["imagebox" "contentbox"]; + padding = mkLiteral "0px"; + spacing = mkLiteral "0px"; + border-radius = mkLiteral "3px"; + }; + contentbox = { + orientation = mkLiteral "vertical"; + children = map mkLiteral ["entry" "listview"]; + spacing = mkLiteral "0px"; + padding = mkLiteral "0px"; + expand = true; + }; + imagebox = { + background-image = mkLiteral "url(\"${./image.jpg}\")"; + background-repeat = false; + size = mkLiteral "200px 625px"; + }; + element = { + border-radius = mkLiteral "0px"; + }; + "element-text, element-icon" = { + padding = mkLiteral "6px 8px"; + spacing = mkLiteral "2px"; + text-color = mkLiteral "#fab387"; + }; + "element selected" = { + background-color = mkLiteral "#191919"; + text-color = mkLiteral "#e5c07b"; + border-radius = mkLiteral "3px"; + }; + prompt = { + enabled = false; + background-color = mkLiteral "transparent"; + text-color = mkLiteral "#61afef"; + padding = mkLiteral "5px 10px"; + }; + entry = { + padding = mkLiteral "8px"; + expand = false; + font = "Cascadia Code 14"; + text-color = mkLiteral "#fab387"; + border-radius = mkLiteral "0px 3px 0px 0px"; + background-color = mkLiteral "#292e36"; + }; + listview = { + lines = mkLiteral "1"; + background-color = mkLiteral "rgba(46, 52, 64, 0.8)"; + border-radius = mkLiteral "0px 0px 3px 0px"; + padding = mkLiteral "5px"; + }; + }; + }; + }; + }; +} diff --git a/modules/home/desktop/spotify.nix b/modules/home/desktop/spotify.nix new file mode 100644 index 0000000..4a391c0 --- /dev/null +++ b/modules/home/desktop/spotify.nix @@ -0,0 +1,33 @@ +{inputs, ...}: { + flake-file.inputs.spicetify = { + url = "github:Gerg-L/spicetify-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + flake.modules.homeManager.spotify = { + pkgs, + config, + lib, + ... + }: + with lib; let + inherit (pkgs.stdenv.hostPlatform) system; + cfg = config.home.desktop.spotify; + spicePkgs = inputs.spicetify.legacyPackages.${system}; + in { + imports = [inputs.spicetify.homeManagerModules.default]; + + options.home.desktop.spotify = { + enable = mkEnableOption "Enable Spotify"; + spicetify.enable = mkEnableOption "Enable Spicetify"; + }; + config.programs = mkIf cfg.enable { + spotify-player.enable = cfg.enable; + spicetify = mkIf cfg.spicetify.enable { + inherit (cfg.spicetify) enable; + theme = spicePkgs.themes.sleek; + colorScheme = "Nord"; + }; + }; + }; +} diff --git a/modules/home/desktop/swaync.nix b/modules/home/desktop/swaync.nix new file mode 100644 index 0000000..8affaf3 --- /dev/null +++ b/modules/home/desktop/swaync.nix @@ -0,0 +1,17 @@ +{...}: { + flake.modules.homeManager.swaync = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.home.desktop.swaync; + in { + options.home.desktop.swaync.enable = mkEnableOption "Enables swaync"; + config = mkIf cfg.enable { + services.swaync.enable = true; + home.packages = [pkgs.swaynotificationcenter]; + }; + }; +} diff --git a/modules/home/desktop/theme.nix b/modules/home/desktop/theme.nix new file mode 100644 index 0000000..623602b --- /dev/null +++ b/modules/home/desktop/theme.nix @@ -0,0 +1,36 @@ +{ + flake.modules.homeManager.theme = { + pkgs, + config, + lib, + ... + }: + with lib; let + cfg = config.home.desktop.theme; + in { + options.home.desktop.theme.enable = mkEnableOption "Enable theme options"; + config = mkIf cfg.enable { + gtk = { + enable = true; + colorScheme = "dark"; + iconTheme = { + name = "Nordzy-icons"; + package = pkgs.nordzy-icon-theme; + }; + theme = { + package = pkgs.nordic; + name = "Nordic"; + }; + gtk4.theme = config.gtk.theme; + }; + home.pointerCursor = { + enable = true; + gtk.enable = true; + hyprcursor.enable = config.home.desktop.hyprland.enable; + name = "Nordzy-cursors"; + package = pkgs.nordzy-cursor-theme; + }; + qt.enable = true; + }; + }; +} diff --git a/modules/home/desktop/waybar.nix b/modules/home/desktop/waybar.nix new file mode 100644 index 0000000..36a08c6 --- /dev/null +++ b/modules/home/desktop/waybar.nix @@ -0,0 +1,156 @@ +{ + flake.modules.homeManager.waybar = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.desktop.waybar; + in { + options.home.desktop.waybar = { + enable = mkEnableOption "Enables waybar."; + battery = mkEnableOption "Enables battery support."; + style = mkOption { + type = types.path; + example = ./style.css; + }; + }; + config.programs.waybar = mkIf cfg.enable { + inherit (cfg) enable; + systemd.enable = true; + settings = { + topBar = { + height = 24; + spacing = 2; + modules-left = ["hyprland/workspaces" "hyprland/submap" "hyprland/window"]; + modules-center = []; + modules-right = [ + "idle_inhibitor" + "group/audio" + "group/hardware" + "network" + "privacy" + "clock" + "tray" + ]; + + idle_inhibitor = { + format = "{icon}"; + format-icons = { + activated = ""; + deactivated = ""; + }; + }; + + mpris = { + dynamic-order = ["title" "artist" "album"]; + dynamic-importance-order = ["title" "artist" "album"]; + format = "DEFAULT: {player_icon} {dynamic}"; + format-paused = "DEFAULT: {status_icon} {dynamic}"; + player-icons = { + default = "▶"; + mpv = "🎵"; + }; + status-icons.paused = "⏸"; + ignored-players = []; + }; + + pulseaudio = { + format = "{volume}% {icon} {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = "{volume}% "; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = ["" "" ""]; + }; + on-click = "pavucontrol"; + }; + + network = { + format-wifi = "{essid} ({signalStrength}%) "; + format-ethernet = "{ipaddr}/{cidr} "; + tooltip-format = "{ifname} via {gwaddr} "; + format-linked = "{ifname} (No IP) "; + format-disconnected = "Disconnected ⚠"; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + }; + + "group/audio" = { + modules = ["pulseaudio" "pulseaudio/slider" "mpris"]; + orientation = "inherit"; + drawer.transition-duration = 300; + }; + + "group/hardware" = { + modules = lists.optional cfg.battery "battery" ++ ["cpu" "memory" "disk"]; + orientation = "inherit"; + drawer.transition-duration = 300; + }; + + cpu = { + format = "{usage}% "; + tooltip = false; + }; + + memory.format = "{}% "; + + disk = { + format = "{path}: {used}/{total} ({percentage_used}%)"; + unit = "GB"; + }; + + battery = { + states = { + good = 90; + warning = 30; + critical = 15; + }; + format = "{capacity}% {icon}"; + format-charging = "{capacity}% "; + format-plugged = "{capacity}% "; + format-alt = "{time} {icon}"; + # An empty format will hide the module + format-good = ""; + format-full = ""; + format-icons = ["" "" "" "" ""]; + }; + + clock = { + timezones = ["Europe/Paris" "Asia/Tokyo" "America/New_York" "America/Los_Angeles" "Asia/Kathmandu"]; + tooltip-format = "{:%Y %B}\n{calendar}"; + format-alt = "{:%Y-%m-%d}"; + actions = { + on-click-right = "mode"; + on-scroll-up = "tz_up"; + on-scroll-down = "tz_down"; + }; + calendar = { + mode = "year"; + mode-mon-col = 3; + weeks-pos = "right"; + on-scroll = 1; + format = { + months = "{}"; + days = "{}"; + weeks = "W{:%W}"; + weekdays = "{}"; + today = "{}"; + }; + }; + }; + + tray.spacing = 10; + }; + }; + style = builtins.readFile cfg.style; + }; + }; +} diff --git a/modules/home/desktop/wl-kbptr.nix b/modules/home/desktop/wl-kbptr.nix new file mode 100644 index 0000000..c243242 --- /dev/null +++ b/modules/home/desktop/wl-kbptr.nix @@ -0,0 +1,39 @@ +{ + flake.modules.homeManager.wl-kbptr = { + config, + lib, + pkgs, + ... + }: + with lib; let + configDir = config.xdg.configHome; + cfg = config.home.desktop.wl-kbptr; + iniFormat = pkgs.formats.ini {}; + in { + options.home.desktop.wl-kbptr = { + enable = mkEnableOption "enable wl-kbptr"; + config = mkOption { + inherit (iniFormat) type; + default = {}; + description = '' + Options to add to the {file}`config` file. See + + for options. + ''; + example = { + general = { + home_row_keys = "abcd"; + }; + }; + }; + }; + config = mkIf cfg.enable { + home = { + packages = [pkgs.wl-kbptr]; + file."${configDir}/wl-kbptr/config" = mkIf (cfg.config != {}) { + source = iniFormat.generate "wl-kbptr-config" cfg.config; + }; + }; + }; + }; +} diff --git a/modules/home/desktop/wlr-which-key.nix b/modules/home/desktop/wlr-which-key.nix new file mode 100644 index 0000000..70ca3a4 --- /dev/null +++ b/modules/home/desktop/wlr-which-key.nix @@ -0,0 +1,191 @@ +{ + flake.modules.homeManager.wlr-which-key = { + config, + lib, + pkgs, + ... + }: let + inherit + (lib) + literalExpression + mkIf + mkOption + mkEnableOption + types + ; + cfg = config.home.desktop.wlr-which-key; + yamlFormat = pkgs.formats.yaml {}; + + # Convert kebab-case to snake_case + toSnakeCase = str: builtins.replaceStrings ["-"] ["_"] str; + + # Recursively filter out null values and convert kebab-case keys to snake_case + filterNulls = value: + if lib.isAttrs value + then lib.mapAttrs' (n: v: lib.nameValuePair (toSnakeCase n) (filterNulls v)) (lib.filterAttrs (_: v: v != null) value) + else if lib.isList value + then map filterNulls value + else value; + menuEntryType = types.submodule { + freeformType = yamlFormat.type; + options = with types; { + key = mkOption { + type = str; + example = "p"; + }; + desc = mkOption { + type = str; + example = "Power"; + }; + cmd = mkOption { + type = nullOr str; + default = null; + example = "echo example"; + }; + keep-open = mkOption { + type = nullOr bool; + default = null; + example = true; + }; + submenu = mkOption { + type = nullOr (listOf menuEntryType); + default = null; + example = literalExpression '' + [ + { key = "s"; desc = "Suspend"; cmd = "systemctl suspend"; } + { key = "r"; desc = "Reboot"; cmd = "systemctl reboot"; } + { key = "o"; desc = "Poweroff"; cmd = "systemctl poweroff"; } + ] + ''; + }; + }; + }; + settingsType = types.submodule { + freeformType = yamlFormat.type; + options = with types; { + background = mkOption { + type = nullOr str; + default = null; + example = "#282828FF"; + }; + color = mkOption { + type = nullOr str; + default = null; + example = "#FBF1C7FF"; + }; + border = mkOption { + type = nullOr str; + default = null; + example = "#8EC07CFF"; + }; + anchor = mkOption { + type = nullOr (enum ["center" "top" "bottom" "left" "right" "top-left" "top-right" "bottom-left" "bottom-right"]); + default = null; + example = "top-left"; + }; + margin-top = mkOption { + type = nullOr int; + default = null; + example = "0"; + }; + margin-right = mkOption { + type = nullOr int; + default = null; + example = "0"; + }; + margin-bottom = mkOption { + type = nullOr int; + default = null; + example = "0"; + }; + margin-left = mkOption { + type = nullOr int; + default = null; + example = "0"; + }; + font = mkOption { + type = nullOr str; + default = null; + example = "monospace 10"; + }; + separator = mkOption { + type = nullOr str; + default = null; + example = " ➜ "; + }; + border-width = mkOption { + type = nullOr (either float int); + default = null; + example = 4.0; + }; + corder-r = mkOption { + type = nullOr (either float int); + default = null; + example = 20.0; + }; + padding = mkOption { + type = nullOr (either float int); + default = null; + example = 15.0; + }; + rows-per-column = mkOption { + type = nullOr int; + default = null; + example = 5; + }; + column-padding = mkOption { + type = nullOr (either float int); + default = null; + example = 25.0; + }; + inhibit-compositor-keyboard-shortcuts = mkOption { + type = bool; + default = true; + example = false; + }; + auto_kbd_layout = mkOption { + type = bool; + default = true; + example = false; + }; + namespace = mkOption { + type = nullOr str; + default = null; + example = "wlr_which_key"; + }; + menu = mkOption { + type = listOf menuEntryType; + default = []; + example = literalExpression '' + [ + { + key = "p"; + desc = "Power"; + submenu = [ + { key = "s"; desc = "Suspend"; cmd = "systemctl suspend"; } + { key = "r"; desc = "Reboot"; cmd = "systemctl reboot"; } + { key = "o"; desc = "Poweroff"; cmd = "systemctl poweroff"; } + ]; + } + ] + ''; + }; + }; + }; + in { + options.home.desktop.wlr-which-key = { + enable = mkEnableOption "Enables wlr-which-key"; + package = lib.mkPackageOption pkgs "wlr-which-key" {}; + settings = mkOption { + type = settingsType; + default = {}; + description = "Configuration written to {file}`$XDG_CONFIG_HOME/wlr-which-key/config.yaml`."; + }; + }; + config = mkIf cfg.enable { + xdg.configFile = { + "wlr-which-key/config.yaml".source = yamlFormat.generate "wlr-which-key-config.yml" (filterNulls cfg.settings); + }; + }; + }; +} diff --git a/modules/home/desktop/wlsunset.nix b/modules/home/desktop/wlsunset.nix new file mode 100644 index 0000000..046fba2 --- /dev/null +++ b/modules/home/desktop/wlsunset.nix @@ -0,0 +1,26 @@ +{ + flake.modules.homeManager.wlsunset = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.desktop.wlsunset; + in { + options.home.desktop.wlsunset = { + enable = mkEnableOption "Enables wlsunset"; + latitude = mkOption { + type = with types; nullOr (oneOf [str ints.unsigned float]); + default = 48.5; + }; + longitude = mkOption { + type = with types; nullOr (oneOf [str ints.unsigned float]); + default = 2.2; + }; + }; + + config.services.wlsunset = mkIf cfg.enable { + inherit (cfg) enable latitude longitude; + }; + }; +} diff --git a/modules/home/dev/ai/ai.nix b/modules/home/dev/ai/ai.nix new file mode 100644 index 0000000..c786057 --- /dev/null +++ b/modules/home/dev/ai/ai.nix @@ -0,0 +1,50 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager.ai = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.home.dev.ai; + jsonFormat = pkgs.formats.json {}; + in { + imports = [ + m.claude + m.ollama + m.opencode + ]; + + options.home.dev.ai = { + enable = mkEnableOption "Enables AI features"; + lmStudio = mkOption { + default = cfg.enable; + example = true; + description = "Enables LM Studio. Enabled by default when AI is enabled."; + }; + mcpServers = mkOption { + inherit (jsonFormat) type; + default = {}; + }; + }; + config = { + home = mkIf cfg.enable { + dev.ai = { + claude = { + enable = mkDefault cfg.enable; + mcpServers = mkDefault cfg.mcpServers; + }; + ollama.enable = mkDefault cfg.enable; + opencode.enable = mkDefault cfg.enable; + }; + packages = lists.optional cfg.lmStudio pkgs.lmstudio; + }; + programs.mcp = mkIf (cfg.mcpServers != {}) { + enable = true; + servers = cfg.mcpServers; + }; + }; + }; +} diff --git a/modules/home/dev/ai/claude.nix b/modules/home/dev/ai/claude.nix new file mode 100644 index 0000000..e34290a --- /dev/null +++ b/modules/home/dev/ai/claude.nix @@ -0,0 +1,30 @@ +{ + flake.modules.homeManager.claude = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.home.dev.ai.claude; + jsonFormat = pkgs.formats.json {}; + in { + options.home.dev.ai.claude = { + enable = mkEnableOption "Enables Claude-related packages"; + mcpServers = mkOption { + inherit (jsonFormat) type; + default = {}; + }; + }; + config = mkIf cfg.enable { + home.packages = let + claude-jj = pkgs.writeShellScriptBin "claude-jj" '' + ${pkgs.claude-code}/bin/claude --append-system-prompt 'CRITICAL: This repository uses Jujutsu (jj), NOT git. Never use git commands. Use jj equivalents.' "$@" + ''; + in [claude-jj pkgs.sox]; + programs.claude-code = { + inherit (cfg) enable mcpServers; + }; + }; + }; +} diff --git a/modules/home/dev/ai/ollama.nix b/modules/home/dev/ai/ollama.nix new file mode 100644 index 0000000..0c545c3 --- /dev/null +++ b/modules/home/dev/ai/ollama.nix @@ -0,0 +1,34 @@ +{ + flake.modules.homeManager.ollama = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.dev.ai.ollama; + in { + options.home.dev.ai.ollama = { + enable = mkEnableOption "Enables Ollama"; + gpu = mkOption { + type = types.nullOr (types.enum [false "rocm" "cuda"]); + example = "rocm"; + default = null; + description = "Which type of GPU should be used for hardware acceleration"; + }; + }; + + config = { + services.ollama = mkIf cfg.enable { + inherit (cfg) enable; + acceleration = cfg.gpu; + host = "0.0.0.0"; + environmentVariables = { + OLLAMA_CONTEXT_LENGTH = "8192"; + OLLAMA_MAX_LOADED_MODELS = "1"; + OLLAMA_KEEP_ALIVE = "10m"; + }; + }; + home.sessionVariables.OLLAMA_API_BASE = "http://${config.services.ollama.host}:11434/"; + }; + }; +} diff --git a/modules/home/dev/ai/opencode.nix b/modules/home/dev/ai/opencode.nix new file mode 100644 index 0000000..5a74921 --- /dev/null +++ b/modules/home/dev/ai/opencode.nix @@ -0,0 +1,102 @@ +{ + flake.modules.homeManager.opencode = { + config, + lib, + pkgs, + bunBaseline, + ... + }: + with lib; let + cfg = config.home.dev.ai.opencode; + + # On x86_64-linux CPUs without AVX2, use the baseline bun variant + # when building opencode - the regular `bun` from nixpkgs requires + # AVX2 and crashes on older hardware, such as my Thinkpad x220’s + # Intel Core i5 2640M. + needsBaselineBun = + pkgs.stdenv.hostPlatform.isx86_64 && !pkgs.stdenv.hostPlatform.avx2Support; + + defaultPackageCli = + if needsBaselineBun + then pkgs.opencode.override {bun = bunBaseline;} + else pkgs.opencode; + + defaultPackageDesktop = + if needsBaselineBun + then pkgs.opencode-desktop.override {bun = bunBaseline;} + else pkgs.opencode-desktop; + + corsList = domains: lists.remove "" (lists.forEach (strings.splitString "," domains) trim); + in { + options.home.dev.ai.opencode = { + enable = mkEnableOption "Enables OpenCode"; + package = mkOption { + type = types.package; + default = defaultPackageCli; + description = "The CLI package for OpenCode"; + }; + settings = mkOption { + type = types.json; + default = {}; + }; + tui = mkOption { + type = types.json; + default = {}; + }; + desktop = { + enable = mkEnableOption "Enables the desktop app"; + package = mkOption { + type = types.package; + default = defaultPackageDesktop; + description = "The desktop package for OpenCode"; + }; + }; + web = { + enable = mkEnableOption "Enables OpenCode web"; + extraArgs = mkOption { + type = types.listOf types.str; + default = []; + example = [ + "--hostname" + "0.0.0.0" + ]; + }; + cors = mkOption { + type = types.nullOr (types.either types.str types.path); + default = null; + example = "opencode.example.com,code.example.com"; + description = '' + Either a string containing the domain allowed to connect to OpenCode’s web instance, or a file containing the target value. The latter is useful when using secret management if you don’t want to publicize the hostname of your OpenCode instance. + + If you want to use multiple domains, you can separate them with a comma. + ''; + }; + mdns = { + enable = mkEnableOption "Enables mDNS with OpenCode"; + hostname = mkOption { + type = types.nullOr types.str; + default = null; + example = "opencode.local"; + }; + }; + }; + }; + config.programs.opencode = mkIf cfg.enable { + inherit (cfg) enable tui package; + enableMcpIntegration = true; + extraPackages = with pkgs; [uv] ++ lists.optional cfg.desktop.enable cfg.desktop.package; + settings = + { + server = mkIf cfg.web.mdns.enable { + mdns = true; + mdnsDomain = mkIf (cfg.web.mdns.hostname != null) cfg.web.mdns.hostname; + cors = corsList cfg.web.cors; + }; + } + // cfg.settings; + web = { + inherit (cfg.web) enable extraArgs; + }; + }; + }; +} diff --git a/modules/home/dev/dev.nix b/modules/home/dev/dev.nix new file mode 100644 index 0000000..2bfcf64 --- /dev/null +++ b/modules/home/dev/dev.nix @@ -0,0 +1,24 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager.dev = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.dev; + in { + imports = [ + m.ai + m.editors + m.vcs + ]; + + options.home.dev.fullDesktop = mkEnableOption "Enables everything except AI"; + config.home.dev = { + vcs.fullDesktop = mkDefault cfg.fullDesktop; + editors.fullDesktop = mkDefault cfg.fullDesktop; + }; + }; +} diff --git a/modules/home/dev/editors/editors.nix b/modules/home/dev/editors/editors.nix new file mode 100644 index 0000000..6f00192 --- /dev/null +++ b/modules/home/dev/editors/editors.nix @@ -0,0 +1,24 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager.editors = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.dev.editors; + in { + imports = [ + m.emacs + ]; + + options.home.dev.editors.fullDesktop = mkEnableOption "Enable all editors"; + config.home.dev.editors.emacs = { + enable = mkDefault cfg.fullDesktop; + service = mkDefault cfg.fullDesktop; + mu4eMime = mkDefault cfg.fullDesktop; + org-protocol = mkDefault cfg.fullDesktop; + }; + }; +} diff --git a/modules/home/dev/editors/emacs.nix b/modules/home/dev/editors/emacs.nix new file mode 100644 index 0000000..1f566f7 --- /dev/null +++ b/modules/home/dev/editors/emacs.nix @@ -0,0 +1,70 @@ +{ + flake.modules.homeManager.emacs = { + pkgs, + config, + lib, + ... + }: + with lib; let + emacsDefaultPackage = with pkgs; ((emacsPackagesFor emacs).emacsWithPackages ( + epkgs: + with epkgs; [ + mu4e + pdf-tools + ] + )); + cfg = config.home.dev.editors.emacs; + in { + options.home.dev.editors.emacs = { + enable = mkEnableOption "enables Emacs"; + package = mkOption { + type = types.package; + default = emacsDefaultPackage; + }; + service = mkEnableOption "enables Emacs service"; + mu4eMime = mkEnableOption "Enables mu4e to handle mailto scheme"; + org-protocol = mkEnableOption "Enables org-protocol"; + }; + + config = { + home.packages = with pkgs; [ + emacs-all-the-icons-fonts + emacs-lsp-booster + ]; + programs.emacs = mkIf cfg.enable { + enable = true; + inherit (cfg) package; + }; + services.emacs = mkIf cfg.service { + enable = true; + inherit (cfg) package; + defaultEditor = true; + startWithUserSession = "graphical"; + client = { + enable = true; + arguments = ["-c" "-a" "${cfg.package}/bin/emacs"]; + }; + }; + + xdg.desktopEntries.mu4e = mkIf cfg.mu4eMime { + name = "mu4e"; + genericName = "mu4e"; + comment = "Maildir Utils for Emacs"; + mimeType = ["x-scheme-handler/mailto"]; + noDisplay = true; + exec = "${cfg.package}/bin/emacsclient -c -n -a ${cfg.package}/bin/emacs -e \"(browse-url-mail \\\"\\$*\\\")\""; + terminal = false; + categories = ["Network" "Email" "TextEditor" "Utility"]; + }; + + xdg.desktopEntries.org-protocol = mkIf cfg.org-protocol { + name = "org-protocol"; + exec = "${cfg.package}/bin/emacsclient -c -n -a ${cfg.package}/bin/emacs %u"; + terminal = false; + noDisplay = true; + categories = ["System"]; + mimeType = ["x-scheme-handler/org-protocol"]; + }; + }; + }; +} diff --git a/modules/home/dev/vcs/git.nix b/modules/home/dev/vcs/git.nix new file mode 100644 index 0000000..debe190 --- /dev/null +++ b/modules/home/dev/vcs/git.nix @@ -0,0 +1,287 @@ +{ + flake.modules.homeManager.git = { + lib, + config, + pkgs, + ... + }: + with lib; let + cfg = config.home.dev.vcs.git; + in { + options.home.dev.vcs.git = { + enable = mkEnableOption "enables git"; + email = mkOption { + type = types.str; + default = "lucien@phundrak.com"; + }; + name = mkOption { + type = types.str; + default = "Lucien Cartier-Tilet"; + }; + cliff = mkEnableOption "enables git-cliff support"; + sendmail = { + enable = mkOption { + type = types.bool; + default = true; + }; + server = mkOption { + type = types.nullOr types.str; + default = "mail.phundrak.com"; + }; + user = mkOption { + type = types.nullOr types.str; + default = null; + }; + encryption = mkOption { + type = types.enum ["tls" "ssl" "none"]; + default = "none"; + }; + port = mkOption { + type = types.nullOr types.int; + default = 587; + }; + passwordFile = mkOption { + type = types.nullOr types.path; + default = null; + description = '' + Path to a file containing the password necessary for authenticating + against the mailserver. + + This file should contain the password only, with no newline. + ''; + }; + }; + browser = mkOption { + type = types.nullOr types.str; + example = "${pkgs.firefox}/bin/firefox"; + default = null; + }; + completeConfig = mkEnableOption "Complete configuration for workstations"; + emacs = { + integration = mkOption { + description = "enables Emacs integration"; + type = types.bool; + default = config.home.dev.editors.emacs.enable; + }; + pkg = mkOption { + type = types.package; + default = pkgs.emacs; + }; + }; + mergeTool = mkOption { + type = types.str; + default = "ediff"; + }; + editor = mkOption { + type = types.str; + default = "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs"; + }; + publicKeyFile = mkOption { + type = types.nullOr types.str; + default = null; + }; + }; + + config = lib.mkIf cfg.enable { + programs.git-cliff.enable = cfg.cliff; + programs.git = let + smtpEmail = + if (cfg.sendmail.user == null) + then cfg.email + else cfg.sendmail.user; + in { + enable = true; + ignores = [ + ".env" + ".direnv/" + + "*~" + "\#*\#" + "*.elc" + "auto-save-list" + ".\#*" + "*_flymake.*" + "/auto/" + ".projectile" + ".dir-locals.el" + + "# Org mode files" + ".org-id-locations" + "*_archive" + + "*.out" + "*.o" + "*.so" + + "# Archives" + "*.7zz" + "*.dmg" + "*.gz" + "*.iso" + "*.jar" + "*.rar" + "*.tar" + "*.zip" + + "*.log" + "*.sqlite" + + "dist/" + ]; + signing = { + format = + if cfg.publicKeyFile != null + then "ssh" + else "openpgp"; + key = cfg.publicKeyFile; + signByDefault = true; + }; + settings = { + user = { + inherit (cfg) name email; + }; + color.ui = "auto"; + column.ui = "auto"; + tag.sort = "version:refname"; + core = mkIf cfg.completeConfig { + compression = 9; + inherit (cfg) editor; + whitespace = "fix,-indent-with-non-tab,trailing-space"; + preloadindex = true; + }; + status = { + branch = true; + showStash = true; + }; + diff = { + algorithm = "histogram"; + colorMoved = "plain"; + mnemonicPrefix = true; + renames = "copy"; + interHunkContext = 10; + }; + gpg.ssh.allowedSignersFile = "${config.home.homeDirectory}/.ssh/allowed_signers"; + init.defaultBranch = "main"; + pull.rebase = true; + push = { + default = "simple"; + autoSetupRemote = true; + followTags = true; + }; + rebase = { + autoSquash = true; + autoStash = true; + missingCommitsCheck = "warn"; + updateRefs = true; + }; + help.autocorrect = "prompt"; + web.browser = mkIf (cfg.browser != null) cfg.browser; + sendemail = mkIf cfg.sendmail.enable { + smtpserver = cfg.sendmail.server; + smtpuser = smtpEmail; + smtpencryption = cfg.sendmail.encryption; + smtpserverport = cfg.sendmail.port; + }; + credentials = mkIf (cfg.sendmail.passwordFile != null) { + "smtp://${smtpEmail}@${cfg.sendmail.server}:${toString cfg.sendmail.port}" = { + helper = "cat ${cfg.sendmail.passwordFile}"; + }; + }; + magithub = mkIf cfg.emacs.integration { + online = true; + "status" = { + includeStatusHeader = true; + includePullRequestsSection = true; + includeIssuesSection = true; + }; + }; + merge = { + tool = mkIf cfg.completeConfig cfg.mergeTool; + conflictstyle = "zdiff3"; + }; + mergetool.ediff.cmd = mkIf (cfg.emacs.integration && cfg.completeConfig) "\"${cfg.emacs.pkg} --eval \" (progn (defun ediff-write-merge-buffer () (let ((file ediff-merge-store-file)) (set-buffer ediff-buffer-C) (write-region (point-min) (point-max) file) (message \\\"Merge buffer saved in: %s\\\" file) (set-buffer-modified-p nil) (sit-for 1))) (setq ediff-quit-hook 'kill-emacs ediff-quit-merge-hook 'ediff-write-merge-buffer) (ediff-merge-files-with-ancestor \\\"$LOCAL\\\" \\\"$REMOTE\\\" \\\"$BASE\\\" nil \\\"$MERGED\\\"))\"\""; + github.user = "phundrak"; + url = { + "https://phundrak@github.com" = { + insteadOf = "https://github.com"; + }; + "https://phundrak@labs.phundrak.com" = { + insteadOf = "https://labs.phundrak.com"; + }; + "https://github.com/RustSec/advisory-db" = { + insteadOf = "https://github.com/RustSec/advisory-db"; + }; + "git@github.com:Phundrak/" = { + insteadOf = "pg:"; + }; + "git@labs.phundrak.com/phundrak:" = { + insteadOf = "p:"; + }; + "git@github.com" = { + insteadOf = "gh:"; + }; + "git@labs.phundrak.com" = { + insteadOf = "labs:"; + }; + }; + alias = { + a = "add --all"; + aca = "!git add --all && git commit --amend"; + acan = "!git add --all && git commit --amend --no-edit"; + ap = "add --patch"; + b = "branch"; + bd = "branch -d"; + bdd = "branch -D"; + c = "commit -S"; + ca = "commit -Sa"; + can = "commit -Sa --no-edit"; + cm = "commit -Sm"; + cam = "commit -Sam"; + co = "checkout"; + cob = "checkout -b"; + cod = "checkout develop"; + cl = "clone"; + cl1 = "clone --depth 1"; + f = "fetch"; + fp = "fetch --prune"; + ps = "push"; + psf = "push --force-with-lease"; + pso = "push origin"; + psfo = "push --force-with-lease origin"; + pushall = "!git remote \vert{} xargs -L1 git push"; + psl = "!git remote \vert{} xargs -L1 git push"; + pullall = "!git remote \vert{} xargs -L1 git pull"; + pll = "!git remote \vert{} xargs -L1 git pull"; + pl = "pull"; + pb = "pull --rebase"; + r = "rebase"; + ra = "rebase --abort"; + rc = "rebase --continue"; + rd = "rebase develop"; + ri = "rebase -i"; + rmf = "rm -f"; + rmd = "rm -r"; + rmdf = "rm -rf"; + sm = "submodule"; + sms = "submodule status"; + sma = "submodule add"; + smu = "submodule update"; + smui = "submodule update --init"; + smuir = "submodule update --init --recursive"; + st = "stash"; + stc = "stash clear"; + stp = "stash pop"; + stw = "stash show"; + u = "reset --"; + d = "diff -w"; + l = "log --all --oneline --graph --decorate --pretty=format':%C(magenta)%h %C(white) %an %ar%C(auto) %D%n%s%n'"; + s = "status"; + staged = "diff --cached"; + upstream = "!git push -u origin HEAD"; + unstage = "reset --"; + }; + }; + }; + }; + }; +} diff --git a/modules/home/dev/vcs/jujutsu.nix b/modules/home/dev/vcs/jujutsu.nix new file mode 100644 index 0000000..6cfa170 --- /dev/null +++ b/modules/home/dev/vcs/jujutsu.nix @@ -0,0 +1,141 @@ +{inputs, ...}: { + flake-file.inputs.jj-cz = { + url = "git+https://labs.phundrak.com/phundrak/jj-cz?ref=develop"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + flake.modules.homeManager.jujutsu = { + lib, + config, + pkgs, + ... + }: + with lib; let + inherit (pkgs.stdenv.hostPlatform) system; + cfg = config.home.dev.vcs.jj; + jj-cz = inputs.jj-cz.packages.${system}.default; + in { + options.home.dev.vcs.jj = { + enable = mkEnableOption "enables jj"; + name = mkOption { + type = types.str; + default = "Lucien Cartier-Tilet"; + }; + email = mkOption { + type = types.str; + default = "lucien@phundrak.com"; + }; + editor = mkOption { + type = types.str; + default = + if config.home.dev.editors.emacs.enable + then "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs" + else "${pkgs.nano}/bin/nano"; + }; + signing = { + enable = mkEnableOption "enables signing jj commits"; + sshKey = mkOption { + type = with types; nullOr (either path str); + example = "~/.ssh/id_ed25519.pub"; + default = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; + description = "Path to the private SSH key for signing."; + }; + }; + cz = { + enable = mkEnableOption "Enables jj-cz"; + alias = mkEnableOption "Enable `jj cz` as an alias to `jj-cz`"; + }; + # used in my shell .nix files + shellCompletion = mkOption { + description = "Enable Jujutsu shell completion"; + type = types.bool; + default = true; + }; + }; + + config = mkIf cfg.enable { + home.packages = mkIf cfg.cz.enable [jj-cz]; + programs.jujutsu = { + enable = true; + settings = { + user = { + inherit (cfg) name email; + }; + ui = { + inherit (cfg) editor; + default-command = "st"; + pager = ":builtin"; + show-cryptographic-signatures = true; + diff-editor = ":builtin"; + merge-editort = ":builtin"; + # These are for vc-jj.el in Emacs + diff-formatter = ":git"; + conflict-marker-style = "git"; + }; + signing = mkIf cfg.signing.enable { + behavior = "own"; + backend = "ssh"; + key = cfg.signing.sshKey; + backends.ssh.allowed-signers = "${config.home.homeDirectory}/.ssh/allowed_signers"; + backends.ssh.program = "${pkgs.openssh}/bin/ssh-keygen"; + }; + aliases = { + blame = ["file" "annotate"]; + consume = ["squash" "--into" "@" "--from"]; + cz = mkIf cfg.cz.alias ["util" "exec" "--" "${jj-cz}/bin/jj-cz"]; + eject = ["squash" "--from" "@" "--into"]; + d = ["diff"]; + dm = ["desc" "-m"]; + gc = ["git" "clone"]; + gcc = ["git" "clone" "--colocate"]; + l = ["log"]; + la = ["log" "-r" "::"]; + lc = ["log" "-r" "(remote_bookmarks()..@)::"]; + ll = ["log" "-T" "builtin_log_detailed"]; + open = ["log" "-r" "open()"]; + n = ["new"]; + nd = ["new" "dev()"]; + nt = ["new" "trunk()"]; + revlog = ["evolog"]; + s = ["show"]; + tug = ["bookmark" "move" "--from" "heads(::@- & bookmarks())" "--to" "@-"]; + }; + colors.working_copy.underline = true; + git = { + private-commits = "blacklist()"; + colocate = true; + subprocess = true; + }; + revset-aliases = { + "immutable_heads()" = "present(trunk()) | tags()"; + # Resolves by default to latest main/master remote bookmarks + "trunk()" = "latest((present(main) | present(master)) & remote_bookmarks())"; + # Same as trunk() but for `dev` or `develop` bookmarks + "dev()" = "latest((present(dev) | present(develop)) & remote_bookmarks())"; + + "user(x)" = "author(x) | committer(x)"; + "gh_pages()" = "ancestors(remote_bookmarks(exact:\"gh-pages\"))"; + + #Private and WIP commits that should never be pushed + "wip()" = "description(glob:\"wip:*\")"; + "private()" = "description(glob:\"private:*\")"; + "blacklist()" = "wip() | private()"; + + # stack(x, n) is the set of mutable commits reachable from + # 'x', with 'n' parents. 'n' is often useful to customize the + # display and return set for certain operations. 'x' can be + # used to target the set of 'roots' to traverse, e.g. @ is the + # current stack. + "stack()" = "ancestors(reachable(@, mutable()), 2)"; + "stack(x)" = "ancestors(reachable(x, mutable()), 2)"; + "stack(x, n)" = "ancestors(reachable(x, mutable()), n)"; + + "open()" = "stack(dev().. & mine(), 1)"; + "ready()" = "open() ~ blacklist()::"; + }; + remotes.origin.auto-track-bookmarks = "*"; + }; + }; + }; + }; +} diff --git a/modules/home/dev/vcs/vcs.nix b/modules/home/dev/vcs/vcs.nix new file mode 100644 index 0000000..cc10b93 --- /dev/null +++ b/modules/home/dev/vcs/vcs.nix @@ -0,0 +1,61 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager.vcs = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.home.dev.vcs; + in { + imports = [m.git m.jujutsu]; + + options.home.dev.vcs = { + fullDesktop = mkEnableOption "Enable all optional values"; + name = mkOption { + type = types.str; + default = "Lucien Cartier-Tilet"; + }; + email = mkOption { + type = types.str; + default = "lucien@phundrak.com"; + }; + editor = mkOption { + type = types.str; + default = "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs"; + }; + publicKey = { + content = mkOption { + type = types.nullOr types.str; + example = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGj+J6N6SO+4P8dOZqfR1oiay2yxhhHnagH52avUqw5h"; + default = null; + }; + file = mkOption { + type = with types; nullOr path; + default = "/home/phundrak/.ssh/id_ed25519.pub"; + }; + }; + }; + + config.home.dev.vcs = { + git = { + enable = mkDefault true; + inherit (cfg) name email editor; + publicKeyFile = cfg.publicKey.file; + cliff = mkDefault cfg.fullDesktop; + completeConfig = mkDefault cfg.fullDesktop; + }; + jj = { + enable = mkDefault true; + inherit (cfg) name email editor; + signing.sshKey = mkDefault (cfg.publicKey.file or cfg.publicKey.content); + cz = { + enable = mkDefault true; + alias = mkDefault true; + }; + }; + }; + }; +} diff --git a/modules/home/media/media.nix b/modules/home/media/media.nix new file mode 100644 index 0000000..8a454ce --- /dev/null +++ b/modules/home/media/media.nix @@ -0,0 +1,30 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager.media = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.media; + in { + imports = [ + m.mopidy + m.mpd + m.mpd-mpris + m.mpv + m.ncmpcpp + m.streamlink + ]; + + options.home.media.fullDesktop = mkEnableOption "Enables everything"; + config.home.media = { + mopidy.enable = mkDefault cfg.fullDesktop; + mpd.enable = mkDefault (cfg.fullDesktop or cfg.mpd-mpris.enable); + mpv.enable = mkDefault cfg.fullDesktop; + ncmpcpp.enable = mkDefault config.home.media.mpd.enable; + streamlink.enable = mkDefault config.home.media.mpv.enable; + }; + }; +} diff --git a/modules/home/media/mopidy.nix b/modules/home/media/mopidy.nix new file mode 100644 index 0000000..bbb0a85 --- /dev/null +++ b/modules/home/media/mopidy.nix @@ -0,0 +1,48 @@ +{ + flake.modules.homeManager.mopidy = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.home.media.mopidy; + in { + options.home.media.mopidy = { + enable = mkEnableOption "Enables Mopidy."; + }; + + config.services.mopidy = mkIf cfg.enable { + inherit (cfg) enable; + extensionPackages = with pkgs; [ + mopidy-bandcamp + mopidy-mpd + mopidy-mpris + mopidy-muse + mopidy-notify + mopidy-spotify + ]; + extraConfigFiles = [ + config.sops.secrets."mopidy/bandcamp".path + config.sops.secrets."mopidy/spotify".path + ]; + settings = { + mpd = { + enabled = true; + hostname = "::"; + port = 6600; + }; + mpris.enabled = true; + muse = { + enabled = true; + mopidy_host = "localhost"; + mopidy_port = 6690; + mopidy_ssl = false; + snapcast_host = "localhost"; + snapcast_port = 1780; + snapcast_ssl = false; + }; + }; + }; + }; +} diff --git a/modules/home/media/mpd-mpris.nix b/modules/home/media/mpd-mpris.nix new file mode 100644 index 0000000..0f899c0 --- /dev/null +++ b/modules/home/media/mpd-mpris.nix @@ -0,0 +1,18 @@ +{ + flake.modules.homeManager.mpd-mpris = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.media.mpd-mpris; + cfgMpd = config.home.media.mpd; + in { + options.home.media.mpd-mpris.enable = mkOption { + type = types.bool; + default = cfgMpd.enable; + example = false; + }; + config.services.mpd-mpris.enable = cfg.enable; + }; +} diff --git a/modules/home/media/mpd.nix b/modules/home/media/mpd.nix new file mode 100644 index 0000000..a092f52 --- /dev/null +++ b/modules/home/media/mpd.nix @@ -0,0 +1,37 @@ +{ + flake.modules.homeManager.mpd = { + lib, + config, + ... + }: + with lib; let + cfg = config.home.media.mpd; + in { + options.home.media.mpd.enable = mkEnableOption "Enables MPD"; + config.services.mpd = mkIf cfg.enable { + inherit (cfg) enable; + musicDirectory = "${config.home.homeDirectory}/Music"; + playlistDirectory = "${config.home.homeDirectory}/Music/playlists"; + network.startWhenNeeded = true; + extraConfig = '' + follow_outside_symlinks "yes" + follow_inside_symlinks "yes" + + bind_to_address "localhost" + auto_update "yes" + + audio_output { + type "pipewire" + name "PipeWire" + } + + audio_output { + type "fifo" + name "my_fifo" + path "/tmp/mpd.fifo" + format "44100:16:2" + } + ''; + }; + }; +} diff --git a/modules/home/media/mpv.nix b/modules/home/media/mpv.nix new file mode 100644 index 0000000..e0cedd8 --- /dev/null +++ b/modules/home/media/mpv.nix @@ -0,0 +1,67 @@ +{ + flake.modules.homeManager.mpv = { + pkgs, + lib, + config, + ... + }: + with lib; let + cfg = config.home.media.mpv; + in { + options.home.media.mpv.enable = mkEnableOption "Enable MPV"; + config.programs.mpv = mkIf cfg.enable { + inherit (cfg) enable; + config = { + force-window = "immediate"; + force-seekable = true; # force streams to be seekable + slang = "jpn,jp,eng,en,fra,fr"; + alang = "eng,en,fra,fr"; + gpu-api = "auto"; + osc = true; + profile = "gpu-hq"; + # geometry = "50%x50%"; + # autofit-larger = "90%x90%"; + + # Screenshots + screenshot-format = "png"; + screenshot-high-bit-depth = true; + screenshot-png-compression = 6; + screenshot-directory = "${config.home.homeDirectory}/Pictures/Screenshots/mpv"; + + deband = true; + deband-iterations = 2; + deband-threshold = 35; + deband-range = 20; + + dither-depth = "auto"; + + sub-auto = "fuzzy"; + + scale = "ewa_lanczossharp"; + cscale = "ewa_lanczossharp"; + }; + scripts = with pkgs.mpvScripts; [ + crop + encode + inhibit-gnome + mpris + mpv-cheatsheet-ng + quality-menu + sponsorblock + thumbfast + twitch-chat + youtube-chat + youtube-upnext + ]; + bindings = { + Q = "quit-watch-later"; + P = "show-progress"; + "/" = "add volume -2"; + "*" = "add volume 2"; + m = "cycle mute"; + M = "vf toggle hflip"; + "Ctrl+r" = "cycle_values video-rotate \"90\" \"180\" \"270\" \"0\""; + }; + }; + }; +} diff --git a/modules/home/media/ncmpcpp.nix b/modules/home/media/ncmpcpp.nix new file mode 100644 index 0000000..0806481 --- /dev/null +++ b/modules/home/media/ncmpcpp.nix @@ -0,0 +1,89 @@ +{ + flake.modules.homeManager.ncmpcpp = { + lib, + config, + ... + }: + with lib; let + cfg = config.home.media.ncmpcpp; + in { + options.home.media.ncmpcpp.enable = mkEnableOption "Enable ncmpcpp"; + config.programs.ncmpcpp = let + musicDir = config.services.mpd.musicDirectory; + in + mkIf cfg.enable { + inherit (cfg) enable; + mpdMusicDir = musicDir; + settings = { + # directories + ncmpcpp_directory = "${config.home.homeDirectory}/.config/ncmpcpp"; + lyrics_directory = "${musicDir}/.lyrics"; + + # MPD + mpd_host = "localhost"; + mpd_port = 6600; + mpd_connection_timeout = 5; + mpd_crossfade_time = 0; + + # music visualizer + visualizer_output_name = "my_fifo"; + visualizer_in_stereo = "yes"; + # visualizer_type = "spectrum"; + visualizer_look = "+|"; + visualizer_color = "blue, cyan, green, yellow, magenta, red"; + + system_encoding = "UTF-8"; + + # song format + song_list_format = "(6)[]{} (23)[red]{a} (26)[yellow]{t|f} (40)[green]{b} (4)[blue]{l}"; + now_playing_prefix = "$b"; + now_playing_suffix = "$8$/b"; + + # columns settings + song_columns_list_format = "(6)[]{} (23)[red]{a} (26)[yellow]{t|f} (40)[green]{b} (4)[blue]{l}"; + + playlist_shorten_total_times = "yes"; + playlist_display_mode = "columns"; + browser_display_mode = "columns"; + search_engine_display_mode = "columns"; + playlist_editor_display_mode = "columns"; + autocenter_mode = "yes"; + centered_cursor = "yes"; + + progressbar_look = "─> "; + header_visibility = "no"; + statusbar_visibility = "no"; + titles_visibility = "no"; + allow_for_physical_item_deletion = "yes"; + + lastfm_preferred_language = "en"; + space_add_mode = "add_remove"; + + locked_screen_width_part = "50"; + ask_for_locked_screen_width_part = "yes"; + jump_to_now_playing_song_at_start = "yes"; + ask_before_clearing_playlists = "yes"; + clock_display_seconds = "no"; + display_volume_level = "yes"; + display_bitrate = "no"; + display_remaining_time = "yes"; + regular_expressions = "extended"; + ignore_leading_the = "yes"; + ignore_diacritics = "yes"; + mouse_support = "no"; + tags_separator = ";"; + enable_window_title = "yes"; + search_engine_default_search_mode = 1; + external_editor = "emacsclient -c"; + use_console_editor = "yes"; + + # colours + colors_enabled = "yes"; + volume_color = "default"; + progressbar_color = "black"; + progressbar_elapsed_color = "white"; + statusbar_color = "white"; + }; + }; + }; +} diff --git a/modules/home/media/streamlink.nix b/modules/home/media/streamlink.nix new file mode 100644 index 0000000..908f6f5 --- /dev/null +++ b/modules/home/media/streamlink.nix @@ -0,0 +1,19 @@ +{ + flake.modules.homeManager.streamlink = { + lib, + config, + pkgs, + ... + }: + with lib; let + cfg = config.home.media.streamlink; + in { + options.home.media.streamlink.enable = mkEnableOption "Enable Streamlink"; + config.programs.streamlink = mkIf cfg.enable { + enable = true; + settings = { + player = "${pkgs.mpv}/bin/mpv"; + }; + }; + }; +} diff --git a/users/phundrak/XCompose b/modules/home/phundrak/XCompose similarity index 100% rename from users/phundrak/XCompose rename to modules/home/phundrak/XCompose diff --git a/users/phundrak/wlr-which-key/center-window.nix b/modules/home/phundrak/_wlr-which-key/center-window.nix similarity index 100% rename from users/phundrak/wlr-which-key/center-window.nix rename to modules/home/phundrak/_wlr-which-key/center-window.nix diff --git a/users/phundrak/wlr-which-key/close-window.nix b/modules/home/phundrak/_wlr-which-key/close-window.nix similarity index 100% rename from users/phundrak/wlr-which-key/close-window.nix rename to modules/home/phundrak/_wlr-which-key/close-window.nix diff --git a/users/phundrak/wlr-which-key/default.nix b/modules/home/phundrak/_wlr-which-key/default.nix similarity index 96% rename from users/phundrak/wlr-which-key/default.nix rename to modules/home/phundrak/_wlr-which-key/default.nix index 9a5b3cb..02d89b8 100644 --- a/users/phundrak/wlr-which-key/default.nix +++ b/modules/home/phundrak/_wlr-which-key/default.nix @@ -26,9 +26,9 @@ focus-urgent = import ./focus-urgent.nix {inherit pkgs;}; fullscreen = import ./fullscreen.nix {inherit pkgs;}; logout = import ./logout.nix {inherit pkgs;}; - app-launcher = import ../../modules/cli/scripts/launcher.nix {inherit pkgs;}; - plock = import ../../modules/cli/scripts/plock.nix {inherit pkgs;}; - ytplay = import ../../modules/cli/scripts/ytplay.nix {inherit pkgs;}; + app-launcher = import ../../cli/_scripts/launcher.nix {inherit pkgs;}; + plock = import ../../cli/_scripts/plock.nix {inherit pkgs;}; + ytplay = import ../../cli/_scripts/ytplay.nix {inherit pkgs;}; in [ { diff --git a/users/phundrak/wlr-which-key/float-window.nix b/modules/home/phundrak/_wlr-which-key/float-window.nix similarity index 100% rename from users/phundrak/wlr-which-key/float-window.nix rename to modules/home/phundrak/_wlr-which-key/float-window.nix diff --git a/users/phundrak/wlr-which-key/focus-urgent.nix b/modules/home/phundrak/_wlr-which-key/focus-urgent.nix similarity index 100% rename from users/phundrak/wlr-which-key/focus-urgent.nix rename to modules/home/phundrak/_wlr-which-key/focus-urgent.nix diff --git a/users/phundrak/wlr-which-key/fullscreen.nix b/modules/home/phundrak/_wlr-which-key/fullscreen.nix similarity index 100% rename from users/phundrak/wlr-which-key/fullscreen.nix rename to modules/home/phundrak/_wlr-which-key/fullscreen.nix diff --git a/users/phundrak/wlr-which-key/logout.nix b/modules/home/phundrak/_wlr-which-key/logout.nix similarity index 100% rename from users/phundrak/wlr-which-key/logout.nix rename to modules/home/phundrak/_wlr-which-key/logout.nix diff --git a/modules/home/phundrak/default.nix b/modules/home/phundrak/default.nix new file mode 100644 index 0000000..18bb841 --- /dev/null +++ b/modules/home/phundrak/default.nix @@ -0,0 +1,181 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager.phundrak = { + pkgs, + config, + lib, + ... + }: + with lib; let + cfg = config.home.phundrak; + fullDesktop = config.home.fullDesktop; + emacsPackage = with pkgs; ((emacsPackagesFor emacs).emacsWithPackages ( + epkgs: + with epkgs; [ + mu4e + pdf-tools + tree-sitter + tree-sitter-langs + (treesit-grammars.with-grammars (grammar: + with grammar; [ + tree-sitter-bash + tree-sitter-c + tree-sitter-cpp + tree-sitter-css + tree-sitter-dockerfile + tree-sitter-http + tree-sitter-javascript + tree-sitter-jsdoc + tree-sitter-json + tree-sitter-just + tree-sitter-markdown + tree-sitter-markdown-inline + tree-sitter-nix + tree-sitter-rust + tree-sitter-sql + tree-sitter-toml + tree-sitter-typescript + tree-sitter-typst + tree-sitter-vue + tree-sitter-yaml + ])) + ] + )); + askpass = import ../cli/_scripts/askpass.nix {inherit pkgs;}; + launchWithEmacsclient = import ../cli/_scripts/launch-with-emacsclient.nix { + inherit pkgs config; + }; + in { + imports = [ + m.home-base + m.sops-user-phundrak + m.phundrak-ai + m.phundrak-email + m.phundrak-firefox + m.phundrak-tmux + m.phundrak-zellij + m.phundrak-packages + ./_wlr-which-key + ]; + + options.home.phundrak = { + sshKey = { + content = mkOption { + type = types.nullOr types.str; + example = "ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; + default = null; + }; + file = mkOption { + type = with types; nullOr path; + default = "/home/phundrak/.ssh/id_ed25519.pub"; + }; + }; + }; + + config = mkMerge [ + # light-home.nix — unconditional base + { + nixpkgs.config.allowUnfree = true; + + home = { + username = "phundrak"; + homeDirectory = "/home/phundrak"; + packages = [pkgs.tree pkgs.ncdu]; + preferXdgDirectories = true; + + phundrak.sshKey.file = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; + + dev.vcs = { + jj.enable = true; + git.enable = true; + publicKey = cfg.sshKey; + }; + + security.ssh = { + enable = true; + hosts = config.sops.secrets."ssh/hosts".path; + }; + + shell = { + bash.enable = true; + zsh.enable = true; + starship = { + enable = true; + jjIntegration = true; + }; + tmux.enable = true; + zoxide = { + enable = true; + replaceCd = true; + }; + }; + + stateVersion = "24.11"; # Do not modify! + }; + + manual.manpages.enable = true; + } + + # home.nix — full-desktop content, now gated on home.fullDesktop + (mkIf fullDesktop { + sops.secrets = { + emailPassword = {}; + "mopidy/bandcamp" = {}; + "mopidy/spotify" = {}; + "opencode/cors" = {}; + }; + + home = { + sessionVariables = { + LAUNCH_EDITOR = "${launchWithEmacsclient}/bin/launch-with-emacsclient"; + SUDO_ASKPASS = "${askpass}/bin/askpass"; + LSP_USE_PLISTS = "true"; + OPENAI_API_URL = "http://localhost:1234/"; + }; + desktop = { + caelestia.enable = true; + spotify = { + enable = true; + spicetify.enable = true; + }; + wl-kbptr = { + enable = true; + config = { + general = { + # first eight chars to select areas, last three chars + # for left, right, middle click + # First eigh chars to select areas: auiectsr + # last three chars for left, right, and middle click: tsr + home_row_keys = "auiectsrtsr"; + modes = "tile,bisect,click"; + }; + }; + }; + }; + dev = { + editors.emacs.package = emacsPackage; + vcs.jj.signing.enable = true; + }; + file = { + ".XCompose".source = ./XCompose; + "${config.home.homeDirectory}/.ssh/allowed_signers" = { + enable = true; + text = lib.strings.join "\n" ( + map (file: let + content = lib.strings.trim (builtins.readFile file); + parts = lib.strings.splitString " " content; + email = lib.lists.last parts; + in "${email} namespaces=\"git\" ${content}") + (lib.filesystem.listFilesRecursive ./keys) + ); + }; + }; + media.mopidy.enable = false; + }; + + manual.html.enable = true; + }) + ]; + }; +} diff --git a/modules/home/phundrak/hosts/elcafe.nix b/modules/home/phundrak/hosts/elcafe.nix new file mode 100644 index 0000000..c7a569f --- /dev/null +++ b/modules/home/phundrak/hosts/elcafe.nix @@ -0,0 +1,13 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager."phundrak-elcafe" = {...}: { + imports = [m.phundrak]; + + home = { + cli.nh.flake = "/home/phundrak/.dotfiles"; + dev.editors.emacs.enable = false; + phundrak.sshKey.content = builtins.readFile ../keys/id_elcafe.pub; + }; + }; +} diff --git a/modules/home/phundrak/hosts/gampo.nix b/modules/home/phundrak/hosts/gampo.nix new file mode 100644 index 0000000..266736d --- /dev/null +++ b/modules/home/phundrak/hosts/gampo.nix @@ -0,0 +1,16 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager."phundrak-gampo" = {config, ...}: { + imports = [m.phundrak]; + + home = { + fullDesktop = true; + cli.nh.flake = "${config.home.homeDirectory}/.dotfiles"; + dev.ai.lmStudio = false; + desktop.hyprland.host = "gampo"; + phundrak.sshKey.content = builtins.readFile ../keys/id_gampo.pub; + }; + programs.caelestia.settings.bar.persistent = false; + }; +} diff --git a/modules/home/phundrak/hosts/marpa.nix b/modules/home/phundrak/hosts/marpa.nix new file mode 100644 index 0000000..24175b7 --- /dev/null +++ b/modules/home/phundrak/hosts/marpa.nix @@ -0,0 +1,26 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager."phundrak-marpa" = {config, ...}: { + imports = [m.phundrak]; + + home = { + fullDesktop = true; + gpuType = "amd"; + cli.nh.flake = "${config.home.homeDirectory}/.dotfiles"; + dev.ai = { + enable = true; + ollama.gpu = "rocm"; + }; + desktop = { + hyprland.host = "marpa"; + caelestia.idleTimeout = 60 * 60 * 24; # a day + }; + phundrak.sshKey.content = builtins.readFile ../keys/id_marpa.pub; + }; + programs.caelestia.settings.bar.status = { + showBattery = false; + showWifi = false; + }; + }; +} diff --git a/modules/home/phundrak/hosts/naromk3.nix b/modules/home/phundrak/hosts/naromk3.nix new file mode 100644 index 0000000..8368d20 --- /dev/null +++ b/modules/home/phundrak/hosts/naromk3.nix @@ -0,0 +1,12 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager."phundrak-NaroMk3" = {...}: { + imports = [m.phundrak]; + + home = { + cli.nh.flake = "/home/phundrak/.dotfiles"; + phundrak.sshKey.content = builtins.readFile ../keys/id_naromk3.pub; + }; + }; +} diff --git a/modules/home/phundrak/hosts/pinetab2.nix b/modules/home/phundrak/hosts/pinetab2.nix new file mode 100644 index 0000000..31c6040 --- /dev/null +++ b/modules/home/phundrak/hosts/pinetab2.nix @@ -0,0 +1,15 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager."phundrak-pinetab2" = {config, ...}: { + imports = [m.phundrak]; + + home = { + fullDesktop = true; + cli.nh.flake = "${config.home.homeDirectory}/.dotfiles"; + desktop.hyprland.host = "gampo"; + phundrak.sshKey.content = builtins.readFile ../keys/id_pinetab2.pub; + }; + programs.caelestia.settings.bar.persistent = false; + }; +} diff --git a/modules/home/phundrak/hosts/tilo.nix b/modules/home/phundrak/hosts/tilo.nix new file mode 100644 index 0000000..b3e2cd6 --- /dev/null +++ b/modules/home/phundrak/hosts/tilo.nix @@ -0,0 +1,12 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager."phundrak-tilo" = {...}: { + imports = [m.phundrak]; + + home = { + cli.nh.flake = "/tank/phundrak/.dotfiles"; + phundrak.sshKey.content = builtins.readFile ../keys/id_tilo.pub; + }; + }; +} diff --git a/users/phundrak/keys/id_elcafe.pub b/modules/home/phundrak/keys/id_elcafe.pub similarity index 100% rename from users/phundrak/keys/id_elcafe.pub rename to modules/home/phundrak/keys/id_elcafe.pub diff --git a/users/phundrak/keys/id_gampo.pub b/modules/home/phundrak/keys/id_gampo.pub similarity index 100% rename from users/phundrak/keys/id_gampo.pub rename to modules/home/phundrak/keys/id_gampo.pub diff --git a/users/phundrak/keys/id_marpa.pub b/modules/home/phundrak/keys/id_marpa.pub similarity index 100% rename from users/phundrak/keys/id_marpa.pub rename to modules/home/phundrak/keys/id_marpa.pub diff --git a/users/phundrak/keys/id_naromk3.pub b/modules/home/phundrak/keys/id_naromk3.pub similarity index 100% rename from users/phundrak/keys/id_naromk3.pub rename to modules/home/phundrak/keys/id_naromk3.pub diff --git a/users/phundrak/keys/id_opn4.pub b/modules/home/phundrak/keys/id_opn4.pub similarity index 100% rename from users/phundrak/keys/id_opn4.pub rename to modules/home/phundrak/keys/id_opn4.pub diff --git a/users/phundrak/keys/id_pinetab2.pub b/modules/home/phundrak/keys/id_pinetab2.pub similarity index 100% rename from users/phundrak/keys/id_pinetab2.pub rename to modules/home/phundrak/keys/id_pinetab2.pub diff --git a/users/phundrak/keys/id_tilo.pub b/modules/home/phundrak/keys/id_tilo.pub similarity index 100% rename from users/phundrak/keys/id_tilo.pub rename to modules/home/phundrak/keys/id_tilo.pub diff --git a/modules/home/phundrak/phundrak-ai.nix b/modules/home/phundrak/phundrak-ai.nix new file mode 100644 index 0000000..932c768 --- /dev/null +++ b/modules/home/phundrak/phundrak-ai.nix @@ -0,0 +1,60 @@ +{ + flake.modules.homeManager.phundrak-ai = {config, ...}: { + home.dev.ai = { + enable = true; + opencode = { + tui = { + mouse = true; + theme = "nord"; + attention = { + enabled = true; + notifications = true; + }; + keybinds = { + leader = "ctrl+x"; + "command_list" = ""; + }; + }; + settings = { + autoupdate = false; + provider = { + ollama = { + npm = "@ai-sdk/openai-compatible"; + name = "Ollama (marpa)"; + options.baseURL = "http://marpa:11434/v1"; + }; + models = { + "qwen3.5:9b".name = "Qwen 3.5 Medium"; + "gemma4:e4b".name = "Gemma E4B"; + "qwen2.5-coder:1.5b-base".name = "Qwen 2.5 Coder Light"; + }; + }; + permission = { + "*" = "ask"; + glob = "allow"; + grep = "allow"; + read = { + "*" = "allow"; + "*.env" = "deny"; + "*.env.*" = "deny"; + "*.env.example" = "allow"; + }; + skill = "allow"; + question = "allow"; + task = "allow"; + todowrite = "allow"; + }; + formatter.nixfmt = { + command = ["nix" "fmt" "$FILE"]; + extensions = [".nix"]; + }; + }; + web = { + enable = true; + cors = config.sops.secrets."opencode/cors".path; + mdns.enable = true; + }; + }; + }; + }; +} diff --git a/modules/home/phundrak/phundrak-email.nix b/modules/home/phundrak/phundrak-email.nix new file mode 100644 index 0000000..02b4979 --- /dev/null +++ b/modules/home/phundrak/phundrak-email.nix @@ -0,0 +1,50 @@ +{ + flake.modules.homeManager.phundrak-email = {config, ...}: let + signature = '' + Lucien “Phundrak” Cartier-Tilet + https://phundrak.com (Français) + https://phundrak.com/en (English) + + Sent from GNU/Emacs + + @@@ Sauvez un arbre, mangez un castor @@@ + @@@ Save a tree, eat a beaver @@@ + @@@ Bjarg tré, et bjórr @@@ + ''; + in { + home.file.".signature" = { + target = ".signature"; + text = signature; + }; + accounts.email = { + maildirBasePath = "Mail"; + accounts."lucien@phundrak.com" = { + realName = "Lucien Cartier-Tilet"; + address = "lucien@phundrak.com"; + aliases = [ + "lucien@cartier-tilet.com" + "admin@phundrak.com" + "webmaster@phundrak.com" + "youdontknow@phundrak.com" + ]; + passwordCommand = "cat ${config.sops.secrets.emailPassword.path}"; + signature = { + text = signature; + showSignature = "append"; + }; + userName = "lucien@phundrak.com"; + imap.host = "mail.phundrak.com"; + smtp.host = "mail.phundrak.com"; + mu.enable = true; + primary = true; + + mbsync = { + create = "maildir"; + enable = true; + expunge = "both"; + remove = "both"; + }; + }; + }; + }; +} diff --git a/modules/home/phundrak/phundrak-firefox.nix b/modules/home/phundrak/phundrak-firefox.nix new file mode 100644 index 0000000..0599e00 --- /dev/null +++ b/modules/home/phundrak/phundrak-firefox.nix @@ -0,0 +1,90 @@ +{ + flake.modules.homeManager.phundrak-firefox = {pkgs, ...}: { + config.home.desktop.firefox = { + enable = true; + useZen = true; + tridactyl = { + enable = true; + preConfig = "sanitise tridactyllocal tridactylsync"; + config = { + editorcmd = "emacsclient -c"; + keyboardlayoutbase = "bepo"; + keyboardlayoutforce = "true"; + hintchars = "auiectsr"; + smothscroll = "true"; + }; + extraConfig = '' + command openTwitchInMpv js -d@\ + const url = new URL(document.location.href);\ + const cleanUrl = url.hostname + url.pathname;\ + const token = document.cookie.split("; ")\ + .find(item => item.startsWith("auth-token="))?.split("=")[1];\ + const auth = "--twitch-api-header=Authorization=OAuth " + token;\ + const cmd = `${pkgs.streamlink}/bin/streamlink "''${auth}" "''${cleanUrl}" best`;\ + tri.native.run(cmd)\ + @ + + unbind h + unbind j + unbind k + unbind l + unbind c + unbind t + unbind s + unbind r + unbind H + unbind J + unbind K + unbind L + unbind C + unbind T + unbind S + unbind R + + " === Bépo layout — scrolling (ctsr = hjkl) === + bind c scrollpx -300 0 + bind t scrollline 5 + bind s scrollline -5 + bind r scrollpx 300 0 + + " Half/full page scroll (replacing C-f/C-b/C-d/C-u) + bind scrollpage 0.5 + bind scrollpage -0.5 + + " === History navigation (C/R = H/L) === + bind C back + bind R forward + + " === Tab navigation === + bind T tabnext + bind S tabprev + + " === Displaced commands === + " reload was on r → move to h (bépo's 'replace' position) + bind h reload + bind H reloadhard + + " tabopen was on t → move to j (bépo's 'find char to' position) + bind j fillcmdline tabopen + + unbind ^http(s?)://youtube\.com f + unbind ^http(s?)://youtube\.com t + unbind ^http(s?)://youtube\.com l + unbind ^http(s?)://youtube\.com j + unbind ^http(s?)://twitch\.tv f + + bind n findnext + bind N findnext -f + bind p findnext --reverse + bind P findnext -f --reverse + + bind < urlincrement -1 + bind > urlincrement 1 + bind ypt openTwitchInMpv + bind ypv js tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${document.location.href}"`) + bind ypm hint -JF e => tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${e.href}"`) + ''; + }; + }; + }; +} diff --git a/modules/home/phundrak/phundrak-packages.nix b/modules/home/phundrak/phundrak-packages.nix new file mode 100644 index 0000000..c9c2c84 --- /dev/null +++ b/modules/home/phundrak/phundrak-packages.nix @@ -0,0 +1,97 @@ +{inputs, ...}: { + flake-file.inputs.pumo-system-info = { + url = "git+https://labs.phundrak.com/phundrak/pumo-system-info"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + flake.modules.homeManager.phundrak-packages = { + pkgs, + lib, + ... + }: + with lib; let + inherit (pkgs.stdenv.hostPlatform) system; + handy = pkgs.callPackage ../../../packages/handy.nix {}; + pumo-system-info = inputs.pumo-system-info.packages.${system}.default; + in { + programs.bun.enable = true; + home.packages = with pkgs; [ + # Terminal stuff + duf + ffmpeg + ripgrep-all + unzip + + # Fonts + #nerdfonts + noto-fonts-cjk-sans + noto-fonts-cjk-serif + tibetan-machine + + # Browsers + amfora + + # Media + ani-cli + audacity + plexamp + plex-desktop + pavucontrol # Volume control + + # Social + vesktop # Discord alternative that works well with wayland + signal-desktop + + # Misc + # gplates + kicad-small + qgis + handy + libnotify + nextcloud-client + onlyoffice-desktopeditors + pumo-system-info + scrcpy + syncthing + watchmate + chatterino7 + + # Games + atlauncher + heroic + openmw + openttd-jgrpp + moonlight-qt + + # Gnome stuff + gnomeExtensions.tray-icons-reloaded + gthumb + + # Graphics + inkscape + gimp + gimpPlugins.gmic + + # Dev + dbeaver-bin + devenv + nodejs + sqlite + tectonic # better LaTeX engine + wakatime-cli + zeal + pandoc + + ## LSP servers + bash-language-server + docker-language-server + kdePackages.qtdeclarative # For QML LSP + nixd + nixfmt + marksman + python3 # for Emacs and LSP + vscode-json-languageserver + yaml-language-server # Yaml (Docker, GitHub Actions, ...) + ]; + }; +} diff --git a/modules/home/phundrak/phundrak-tmux.nix b/modules/home/phundrak/phundrak-tmux.nix new file mode 100644 index 0000000..b4bd8dc --- /dev/null +++ b/modules/home/phundrak/phundrak-tmux.nix @@ -0,0 +1,212 @@ +{ + flake.modules.homeManager.phundrak-tmux = { + home.shell.tmux = { + enable = true; + extraConfig = "set-option -sa terminal-overrides \",xterm*:Tc\""; + unbind = [ + "C-b" + {"copy-mode-vi" = ["H" "J" "K" "L" "h" "j" "k" "l"];} + ]; + bind = { + prefix = [ + { + key = "«"; + action = "select-window -p"; + } + { + key = "»"; + action = "select-window -n"; + } + { + key = "Tab"; + action = "switch-client -T windows"; + } + { + key = "w"; + action = "switch-client -T pane"; + } + { + key = "y"; + action = "switch-client -T copy-mode"; + } + ]; + pane = [ + { + key = "/"; + action = "split-window -h -c \"#{pane-current_path}\""; + } + { + key = "-"; + action = "split-window -v -c \"#{pane-current_path}\""; + } + { + key = "c"; + action = "select-pane -L"; + } + { + key = "t"; + action = "select-pane -D"; + } + { + key = "s"; + action = "select-pane -U"; + } + { + key = "r"; + action = "select-pane -R"; + } + { + key = "f"; + action = "resize-pane -Z"; + } + { + key = "."; + action = "switch-client -T pane-resize"; + } + ]; + "pane-resize" = [ + { + key = "c"; + action = "resize-pane -L 5\\; switch-client -T pane-resize"; + } + { + key = "t"; + action = "resize-pane -D 5\\; switch-client -T pane-resize"; + } + { + key = "s"; + action = "resize-pane -U 5\\; switch-client -T pane-resize"; + } + { + key = "r"; + action = "resize-pane -R 5\\; switch-client -T pane-resize"; + } + { + key = "C"; + action = "resize-pane -L\\; switch-client -T pane-resize"; + } + { + key = "T"; + action = "resize-pane -D\\; switch-client -T pane-resize"; + } + { + key = "S"; + action = "resize-pane -U\\; switch-client -T pane-resize"; + } + { + key = "R"; + action = "resize-pane -R\\; switch-client -T pane-resize"; + } + ]; + windows = [ + { + key = "c"; + action = "new-window"; + } + { + key = "n"; + action = "next-window"; + } + { + key = "p"; + action = "previous-window"; + } + { + key = "r"; + action = "command-prompt \"rename-window '%%'\""; + } + { + key = "\\\""; + action = "select-window -t :=1"; + } + { + key = "«"; + action = "select-window -t :=2"; + } + { + key = "»"; + action = "select-window -t :=3"; + } + { + key = "("; + action = "select-window -t :=4"; + } + { + key = ")"; + action = "select-window -t :=5"; + } + { + key = "@"; + action = "select-window -t :=6"; + } + { + key = "+"; + action = "select-window -t :=7"; + } + { + key = "-"; + action = "select-window -t :=8"; + } + { + key = "/"; + action = "select-window -t :=9"; + } + { + key = "*"; + action = "select-window -t :=10"; + } + ]; + "copy-mode-vi" = [ + { + key = "v"; + action = "send-keys -X begin-selection"; + } + { + key = "C-v"; + action = "send-keys -X rectangle-toggle"; + } + { + key = "y"; + action = "send-keys -X copy-selection-and-cancel"; + } + { + key = "C"; + action = "send-keys -X top-line"; + } + { + key = "J"; + action = "send-keys -X jump-to-backward"; + } + { + key = "S"; + action = "send-keys -X scroll-up"; + } + { + key = "R"; + action = "send-keys -X bottom-line"; + } + { + key = "T"; + action = "send-keys -X scroll-down"; + } + { + key = "c"; + action = "send-keys -X cursor-left"; + } + { + key = "t"; + action = "send-keys -X cursor-down"; + } + { + key = "s"; + action = "send-keys -X cursor-up"; + } + { + key = "r"; + action = "send-keys -X cursor-right"; + } + ]; + }; + }; + }; +} diff --git a/modules/home/phundrak/phundrak-zellij.nix b/modules/home/phundrak/phundrak-zellij.nix new file mode 100644 index 0000000..ac3959f --- /dev/null +++ b/modules/home/phundrak/phundrak-zellij.nix @@ -0,0 +1,266 @@ +{ + flake.modules.homeManager.phundrak-zellij = {lib, ...}: { + home.shell.zellij = with lib; { + enable = true; + clearDefaultKeybinds = true; + useUnlockFirst = true; + settings.copy_on_select = true; + extraSettings = '' + plugins { + about location="zellij:about" + compact-bar location="zellij:compact-bar" + configuration location="zellij:configuration" + filepicker location="zellij:strider" { + cwd "/" + } + plugin-manager location="zellij:plugin-manager" + session-manager location="zellij:session-manager" + status-bar location="zellij:status-bar" + strider location="zellij:strider" + tab-bar location="zellij:tab-bar" + welcome-screen location="zellij:session-manager" { + welcome_screen true + } + } + ''; + keybinds = let + # bépo layout + left = ["c" "Left"]; + down = ["t" "Down"]; + up = ["s" "Up"]; + right = ["r" "Right"]; + numRow = ["\"" "«" "»" "(" ")" "@" "+" "-" "/" "*"]; + in { + locked = [ + { + bind = "Ctrl Alt g"; + actions = {SwitchToMode = "normal";}; + } + ]; + pane = [ + { + bind = left; + actions = {MoveFocus = "Left";}; + } + { + bind = down; + actions = {MoveFocus = "Down";}; + } + { + bind = up; + actions = {MoveFocus = "Up";}; + } + { + bind = right; + actions = {MoveFocus = "Right";}; + } + { + bind = "n"; + actions = {NewPane = [];}; + useUnlockFirst = true; + } + { + bind = "T"; + actions = {NewPane = "Down";}; + useUnlockFirst = true; + } + { + bind = "R"; + actions = {NewPane = "Right";}; + useUnlockFirst = true; + } + { + bind = "S"; + actions = {NewPane = "stacked";}; + useUnlockFirst = true; + } + { + bind = "N"; + actions = {SwitchToMode = "normal";}; + } + { + bind = "e"; + actions = {TogglePaneEmbedOrFloating = [];}; + useUnlockFirst = true; + } + { + bind = "i"; + actions = {TogglePanePinned = [];}; + } + { + bind = "f"; + actions = {ToggleFocusFullscreen = [];}; + useUnlockFirst = true; + } + { + bind = "F"; + actions = {ToggleFloatingPanes = [];}; + } + { + bind = "q"; + actions = {CloseFocus = [];}; + useUnlockFirst = true; + } + { + bind = "p"; + actions = {SwitchToMode = "normal";}; + } + { + bind = "P"; + actions = { + SwitchToMode = "renamepane"; + PaneNameInput = 0; + }; + } + { + bind = "z"; + actions = {TogglePaneFrames = [];}; + useUnlockFirst = true; + } + { + bind = "tab"; + actions = {SwitchFocus = [];}; + } + ]; + resize = [ + { + bind = "n"; + actions = {SwitchToMode = "locked";}; + } + { + bind = left; + actions = {Resize = "Increase Left";}; + } + { + bind = down; + actions = {Resize = "Increase Down";}; + } + { + bind = up; + actions = {Resize = "Increase Up";}; + } + { + bind = right; + actions = {Resize = "Increase Right";}; + } + { + bind = "C"; + actions = {Resize = "Decrease Left";}; + } + { + bind = "T"; + actions = {Resize = "Decrease Down";}; + } + { + bind = "S"; + actions = {Resize = "Decrease Up";}; + } + { + bind = "R"; + actions = {Resize = "Decrease Right";}; + } + { + bind = "+"; + actions = {Resize = "Increase";}; + } + { + bind = "-"; + actions = {Resize = "Decrease";}; + } + ]; + move = [ + { + bind = left; + actions = {MovePane = "left";}; + } + { + bind = down; + actions = {MovePane = "down";}; + } + { + bind = up; + actions = {MovePane = "up";}; + } + { + bind = right; + actions = {MovePane = "right";}; + } + { + bind = "m"; + actions = {SwitchToMode = "normal";}; + } + { + bind = ["n" "tab"]; + actions = {MovePane = [];}; + } + { + bind = "p"; + actions = {MovePaneBackwards = [];}; + } + ]; + tab = + [ + { + bind = left ++ up; + actions = {GoToPreviousTab = [];}; + } + { + bind = down ++ right; + actions = {GoToNextTab = [];}; + } + { + bind = "["; + actions = {BreakPaneLeft = [];}; + useUnlockFirst = true; + } + { + bind = "]"; + actions = {BreakPaneRight = [];}; + useUnlockFirst = true; + } + { + bind = "b"; + actions = {BreakPane = [];}; + useUnlockFirst = true; + } + { + bind = "n"; + actions = {NewTab = [];}; + useUnlockFirst = true; + } + { + bind = "R"; + actions = { + SwitchToMode = "renametab"; + TabNameInput = 0; + }; + } + { + bind = "s"; + actions = {ToggleActiveSyncTab = [];}; + useUnlockFirst = true; + } + { + bind = "T"; + actions = {SwitchToMode = "normal";}; + } + { + bind = "x"; + actions = {CloseTab = [];}; + useUnlockFirst = true; + } + { + bind = "tab"; + actions = {ToggleTab = [];}; + } + ] + ++ (lists.imap1 (i: key: { + bind = key; + actions = {GoToTab = i;}; + useUnlockFirst = true; + }) + numRow); + }; + }; + }; +} diff --git a/modules/home/security/gpg.nix b/modules/home/security/gpg.nix new file mode 100644 index 0000000..0129f5d --- /dev/null +++ b/modules/home/security/gpg.nix @@ -0,0 +1,31 @@ +{ + flake.modules.homeManager.gpg = { + pkgs, + lib, + config, + ... + }: + with lib; let + cfg = config.home.security.gpg; + in { + options.home.security.gpg = { + enable = mkEnableOption "Enable GPG"; + pinentry.package = mkOption { + type = types.package; + default = pkgs.pinentry-gnome3; + }; + }; + config = mkIf cfg.enable { + programs.gpg = { + inherit (cfg) enable; + mutableKeys = true; + mutableTrust = true; + }; + services.gpg-agent = { + enable = true; + enableSshSupport = false; + pinentry.package = cfg.pinentry.package; + }; + }; + }; +} diff --git a/modules/home/security/security.nix b/modules/home/security/security.nix new file mode 100644 index 0000000..017194b --- /dev/null +++ b/modules/home/security/security.nix @@ -0,0 +1,22 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager.security = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.security; + in { + imports = [ + m.gpg + m.ssh + ]; + options.home.security.fullDesktop = mkEnableOption "Enable all modules"; + config.home.security = { + gpg.enable = mkDefault cfg.fullDesktop; + ssh.enable = mkDefault cfg.fullDesktop; + }; + }; +} diff --git a/modules/home/security/ssh.nix b/modules/home/security/ssh.nix new file mode 100644 index 0000000..3f55282 --- /dev/null +++ b/modules/home/security/ssh.nix @@ -0,0 +1,26 @@ +{ + flake.modules.homeManager.ssh = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.security.ssh; + in { + options.home.security.ssh = { + enable = mkEnableOption "enables SSH"; + hosts = mkOption { + type = types.nullOr types.path; + default = null; + }; + }; + + config = { + programs.ssh = mkIf cfg.enable { + enable = true; + enableDefaultConfig = false; + includes = lists.optional (cfg.hosts != null) cfg.hosts; + }; + }; + }; +} diff --git a/modules/home/services/blanket.nix b/modules/home/services/blanket.nix new file mode 100644 index 0000000..9912c26 --- /dev/null +++ b/modules/home/services/blanket.nix @@ -0,0 +1,13 @@ +{ + flake.modules.homeManager.blanket = { + lib, + config, + ... + }: + with lib; let + cfg = config.home.myServices.blanket; + in { + options.home.myServices.blanket.enable = mkEnableOption "Enable blanket"; + config.services.blanket.enable = cfg.enable; + }; +} diff --git a/modules/home/services/mbsync.nix b/modules/home/services/mbsync.nix new file mode 100644 index 0000000..fac25cb --- /dev/null +++ b/modules/home/services/mbsync.nix @@ -0,0 +1,24 @@ +{ + flake.modules.homeManager.mbsync = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.myServices.mbsync; + in { + options.home.myServices.mbsync = { + enable = mkEnableOption "Enables mbsync"; + service.enable = mkOption { + type = types.bool; + default = true; + }; + }; + + config = mkIf cfg.enable { + systemd.user.services.mbsync.unitConfig.After = ["sops-nix.service"]; + services.mbsync.enable = cfg.service.enable; + programs.mbsync.enable = true; + }; + }; +} diff --git a/modules/home/services/mpris-proxy.nix b/modules/home/services/mpris-proxy.nix new file mode 100644 index 0000000..1074c40 --- /dev/null +++ b/modules/home/services/mpris-proxy.nix @@ -0,0 +1,13 @@ +{ + flake.modules.homeManager.mpris-proxy = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.myServices.mpris-proxy; + in { + options.home.myServices.mpris-proxy.enable = mkEnableOption "Enable MPRIS forwarding towards bluetooth and MIDI"; + config.services.mpris-proxy.enable = cfg.enable; + }; +} diff --git a/modules/home/services/my-services.nix b/modules/home/services/my-services.nix new file mode 100644 index 0000000..8cbb1cf --- /dev/null +++ b/modules/home/services/my-services.nix @@ -0,0 +1,30 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager.my-services = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.myServices; + in { + imports = [ + m.blanket + m.mbsync + m.mpris-proxy + m.playerctld + ]; + options.home.myServices.fullDesktop = mkOption { + description = "Enable all modules"; + type = types.bool; + default = config.home.fullDesktop; + }; + config.home.myServices = { + blanket.enable = mkDefault cfg.fullDesktop; + mbsync.enable = mkDefault cfg.fullDesktop; + mpris-proxy.enable = mkDefault cfg.fullDesktop; + playerctld.enable = mkDefault cfg.fullDesktop; + }; + }; +} diff --git a/modules/home/services/playerctld.nix b/modules/home/services/playerctld.nix new file mode 100644 index 0000000..b842c89 --- /dev/null +++ b/modules/home/services/playerctld.nix @@ -0,0 +1,13 @@ +{ + flake.modules.homeManager.playerctld = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.myServices.playerctld; + in { + options.home.myServices.playerctld.enable = mkEnableOption "Enable playerctld daemon"; + config.services.playerctld.enable = cfg.enable; + }; +} diff --git a/modules/home/shell/bash.nix b/modules/home/shell/bash.nix new file mode 100644 index 0000000..a95fb13 --- /dev/null +++ b/modules/home/shell/bash.nix @@ -0,0 +1,60 @@ +{ + flake.modules.homeManager.bash = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.shell.bash; + in { + options.home.shell.bash = { + enable = mkEnableOption "Enables bash"; + aliases = mkOption { + type = types.attrsOf types.str; + default = {}; + example = { + cp = "cp -i"; + lns = "ln -si"; + }; + }; + autocompletion = mkOption { + type = types.bool; + default = config.home.shell.autocompletion; + example = true; + }; + eatIntegration = mkEnableOption "Enable Emacs Eat integration"; + bashrcExtra = mkOption { + type = types.lines; + default = ""; + }; + }; + + config = mkIf cfg.enable { + programs.bash = { + enable = true; + # inherit (cfg) bashrcExtra; + bashrcExtra = + concatLines + [ + (strings.optionalString cfg.eatIntegration ''[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/bash"'') + (strings.optionalString config.home.dev.vcs.jj.shellCompletion "source <(jj util completion bash)") + cfg.bashrcExtra + ]; + enableCompletion = cfg.autocompletion; + shellAliases = cfg.aliases; + shellOptions = [ + "histappend" + "cmdhist" + "lithist" + "checkwinsize" + "extglob" + "globstar" + "checkjobs" + "autocd" + "cdspell" + "dirspell" + ]; + }; + }; + }; +} diff --git a/modules/home/shell/fish.nix b/modules/home/shell/fish.nix new file mode 100644 index 0000000..d5a2f75 --- /dev/null +++ b/modules/home/shell/fish.nix @@ -0,0 +1,92 @@ +{ + flake.modules.homeManager.fish = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.home.shell.fish; + in { + options.home.shell.fish = { + enable = lib.mkEnableOption "enables fish"; + abbrs = lib.mkOption { + type = types.attrsOf types.str; + default = {}; + example = { + cp = "cp -i"; + lns = "ln -si"; + }; + }; + autocompletion = mkOption { + type = types.bool; + default = config.home.shell.autocompletion; + example = true; + }; + extraShellInit = mkOption { + type = types.lines; + default = ""; + }; + }; + + config = lib.mkIf cfg.enable { + programs.fish = { + enable = true; + generateCompletions = cfg.autocompletion; + shellAbbrs = cfg.abbrs; + preferAbbrs = true; + shellInit = with lib; + concatLines [ + '' + function fish_command_not_found + __fish_default_command_not_found_handler $argv + end + '' + (strings.optionalString config.home.dev.vcs.jj.shellCompletion "jj util completion fish | source") + cfg.extraShellInit + ]; + plugins = [ + { + name = "bass"; + inherit (pkgs.fishPlugins.bass) src; + # src = pkgs.fishPlugins.bass.src; + } + { + name = "colored-man-pages"; + inherit (pkgs.fishPlugins.colored-man-pages) src; + } + { + name = "done"; + inherit (pkgs.fishPlugins.done) src; + } + { + name = "fzf"; + inherit (pkgs.fishPlugins.fzf) src; + } + { + name = "pisces"; + inherit (pkgs.fishPlugins.pisces) src; + } + { + name = "getopts.fish"; + src = pkgs.fetchFromGitHub { + owner = "jorgebucaran"; + repo = "getopts.fish"; + rev = "4b74206725c3e11d739675dc2bb84c77d893e901"; + sha256 = "9hRFBmjrCgIUNHuOJZvOufyLsfreJfkeS6XDcCPesvw="; + }; + } + { + name = "replay.fish"; + src = pkgs.fetchFromGitHub { + owner = "jorgebucaran"; + repo = "replay.fish"; + rev = "d2ecacd3fe7126e822ce8918389f3ad93b14c86c"; + sha256 = "TzQ97h9tBRUg+A7DSKeTBWLQuThicbu19DHMwkmUXdg="; + }; + } + ]; + }; + }; + }; +} diff --git a/modules/home/shell/shell.nix b/modules/home/shell/shell.nix new file mode 100644 index 0000000..ab00b8c --- /dev/null +++ b/modules/home/shell/shell.nix @@ -0,0 +1,116 @@ +{config, ...}: let + m = config.flake.modules.homeManager; +in { + flake.modules.homeManager.shell = { + config, + lib, + ... + }: + with lib; let + defaultAliases = { + df = "df -H"; + diskspace = "sudo df -h | grep -E \"sd|lv|Size\""; + du = "du -ch"; + meminfo = "free -m -l -t"; + gpumeminfo = "grep -i --color memory /var/log/Xorg.0.log"; + cpuinfo = "lscpu"; + pscpu = "ps auxf | sort -nr -k 3"; + pscpu10 = "ps auxf | sort -nr -k 3 | head -10"; + psmem = "ps auxf | sort -nr -k 4"; + psmem10 = "ps auxf | sort -nr -k 4 | head -10"; + + s = "systemctl"; + ss = "systemctl status"; + sst = "systemctl stop"; + sr = "systemctl restart"; + sre = "systemctl reload"; + se = "systemctl enable"; + sen = "systemctl enable --now"; + su = "systemctl --user"; + sus = "systemctl --user status"; + sust = "systemctl --user stop"; + sur = "systemctl --user restart"; + sure = "systemctl --user reload"; + sue = "systemctl --user enable"; + suen = "systemctl --user enable --now"; + + dc = "docker compose"; + dcd = "docker compose down"; + dcl = "docker compose logs"; + dclf = "docker compose logs -f"; + dcp = "docker compose pull"; + dcu = "docker compose up"; + dcud = "docker compose up -d"; + dcudp = "docker compose up -d --pull=always"; + dcr = "docker compose restart"; + pc = "podman compose"; + pcd = "podman compose down"; + pcl = "podman compose logs"; + pclf = "podman compose logs -f"; + pcp = "podman compose pull"; + pcu = "podman compose up"; + pcud = "podman compose up -d"; + pcudp = "podman compose up -d --pull=always"; + pcr = "podman compose restart"; + + enw = "emacsclient -nw"; + e = "emacsclient -n -c"; + + cp = "cp -i"; + rsync = "rsync -Pa --progress"; + ln = "ln -i"; + lns = "ln -si"; + mv = "mv -i"; + rm = "rm -Iv"; + rmd = "rm --preserve-root -Irv"; + rmdf = "rm --preserve-root -Irfv"; + rmf = "rm --preserve-root -Ifv"; + chgrp = "chgrp --preserve-root -v"; + chmod = "chmod --preserve-root -v"; + chown = "chown --preserve-root -v"; + lsl = "eza -halg@ --group-directories-first --git"; + + flac = "yt-dlp -x --audio-format flac --audio-quality 0 o \"~/Music/%(uploader)s/%(title)s.%(ext)s\""; + please = "sudo -A"; + wget = "wget --hsts-file=\"$XDG_DATA_HOME/wget-hsts\" -c"; + }; + cfg = config.home.shell; + in { + imports = [ + m.bash + m.fish + m.starship + m.tmux + m.zellij + m.zsh + m.zoxide + ]; + options.home.shell = { + fullDesktop = mkEnableOption "Enable all shells"; + aliases = mkOption { + type = types.attrsOf types.str; + default = {}; + example = {la = "ls -a";}; + }; + autocompletion = mkOption { + type = types.bool; + default = true; + }; + }; + config.home.shell = { + enableShellIntegration = cfg.bash.enable or cfg.zsh.enable or cfg.fish.enable; + bash = { + aliases = defaultAliases // cfg.aliases; + enable = mkDefault cfg.fullDesktop; + }; + fish = { + abbrs = defaultAliases // cfg.aliases; + enable = mkDefault cfg.fullDesktop; + }; + zsh = { + abbrs = defaultAliases // cfg.aliases; + enable = mkDefault cfg.fullDesktop; + }; + }; + }; +} diff --git a/modules/home/shell/starship.nix b/modules/home/shell/starship.nix new file mode 100644 index 0000000..1d6bc52 --- /dev/null +++ b/modules/home/shell/starship.nix @@ -0,0 +1,79 @@ +{ + flake.modules.homeManager.starship = { + config, + lib, + ... + }: + with lib; let + cfg = config.home.shell.starship; + in { + options.home.shell.starship = { + enable = mkEnableOption "Enables the starship prompt."; + jjIntegration = mkOption { + description = "Enable Jujutsu integration in starship"; + default = config.programs.jujutsu.enable; + type = types.bool; + }; + }; + + config.programs.starship = mkIf cfg.enable { + inherit (cfg) enable; + enableTransience = true; + settings = mkIf cfg.jjIntegration { + # Disabling these so they can be enabled conditionally + # See https://github.com/jj-vcs/jj/wiki/Starship + git_status.disabled = true; + git_commit.disabled = true; + git_metrics.disabled = true; + git_branch.disabled = true; + custom = let + when = "! jj --ignore-working-copy-root"; + description = "Only show if we’re not in a jj repository"; + style = ""; + in { + git_status = { + inherit when description style; + command = "starship module git_status"; + }; + git_commit = { + inherit when description style; + command = "starship module git_commit"; + }; + git_metrics = { + inherit when description style; + command = "starship module git_metrics"; + }; + git_branch = { + inherit when description style; + command = "starship module git_branch"; + }; + jj = { + description = "The current jj status"; + detect_folders = [".jj"]; + symbol = "🥋 "; + command = '' + jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template ' + separate(" ", + change_id.shortest(4), + bookmarks, + "|", + concat( + if(conflict, "💥"), + if(divergent, "🚧"), + if(hidden, "👻"), + if(immutable, "🔒"), + ), + raw_escape_sequence("\x1b[1;32m") ++ if(empty, "(empty)"), + raw_escape_sequence("\x1b[1;32m") ++ coalesce( + truncate_end(29, description.first_line(), "…"), + "(no description set)", + ) ++ raw_escape_sequence("\x1b[0m"), + ) + ' + ''; + }; + }; + }; + }; + }; +} diff --git a/modules/home/shell/tmux.nix b/modules/home/shell/tmux.nix new file mode 100644 index 0000000..fde0aa4 --- /dev/null +++ b/modules/home/shell/tmux.nix @@ -0,0 +1,83 @@ +{ + flake.modules.homeManager.tmux = { + pkgs, + lib, + config, + ... + }: + with lib; let + cfg = config.home.shell.tmux; + keyType = types.submodule { + options = { + key = mkOption { + type = types.str; + example = "C-b"; + }; + action = mkOption { + type = types.str; + example = "resize-pane -Z"; + }; + }; + }; + in { + options.home.shell.tmux = with types; { + enable = mkEnableOption "Enable tmux"; + bind = mkOption { + type = attrsOf (listOf keyType); + default = {}; + example = { + "prefix" = [ + { + key = "C-r"; + action = "resize-pane -R"; + } + ]; + }; + }; + unbind = mkOption { + type = listOf (either str (attrsOf (listOf str))); + default = []; + }; + extraConfig = mkOption { + type = types.lines; + default = ""; + }; + }; + config.programs.tmux = mkIf cfg.enable { + inherit (cfg) enable; + baseIndex = 1; + clock24 = true; + customPaneNavigationAndResize = true; + keyMode = "vi"; + mouse = true; + newSession = true; + prefix = "M-space"; + plugins = with pkgs.tmuxPlugins; [ + cpu + nord + prefix-highlight + resurrect + sensible + yank + ]; + extraConfig = let + generateBinds = concatLines ( + mapAttrsToList (table: keys: concatMapStrings (key: "bind -T ${table} ${key.key} ${key.action}\n") keys) cfg.bind + ); + generateUnbind = + concatMapStrings ( + entry: + if builtins.isString entry + then "unbind ${entry}\n" + else concatStrings (mapAttrsToList (table: keys: concatMapStrings (key: "unbind -T ${table} ${key}\n") keys) entry) + ) + cfg.unbind; + in '' + ${cfg.extraConfig} + + ${generateUnbind} + ${generateBinds} + ''; + }; + }; +} diff --git a/modules/home/shell/zellij.nix b/modules/home/shell/zellij.nix new file mode 100644 index 0000000..e0ad0a6 --- /dev/null +++ b/modules/home/shell/zellij.nix @@ -0,0 +1,175 @@ +{ + flake.modules.homeManager.zellij = { + pkgs, + lib, + config, + ... + }: + with lib; let + cfg = config.home.shell.zellij; + isEmpty = list: list == []; + keybind = { + options = { + bind = mkOption { + type = types.either types.str (types.listOf types.str); + example = "Alt j"; + description = "Value used as a string after `bind` in zellij config"; + }; + actions = mkOption { + type = with types; let + allowed = oneOf [int str]; + in + attrsOf (either (listOf allowed) allowed); + default = {}; + example = { + SwitchToMode = ["normal"]; + SwitchFocus = []; + PaneNameInput = [0]; + }; + }; + useUnlockFirst = mkOption { + type = types.bool; + default = false; + description = '' + Go back to locked mode after the actions are done. + + Only works when `config.home.shell.zellij.useUnlockFirst` is true. + ''; + }; + }; + }; + convertBind = item: { + bind = let + useUnlockFirst = cfg.useUnlockFirst && item.useUnlockFirst; + children = + mapAttrsToList (action: args: let + actualArgs = + if isEmpty args + then {} + else {_args = lists.toList args;}; + in {"${action}" = actualArgs;}) + (item.actions + // ( + if useUnlockFirst + then {SwitchToMode = ["locked"];} + else {} + )); + in { + _args = lists.toList item.bind; + _children = children; + }; + }; + keybindsModule = { + options = mergeAttrsList (forEach [ + "normal" + "locked" + "resize" + "pane" + "move" + "tab" + "scroll" + "search" + "entersearch" + "renametab" + "renamepane" + "session" + "tmux" + ] + (x: { + "${x}" = mkOption { + type = types.listOf (types.submodule keybind); + default = []; + }; + })); + }; + makeKeybinds = keybinds: let + values = + attrsets.concatMapAttrs ( + mode: binds: + if (isEmpty binds) + then {} + else { + "${mode}"._children = lists.forEach binds convertBind; + } + ) + keybinds; + in + if values == {} + then {} + else { + keybinds = values; + }; + in { + options.home.shell.zellij = let + jsonFormat = pkgs.formats.yaml {}; + in { + enable = mkEnableOption "Enable Zellij"; + clearDefaultKeybinds = mkEnableOption "Clear default keybinds"; + settings = mkOption { + inherit (jsonFormat) type; + default = {}; + }; + layouts = mkOption { + inherit (jsonFormat) type; + default = {}; + }; + extraSettings = mkOption { + type = types.lines; + default = ""; + description = '' + Extra configuration lines to add to `$XDG_CONFIG_HOME/zellij/config.kdl` + ''; + }; + useUnlockFirst = mkEnableOption "Use Unlock-First (non-colliding) behaviour by default"; + plugins = mkOption { + type = types.listOf (types.submodule plugin); + default = {}; + example = [ + {name = "about";} + { + name = "filepicker"; + location = "zellij:strider"; + options = { + cwd = "/"; + }; + } + ]; + }; + keybinds = mkOption { + type = types.submodule keybindsModule; + default = {}; + example = { + pane = [ + { + bind = "c"; + actions = [ + { + action = "SwitchToMode"; + args = ["renamepane"]; + } + { + action = "PaneNameInput"; + args = [0]; + } + ]; + } + ]; + }; + }; + }; + config.programs.zellij = mkIf cfg.enable { + inherit (cfg) enable layouts; + extraConfig = cfg.extraSettings; + settings = let + resetKeybinds = + if cfg.clearDefaultKeybinds + then { + keybinds._props.clear-defaults = true; + } + else {}; + keybinds = makeKeybinds cfg.keybinds; + in + cfg.settings // (lib.recursiveUpdate resetKeybinds keybinds); + }; + }; +} diff --git a/modules/home/shell/zoxide.nix b/modules/home/shell/zoxide.nix new file mode 100644 index 0000000..f47bebe --- /dev/null +++ b/modules/home/shell/zoxide.nix @@ -0,0 +1,21 @@ +{ + flake.modules.homeManager.zoxide = { + lib, + config, + ... + }: + with lib; let + cfg = config.home.shell.zoxide; + in { + options.home.shell.zoxide = { + enable = mkEnableOption "Enable zoxide"; + replaceCd = mkEnableOption "Replace cd with zoxide"; + }; + config.programs.zoxide = mkIf cfg.enable { + inherit (cfg) enable; + options = mkIf cfg.replaceCd [ + "--cmd cd" + ]; + }; + }; +} diff --git a/modules/home/shell/zsh.nix b/modules/home/shell/zsh.nix new file mode 100644 index 0000000..3d6fe80 --- /dev/null +++ b/modules/home/shell/zsh.nix @@ -0,0 +1,108 @@ +{ + flake.modules.homeManager.zsh = { + config, + lib, + pkgs, + ... + }: + with lib; let + cfg = config.home.shell.zsh; + in { + options.home.shell.zsh = { + enable = lib.mkEnableOption "Enables zsh"; + abbrs = lib.mkOption { + type = types.attrsOf types.str; + default = {}; + example = { + cp = "cp -i"; + lns = "ln -si"; + }; + }; + autocompletion = mkOption { + type = types.bool; + default = config.home.shell.autocompletion; + example = true; + }; + eatIntegration = mkEnableOption "Enable Emacs Eat integration"; + zshrcExtra = lib.mkOption { + type = types.lines; + default = ""; + }; + }; + + config = lib.mkIf cfg.enable { + programs.zsh = { + enable = true; + autocd = true; + autosuggestion = { + enable = true; + strategy = ["match_prev_cmd" "completion"]; + }; + enableCompletion = cfg.autocompletion; + enableVteIntegration = true; + history = { + findNoDups = true; + ignoreAllDups = true; + ignoreDups = true; + ignoreSpace = true; + path = "${config.xdg.dataHome}/zsh/zsh_history"; + saveNoDups = true; + }; + historySubstringSearch.enable = true; + initContent = with lib; + concatLines [ + '' + bindkey -e + bindkey '^p' history-search-backward + bindkey '^n' history-search-forward + + # Completion styling + zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' + zstyle ':completion:*' list-colors "''${(s.:.)LS_COLORS}" + zstyle ':completion:*' menu no + zstyle ':fzf-tab:complete:cd:*' fzf-preview '${pkgs.eza}/bin/eza $realpath' + '' + (strings.optionalString cfg.eatIntegration ''[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/zsh"'') + (strings.optionalString config.home.dev.vcs.jj.shellCompletion '' + autoload -U compinit + compinit + source <(jj util completion zsh) + '') + cfg.zshrcExtra + ]; + oh-my-zsh = { + enable = true; + plugins = [ + "dirhistory" + "sudo" + ]; + }; + plugins = [ + { + name = "fzf-tab"; + src = pkgs.fetchFromGitHub { + owner = "Aloxaf"; + repo = "fzf-tab"; + rev = "v1.2.0"; + sha256 = "sha256-q26XVS/LcyZPRqDNwKKA9exgBByE0muyuNb0Bbar2lY="; + }; + } + { + name = "zsh-autopair"; + src = pkgs.fetchFromGitHub { + owner = "hlissner"; + repo = "zsh-autopair"; + rev = "449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d"; + sha256 = "sha256-3zvOgIi+q7+sTXrT+r/4v98qjeiEL4Wh64rxBYnwJvQ="; + }; + } + ]; + syntaxHighlighting.enable = true; + zsh-abbr = { + enable = true; + abbreviations = cfg.abbrs; + }; + }; + }; + }; +} diff --git a/hosts/naromk3/hardware-configuration.nix b/modules/hosts/NaroMk3/_hardware.nix similarity index 100% rename from hosts/naromk3/hardware-configuration.nix rename to modules/hosts/NaroMk3/_hardware.nix diff --git a/modules/hosts/NaroMk3/default.nix b/modules/hosts/NaroMk3/default.nix new file mode 100644 index 0000000..501e758 --- /dev/null +++ b/modules/hosts/NaroMk3/default.nix @@ -0,0 +1,99 @@ +{ + config, + inputs, + ... +}: let + m = config.flake.modules.nixos; +in { + flake-file.inputs.srvos = { + url = "github:nix-community/srvos"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + flake.modules.nixos.NaroMk3 = {...}: { + imports = [ + inputs.srvos.nixosModules.server + inputs.srvos.nixosModules.hardware-hetzner-cloud + inputs.srvos.nixosModules.mixins-terminfo + ./_hardware.nix + m.system-default + m.kernel + m.hardened + m.loader + m.docker + m.endlessh + m.ssh + ]; + + mySystem = { + boot = { + kernel = { + hardened = true; + cpuVendor = "amd"; + }; + grub = { + enable = true; + device = "/dev/sdb"; + }; + }; + dev.docker.enable = true; + misc.keymap = "fr-bepo"; + networking = { + hostname = "NaroMk3"; + id = "0003beef"; + firewall = { + openPorts = [ + 22 # Gitea SSH + 25 # SMTP + 80 # HTTP + 443 # HTTPS + 465 # SMTPS + 993 # IMAPS + ]; + }; + }; + packages.nix.gc.automatic = true; + services = { + endlessh.enable = false; + ssh = { + enable = true; + allowedUsers = ["phundrak"]; + passwordAuthentication = false; + port = 2222; # port 22 will be used by Gitea + }; + }; + users = { + root.disablePassword = true; + phundrak = { + enable = true; + trusted = true; + }; + }; + }; + + # This option defines the first version of NixOS you have installed + # on this particular machine, and is used to maintain compatibility + # with application data (e.g. databases) created on older NixOS + # versions. + # + # Most users should NEVER change this value after the initial + # install, for any reason, even if you've upgraded your system to a + # new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and + # OS are pulled from, so changing it will NOT upgrade your system - + # see https://nixos.org/manual/nixos/stable/#sec-upgrading for how + # to actually do that. + # + # This value being lower than the current NixOS release does NOT + # mean your system is out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all + # the changes it would make to your configuration, and migrated your + # data accordingly. + # + # For more information, see `man configuration.nix` or + # https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion + system.stateVersion = "25.05"; # Did you read the comment? + }; +} diff --git a/hosts/elcafe/hardware-configuration.nix b/modules/hosts/elcafe/_hardware.nix similarity index 100% rename from hosts/elcafe/hardware-configuration.nix rename to modules/hosts/elcafe/_hardware.nix diff --git a/modules/hosts/elcafe/default.nix b/modules/hosts/elcafe/default.nix new file mode 100644 index 0000000..1f8f3bc --- /dev/null +++ b/modules/hosts/elcafe/default.nix @@ -0,0 +1,82 @@ +{config, ...}: let + m = config.flake.modules.nixos; +in { + flake.modules.nixos.elcafe = {config, ...}: { + imports = [ + ./_hardware.nix + m.system-default + m.sops-system + m.kernel + m.hardened + m.loader + m.docker + m.endlessh + m.ssh + m.traefik + ]; + + sops.secrets = { + "elcafe/traefik/env".restartUnits = ["traefik.service"]; + "elcafe/traefik/dynamic".restartUnits = ["traefik.service"]; + }; + + mySystem = { + boot = { + kernel = { + hardened = true; + cpuVendor = "intel"; + }; + grub = { + enable = true; + device = "/dev/sdh"; + }; + zfs = { + enable = true; + pools = ["tank"]; + }; + }; + dev.docker = { + enable = true; + storage = "/tank/docker/"; + }; + misc.keymap = "fr"; + networking = { + hostname = "elcafe"; + id = "501c7fb9"; + }; + packages.nix.gc.automatic = true; + services = { + endlessh.enable = true; + ssh = { + enable = true; + allowedUsers = ["phundrak"]; + passwordAuthentication = true; + }; + traefik = { + enable = false; + environmentFiles = [config.sops.secrets."elcafe/traefik/env".path]; + dynamicConfigFile = config.sops.secrets."elcafe/traefik/dynamic".path; + }; + }; + users = { + root.disablePassword = true; + phundrak = { + enable = true; + trusted = true; + }; + creug = { + enable = true; + sudo = true; + }; + }; + }; + + # 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. It's perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.11"; # Did you read the comment? + }; +} diff --git a/hosts/gampo/hardware-configuration.nix b/modules/hosts/gampo/_hardware.nix similarity index 100% rename from hosts/gampo/hardware-configuration.nix rename to modules/hosts/gampo/_hardware.nix diff --git a/modules/hosts/gampo/default.nix b/modules/hosts/gampo/default.nix new file mode 100644 index 0000000..69546dd --- /dev/null +++ b/modules/hosts/gampo/default.nix @@ -0,0 +1,106 @@ +{config, ...}: let + m = config.flake.modules.nixos; +in { + flake.modules.nixos.gampo = { + config, + pkgs, + ... + }: { + imports = [ + ./_hardware.nix + m.system-default + m.sops-system + m.kernel + m.loader + m.plymouth + m.hyprland + m.xserver + m.docker + m.bluetooth + m.fingerprint + m.corne + m.ibm-trackpoint + m.opentablet + m.sound + m.i18n-input + m.appimage + m.flatpak + m.steam + m.fwupd + m.ssh + ]; + + mySystem = { + boot = { + plymouth.enable = true; + kernel = { + cpuVendor = "intel"; + package = pkgs.linuxPackages; + }; + systemd-boot = true; + }; + desktop = { + hyprland.enable = true; + xserver = { + enable = true; + de = "gnome"; + }; + }; + dev.docker = { + enable = true; + podman.enable = true; + autoprune.enable = true; + }; + hardware = { + bluetooth.enable = true; + fingerprint.enable = true; + input = { + corne.allowHidAccess = true; + ibmTrackpoint.disable = true; + opentablet.enable = true; + }; + sound.enable = true; + }; + i18n.input.enable = true; + misc.keymap = "fr-bepo"; + networking = { + hostname = "gampo"; + id = "0630b33f"; + }; + packages = { + appimage.enable = true; + flatpak.enable = true; + nix = { + gc.automatic = true; + nix-ld.enable = true; + }; + }; + services = { + fwupd.enable = true; + ssh.enable = true; + }; + users = { + root.disablePassword = true; + phundrak = { + enable = true; + trusted = true; + }; + }; + }; + + sops.secrets.extraHosts = { + inherit (config.users.users.root) group; + owner = config.users.users.phundrak.name; + mode = "0440"; + }; + + # 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. It‘s perfectly fine and + # recommended to leave this value at the release version of the + # first install of this system. Before changing this value read + # the documentation for this option (e.g. man configuration.nix or + # on https://nixos.org/nixos/options.html). + system.stateVersion = "23.11"; # Did you read the comment? + }; +} diff --git a/hosts/marpa/hardware-configuration.nix b/modules/hosts/marpa/_hardware.nix similarity index 100% rename from hosts/marpa/hardware-configuration.nix rename to modules/hosts/marpa/_hardware.nix diff --git a/modules/hosts/marpa/default.nix b/modules/hosts/marpa/default.nix new file mode 100644 index 0000000..7c53dc7 --- /dev/null +++ b/modules/hosts/marpa/default.nix @@ -0,0 +1,181 @@ +{config, ...}: let + m = config.flake.modules.nixos; +in { + flake.modules.nixos.marpa = { + config, + pkgs, + ... + }: { + imports = [ + ./_hardware.nix + m.system-default + m.sops-system + m.kernel + m.loader + m.plymouth + m.hyprland + # m.niri + m.waydroid + m.xserver + m.docker + m.qemu + m.bluetooth + m.corne + m.opentablet + m.sound + m.i18n-input + m.appimage + m.flatpak + m.steam + m.fwupd + m.harmonia + m.languagetool + m.printing + m.ssh + m.sunshine + ]; + + fileSystems = { + "/home".options = [ + "compress=zstd:3" # Good balance of compression vs speed + "space_cache=v2" # Better performance + "noatime" # Don't update access times (less writes) + ]; + "/mnt/ai" = { + device = "/dev/disk/by-uuid/47e87286-caaa-4e43-b2fd-b9eceac90fe9"; + fsType = "btrfs"; + options = [ + "compress=zstd:3" # Good balance of compression vs speed + "space_cache=v2" # Better performance + "noatime" # Don't update access times (less writes) + ]; + }; + "/mnt/games" = { + device = "/dev/disk/by-uuid/a8453133-76dc-44bd-a825-444c3305fd9b"; + fsType = "btrfs"; + options = [ + "compress=zstd:3" # Good balance of compression vs speed + "space_cache=v2" # Better performance + "noatime" # Don't update access times (less writes) + ]; + }; + "/games" = { + device = "/dev/disk/by-uuid/77d32db8-2e85-4593-b6b8-55d4f9d14e1a"; + fsType = "ext4"; + }; + }; + + services.displayManager.autoLogin = { + user = "phundrak"; + enable = true; + }; + + mySystem = { + boot = { + plymouth.enable = true; + kernel = { + cpuVendor = "amd"; + v4l2loopback.enable = true; + extraModprobeConfig = '' + options snd_usb_audio vid=0x1235 pid=0x8212 device_setup=1 + ''; + }; + systemd-boot = true; + }; + desktop = { + hyprland.enable = true; + niri.enable = true; + waydroid.enable = true; + xserver = { + enable = true; + de = "gnome"; + }; + }; + dev = { + docker = { + enable = true; + podman.enable = true; + autoprune.enable = true; + }; + qemu.enable = true; + }; + hardware = { + amdgpu.enable = true; + bluetooth.enable = true; + input = { + corne.allowHidAccess = true; + opentablet.enable = true; + }; + sound = { + enable = true; + noisetorch = true; + jack = true; + scarlett.enable = true; + }; + }; + i18n.input.enable = true; + misc.keymap = "fr-bepo"; + networking = { + hostname = "marpa"; + id = "7EA4A111"; + firewall.openPortRanges = [ + { + # Sunshine + from = 1714; + to = 1764; + } + ]; + }; + packages = { + appimage.enable = true; + flatpak.enable = true; + nix.nix-ld.enable = true; + }; + services = { + fwupd.enable = true; + harmonia = { + enable = true; + signKeyPaths = [config.sops.secrets."marpa/nix-cache-priv-key".path]; + }; + languagetool.enable = true; + printing.enable = true; + ssh.enable = true; + sunshine = { + enable = true; + autostart = true; + }; + }; + users = { + root.disablePassword = true; + phundrak = { + enable = true; + trusted = true; + }; + }; + }; + + sops.secrets = { + "marpa/nix-cache-priv-key" = {}; + extraHosts = { + inherit (config.users.users.root) group; + owner = config.users.users.phundrak.name; + mode = "0440"; + }; + }; + + services.udev.extraHwdb = '' + mouse:usb:047d:80a6:* + LIBINPUT_MIDDLE_EMULATION_ENABLED=1 + ''; + + security.polkit.enable = true; + + # 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. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.11"; # Did you read the comment? + }; +} diff --git a/modules/hosts/pinetab2/default.nix b/modules/hosts/pinetab2/default.nix new file mode 100644 index 0000000..f2b13fe --- /dev/null +++ b/modules/hosts/pinetab2/default.nix @@ -0,0 +1,78 @@ +{config, ...}: let + m = config.flake.modules.nixos; +in { + flake.modules.nixos.pinetab2-base = {config, ...}: { + imports = [ + m.system-default + m.sops-system + m.hyprland + m.niri + m.waydroid + m.xserver + m.amdgpu + m.docker + m.bluetooth + m.opentablet + m.sound + m.i18n-input + m.appimage + m.flatpak + m.ssh + m.pinetab2 + ]; + + system.stateVersion = "25.11"; + + mySystem = { + desktop = { + hyprland.enable = true; + niri.enable = true; + waydroid.enable = true; + xserver = { + enable = true; + de = "gnome"; + }; + }; + dev.docker = { + enable = true; + podman.enable = true; + autoprune.enable = true; + }; + hardware = { + bluetooth.enable = true; + input.opentablet.enable = true; + pinetab2.enable = true; + sound.enable = true; + }; + i18n.input.enable = true; + misc.keymap = "fr-bepo"; + networking = { + hostname = "pinetab2"; + id = "99a11b15"; + wifi.disablePowersave = true; + }; + packages = { + appimage.enable = true; + flatpak.enable = true; + nix = { + gc.automatic = true; + nix-ld.enable = true; + }; + }; + services.ssh.enable = true; + users = { + root.disablePassword = true; + phundrak = { + enable = true; + trusted = true; + }; + }; + }; + + sops.secrets.extraHosts = { + inherit (config.users.users.root) group; + owner = config.users.users.phundrak.name; + mode = "0440"; + }; + }; +} diff --git a/modules/hosts/pinetab2/gnome.nix b/modules/hosts/pinetab2/gnome.nix new file mode 100644 index 0000000..1d3e7ac --- /dev/null +++ b/modules/hosts/pinetab2/gnome.nix @@ -0,0 +1,39 @@ +{...}: { + flake.modules.nixos.pinetab2-gnome = { + pkgs, + config, + ... + }: { + # https://github.com/systemd/systemd/pull/35304#issuecomment-3855146191 + # gnome autorotate expects 'normal' is the _display panel_ normal, but + # mutter autoconfiguration rotates by 90deg. + # compensating with gdctl for now, though it would be better to 'properly' + # fix this. + services.udev = { + extraHwdb = '' + sensor:modalias:*sc7a20:* + ACCEL_MOUNT_MATRIX=1, 0, 0; 0, 0, 1; 0, 1, 0 + ''; + extraRules = '' + ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="1018", ATTRS{idProduct}=="1006", ENV{SYSTEMD_WANTS}+="landscape.service", TAG+="systemd" + ''; + }; + systemd.services.landscape = { + script = '' + ${pkgs.mutter}/bin/gdctl set --logical-monitor --primary --monitor=DSI-1 --transform normal + ''; + serviceConfig.User = "phundrak"; + serviceConfig.Type = "oneshot"; + environment = { + "DBUS_SESSION_BUS_ADDRESS" = "unix:path=/run/user/${toString config.users.users."phundrak".uid}/bus"; + }; + }; + environment.systemPackages = with pkgs; [ + gnomeExtensions.arc-menu + gnomeExtensions.dash-to-dock + gnomeExtensions.dash-to-panel + gnomeExtensions.gjs-osk + gnomeExtensions.one-window-wonderland + ]; + }; +} diff --git a/hosts/tilo/hardware-configuration.nix b/modules/hosts/tilo/_hardware.nix similarity index 100% rename from hosts/tilo/hardware-configuration.nix rename to modules/hosts/tilo/_hardware.nix diff --git a/modules/hosts/tilo/default.nix b/modules/hosts/tilo/default.nix new file mode 100644 index 0000000..4bfe530 --- /dev/null +++ b/modules/hosts/tilo/default.nix @@ -0,0 +1,75 @@ +{config, ...}: let + m = config.flake.modules.nixos; +in { + flake.modules.nixos.tilo = {...}: { + imports = [ + ./_hardware.nix + m.system-default + m.kernel + m.hardened + m.loader + m.docker + m.calibre + m.endlessh + m.jellyfin + m.plex + m.ssh + ]; + + mySystem = { + boot = { + kernel = { + hardened = true; + cpuVendor = "amd"; + }; + zfs = { + enable = true; + pools = ["tank"]; + }; + }; + dev.docker.enable = true; + misc.keymap = "fr-bepo"; + networking = { + hostname = "tilo"; + id = "7110b33f"; + firewall = { + openPorts = [ + 80 # HTTP + 443 # HTTPS + 25565 # Minecraft + ]; + }; + }; + packages.nix.gc.automatic = true; + services = { + calibre.enable = true; + endlessh.enable = true; + jellyfin.enable = true; + plex = { + enable = true; + dataDir = "/tank/web/stacks/plex/plex-config"; + }; + ssh = { + enable = true; + allowedUsers = ["phundrak"]; + passwordAuthentication = false; + }; + }; + users = { + root.disablePassword = true; + phundrak = { + enable = true; + trusted = true; + }; + }; + }; + + # 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. It‘s 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 = "24.11"; # Did you read the comment? + }; +} diff --git a/modules/i18n/input.nix b/modules/i18n/input.nix new file mode 100644 index 0000000..bc7b684 --- /dev/null +++ b/modules/i18n/input.nix @@ -0,0 +1,27 @@ +{ + flake.modules.nixos.i18n-input = { + lib, + config, + pkgs, + ... + }: + with lib; let + cfg = config.mySystem.i18n.input; + in { + options.mySystem.i18n.input.enable = mkEnableOption "Enable i18n input with fcitx5"; + + config.i18n.inputMethod = mkIf cfg.enable { + enable = true; + type = "fcitx5"; + fcitx5.addons = with pkgs; [ + fcitx5-gtk + fcitx5-mozc-ut # Japanese input support + fcitx5-nord + fcitx5-table-other # X-SAMPA to IPA support + qt6Packages.fcitx5-chinese-addons # allow to load table addons + qt6Packages.fcitx5-configtool + qt6Packages.fcitx5-with-addons + ]; + }; + }; +} diff --git a/modules/i18n/locale.nix b/modules/i18n/locale.nix new file mode 100644 index 0000000..6e45d65 --- /dev/null +++ b/modules/i18n/locale.nix @@ -0,0 +1,18 @@ +{ + flake.modules.nixos.locale = { + i18n = { + defaultLocale = "en_DK.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "fr_FR.UTF-8"; + LC_IDENTIFICATION = "fr_FR.UTF-8"; + LC_MEASUREMENT = "fr_FR.UTF-8"; + LC_MONETARY = "fr_FR.UTF-8"; + LC_NAME = "fr_FR.UTF-8"; + LC_NUMERIC = "fr_FR.UTF-8"; + LC_PAPER = "fr_FR.UTF-8"; + LC_TELEPHONE = "fr_FR.UTF-8"; + LC_TIME = "fr_FR.UTF-8"; + }; + }; + }; +} diff --git a/modules/inputs.nix b/modules/inputs.nix new file mode 100644 index 0000000..622d875 --- /dev/null +++ b/modules/inputs.nix @@ -0,0 +1,15 @@ +{ + flake-file.inputs = { + nixpkgsStable.url = "nixpkgs/nixos-25.11"; + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + flake-file.url = "github:vic/flake-file"; + import-tree.url = "github:vic/import-tree"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + flake-file.outputs = "dendritic"; + flake-file.description = "NixOS and Home Manager configuration of phundrak"; +} diff --git a/modules/misc.nix b/modules/misc.nix new file mode 100644 index 0000000..3ecf0d4 --- /dev/null +++ b/modules/misc.nix @@ -0,0 +1,37 @@ +{ + flake.modules.nixos.misc = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.misc; + in { + options.mySystem.misc = { + timezone = mkOption { + type = types.str; + default = "Europe/Paris"; + }; + keymap = mkOption { + type = types.str; + default = "fr"; + example = "fr-bepo"; + description = "Keymap to use in the TTY console"; + }; + }; + + config = { + boot.tmp.cleanOnBoot = true; + console.keyMap = cfg.keymap; + time.timeZone = cfg.timezone; + environment.pathsToLink = [ + "/share/bash-completion" + "/share/zsh" + ]; + services = { + orca.enable = false; + envfs.enable = true; + }; + }; + }; +} diff --git a/modules/network/networking.nix b/modules/network/networking.nix new file mode 100644 index 0000000..81fc4aa --- /dev/null +++ b/modules/network/networking.nix @@ -0,0 +1,80 @@ +{...}: { + flake.modules.nixos.networking = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.networking; + in { + options.mySystem.networking = with types; { + hostname = mkOption { + type = str; + example = "gampo"; + }; + id = mkOption { + type = str; + example = "deadb33f"; + }; + domain = mkOption { + type = nullOr str; + example = "phundrak.com"; + default = null; + }; + hostFiles = mkOption { + type = listOf path; + example = [/path/to/hostFile]; + default = []; + }; + firewall = { + openPorts = mkOption { + type = listOf int; + example = [22 80 443]; + default = []; + }; + openPortRanges = mkOption { + type = listOf (attrsOf port); + default = []; + example = [ + { + from = 8080; + to = 8082; + } + ]; + description = '' + A range of TCP and UDP ports on which incoming connections are + accepted. + ''; + }; + extraCommands = mkOption { + type = nullOr lines; + example = "iptables -A INPUTS -p icmp -j ACCEPT"; + default = null; + }; + }; + wifi.disablePowersave = mkEnableOption '' + Disables powersave for Wifi. + + Used mainly for the PineTab2, as leaving WiFi powersave with the bes2600 can cause stability issues. + ''; + }; + + config.networking = { + hostName = cfg.hostname; # Define your hostname. + hostId = cfg.id; + networkmanager = { + enable = true; + wifi.powersave = ! cfg.wifi.disablePowersave; + }; + inherit (cfg) hostFiles domain; + firewall = { + enable = true; + allowedTCPPorts = cfg.firewall.openPorts; + allowedUDPPorts = cfg.firewall.openPorts; + allowedTCPPortRanges = cfg.firewall.openPortRanges; + allowedUDPPortRanges = cfg.firewall.openPortRanges; + extraCommands = (mkIf (cfg.firewall.extraCommands != null)) cfg.firewall.extraCommands; + }; + }; + }; +} diff --git a/modules/network/tailscale.nix b/modules/network/tailscale.nix new file mode 100644 index 0000000..c2a8614 --- /dev/null +++ b/modules/network/tailscale.nix @@ -0,0 +1,25 @@ +{...}: { + flake.modules.nixos.tailscale = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.network.tailscale; + in { + options.mySystem.network.tailscale = { + enable = mkOption { + type = types.bool; + default = true; + }; + }; + config.services.tailscale = { + inherit (cfg) enable; + extraSetFlags = [ + "--accept-dns" + "--accept-routes" + "--ssh" + ]; + }; + }; +} diff --git a/modules/nix-config.nix b/modules/nix-config.nix new file mode 100644 index 0000000..a2b7040 --- /dev/null +++ b/modules/nix-config.nix @@ -0,0 +1,37 @@ +{...}: let + cacheSettings = { + substituters = [ + "https://phundrak.cachix.org?priority=10" + "https://nix-community.cachix.org?priority=20" + "https://cache.nixos.org?priority=40" + ]; + trustedPublicKeys = [ + "phundrak.cachix.org-1:osJAkYO0ioTOPqaQCIXMfIRz1/+YYlVFkup3R2KSexk=" + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + ]; + }; +in { + flake-file.nixConfig = { + extra-trusted-public-keys = cacheSettings.trustedPublicKeys; + extra-substituters = cacheSettings.substituters; + extra-experimental-features = ["nix-command" "flakes"]; + http-connections = 128; + }; + + flake.nixConfig = { + extra-trusted-public-keys = cacheSettings.trustedPublicKeys; + extra-substituters = cacheSettings.substituters; + extra-experimental-features = ["nix-command" "flakes"]; + http-connections = 128; + }; + + flake.modules.nixos.nix-cache-settings = { + nix.settings = { + substituters = cacheSettings.substituters; + trusted-public-keys = cacheSettings.trustedPublicKeys; + http-connections = 128; + experimental-features = ["nix-command" "flakes"]; + }; + }; +} diff --git a/modules/packages/appimage.nix b/modules/packages/appimage.nix new file mode 100644 index 0000000..2f583f7 --- /dev/null +++ b/modules/packages/appimage.nix @@ -0,0 +1,16 @@ +{ + flake.modules.nixos.appimage = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.packages.appimage; + in { + options.mySystem.packages.appimage.enable = mkEnableOption "Enables AppImage support"; + config.programs.appimage = mkIf cfg.enable { + inherit (cfg) enable; + binfmt = true; + }; + }; +} diff --git a/modules/packages/base.nix b/modules/packages/base.nix new file mode 100644 index 0000000..b5f3570 --- /dev/null +++ b/modules/packages/base.nix @@ -0,0 +1,9 @@ +{ + flake.modules.nixos.base-packages = {pkgs, ...}: { + environment.systemPackages = with pkgs; [ + curl + openssl + wget + ]; + }; +} diff --git a/modules/packages/bun-baseline.nix b/modules/packages/bun-baseline.nix new file mode 100644 index 0000000..1a7c1a0 --- /dev/null +++ b/modules/packages/bun-baseline.nix @@ -0,0 +1,5 @@ +{ + perSystem = {pkgs, ...}: { + packages.bun-baseline = pkgs.callPackage ../../packages/bun-baseline.nix {}; + }; +} diff --git a/modules/packages/flatpak.nix b/modules/packages/flatpak.nix new file mode 100644 index 0000000..6691744 --- /dev/null +++ b/modules/packages/flatpak.nix @@ -0,0 +1,20 @@ +{ + flake.modules.nixos.flatpak = { + pkgs, + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.packages.flatpak; + in { + options.mySystem.packages.flatpak = { + enable = mkEnableOption "Enable Flatpak support"; + builder.enable = mkEnableOption "Enable Flatpak builder"; + }; + config = mkIf cfg.enable { + environment.systemPackages = lists.optional cfg.builder.enable pkgs.flatpak-builder; + services.flatpak.enable = true; + }; + }; +} diff --git a/modules/packages/nano.nix b/modules/packages/nano.nix new file mode 100644 index 0000000..30d5c2f --- /dev/null +++ b/modules/packages/nano.nix @@ -0,0 +1,16 @@ +{ + flake.modules.nixos.nano = { + programs.nano = { + enable = true; + syntaxHighlight = true; + nanorc = '' + set tabsize 2 + set autoindent + set atblanks + set linenumber + set smarthome + set softwrap + ''; + }; + }; +} diff --git a/modules/packages/nix-settings.nix b/modules/packages/nix-settings.nix new file mode 100644 index 0000000..bd5e59b --- /dev/null +++ b/modules/packages/nix-settings.nix @@ -0,0 +1,51 @@ +{ + flake.modules.nixos.nix-settings = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.packages.nix; + in { + options.mySystem.packages.nix = { + allowUnfree = mkEnableOption "Enable unfree packages"; + disableSandbox = mkEnableOption "Disable Nix sandbox"; + gc = { + automatic = mkOption { + type = types.bool; + default = true; + }; + dates = mkOption { + type = types.str; + default = "Monday 01:00 UTC"; + }; + options = mkOption { + type = types.str; + default = "--delete-older-than 30d"; + }; + }; + nix-ld.enable = mkEnableOption "Enable unpatched binaries support"; + trusted-users = mkOption { + type = types.listOf types.str; + example = ["alice" "bob"]; + default = ["@wheel" "root"]; + }; + }; + + config = { + nix = { + inherit (cfg) gc; + settings = { + inherit (cfg) trusted-users; + sandbox = cfg.disableSandbox; + experimental-features = ["nix-command" "flakes"]; + auto-optimise-store = true; + }; + }; + nixpkgs.config.allowUnfree = true; + programs = { + inherit (cfg) nix-ld; + }; + }; + }; +} diff --git a/system/packages/steam.nix b/modules/packages/steam.nix similarity index 72% rename from system/packages/steam.nix rename to modules/packages/steam.nix index 952a16a..0293bca 100644 --- a/system/packages/steam.nix +++ b/modules/packages/steam.nix @@ -1,17 +1,8 @@ { - pkgs, - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.programs.steam; -in { - options.mySystem.programs.steam.enable = mkEnableOption "Enables Steam and Steam hardware"; - config = mkIf cfg.enable { + flake.modules.nixos.steam = {pkgs, ...}: { programs = { steam = { - inherit (cfg) enable; + enable = true; protontricks.enable = true; remotePlay.openFirewall = true; localNetworkGameTransfers.openFirewall = true; @@ -41,8 +32,6 @@ in { ]; }; }; - hardware.steam-hardware = { - inherit (cfg) enable; - }; + hardware.steam-hardware.enable = true; }; } diff --git a/modules/security/rtkit.nix b/modules/security/rtkit.nix new file mode 100644 index 0000000..4ff7288 --- /dev/null +++ b/modules/security/rtkit.nix @@ -0,0 +1,5 @@ +{ + flake.modules.nixos.rtkit = { + security.rtkit.enable = true; + }; +} diff --git a/modules/security/sops-system.nix b/modules/security/sops-system.nix new file mode 100644 index 0000000..4a58a50 --- /dev/null +++ b/modules/security/sops-system.nix @@ -0,0 +1,26 @@ +{inputs, ...}: { + flake-file.inputs.sops-nix = { + url = "github:Mic92/sops-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + flake.modules.nixos.sops-system = { + imports = [inputs.sops-nix.nixosModules.sops]; + + sops = { + defaultSopsFile = ../../secrets/secrets.yaml; + defaultSopsFormat = "yaml"; + age = { + # automatically import user SSH keys as age keys + sshKeyPaths = [ + "/home/phundrak/.ssh/id_ed25519" + "/etc/ssh/ssh_host_ed25519_key" + ]; + # this will use an age key that is expected to already be in the filesystem + keyFile = "/var/lib/sops-nix/key.txt"; + # generate a new key if the key specified above does not exist + generateKey = true; + }; + }; + }; +} diff --git a/modules/security/sops-user-phundrak.nix b/modules/security/sops-user-phundrak.nix new file mode 100644 index 0000000..7ae9f10 --- /dev/null +++ b/modules/security/sops-user-phundrak.nix @@ -0,0 +1,19 @@ +{inputs, ...}: { + flake.modules.homeManager.sops-user-phundrak = {config, ...}: { + imports = [inputs.sops-nix.homeManagerModules.sops]; + + sops = { + defaultSopsFile = ../../secrets/secrets.yaml; + defaultSopsFormat = "yaml"; + secrets."ssh/hosts" = {}; + age = { + # automatically import user SSH keys as age keys + sshKeyPaths = ["${config.home.homeDirectory}/.ssh/id_ed25519"]; + # this will use an age key that is expected to already be in the filesystem + keyFile = "${config.home.homeDirectory}/.local/sops-nix/key.txt"; + # generate a new key if the key specified above does not exist + generateKey = true; + }; + }; + }; +} diff --git a/modules/services/calibre.nix b/modules/services/calibre.nix new file mode 100644 index 0000000..3caa986 --- /dev/null +++ b/modules/services/calibre.nix @@ -0,0 +1,40 @@ +{ + flake.modules.nixos.calibre = { + config, + lib, + ... + }: + with lib; let + cfg = config.mySystem.services.calibre; + in { + options.mySystem.services.calibre = { + enable = mkEnableOption "Enable Calibre Web"; + user = mkOption { + type = types.str; + default = "phundrak"; + }; + group = mkOption { + type = types.str; + default = "users"; + }; + dataDir = mkOption { + type = types.str; + example = "/tank/calibre/conf"; + default = "/tank/calibre/conf"; + }; + library = mkOption { + type = types.str; + example = "/tank/calibre/library"; + default = "/tank/calibre/library"; + }; + }; + config.services.calibre-web = mkIf cfg.enable { + inherit (cfg) enable user dataDir group; + options = { + calibreLibrary = cfg.library; + enableBookConversion = true; + enableBookUploading = true; + }; + }; + }; +} diff --git a/modules/services/docker.nix b/modules/services/docker.nix new file mode 100644 index 0000000..69b9029 --- /dev/null +++ b/modules/services/docker.nix @@ -0,0 +1,61 @@ +{ + flake.modules.nixos.docker = { + lib, + config, + pkgs, + ... + }: + with lib; let + cfg = config.mySystem.dev.docker; + containerGroups = ["docker"] ++ lists.optional cfg.podman.enable "podman"; + in { + options.mySystem.dev.docker = { + enable = mkEnableOption "Enable Docker"; + podman.enable = mkEnableOption "Enable Podman rather than Docker"; + nvidia.enable = mkEnableOption "Activate Nvidia support"; + autoprune.enable = mkEnableOption "Enable autoprune"; + storage = mkOption { + type = types.nullOr types.path; + default = null; + example = "/path/to/docker/storage"; + }; + }; + + config = mkIf cfg.enable { + users.users = { + phundrak = mkIf config.mySystem.users.phundrak.enable { + extraGroups = containerGroups; + }; + creug = mkIf config.mySystem.users.creug.enable { + extraGroups = containerGroups; + }; + }; + environment.systemPackages = with pkgs; + [ + dive # A tool for exploring each layer in a docker image + grype # Vulnerability scanner for container images and filesystems + ] + ++ lists.optionals cfg.podman.enable [ + podman-compose + podman-desktop + ]; + virtualisation = { + docker = mkIf (!cfg.podman.enable) { + enable = true; + enableNvidia = cfg.nvidia.enable; + autoPrune.enable = cfg.autoprune.enable; + daemon.settings = mkIf (cfg.storage != null) { + "data-root" = cfg.storage; + }; + }; + podman = mkIf cfg.podman.enable { + enable = true; + dockerCompat = cfg.enable; + enableNvidia = cfg.nvidia.enable; + dockerSocket.enable = cfg.enable; + autoPrune.enable = cfg.autoprune.enable; + }; + }; + }; + }; +} diff --git a/modules/services/endlessh.nix b/modules/services/endlessh.nix new file mode 100644 index 0000000..5842796 --- /dev/null +++ b/modules/services/endlessh.nix @@ -0,0 +1,23 @@ +{ + flake.modules.nixos.endlessh = { + config, + lib, + ... + }: + with lib; let + cfg = config.mySystem.services.endlessh; + in { + options.mySystem.services.endlessh = { + enable = mkEnableOption "Enables endlessh."; + port = mkOption { + type = types.port; + default = 2222; + example = 22; + }; + }; + config.services.endlessh-go = mkIf cfg.enable { + inherit (cfg) enable port; + openFirewall = true; + }; + }; +} diff --git a/modules/services/fwupd.nix b/modules/services/fwupd.nix new file mode 100644 index 0000000..3806263 --- /dev/null +++ b/modules/services/fwupd.nix @@ -0,0 +1,15 @@ +{ + flake.modules.nixos.fwupd = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.services.fwupd; + in { + options.mySystem.services.fwupd.enable = mkEnableOption "Enable fwupd"; + config.services.fwupd = mkIf cfg.enable { + inherit (cfg) enable; + }; + }; +} diff --git a/modules/services/harmonia.nix b/modules/services/harmonia.nix new file mode 100644 index 0000000..827062d --- /dev/null +++ b/modules/services/harmonia.nix @@ -0,0 +1,38 @@ +{ + flake.modules.nixos.harmonia = { + config, + lib, + ... + }: + with lib; let + cfg = config.mySystem.services.harmonia; + in { + options.mySystem.services.harmonia = { + enable = mkEnableOption "Harmonia Nix binary cache server"; + port = mkOption { + type = types.port; + default = 5000; + description = "Port to listen on"; + }; + priority = mkOption { + type = types.ints.between 0 100; + default = 50; + description = "Cache priority (lower = higher priority, 0-100)"; + }; + signKeyPaths = mkOption { + type = types.listOf types.path; + description = "Paths to the signing keys to use for signing the cache."; + }; + }; + config = mkIf cfg.enable { + services.harmonia.cache = { + enable = true; + inherit (cfg) signKeyPaths; + settings = { + inherit (cfg) priority; + bind = "[::]:${toString cfg.port}"; + }; + }; + }; + }; +} diff --git a/modules/services/jellyfin.nix b/modules/services/jellyfin.nix new file mode 100644 index 0000000..a1a4eec --- /dev/null +++ b/modules/services/jellyfin.nix @@ -0,0 +1,30 @@ +{ + flake.modules.nixos.jellyfin = { + config, + lib, + ... + }: + with lib; let + cfg = config.mySystem.services.jellyfin; + in { + options.mySystem.services.jellyfin = { + enable = mkEnableOption "Enable Jellyfin"; + dataDir = mkOption { + type = types.str; + default = "/tank/jellyfin/data"; + example = "/tank/jellyfin/data"; + }; + user = mkOption { + type = types.str; + default = "phundrak"; + }; + group = mkOption { + type = types.str; + default = "users"; + }; + }; + config.services.jellyfin = mkIf cfg.enable { + inherit (cfg) enable group user dataDir; + }; + }; +} diff --git a/modules/services/languagetool.nix b/modules/services/languagetool.nix new file mode 100644 index 0000000..b11545e --- /dev/null +++ b/modules/services/languagetool.nix @@ -0,0 +1,22 @@ +{ + flake.modules.nixos.languagetool = { + config, + lib, + ... + }: + with lib; let + cfg = config.mySystem.services.languagetool; + in { + options.mySystem.services.languagetool = { + enable = mkEnableOption "Enables languagetool"; + port = mkOption { + type = types.port; + default = 8081; + example = 80; + }; + }; + config.services.languagetool = mkIf cfg.enable { + inherit (cfg) enable port; + }; + }; +} diff --git a/modules/services/plex.nix b/modules/services/plex.nix new file mode 100644 index 0000000..74a0dfa --- /dev/null +++ b/modules/services/plex.nix @@ -0,0 +1,37 @@ +{ + flake.modules.nixos.plex = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.services.plex; + in { + options.mySystem.services.plex = { + enable = mkEnableOption "Enable Plex"; + group = mkOption { + type = types.str; + default = "users"; + example = "users"; + description = "Group under which Plex runs"; + }; + dataDir = mkOption { + type = types.str; + example = "/tank/plex-config"; + }; + user = mkOption { + type = types.str; + default = "phundrak"; + }; + }; + config = { + services.plex = mkIf cfg.enable { + inherit (cfg) enable user group dataDir; + openFirewall = cfg.enable; + }; + boot.kernel.sysctl = { + "kernel.unprivileged_userns_clone" = 1; + }; + }; + }; +} diff --git a/modules/services/printing.nix b/modules/services/printing.nix new file mode 100644 index 0000000..7d2b0b2 --- /dev/null +++ b/modules/services/printing.nix @@ -0,0 +1,15 @@ +{ + flake.modules.nixos.printing = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.services.printing; + in { + options.mySystem.services.printing.enable = mkEnableOption "Enable printing with CUPS"; + config.services.printing = mkIf cfg.enable { + inherit (cfg) enable; + }; + }; +} diff --git a/modules/services/ssh.nix b/modules/services/ssh.nix new file mode 100644 index 0000000..f690590 --- /dev/null +++ b/modules/services/ssh.nix @@ -0,0 +1,37 @@ +{ + flake.modules.nixos.ssh = { + lib, + config, + ... + }: + with lib; let + cfg = config.mySystem.services.ssh; + in { + options.mySystem.services.ssh = { + enable = mkEnableOption "Enables OpenSSH"; + allowedUsers = mkOption { + type = types.listOf types.str; + example = ["alice" "bob"]; + default = ["phundrak"]; + }; + passwordAuthentication = mkOption { + type = types.bool; + example = true; + default = false; + }; + port = mkOption { + type = types.int; + default = 22; + }; + }; + config.services.openssh = mkIf cfg.enable { + inherit (cfg) enable; + ports = [cfg.port]; + settings = { + AllowUsers = cfg.allowedUsers; + PermitRootLogin = "no"; + PasswordAuthentication = cfg.passwordAuthentication; + }; + }; + }; +} diff --git a/modules/services/sunshine.nix b/modules/services/sunshine.nix new file mode 100644 index 0000000..5dc5d41 --- /dev/null +++ b/modules/services/sunshine.nix @@ -0,0 +1,71 @@ +{ + flake.modules.nixos.sunshine = { + config, + lib, + ... + }: + with lib; let + cfg = config.mySystem.services.sunshine; + in { + options.mySystem.services.sunshine = { + enable = mkEnableOption "Enables Sunshine"; + autostart = mkEnableOption "Enables autostart"; + }; + config.services.sunshine = mkIf cfg.enable { + inherit (cfg) enable; + autoStart = cfg.autostart; + capSysAdmin = true; + openFirewall = true; + settings = { + sunshine_name = config.mySystem.networking.hostname; + locale = "en_GB"; + system_tray = "enabled"; + output_name = 1; + csrf_allowed_origins = "192.168.1.86,marpa,localhost"; + }; + applications.apps = let + defaultPrep = [ + { + do = "sh -c \"hyprctl -i 0 keyword monitor \\\"DP-2,\${SUNSHINE_CLIENT_WIDTH}x\${SUNSHINE_CLIENT_HEIGHT}@\${SUNSHINE_CLIENT_FPS},0x0,1\\\"\""; + undo = "sh -c \"hyprctl -i 0 keyword monitor 'DP-2,2560x1080@60,0x0,1,transform,1'\""; + } + ]; + in [ + { + name = "Desktop"; + image-path = "desktop.png"; + prep-cmd = defaultPrep; + } + { + name = "Low Res Desktop"; + image-path = "desktop.png"; + prep-cmd = defaultPrep; + } + { + name = "Steam Big Picture"; + detached = ["setsid steam steam://open/bigpicture"]; + prep-cmd = defaultPrep; + image-path = "steam.png"; + } + { + name = "OpenTTD"; + cmd = "openttd"; + image-path = "/home/phundrak/.config/sunshine/covers/igdb_18074.png"; + prep-cmd = defaultPrep; + } + { + name = "OpenMW"; + cmd = "openmw"; + image-path = "/home/phundrak/.config/sunshine/covers/igdb_24775.png"; + prep-cmd = defaultPrep; + } + { + name = "Vintage Story"; + cmd = "flatpak run at.vintagestory.VintageStory"; + image-path = "/home/phundrak/.config/sunshine/covers/igdb_69547.png"; + prep-cmd = defaultPrep; + } + ]; + }; + }; +} diff --git a/modules/services/traefik.nix b/modules/services/traefik.nix new file mode 100644 index 0000000..931e929 --- /dev/null +++ b/modules/services/traefik.nix @@ -0,0 +1,73 @@ +{ + flake.modules.nixos.traefik = { + config, + lib, + ... + }: + with lib; let + cfg = config.mySystem.services.traefik; + in { + options.mySystem.services.traefik = { + enable = mkEnableOption "Enable Traefik"; + email = mkOption { + type = types.str; + default = ""; + }; + dataDir = mkOption { + type = types.path; + default = "/tank/traefik"; + example = "/path/to/traefik/data"; + }; + environmentFiles = mkOption { + type = types.listOf types.path; + example = ["/var/traefik/traefik.env"]; + default = []; + }; + dynamicConfigFile = mkOption { + type = types.path; + default = "${cfg.dataDir}/traefik.yaml"; + example = "/var/traefik/dynamic.yaml"; + }; + }; + config.services.traefik = { + inherit (cfg) enable dynamicConfigFile environmentFiles; + staticConfigOptions = { + api.dashboard = true; + log = { + level = "INFO"; + filePath = "${cfg.dataDir}/traefik.log"; + format = "json"; + }; + accessLog.filePath = "${cfg.dataDir}/access.log"; + entryPoints = { + web = { + address = ":80"; + asDefault = true; + http.redirections.entrypoint = { + to = "websecure"; + scheme = "https"; + }; + }; + websecure = { + address = ":443"; + asDefault = true; + httpChallenge.entryPoint = "websecure"; + }; + }; + providers.docker = { + endpoint = "unix:///var/run/docker.sock"; + exposedByDefault = false; + }; + certificatesResolvers.cloudflare.acme = { + inherit (cfg) email; + storage = "${cfg.dataDir}/acme.json"; + dnsChallenge = { + provider = "cloudflare"; + resolvers = ["1.1.1.1:53" "1.0.0.1:53"]; + propagation.delayBeforeChecks = 60; + }; + }; + }; + }; + }; +} diff --git a/modules/system-types/system-default.nix b/modules/system-types/system-default.nix new file mode 100644 index 0000000..354b3d7 --- /dev/null +++ b/modules/system-types/system-default.nix @@ -0,0 +1,25 @@ +{config, ...}: let + m = config.flake.modules.nixos; +in { + flake.modules.nixos.system-default = { + imports = [ + m.nix-cache-settings + m.locale + m.misc + m.base-packages + m.nano + m.nix-settings + m.networking + m.tailscale + m.rtkit + m.firmware + m.trackball + m.system-account-phundrak + m.system-account-creug + m.system-account-root + ]; + + # from system/users/default.nix, unconditional + programs.zsh.enable = true; + }; +} diff --git a/modules/users/creug.nix b/modules/users/creug.nix new file mode 100644 index 0000000..ceb91e7 --- /dev/null +++ b/modules/users/creug.nix @@ -0,0 +1,36 @@ +{ + flake.modules.nixos.system-account-creug = { + lib, + config, + pkgs, + ... + }: + with lib; let + cfg = config.mySystem.users.creug; + in { + options.mySystem.users.creug = { + enable = mkEnableOption "Enables user creug"; + sudo = mkEnableOption "Make the user a superuser"; + trusted = mkOption { + description = "Mark the user as trusted by Nix"; + default = cfg.sudo; + example = true; + }; + }; + + config = { + users.users.creug = mkIf cfg.enable { + isNormalUser = true; + description = "Greg"; + extraGroups = + ["networkmanager" "dialout" "games" "audio" "input"] + ++ lists.optional cfg.sudo "wheel"; + shell = pkgs.zsh; + openssh.authorizedKeys.keyFiles = lib.filesystem.listFilesRecursive ../home/creug/keys; + }; + nix.settings = mkIf cfg.trusted { + trusted-users = ["creug"]; + }; + }; + }; +} diff --git a/modules/users/phundrak.nix b/modules/users/phundrak.nix new file mode 100644 index 0000000..acbff09 --- /dev/null +++ b/modules/users/phundrak.nix @@ -0,0 +1,36 @@ +{ + flake.modules.nixos.system-account-phundrak = { + lib, + config, + pkgs, + ... + }: + with lib; let + cfg = config.mySystem.users.phundrak; + in { + options.mySystem.users.phundrak = { + enable = mkEnableOption "Enables user phundrak"; + trusted = mkEnableOption "Mark the user as trusted by Nix"; + extraGroups = mkOption { + type = types.listOf types.str; + default = []; + example = ["feedbackd"]; + }; + }; + + config = { + users.users.phundrak = mkIf cfg.enable { + isNormalUser = true; + description = "Lucien Cartier-Tilet"; + extraGroups = + ["networkmanager" "wheel" "dialout" "plugdev" "games" "audio" "input"] + ++ cfg.extraGroups; + shell = pkgs.zsh; + openssh.authorizedKeys.keyFiles = lib.filesystem.listFilesRecursive ../home/phundrak/keys; + }; + nix.settings = mkIf cfg.trusted { + trusted-users = ["phundrak"]; + }; + }; + }; +} diff --git a/modules/users/root.nix b/modules/users/root.nix new file mode 100644 index 0000000..d202181 --- /dev/null +++ b/modules/users/root.nix @@ -0,0 +1,19 @@ +{ + flake.modules.nixos.system-account-root = { + lib, + config, + pkgs, + ... + }: + with lib; let + cfg = config.mySystem.users.root; + in { + options.mySystem.users.root.disablePassword = mkEnableOption "Disables root password"; + config = { + users.users.root = { + hashedPassword = mkIf cfg.disablePassword "*"; + shell = pkgs.zsh; + }; + }; + }; +} diff --git a/system/boot/boot.nix b/system/boot/boot.nix deleted file mode 100644 index 98d575d..0000000 --- a/system/boot/boot.nix +++ /dev/null @@ -1,110 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.mySystem.boot; -in { - options.mySystem.boot = { - kernel = { - package = mkOption { - type = types.raw; - default = pkgs.linuxPackages_zen; - }; - modules = mkOption { - type = types.listOf types.str; - default = []; - }; - cpuVendor = mkOption { - description = "Intel or AMD?"; - type = types.enum ["intel" "amd"]; - default = "amd"; - }; - v4l2loopback.enable = mkEnableOption "Enables v4l2loopback kernel module"; - hardened = mkEnableOption "Enables hardened Linux kernel"; - extraModprobeConfig = mkOption { - type = types.lines; - default = ""; - example = '' - options snd_usb_audio vid=0x1235 pid=0x8212 device_setup=1 - ''; - }; - }; - systemd-boot = mkOption { - type = types.bool; - default = !cfg.grub.enable; - description = "Does the system use systemd-boot?"; - }; - grub = { - enable = mkEnableOption "Does the system use GRUB? (Disables systemd-boot)"; - device = mkOption { - type = types.path; - description = "The GRUB device"; - default = ""; - }; - }; - zfs = { - enable = mkEnableOption "Enables ZFS"; - pools = mkOption { - type = types.listOf types.str; - default = []; - }; - }; - }; - - config.boot = { - initrd.kernelModules = lib.lists.singleton ( - if config.mySystem.hardware.amdgpu.enable - then "amdgpu" - else "i915" - ); - extraModprobeConfig = - strings.concatLines - ([cfg.kernel.extraModprobeConfig] - ++ lists.optional cfg.kernel.v4l2loopback.enable ''options v4l2loopback exclusive_caps=1 devices=1 video_nr=0 card_label="OBS Studio"''); - loader = { - systemd-boot.enable = cfg.systemd-boot; - efi.canTouchEfiVariables = cfg.systemd-boot; - grub = mkIf cfg.grub.enable { - inherit (cfg.grub) enable device; - }; - }; - supportedFilesystems = mkIf cfg.zfs.enable ["zfs"]; - zfs.extraPools = mkIf cfg.zfs.enable cfg.zfs.pools; - kernelPackages = cfg.kernel.package; - kernelModules = - cfg.kernel.modules - ++ ["kvm-${cfg.kernel.cpuVendor}"] - ++ lists.optional cfg.kernel.hardened "tcp_bbr"; - kernel.sysctl = mkIf cfg.kernel.hardened { - "kernel.sysrq" = 0; # Disable magic SysRq key - # Ignore ICMP broadcasts to avoid participating in Smurf attacks - "net.ipv4.icmp_echo_ignore_broadcasts" = 1; - # Ignore bad ICMP errors - "net.ipv4.icmp_ignore_bogus_error_responses" = 1; - # SYN flood protection - "net.ipv4.tcp_syncookies" = 1; - # Do not accept ICMP redirects (prevent MITM attacks) - "net.ipv4.conf.all.accept_redirects" = 0; - "net.ipv4.conf.default_accept_redirects" = 0; - "net.ipv4.conf.all.secure_redirects" = 0; - "net.ipv4.conf.default.secure_redirects" = 0; - "net.ipv6.conf.all.accept_redirects" = 0; - "net.ipv6.conf.default.accept_redirects" = 0; - # Do not send ICMP redirects (we are not a router) - "net.ipv4.conf.all.send_redirects" = 0; - # Do not accept IP source route packets (we are not a router) - "net.ipv4.conf.all.accept_source_route" = 0; - "net.ipv6.conf.all.accept_source_route" = 0; - # Protect against tcp time-wait assassination hazards - "net.ipv4.tcp_rfc1337" = 1; - # Latency reduction - "net.ipv4.tcp_fastopen" = 3; - # Bufferfloat mitigations - "net.ipv4.tcp_congestion_control" = "bbr"; - "net.core.default_qdisc" = "cake"; - }; - }; -} diff --git a/system/boot/default.nix b/system/boot/default.nix deleted file mode 100644 index f3b4823..0000000 --- a/system/boot/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - imports = [ - ./boot.nix - ./plymouth.nix - ./zram.nix - ]; -} diff --git a/system/boot/plymouth.nix b/system/boot/plymouth.nix deleted file mode 100644 index e1e1cdb..0000000 --- a/system/boot/plymouth.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.boot.plymouth; -in { - options.mySystem.boot.plymouth.enable = mkEnableOption "Enables Plymouth at system boot"; - config.boot = mkIf cfg.enable { - plymouth = { - inherit (cfg) enable; - theme = "circle_hud"; - themePackages = with pkgs; [ - (adi1090x-plymouth-themes.override { - selected_themes = ["circle_hud"]; - }) - ]; - }; - consoleLogLevel = 3; - initrd.verbose = false; - kernelParams = [ - "quiet" - "splash" - "boot.shell_on_fail" - "udev.log_priority=3" - "rd.systemd.show_status=auto" - ]; - # Loader appears only if a key is pressed - loader.timeout = 0; - }; -} diff --git a/system/boot/zram.nix b/system/boot/zram.nix deleted file mode 100644 index a525d5a..0000000 --- a/system/boot/zram.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.boot.zram; -in { - options.mySystem.boot.zram = { - enable = mkEnableOption "Enable ZRAM"; - memoryMax = mkOption { - type = types.int; - example = "512"; - description = "Maximum size allocated to ZRAM in MiB"; - }; - }; - config.zramSwap = mkIf cfg.enable { - inherit (cfg) enable; - memoryMax = cfg.memoryMax * 1024 * 1024; - }; -} diff --git a/system/default.nix b/system/default.nix deleted file mode 100644 index 3a6b368..0000000 --- a/system/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - imports = [ - ./boot - ./desktop - ./dev - ./hardware - ./i18n - ./misc.nix - ./network - ./packages - ./security - ./services - ./users - ]; -} diff --git a/system/desktop/default.nix b/system/desktop/default.nix deleted file mode 100644 index 4e3c5a2..0000000 --- a/system/desktop/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - imports = [ - ./hyprland.nix - ./niri.nix - ./waydroid.nix - ./xserver.nix - ]; -} diff --git a/system/desktop/hyprland.nix b/system/desktop/hyprland.nix deleted file mode 100644 index 0e4a780..0000000 --- a/system/desktop/hyprland.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.mySystem.desktop.hyprland; -in { - options.mySystem.desktop.hyprland.enable = mkEnableOption "Enables Hyprland"; - config.programs.hyprland = mkIf cfg.enable { - inherit (cfg) enable; - withUWSM = true; - }; -} diff --git a/system/desktop/niri.nix b/system/desktop/niri.nix deleted file mode 100644 index cab16f1..0000000 --- a/system/desktop/niri.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.mySystem.desktop.niri; -in { - options.mySystem.desktop.niri.enable = mkEnableOption "Enables Niri"; - config.programs.niri = mkIf cfg.enable { - inherit (cfg) enable; - }; -} diff --git a/system/desktop/waydroid.nix b/system/desktop/waydroid.nix deleted file mode 100644 index 20cb1a6..0000000 --- a/system/desktop/waydroid.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.mySystem.desktop.waydroid; -in { - options.mySystem.desktop.waydroid.enable = mkEnableOption "Enables Waydroid"; - config = mkIf cfg.enable { - virtualisation.waydroid = { - enable = cfg.enable; - package = pkgs.waydroid-nftables; - }; - environment.systemPackages = [pkgs.waydroid-helper]; - }; -} diff --git a/system/desktop/xserver.nix b/system/desktop/xserver.nix deleted file mode 100644 index f6ae789..0000000 --- a/system/desktop/xserver.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.mySystem.desktop.xserver; -in { - options.mySystem.desktop.xserver = { - enable = mkEnableOption "Enables xserver"; - de = mkOption { - type = types.enum ["gnome" "kde"]; - default = "gnome"; - example = "kde"; - description = "Which DE to enable"; - }; - }; - config.services = mkIf cfg.enable { - displayManager = { - sddm.enable = mkIf (cfg.de == "kde") true; - gdm.enable = mkIf (cfg.de == "gnome") true; - }; - desktopManager = { - plasma6.enable = mkIf (cfg.de == "kde") true; - gnome.enable = mkIf (cfg.de == "gnome") true; - }; - - gnome = mkIf (cfg.de == "gnome") { - gnome-browser-connector.enable = true; - games.enable = false; - gnome-remote-desktop.enable = true; - gnome-online-accounts.enable = true; - sushi.enable = true; - }; - - xserver = { - inherit (cfg) enable; - videoDrivers = lists.optional config.mySystem.hardware.amdgpu.enable "amdgpu"; - xkb = { - layout = "fr"; - variant = "bepo_afnor"; - }; - }; - }; -} diff --git a/system/dev/default.nix b/system/dev/default.nix deleted file mode 100644 index 5669147..0000000 --- a/system/dev/default.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - imports = [./docker.nix ./qemu.nix]; -} diff --git a/system/dev/docker.nix b/system/dev/docker.nix deleted file mode 100644 index 279fa9b..0000000 --- a/system/dev/docker.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -with lib; let - cfg = config.mySystem.dev.docker; -in { - options.mySystem.dev.docker = { - enable = mkEnableOption "Enable Docker"; - podman.enable = mkEnableOption "Enable Podman rather than Docker"; - nvidia.enable = mkEnableOption "Activate Nvidia support"; - autoprune.enable = mkEnableOption "Enable autoprune"; - storage = mkOption { - type = types.nullOr types.path; - default = null; - example = "/path/to/docker/storage"; - }; - }; - - config = mkIf cfg.enable { - mySystem.users.phundrak = mkIf config.mySystem.users.phundrak.enable { - extraGroups = ["docker"] ++ lists.optional cfg.podman.enable "podman"; - }; - environment.systemPackages = with pkgs; - [ - dive # A tool for exploring each layer in a docker image - grype # Vulnerability scanner for container images and filesystems - ] - ++ lists.optionals cfg.podman.enable [ - podman-compose - podman-desktop - ]; - virtualisation = { - docker = mkIf (!cfg.podman.enable) { - enable = true; - enableNvidia = cfg.nvidia.enable; - autoPrune.enable = cfg.autoprune.enable; - daemon.settings = mkIf (cfg.storage != null) { - "data-root" = cfg.storage; - }; - }; - podman = mkIf cfg.podman.enable { - enable = true; - dockerCompat = cfg.enable; - enableNvidia = cfg.nvidia.enable; - dockerSocket.enable = cfg.enable; - autoPrune.enable = cfg.autoprune.enable; - }; - }; - }; -} diff --git a/system/dev/qemu.nix b/system/dev/qemu.nix deleted file mode 100644 index 2ad6955..0000000 --- a/system/dev/qemu.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.mySystem.dev.qemu; -in { - options.mySystem.dev.qemu = { - enable = mkEnableOption "Enable QEMU"; - users = mkOption { - type = types.listOf types.str; - default = ["phundrak"]; - example = ["user1" "user2"]; - }; - }; - config = mkIf cfg.enable { - programs.virt-manager.enable = true; - users.groups.libvirtd.members = cfg.users; - virtualisation = { - libvirtd.enable = true; - spiceUSBRedirection.enable = true; - }; - environment.systemPackages = with pkgs; [ - qemu - quickemu - swtpm - ]; - systemd.tmpfiles.rules = ["L+ /var/lib/qemu/firmware - - - - ${pkgs.qemu}/share/qemu/firmware"]; - boot.binfmt.emulatedSystems = ["aarch64-linux"]; - }; -} diff --git a/system/hardware/amdgpu.nix b/system/hardware/amdgpu.nix deleted file mode 100644 index 121526c..0000000 --- a/system/hardware/amdgpu.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.hardware.amdgpu; -in { - options.mySystem.hardware.amdgpu.enable = mkEnableOption "Enables an AMD GPU configuration"; - config = mkIf cfg.enable { - hardware = { - graphics = { - enable = true; - enable32Bit = true; - extraPackages = with pkgs; [ - mesa # Mesa drivers for AMD GPUs - rocmPackages.clr # common language runtime for ROCm - rocmPackages.clr.icd # ROCm ICD for OpenCL - rocmPackages.rocblas # ROCm BLAS library - rocmPackages.hipblas # - rocmPackages.rpp # High-performance computer vision library - nvtopPackages.amd # GPU utilization monitoring - ]; - }; - amdgpu = { - initrd.enable = true; - opencl.enable = true; - }; - }; - environment.systemPackages = with pkgs; [ - clinfo - amdgpu_top - nvtopPackages.amd - ]; - systemd = { - packages = with pkgs; [lact]; - services.lactd.wantedBy = ["multi-user.target"]; - tmpfiles.rules = let - rocmEnv = pkgs.symlinkJoin { - name = "rocm-combined"; - paths = with pkgs.rocmPackages; [ - clr - clr.icd - rocblas - hipblas - rpp - ]; - }; - in [ - "L+ /opt/rocm - - - - ${rocmEnv}" - ]; - }; - environment.variables = { - ROCM_PATH = "/opt/rocm"; # Set ROCm path - HIP_VISIBLE_DEVICES = "1"; # Use only the eGPU (ID 1) - ROCM_VISIBLE_DEVICES = "1"; # Optional: ROCm equivalent for visibility - # LD_LIBRARY_PATH = "/opt/rocm/lib"; # Add ROCm libraries - HSA_OVERRIDE_GFX_VERSION = "10.3.0"; # Set GFX version override - }; - }; -} diff --git a/system/hardware/bluetooth.nix b/system/hardware/bluetooth.nix deleted file mode 100644 index bdd0706..0000000 --- a/system/hardware/bluetooth.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.hardware.bluetooth; -in { - options.mySystem.hardware.bluetooth.enable = mkEnableOption "Enable bluetooth"; - config = mkIf cfg.enable { - hardware.bluetooth.enable = cfg.enable; - services.blueman.enable = cfg.enable; - }; -} diff --git a/system/hardware/default.nix b/system/hardware/default.nix deleted file mode 100644 index a3d2882..0000000 --- a/system/hardware/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{lib, ...}: { - imports = [ - ./amdgpu.nix - ./bluetooth.nix - ./fingerprint.nix - ./input - ./pinetab2.nix - ./sound.nix - ]; - - hardware.enableAllFirmware = lib.mkDefault true; -} diff --git a/system/hardware/fingerprint.nix b/system/hardware/fingerprint.nix deleted file mode 100644 index 8eb143a..0000000 --- a/system/hardware/fingerprint.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.hardware.fingerprint; -in { - options.mySystem.hardware.fingerprint.enable = mkEnableOption "Enable fingerprint reader"; - config = mkIf cfg.enable { - hardware.facter.detected.fingerprint.enable = cfg.enable; - }; -} diff --git a/system/hardware/input/corne.nix b/system/hardware/input/corne.nix deleted file mode 100644 index 5c52d39..0000000 --- a/system/hardware/input/corne.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.hardware.input.corne; -in { - options.mySystem.hardware.input.corne.allowHidAccess = mkEnableOption "Enable HID access to the corne keyboard"; - config.services.udev = mkIf cfg.allowHidAccess { - extraRules = '' - KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{serial}=="*vial:f64c2b3c*", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl" - ''; - }; -} diff --git a/system/hardware/input/default.nix b/system/hardware/input/default.nix deleted file mode 100644 index 270e870..0000000 --- a/system/hardware/input/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - imports = [ - ./corne.nix - ./ibm-trackpoint.nix - ./opentablet.nix - ./trackball.nix - ]; -} diff --git a/system/hardware/input/ibm-trackpoint.nix b/system/hardware/input/ibm-trackpoint.nix deleted file mode 100644 index c6b5a76..0000000 --- a/system/hardware/input/ibm-trackpoint.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.hardware.input.ibmTrackpoint; -in { - options.mySystem.hardware.input.ibmTrackpoint.disable = mkEnableOption "Disable IBM’s trackpoint on ThinkPad"; - config.services.udev = mkIf cfg.disable { - extraRules = '' - ATTRS{name}=="*TPPS/2 IBM TrackPoint", ENV{ID_INPUT}="", ENV{ID_INPUT_MOUSE}="", ENV{ID_INPUT_POINTINGSTICK}="" - ''; - }; -} diff --git a/system/hardware/input/opentablet.nix b/system/hardware/input/opentablet.nix deleted file mode 100644 index 6134b66..0000000 --- a/system/hardware/input/opentablet.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.hardware.input.opentablet; -in { - options.mySystem.hardware.input.opentablet.enable = mkEnableOption "Enables OpenTablet drivers"; - config = mkIf cfg.enable { - hardware.opentabletdriver = { - inherit (cfg) enable; - daemon.enable = true; - }; - boot.kernelModules = ["wacom"]; - }; -} diff --git a/system/hardware/input/trackball.nix b/system/hardware/input/trackball.nix deleted file mode 100644 index dc92129..0000000 --- a/system/hardware/input/trackball.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - services.libinput.mouse.middleEmulation = true; -} diff --git a/system/hardware/pinetab2.nix b/system/hardware/pinetab2.nix deleted file mode 100644 index 6ef7997..0000000 --- a/system/hardware/pinetab2.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.hardware.pinetab2; -in { - options.mySystem.hardware.pinetab2.enable = mkEnableOption "Activate support for the PineTab2"; - config = { - boot.kernelParams = ["console=tty0" "console=ttyS2,1500000n8" "rootwait" "root=LABEL=NIXOS_SD" "rw"]; - hardware.sensor.iio.enable = true; - services.avahi = { - enable = true; - openFirewall = true; - }; - }; -} diff --git a/system/hardware/sound.nix b/system/hardware/sound.nix deleted file mode 100644 index 62c6f14..0000000 --- a/system/hardware/sound.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -with lib; let - cfg = config.mySystem.hardware.sound; -in { - options.mySystem.hardware.sound = { - enable = mkEnableOption "Whether to enable sounds with Pipewire"; - noisetorch = mkEnableOption "Whether to activate noisetorch support"; - scarlett.enable = mkEnableOption "Activate support for Scarlett sound card"; - alsa = mkOption { - type = types.bool; - example = true; - default = true; - description = "Whether to enable ALSA support with Pipewire"; - }; - jack = mkOption { - type = types.bool; - example = true; - default = false; - description = "Whether to enable JACK support with Pipewire"; - }; - package = mkOption { - type = types.package; - example = pkgs.pulseaudio; - default = pkgs.pulseaudioFull; - description = "Which base package to use for PulseAudio"; - }; - }; - - config = { - environment.systemPackages = mkIf cfg.scarlett.enable [pkgs.alsa-scarlett-gui]; - services = { - pipewire = mkIf cfg.enable { - enable = true; - alsa = mkIf cfg.alsa { - enable = mkDefault true; - support32Bit = mkDefault true; - }; - jack.enable = mkDefault cfg.jack; - }; - pulseaudio.enable = false; - }; - programs.noisetorch = mkIf cfg.enable { - enable = cfg.noisetorch; - }; - }; -} diff --git a/system/i18n/default.nix b/system/i18n/default.nix deleted file mode 100644 index 722d144..0000000 --- a/system/i18n/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - imports = [ - ./input.nix - ./locale.nix - ]; -} diff --git a/system/i18n/input.nix b/system/i18n/input.nix deleted file mode 100644 index 3ba6c2c..0000000 --- a/system/i18n/input.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -with lib; let - cfg = config.mySystem.i18n.input; -in { - options.mySystem.i18n.input.enable = mkEnableOption "Enable i18n input with fcitx5"; - - config.i18n.inputMethod = mkIf cfg.enable { - enable = true; - type = "fcitx5"; - fcitx5.addons = with pkgs; [ - fcitx5-gtk - fcitx5-mozc-ut # Japanese input support - fcitx5-nord - fcitx5-table-other # X-SAMPA to IPA support - qt6Packages.fcitx5-chinese-addons # allow to load table addons - qt6Packages.fcitx5-configtool - qt6Packages.fcitx5-with-addons - ]; - }; -} diff --git a/system/i18n/locale.nix b/system/i18n/locale.nix deleted file mode 100644 index e826217..0000000 --- a/system/i18n/locale.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - i18n = { - defaultLocale = "en_DK.UTF-8"; - extraLocaleSettings = { - LC_ADDRESS = "fr_FR.UTF-8"; - LC_IDENTIFICATION = "fr_FR.UTF-8"; - LC_MEASUREMENT = "fr_FR.UTF-8"; - LC_MONETARY = "fr_FR.UTF-8"; - LC_NAME = "fr_FR.UTF-8"; - LC_NUMERIC = "fr_FR.UTF-8"; - LC_PAPER = "fr_FR.UTF-8"; - LC_TELEPHONE = "fr_FR.UTF-8"; - LC_TIME = "fr_FR.UTF-8"; - }; - }; -} diff --git a/system/misc.nix b/system/misc.nix deleted file mode 100644 index ab050d1..0000000 --- a/system/misc.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.misc; -in { - options.mySystem.misc = { - timezone = mkOption { - type = types.str; - default = "Europe/Paris"; - }; - keymap = mkOption { - type = types.str; - default = "fr"; - example = "fr-bepo"; - description = "Keymap to use in the TTY console"; - }; - }; - - config = { - boot.tmp.cleanOnBoot = true; - console.keyMap = cfg.keymap; - time.timeZone = cfg.timezone; - environment.pathsToLink = [ - "/share/bash-completion" - "/share/zsh" - ]; - services = { - orca.enable = false; - envfs.enable = true; - }; - - nix.settings = { - substituters = [ - "http://marpa:5000?priority=5" - "https://phundrak.cachix.org?priority=10" - "https://nix-community.cachix.org?priority=20" - "https://cache.nixos.org?priority=40" - ]; - trusted-public-keys = [ - "marpa-local:XoO+dFN4PeauF52pYuy3Vh4Sdtl2qIdxu5aUasWKv6Q=" - "phundrak.cachix.org-1:osJAkYO0ioTOPqaQCIXMfIRz1/+YYlVFkup3R2KSexk=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - ]; - http-connections = 128; - experimental-features = [ - "nix-command" - "flakes" - ]; - }; - }; -} diff --git a/system/network/default.nix b/system/network/default.nix deleted file mode 100644 index 940fd9d..0000000 --- a/system/network/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - imports = [ - ./networking.nix - ./tailscale.nix - ]; -} diff --git a/system/network/networking.nix b/system/network/networking.nix deleted file mode 100644 index 4003ca3..0000000 --- a/system/network/networking.nix +++ /dev/null @@ -1,78 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.networking; -in { - options.mySystem.networking = with types; { - hostname = mkOption { - type = str; - example = "gampo"; - }; - id = mkOption { - type = str; - example = "deadb33f"; - }; - domain = mkOption { - type = nullOr str; - example = "phundrak.com"; - default = null; - }; - hostFiles = mkOption { - type = listOf path; - example = [/path/to/hostFile]; - default = []; - }; - firewall = { - openPorts = mkOption { - type = listOf int; - example = [22 80 443]; - default = []; - }; - openPortRanges = mkOption { - type = listOf (attrsOf port); - default = []; - example = [ - { - from = 8080; - to = 8082; - } - ]; - description = '' - A range of TCP and UDP ports on which incoming connections are - accepted. - ''; - }; - extraCommands = mkOption { - type = nullOr lines; - example = "iptables -A INPUTS -p icmp -j ACCEPT"; - default = null; - }; - }; - wifi.disablePowersave = mkEnableOption '' - Disables powersave for Wifi. - - Used mainly for the PineTab2, as leaving WiFi powersave with the bes2600 can cause stability issues. - ''; - }; - - config.networking = { - hostName = cfg.hostname; # Define your hostname. - hostId = cfg.id; - networkmanager = { - enable = true; - wifi.powersave = ! cfg.wifi.disablePowersave; - }; - inherit (cfg) hostFiles domain; - firewall = { - enable = true; - allowedTCPPorts = cfg.firewall.openPorts; - allowedUDPPorts = cfg.firewall.openPorts; - allowedTCPPortRanges = cfg.firewall.openPortRanges; - allowedUDPPortRanges = cfg.firewall.openPortRanges; - extraCommands = (mkIf (cfg.firewall.extraCommands != null)) cfg.firewall.extraCommands; - }; - }; -} diff --git a/system/network/tailscale.nix b/system/network/tailscale.nix deleted file mode 100644 index e79e190..0000000 --- a/system/network/tailscale.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.network.tailscale; -in { - options.mySystem.network.tailscale = { - enable = mkOption { - type = types.bool; - default = true; - }; - }; - config.services.tailscale = { - inherit (cfg) enable; - extraSetFlags = [ - "--accept-dns" - "--accept-routes" - "--ssh" - ]; - }; -} diff --git a/system/packages/appimage.nix b/system/packages/appimage.nix deleted file mode 100644 index 607b3cf..0000000 --- a/system/packages/appimage.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.packages.appimage; -in { - options.mySystem.packages.appimage.enable = mkEnableOption "Enables AppImage support"; - config.programs.appimage = mkIf cfg.enable { - inherit (cfg) enable; - binfmt = true; - }; -} diff --git a/system/packages/default.nix b/system/packages/default.nix deleted file mode 100644 index 2bfb604..0000000 --- a/system/packages/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{pkgs, ...}: { - imports = [ - ./appimage.nix - ./flatpak.nix - ./nano.nix - ./nix.nix - ./steam.nix - ]; - - environment.systemPackages = with pkgs; [ - curl - openssl - wget - ]; -} diff --git a/system/packages/flatpak.nix b/system/packages/flatpak.nix deleted file mode 100644 index 0d59a64..0000000 --- a/system/packages/flatpak.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.packages.flatpak; -in { - options.mySystem.packages.flatpak = { - enable = mkEnableOption "Enable Flatpak support"; - builder.enable = mkEnableOption "Enable Flatpak builder"; - }; - config = mkIf cfg.enable { - environment.systemPackages = lists.optional cfg.builder.enable pkgs.flatpak-builder; - services.flatpak.enable = true; - }; -} diff --git a/system/packages/nano.nix b/system/packages/nano.nix deleted file mode 100644 index 0b2a8aa..0000000 --- a/system/packages/nano.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - programs.nano = { - enable = true; - syntaxHighlight = true; - nanorc = '' - set tabsize 2 - set autoindent - set atblanks - set linenumber - set smarthome - set softwrap - ''; - }; -} diff --git a/system/packages/nix.nix b/system/packages/nix.nix deleted file mode 100644 index 8434cee..0000000 --- a/system/packages/nix.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.packages.nix; -in { - options.mySystem.packages.nix = { - allowUnfree = mkEnableOption "Enable unfree packages"; - disableSandbox = mkEnableOption "Disable Nix sandbox"; - gc = { - automatic = mkOption { - type = types.bool; - default = true; - }; - dates = mkOption { - type = types.str; - default = "Monday 01:00 UTC"; - }; - options = mkOption { - type = types.str; - default = "--delete-older-than 30d"; - }; - }; - nix-ld.enable = mkEnableOption "Enable unpatched binaries support"; - trusted-users = mkOption { - type = types.listOf types.str; - example = ["alice" "bob"]; - default = ["@wheel" "root"]; - }; - }; - - config = { - nix = { - inherit (cfg) gc; - settings = { - inherit (cfg) trusted-users; - sandbox = cfg.disableSandbox; - experimental-features = ["nix-command" "flakes"]; - auto-optimise-store = true; - }; - }; - nixpkgs.config.allowUnfree = true; - programs = { - inherit (cfg) nix-ld; - }; - }; -} diff --git a/system/security/default.nix b/system/security/default.nix deleted file mode 100644 index f437212..0000000 --- a/system/security/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - imports = [ - ./sops.nix - ]; - security.rtkit.enable = true; -} diff --git a/system/security/sops.nix b/system/security/sops.nix deleted file mode 100644 index 34fd996..0000000 --- a/system/security/sops.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - sops = { - defaultSopsFile = ../../secrets/secrets.yaml; - defaultSopsFormat = "yaml"; - age = { - # automatically import user SSH keys as age keys - sshKeyPaths = [ - "/home/phundrak/.ssh/id_ed25519" - "/etc/ssh/ssh_host_ed25519_key" - ]; - # this will use an age key that is expected to already be in the filesystem - keyFile = "/var/lib/sops-nix/key.txt"; - # generate a new key if the key specified above does not exist - generateKey = true; - }; - }; -} diff --git a/system/services/calibre.nix b/system/services/calibre.nix deleted file mode 100644 index 38fd978..0000000 --- a/system/services/calibre.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.mySystem.services.calibre; -in { - options.mySystem.services.calibre = { - enable = mkEnableOption "Enable Calibre Web"; - user = mkOption { - type = types.str; - default = "phundrak"; - }; - group = mkOption { - type = types.str; - default = "users"; - }; - dataDir = mkOption { - type = types.str; - example = "/tank/calibre/conf"; - default = "/tank/calibre/conf"; - }; - library = mkOption { - type = types.str; - example = "/tank/calibre/library"; - default = "/tank/calibre/library"; - }; - }; - config.services.calibre-web = mkIf cfg.enable { - inherit (cfg) enable user dataDir group; - options = { - calibreLibrary = cfg.library; - enableBookConversion = true; - enableBookUploading = true; - }; - }; -} diff --git a/system/services/default.nix b/system/services/default.nix deleted file mode 100644 index fda7ce2..0000000 --- a/system/services/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - imports = [ - ./calibre.nix - ./endlessh.nix - ./fwupd.nix - ./harmonia.nix - ./jellyfin.nix - ./languagetool.nix - ./plex.nix - ./printing.nix - ./ssh.nix - ./sunshine.nix - ./traefik.nix - ]; -} diff --git a/system/services/endlessh.nix b/system/services/endlessh.nix deleted file mode 100644 index 09488bb..0000000 --- a/system/services/endlessh.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.mySystem.services.endlessh; -in { - options.mySystem.services.endlessh = { - enable = mkEnableOption "Enables endlessh."; - port = mkOption { - type = types.port; - default = 2222; - example = 22; - }; - }; - config.services.endlessh-go = mkIf cfg.enable { - inherit (cfg) enable port; - openFirewall = true; - }; -} diff --git a/system/services/fwupd.nix b/system/services/fwupd.nix deleted file mode 100644 index fad0da2..0000000 --- a/system/services/fwupd.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.services.fwupd; -in { - options.mySystem.services.fwupd.enable = mkEnableOption "Enable fwupd"; - config.services.fwupd = mkIf cfg.enable { - inherit (cfg) enable; - }; -} diff --git a/system/services/harmonia.nix b/system/services/harmonia.nix deleted file mode 100644 index 1ffc26e..0000000 --- a/system/services/harmonia.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.mySystem.services.harmonia; -in { - options.mySystem.services.harmonia = { - enable = mkEnableOption "Harmonia Nix binary cache server"; - port = mkOption { - type = types.port; - default = 5000; - description = "Port to listen on"; - }; - priority = mkOption { - type = types.ints.between 0 100; - default = 50; - description = "Cache priority (lower = higher priority, 0-100)"; - }; - signKeyPaths = mkOption { - type = types.listOf types.path; - description = "Paths to the signing keys to use for signing the cache."; - }; - }; - config = mkIf cfg.enable { - services.harmonia.cache = { - enable = true; - inherit (cfg) signKeyPaths; - settings = { - inherit (cfg) priority; - bind = "[::]:${toString cfg.port}"; - }; - }; - }; -} diff --git a/system/services/jellyfin.nix b/system/services/jellyfin.nix deleted file mode 100644 index aabfcdd..0000000 --- a/system/services/jellyfin.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.mySystem.services.jellyfin; -in { - options.mySystem.services.jellyfin = { - enable = mkEnableOption "Enable Jellyfin"; - dataDir = mkOption { - type = types.str; - default = "/tank/jellyfin/data"; - example = "/tank/jellyfin/data"; - }; - user = mkOption { - type = types.str; - default = "phundrak"; - }; - group = mkOption { - type = types.str; - default = "users"; - }; - }; - config.services.jellyfin = mkIf cfg.enable { - inherit (cfg) enable group user dataDir; - }; -} diff --git a/system/services/languagetool.nix b/system/services/languagetool.nix deleted file mode 100644 index ca5751c..0000000 --- a/system/services/languagetool.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.mySystem.services.languagetool; -in { - options.mySystem.services.languagetool = { - enable = mkEnableOption "Enables languagetool"; - port = mkOption { - type = types.port; - default = 8081; - example = 80; - }; - }; - config.services.languagetool = mkIf cfg.enable { - inherit (cfg) enable port; - }; -} diff --git a/system/services/plex.nix b/system/services/plex.nix deleted file mode 100644 index b8269a8..0000000 --- a/system/services/plex.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.services.plex; -in { - options.mySystem.services.plex = { - enable = mkEnableOption "Enable Plex"; - group = mkOption { - type = types.str; - default = "users"; - example = "users"; - description = "Group under which Plex runs"; - }; - dataDir = mkOption { - type = types.str; - example = "/tank/plex-config"; - }; - user = mkOption { - type = types.str; - default = "phundrak"; - }; - }; - config = { - services.plex = mkIf cfg.enable { - inherit (cfg) enable user group dataDir; - openFirewall = cfg.enable; - }; - boot.kernel.sysctl = { - "kernel.unprivileged_userns_clone" = 1; - }; - }; -} diff --git a/system/services/printing.nix b/system/services/printing.nix deleted file mode 100644 index 516f994..0000000 --- a/system/services/printing.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.services.printing; -in { - options.mySystem.services.printing.enable = mkEnableOption "Enable printing with CUPS"; - config.services.printing = mkIf cfg.enable { - inherit (cfg) enable; - }; -} diff --git a/system/services/ssh.nix b/system/services/ssh.nix deleted file mode 100644 index 21b0671..0000000 --- a/system/services/ssh.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.mySystem.services.ssh; -in { - options.mySystem.services.ssh = { - enable = mkEnableOption "Enables OpenSSH"; - allowedUsers = mkOption { - type = types.listOf types.str; - example = ["alice" "bob"]; - default = ["phundrak"]; - }; - passwordAuthentication = mkOption { - type = types.bool; - example = true; - default = false; - }; - port = mkOption { - type = types.int; - default = 22; - }; - }; - config.services.openssh = mkIf cfg.enable { - inherit (cfg) enable; - ports = [cfg.port]; - settings = { - AllowUsers = cfg.allowedUsers; - PermitRootLogin = "no"; - PasswordAuthentication = cfg.passwordAuthentication; - }; - }; -} diff --git a/system/services/sunshine.nix b/system/services/sunshine.nix deleted file mode 100644 index 6b56df4..0000000 --- a/system/services/sunshine.nix +++ /dev/null @@ -1,68 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.mySystem.services.sunshine; -in { - options.mySystem.services.sunshine = { - enable = mkEnableOption "Enables Sunshine"; - autostart = mkEnableOption "Enables autostart"; - }; - config.services.sunshine = mkIf cfg.enable { - inherit (cfg) enable; - autoStart = cfg.autostart; - capSysAdmin = true; - openFirewall = true; - settings = { - sunshine_name = config.mySystem.networking.hostname; - locale = "en_GB"; - system_tray = "enabled"; - output_name = 1; - }; - applications.apps = let - defaultPrep = [ - { - do = "sh -c \"hyprctl -i 0 keyword monitor \\\"DP-2,\${SUNSHINE_CLIENT_WIDTH}x\${SUNSHINE_CLIENT_HEIGHT}@\${SUNSHINE_CLIENT_FPS},0x0,1\\\"\""; - undo = "sh -c \"hyprctl -i 0 keyword monitor 'DP-2,2560x1080@60,0x0,1,transform,1'\""; - } - ]; - in [ - { - name = "Desktop"; - image-path = "desktop.png"; - prep-cmd = defaultPrep; - } - { - name = "Low Res Desktop"; - image-path = "desktop.png"; - prep-cmd = defaultPrep; - } - { - name = "Steam Big Picture"; - detached = ["setsid steam steam://open/bigpicture"]; - prep-cmd = defaultPrep; - image-path = "steam.png"; - } - { - name = "OpenTTD"; - cmd = "openttd"; - image-path = "/home/phundrak/.config/sunshine/covers/igdb_18074.png"; - prep-cmd = defaultPrep; - } - { - name = "OpenMW"; - cmd = "openmw"; - image-path = "/home/phundrak/.config/sunshine/covers/igdb_24775.png"; - prep-cmd = defaultPrep; - } - { - name = "Vintage Story"; - cmd = "flatpak run at.vintagestory.VintageStory"; - image-path = "/home/phundrak/.config/sunshine/covers/igdb_69547.png"; - prep-cmd = defaultPrep; - } - ]; - }; -} diff --git a/system/services/traefik.nix b/system/services/traefik.nix deleted file mode 100644 index 940a6fa..0000000 --- a/system/services/traefik.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.mySystem.services.traefik; -in { - options.mySystem.services.traefik = { - enable = mkEnableOption "Enable Traefik"; - email = mkOption { - type = types.str; - default = ""; - }; - dataDir = mkOption { - type = types.path; - default = "/tank/traefik"; - example = "/path/to/traefik/data"; - }; - environmentFiles = mkOption { - type = types.listOf types.path; - example = ["/var/traefik/traefik.env"]; - default = []; - }; - dynamicConfigFile = mkOption { - type = types.path; - default = "${cfg.dataDir}/traefik.yaml"; - example = "/var/traefik/dynamic.yaml"; - }; - }; - config.services.traefik = { - inherit (cfg) enable dynamicConfigFile environmentFiles; - staticConfigOptions = { - api.dashboard = true; - log = { - level = "INFO"; - filePath = "${cfg.dataDir}/traefik.log"; - format = "json"; - }; - accessLog.filePath = "${cfg.dataDir}/access.log"; - entryPoints = { - web = { - address = ":80"; - asDefault = true; - http.redirections.entrypoint = { - to = "websecure"; - scheme = "https"; - }; - }; - websecure = { - address = ":443"; - asDefault = true; - httpChallenge.entryPoint = "websecure"; - }; - }; - providers.docker = { - endpoint = "unix:///var/run/docker.sock"; - exposedByDefault = false; - }; - certificatesResolvers.cloudflare.acme = { - inherit (cfg) email; - storage = "${cfg.dataDir}/acme.json"; - dnsChallenge = { - provider = "cloudflare"; - resolvers = ["1.1.1.1:53" "1.0.0.1:53"]; - propagation.delayBeforeChecks = 60; - }; - }; - }; - }; -} diff --git a/system/users/creug.nix b/system/users/creug.nix deleted file mode 100644 index 1f7a189..0000000 --- a/system/users/creug.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -with lib; let - cfg = config.mySystem.users.creug; -in { - options.mySystem.users.creug = { - enable = mkEnableOption "Enables user creug"; - sudo = mkEnableOption "Make the user a superuser"; - trusted = mkOption { - description = "Mark the user as trusted by Nix"; - default = cfg.sudo; - example = true; - }; - }; - - config = { - users.users.creug = mkIf cfg.enable { - isNormalUser = true; - description = "Greg"; - extraGroups = - ["networkmanager" "dialout" "games" "audio" "input"] - ++ lists.optional config.mySystem.dev.docker.enable "docker" - ++ lists.optional config.mySystem.dev.docker.podman.enable "podman" - ++ lists.optional cfg.sudo "wheel"; - shell = pkgs.zsh; - openssh.authorizedKeys.keyFiles = lib.filesystem.listFilesRecursive ../../users/creug/keys; - }; - nix.settings = mkIf cfg.trusted { - trusted-users = ["creug"]; - }; - }; -} diff --git a/system/users/default.nix b/system/users/default.nix deleted file mode 100644 index 617123c..0000000 --- a/system/users/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - imports = [ - ./creug.nix - ./phundrak.nix - ./root.nix - ]; - programs.zsh.enable = true; -} diff --git a/system/users/phundrak.nix b/system/users/phundrak.nix deleted file mode 100644 index ccdd76d..0000000 --- a/system/users/phundrak.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -with lib; let - cfg = config.mySystem.users.phundrak; -in { - options.mySystem.users.phundrak = { - enable = mkEnableOption "Enables user phundrak"; - trusted = mkEnableOption "Mark the user as trusted by Nix"; - extraGroups = mkOption { - type = types.listOf types.str; - default = []; - example = ["feedbackd"]; - }; - }; - - config = { - users.users.phundrak = mkIf cfg.enable { - isNormalUser = true; - description = "Lucien Cartier-Tilet"; - extraGroups = - ["networkmanager" "wheel" "dialout" "plugdev" "games" "audio" "input"] - ++ cfg.extraGroups; - shell = pkgs.zsh; - openssh.authorizedKeys.keyFiles = lib.filesystem.listFilesRecursive ../../users/phundrak/keys; - }; - nix.settings = mkIf cfg.trusted { - trusted-users = ["phundrak"]; - }; - }; -} diff --git a/system/users/root.nix b/system/users/root.nix deleted file mode 100644 index 28cf703..0000000 --- a/system/users/root.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -with lib; let - cfg = config.mySystem.users.root; -in { - options.mySystem.users.root.disablePassword = mkEnableOption "Disables root password"; - config = { - users.users.root = { - hashedPassword = mkIf cfg.disablePassword "*"; - shell = pkgs.zsh; - }; - }; -} diff --git a/users/creug/home.nix b/users/creug/home.nix deleted file mode 100644 index a394f28..0000000 --- a/users/creug/home.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -with lib; let - cfg = config.home.creug; -in { - imports = [../modules]; - options.home.creug = { - sshKey = { - content = mkOption { - type = types.nullOr types.str; - example = "ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; - default = null; - }; - file = mkOption { - type = with types; nullOr path; - default = "/home/creug/.ssh/id_ed25519.pub"; - }; - }; - }; - - config = { - nixpkgs.config.allowUnfree = true; - - home = { - username = "creug"; - homeDirectory = "/home/creug"; - packages = [pkgs.tree pkgs.ncdu]; - preferXdgDirectories = true; - - creug.sshKey.file = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; - - dev.vcs = { - name = "Creug"; - email = "gregory.foulachon@gmail.com"; - editor = "${pkgs.nano}/bin/nano"; - jj = { - enable = true; - cz = { - enable = true; - alias = true; - }; - }; - git.enable = true; - publicKey = cfg.sshKey; - }; - - security.ssh.enable = true; - - shell = { - bash.enable = true; - zsh.enable = true; - starship.enable = true; - tmux.enable = false; - zoxide.enable = false; - }; - - stateVersion = "24.11"; # Do not modify! - }; - - manual.manpages.enable = true; - }; -} diff --git a/users/creug/host/elcafe.nix b/users/creug/host/elcafe.nix deleted file mode 100644 index a8ea848..0000000 --- a/users/creug/host/elcafe.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - imports = [../home.nix]; - home = { - cli.nh.flake = "/home/creug/.dotfiles"; - dev.editors.emacs.enable = false; - creug.sshKey.content = builtins.readFile ../keys/id_elcafe.pub; - }; -} diff --git a/users/modules/basics.nix b/users/modules/basics.nix deleted file mode 100644 index 5159beb..0000000 --- a/users/modules/basics.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - programs = { - fd.enable = true; - fzf.enable = true; - home-manager.enable = true; - htop.enable = true; - jq.enable = true; - ripgrep.enable = true; - }; -} diff --git a/users/modules/cli/bat.nix b/users/modules/cli/bat.nix deleted file mode 100644 index 8b0ed07..0000000 --- a/users/modules/cli/bat.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.home.cli.bat; -in { - options.home.cli.bat.extras = mkEnableOption "Enables extra packages for bat."; - config.programs.bat = { - enable = true; - config = { - theme = "Nord"; - map-syntax = [ - ".spacemacs*:Lisp" - ]; - }; - extraPackages = mkIf cfg.extras (with pkgs.bat-extras; [ - batman - batpipe - ]); - }; -} diff --git a/users/modules/cli/btop.nix b/users/modules/cli/btop.nix deleted file mode 100644 index 04f0eed..0000000 --- a/users/modules/cli/btop.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ - pkgs, - config, - ... -}: let - inherit (config.home) gpuType; -in { - programs.btop = { - enable = true; - package = - if gpuType != null - then - pkgs.btop.override { - rocmSupport = gpuType == "amd"; - cudaSupport = gpuType == "nvidia"; - } - else pkgs.btop; - settings = { - color_theme = "${pkgs.btop}/share/btop/themes/nord.theme"; - cpu_bottom = false; - cpu_sensor = "auto"; - io_graph_combined = false; - io_mode = true; - only_physical = true; - proc_tree = true; - rounded_corners = true; - show_disks = true; - show_gpu_info = "on"; - show_uptime = true; - theme_background = true; - vim_keys = false; - }; - }; -} diff --git a/users/modules/cli/default.nix b/users/modules/cli/default.nix deleted file mode 100644 index 716ebac..0000000 --- a/users/modules/cli/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.cli; -in { - imports = [ - ./bat.nix - ./btop.nix - ./direnv.nix - ./eza.nix - ./mu.nix - ./nh.nix - ./nix-index.nix - ./scripts - ./tealdeer.nix - ./yt-dlp.nix - ]; - - options.home.cli.fullDesktop = mkEnableOption "Enable all optional modules and options"; - config.home.cli = { - bat.extras = mkDefault cfg.fullDesktop; - mu.enable = mkDefault cfg.fullDesktop; - scripts.enable = mkDefault cfg.fullDesktop; - yt-dlp.enable = mkDefault cfg.fullDesktop; - }; -} diff --git a/users/modules/cli/direnv.nix b/users/modules/cli/direnv.nix deleted file mode 100644 index a17b513..0000000 --- a/users/modules/cli/direnv.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - programs.direnv = { - enable = true; - config.global = { - load_dotenv = true; - hide_env_diff = true; - }; - nix-direnv.enable = true; - }; -} diff --git a/users/modules/cli/eza.nix b/users/modules/cli/eza.nix deleted file mode 100644 index fab98e9..0000000 --- a/users/modules/cli/eza.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - programs.eza = { - enable = true; - colors = "auto"; - icons = "auto"; - git = true; - }; -} diff --git a/users/modules/cli/mu.nix b/users/modules/cli/mu.nix deleted file mode 100644 index bdfc11b..0000000 --- a/users/modules/cli/mu.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.cli.mu; -in { - options.home.cli.mu.enable = mkEnableOption "Enable mu"; - config.programs.mu.enable = cfg.enable; -} diff --git a/users/modules/cli/nh.nix b/users/modules/cli/nh.nix deleted file mode 100644 index bd6e843..0000000 --- a/users/modules/cli/nh.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.cli.nh; -in { - options.home.cli.nh.flake = mkOption { - type = types.path; - default = "/home/phundrak/.dotfiles"; - example = "/etc/nixos"; - }; - config.programs.nh = { - enable = true; - clean.enable = true; - clean.extraArgs = "--keep-since 15d --keep 5"; - inherit (cfg) flake; - }; -} diff --git a/users/modules/cli/nix-index.nix b/users/modules/cli/nix-index.nix deleted file mode 100644 index adff6a8..0000000 --- a/users/modules/cli/nix-index.nix +++ /dev/null @@ -1,10 +0,0 @@ -{inputs, ...}: { - imports = [ - inputs.nix-index-database.homeModules.nix-index - ]; - - programs = { - nix-index.enable = true; - nix-index-database.comma.enable = true; - }; -} diff --git a/users/modules/cli/scripts/default.nix b/users/modules/cli/scripts/default.nix deleted file mode 100644 index 11974b4..0000000 --- a/users/modules/cli/scripts/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: -with lib; let - cfg = config.home.cli.scripts; - files = filesystem.listFilesRecursive ./.; - scriptFiles = builtins.filter (path: baseNameOf path != "default.nix") files; - scripts = map (file: (import file {inherit pkgs config;})) scriptFiles; -in { - options.home.cli.scripts.enable = mkEnableOption "Add custom scripts to PATH"; - config.home.packages = mkIf cfg.enable scripts; -} diff --git a/users/modules/cli/tealdeer.nix b/users/modules/cli/tealdeer.nix deleted file mode 100644 index 75cebfd..0000000 --- a/users/modules/cli/tealdeer.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - programs.tealdeer = { - enable = true; - enableAutoUpdates = true; - }; -} diff --git a/users/modules/cli/yt-dlp.nix b/users/modules/cli/yt-dlp.nix deleted file mode 100644 index 3185810..0000000 --- a/users/modules/cli/yt-dlp.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.home.cli.yt-dlp; -in { - options.home.cli.yt-dlp.enable = mkEnableOption "Enable yt-dlp"; - config.programs.yt-dlp = mkIf cfg.enable { - inherit (cfg) enable; - settings = { - embed-thumbnail = true; - embed-subs = true; - sub-langs = "all"; - }; - }; -} diff --git a/users/modules/default.nix b/users/modules/default.nix deleted file mode 100644 index d08e679..0000000 --- a/users/modules/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home; -in { - imports = [ - ./basics.nix - ./cli - ./desktop - ./dev - ./media - ./services - ./security - ./shell - ]; - - options.home = { - fullDesktop = mkEnableOption "Enable most modules"; - gpuType = mkOption { - type = types.nullOr (types.enum ["nvidia" "amd" "intel"]); - default = null; - example = "amd"; - }; - }; - config.home = { - cli.fullDesktop = mkDefault cfg.fullDesktop; - desktop.fullDesktop = mkDefault cfg.fullDesktop; - dev.fullDesktop = mkDefault cfg.fullDesktop; - media.fullDesktop = mkDefault cfg.fullDesktop; - security.fullDesktop = mkDefault cfg.fullDesktop; - myServices.fullDesktop = mkDefault cfg.fullDesktop; - }; -} diff --git a/users/modules/desktop/caelestia.nix b/users/modules/desktop/caelestia.nix deleted file mode 100644 index 2591b10..0000000 --- a/users/modules/desktop/caelestia.nix +++ /dev/null @@ -1,89 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.home.desktop.caelestia; -in { - options.home.desktop.caelestia = { - enable = mkEnableOption "Enables Caelestia Shell"; - idleTimeout = mkOption { - description = "Idle duration in seconds before locking the session"; - default = 60 * 60; # an hour - type = types.int; - }; - }; - config.programs.caelestia = mkIf cfg.enable { - inherit (cfg) enable; - systemd = { - enable = true; - target = "graphical-session.target"; - environment = ["QT3_QPA_PLATFORMTHEME=gtk3"]; - }; - settings = { - paths.wallpaperDir = "~/Pictures/Wallpapers/nord"; - general = { - apps = { - terminal = ["kitty"]; - audio = ["pavucontrol"]; - playback = ["mpv"]; - explorer = ["${pkgs.nemo-with-extensions}/bin/nemo"]; - }; - idle = { - inhibitWhenAudio = true; - timeouts = [ - { - timeout = cfg.idleTimeout; - idleAction = "lock"; - } - ]; - }; - }; - background = { - desktopClock.enabled = true; - visualiser.enabled = true; - }; - dashboard = { - enabled = true; - showOnHover = true; - }; - launcher = { - enabled = true; - showOnHover = false; - useFuzzy = { - apps = true; - schemes = true; - wallpapers = true; - }; - }; - osd.enableMicrophone = true; - bar = { - status = { - showAudio = true; - showKbLayout = false; - }; - tray.compact = true; - }; - services = mkIf (config.home.gpuType != null) { - inherit (config.home) gpuType; - }; - session.commands = { - logout = ["uwsm" "stop"]; - shutdown = ["systemctl" "poweroff"]; - hibernate = ["systemctl" "hibernate"]; - reboot = ["systemctl" "reboot"]; - }; - utilities.toasts = { - capsLockChanged = false; - numLockChanged = false; - kbLayoutChanged = false; - }; - }; - cli = { - enable = true; - settings.theme.enableGtk = true; - }; - }; -} diff --git a/users/modules/desktop/default.nix b/users/modules/desktop/default.nix deleted file mode 100644 index e6f53ce..0000000 --- a/users/modules/desktop/default.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.home.desktop; -in { - imports = [ - ./caelestia.nix - ./firefox.nix - ./hyprland.nix - ./kdeconnect.nix - ./kitty.nix - ./obs.nix - ./rofi - ./spotify.nix - ./swaync.nix - ./theme.nix - ./waybar.nix - ./wl-kbptr.nix - ./wlr-which-key.nix - ./wlsunset.nix - ]; - - options.home.desktop.fullDesktop = mkEnableOption "Enable options for graphical environments"; - config.home.desktop = { - firefox.enable = mkDefault cfg.fullDesktop; - hyprland.enable = mkDefault cfg.fullDesktop; - kdeconnect.enable = mkDefault cfg.fullDesktop; - kitty.enable = mkDefault cfg.fullDesktop; - obs.enable = mkDefault cfg.fullDesktop; - rofi.enable = mkDefault cfg.fullDesktop; - spotify.enable = mkDefault cfg.fullDesktop; - spotify.spicetify.enable = mkDefault cfg.fullDesktop; - theme.enable = mkDefault cfg.fullDesktop; - wlr-which-key.enable = mkDefault cfg.fullDesktop; - }; -} diff --git a/users/modules/desktop/firefox.nix b/users/modules/desktop/firefox.nix deleted file mode 100644 index 753a76c..0000000 --- a/users/modules/desktop/firefox.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ - config, - lib, - inputs, - pkgs, - ... -}: -with lib; let - cfg = config.home.desktop.firefox; - inherit (pkgs.stdenv.hostPlatform) system; - zen = inputs.zen-browser.packages.${system}.default; - settingsToLines = settings: - concatStringsSep "\n" (mapAttrsToList (name: value: "set ${name} ${toString value}") settings); -in { - options.home.desktop.firefox = { - enable = mkEnableOption "enable Firefox"; - useZen = mkEnableOption "use Zen instead of Firefox"; - tridactyl = { - enable = mkEnableOption "enable Tridactyl"; - preConfig = mkOption { - description = "Lines to add to the beginning of tridactylrc"; - type = types.lines; - default = ""; - }; - config = mkOption { - type = with types; - attrsOf (oneOf [ - int - str - bool - ]); - description = "Tridactyl settings (converted to 'set key value' lines)"; - default = {}; - example = { - smoothscroll = true; - history = 1000; - }; - }; - extraConfig = mkOption { - description = "Extra lines to add to tridactylrc (for bindings, autocmds, etc)"; - type = types.lines; - default = ""; - }; - }; - }; - - config = mkIf cfg.enable { - home.sessionVariables.MOZ_ENABLE_WAYLAND = "1"; - programs.firefox = { - inherit (cfg) enable; - package = - if cfg.useZen - then zen - else pkgs.firefox; - nativeMessagingHosts = lists.optional cfg.tridactyl.enable pkgs.tridactyl-native; - configPath = ".mozilla/firefox"; - }; - xdg.configFile."tridactyl/tridactylrc" = mkIf cfg.tridactyl.enable { - text = concatStringsSep "\n" (filter (s: s != "") [ - cfg.tridactyl.preConfig - (settingsToLines (cfg.tridactyl.config - // { - browser = - if cfg.useZen - then "zen" - else "firefox"; - })) - cfg.tridactyl.extraConfig - ]); - }; - }; -} diff --git a/users/modules/desktop/hyprland.nix b/users/modules/desktop/hyprland.nix deleted file mode 100644 index d756ad0..0000000 --- a/users/modules/desktop/hyprland.nix +++ /dev/null @@ -1,190 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.home.desktop.hyprland; - laptops = ["gampo"]; - caelestiaEnabled = config.home.desktop.caelestia.enable; -in { - imports = [ - ./swaync.nix - ./waybar.nix - ./wlsunset.nix - ./hyprpaper.nix - ]; - - options.home.desktop.hyprland = { - enable = mkEnableOption "Enables Hyprland"; - emacsPkg = mkOption { - type = types.package; - default = config.home.dev.editors.emacs.package or pkgs.emacs; - example = pkgs.emacs; - }; - host = mkOption { - type = types.enum ["gampo" "marpa"]; - description = '' - Which host is Hyprland running on. - - This helps determine the monitors layout and enable battery support in waybar. - ''; - }; - }; - - config = mkIf cfg.enable { - home.desktop = { - hyprpaper.enable = mkDefault (! caelestiaEnabled); - rofi.enable = mkDefault true; - swaync.enable = mkDefault (! caelestiaEnabled); - waybar = { - enable = mkDefault (! caelestiaEnabled); - battery = mkDefault (builtins.elem cfg.host laptops); - }; - wlsunset.enable = mkDefault true; - }; - services.blueman-applet.enable = ! caelestiaEnabled; - wayland.windowManager.hyprland = { - enable = true; - systemd.enable = false; - importantPrefixes = ["$left" "$right" "$up" "$down" "$menu"]; - settings = { - env = [ - "XMODIFIERS,@im=fcitx" - "XCURSOR_SIZE,12" - ]; - input = { - kb_layout = "fr,us"; - kb_variant = "bepo_afnor,"; - numlock_by_default = true; - follow_mouse = 1; - touchpad.natural_scroll = false; - sensitivity = "0"; - }; - device = { - name = "wacom-usb-bamboo-pad-finger"; - sensitivity = 0.5; - }; - monitor = - { - "marpa" = [ - "DP-1, 3440x1440@144, 1080x550, 1" - # "DP-1, 2560x1440@144, 1080x550, 1" # streaming - "DP-2, 2560x1080@60, 0x0, 1, transform, 1" - ]; - "gampo" = []; - }."${cfg.host}"; - general = { - gaps_in = 5; - gaps_out = 20; - border_size = 2; - "col.active_border" = "rgb(81a1c1) rgb(a3be8c) 45deg"; - "col.inactive_border" = "rgb(4c566a)"; - layout = "master"; - }; - master = { - orientation = "center"; - new_status = "inherit"; - }; - workspace = [ - "1, layoutopt:orientation:bottom" - "9, layoutopt:orientation:bottom" - "10, layoutopt:orientation:bottom" - ]; - decoration = { - rounding = 20; - }; - animations = { - enabled = true; - animation = [ - # "windows, 1, 7, myBezier" - "windowsOut, 1, 7, default, popin 80%" - "border, 1, 10, default" - "borderangle, 1, 8, default" - "fade, 1, 7, default" - "workspaces, 1, 6, default" - ]; - }; - dwindle.preserve_split = true; - exec-once = - [ - "pactl load-module module-switch-on-connect" - "${pkgs.mpc}/bin/mpc stop" - "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" - "${pkgs.mozc}/lib/mozc/mozc_server" - "${pkgs.fcitx5}/bin/fcitx5 -d" - ] - ++ lib.lists.optional (! caelestiaEnabled) "${pkgs.networkmanagerapplet}/bin/nm-applet"; - }; - extraConfig = '' - device { - name = wacom-usb-bamboo-pad-finger - sensitivity = 0.5 - accel_profile = adaptive - } - - $left = c - $right = r - $up = s - $down = t - $menu = rofi -combi-modi drun,calc -show combi - - bind = SUPER, Return, exec, ${pkgs.kitty}/bin/kitty ${pkgs.tmux}/bin/tmux - bind = SUPER, Space, exec, ${pkgs.wlr-which-key}/bin/wlr-which-key - bind = , Print, exec, ${pkgs.wlr-which-key}/bin/wlr-which-key -k s - - bindl = , XF86AudioPlay, exec, playerctl play-pause - bindl = , XF86AudioPause, exec, playerctl pause - bindl = , XF86AudioStop, exec, playerctl stop - bindl = , XF86AudioPrev, exec, playerctl previous - bindl = , XF86AudioNext, exec, playerctl next - bindl = , XF86AudioForward, exec, playerctl position +1 - bindl = , XF86AudioRewind, exec, playerctl position -1 - bindl = , XF86AudioRaiseVolume, exec, pamixer -i 2 - bindl = , XF86AudioLowerVolume, exec, pamixer -d 2 - bindl = , XF86MonBrightnessUp, exec, xbacklight -perceived -inc 2 - bindl = , XF86MonBrightnessDown, exec, xbacklight -perceived -dec 2 - bindl = , XF86KbdBrightnessUp, exec, xbacklight -perceived -inc 2 - bindl = , XF86KbdBrightnessDown, exec, xbacklight -perceived -dec 2 - bind = SUPER, a, exec, hyprctl switchxkblayout glove80-keyboard next - bind = SUPER, $left, movefocus, l - bind = SUPER, $right, movefocus, r - bind = SUPER, $up, movefocus, u - bind = SUPER, $down, movefocus, d - bind = SUPER_SHIFT, $left, movewindow, l - bind = SUPER_SHIFT, $right, movewindow, r - bind = SUPER_SHIFT, $up, movewindow, u - bind = SUPER_SHIFT, $down, movewindow, d - bind = SUPER_CTRL_SHIFT, $left, moveworkspacetomonitor, e+0 +1 - bind = SUPER_CTRL_SHIFT, $right, moveworkspacetomonitor, e+0 -1 - bind = SUPER, Tab, cyclenext, - bind = SUPER_SHIFT, Tab, cyclenext, prev - bindm = SUPER, mouse:272, movewindow - bindm = SUPER, mouse:273, resizewindow - bind = SUPER, quotedbl, workspace, 1 - bind = SUPER, guillemotleft, workspace, 2 - bind = SUPER, guillemotright, workspace, 3 - bind = SUPER, parenleft, workspace, 4 - bind = SUPER, parenright, workspace, 5 - bind = SUPER, at, workspace, 6 - bind = SUPER, plus, workspace, 7 - bind = SUPER, minus, workspace, 8 - bind = SUPER, slash, workspace, 9 - bind = SUPER, asterisk, workspace, 10 - bind = SUPER, mouse_down, workspace, e+1 - bind = SUPER, mouse_up, workspace, e-1 - bind = SUPER_SHIFT, quotedbl, movetoworkspace, 1 - bind = SUPER_SHIFT, guillemotleft, movetoworkspace, 2 - bind = SUPER_SHIFT, guillemotright, movetoworkspace, 3 - bind = SUPER_SHIFT, parenleft, movetoworkspace, 4 - bind = SUPER_SHIFT, parenright, movetoworkspace, 5 - bind = SUPER_SHIFT, at, movetoworkspace, 6 - bind = SUPER_SHIFT, plus, movetoworkspace, 7 - bind = SUPER_SHIFT, minus, movetoworkspace, 8 - bind = SUPER_SHIFT, slash, movetoworkspace, 9 - bind = SUPER_SHIFT, asterisk, movetoworkspace, 10 - ''; - }; - }; -} diff --git a/users/modules/desktop/hyprpaper.nix b/users/modules/desktop/hyprpaper.nix deleted file mode 100644 index d74aa05..0000000 --- a/users/modules/desktop/hyprpaper.nix +++ /dev/null @@ -1,88 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.home.desktop.hyprpaper; -in { - options.home.desktop.hyprpaper = { - enable = mkEnableOption "Enables Hyprpaper"; - default = mkOption { - type = types.str; - default = "/home/phundrak/Pictures/Wallpapers/nord/Nordic6.jpg"; - example = "/home/user/image.jpg"; - }; - wallpapers-dir = mkOption { - type = types.str; - default = "/home/phundrak/Pictures/Wallpapers/nord/"; - example = "/home/user/Pictures/"; - }; - rotation-interval = mkOption { - type = types.str; - default = "5m"; - example = "10m"; - description = "Interval between wallpaper rotations"; - }; - }; - config = mkIf cfg.enable { - services.hyprpaper = { - inherit (cfg) enable; - settings = { - ipc = "on"; - splash = false; - preload = cfg.default; - wallpaper = ", ${cfg.default}"; - }; - }; - systemd.user = { - services.hyprpaper-rotation = { - Unit = { - Description = "Rotate Hyprpaper wallpaper"; - After = "graphical-session.target"; - }; - Service = { - Type = "oneshot"; - ExecCondition = "${pkgs.procps}/bin/pidof Hyprland"; - ExecStart = "${config.home.homeDirectory}/.config/hypr/hyprpaper-rotate.sh"; - }; - }; - - timers.hyprpaper-rotation = { - Unit = { - Description = "Timer for rotating Hyprpaper wallpaper"; - }; - Timer = { - OnBootSec = cfg.rotation-interval; - OnUnitActiveSec = cfg.rotation-interval; - }; - Install = { - WantedBy = ["timers.target"]; - }; - }; - }; - home.file.".config/hypr/hyprpaper-rotate.sh" = { - text = '' - #!/usr/bin/env bash - set -euo pipefail - - WALLPAPER_DIR="${cfg.wallpapers-dir}" - - # Find a random wallpaper - WP=$(find "$WALLPAPER_DIR" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) | shuf -n 1) - - if [ -z "$WP" ]; then - echo "No wallpapers found in $WALLPAPER_DIR" - exit 1 - fi - - echo "Setting wallpaper to: $WP" - - # Load and set the wallpaper - ${pkgs.hyprland}/bin/hyprctl hyprpaper preload "$WP" && ${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ",$WP" - ''; - executable = true; - }; - }; -} diff --git a/users/modules/desktop/kdeconnect.nix b/users/modules/desktop/kdeconnect.nix deleted file mode 100644 index adda4a7..0000000 --- a/users/modules/desktop/kdeconnect.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.home.desktop.kdeconnect; -in { - options.home.desktop.kdeconnect.enable = mkEnableOption "Enable KDE Connect"; - config.services.kdeconnect = mkIf cfg.enable { - enable = true; - indicator = true; - }; -} diff --git a/users/modules/desktop/kitty.nix b/users/modules/desktop/kitty.nix deleted file mode 100644 index 74135ec..0000000 --- a/users/modules/desktop/kitty.nix +++ /dev/null @@ -1,114 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.home.desktop.kitty; -in { - options.home.desktop.kitty.enable = mkEnableOption "Enable kitty terminal"; - config.programs.kitty = mkIf cfg.enable { - inherit (cfg) enable; - themeFile = "Nord"; - font = { - package = pkgs.cascadia-code; - name = "Cascadia Code"; - size = 10; - }; - settings = { - enable_audio_bell = true; - visual_bell_duration = 0.1; - enabled_layouts = "fat,fat:mirrored=true,tall,tall:mirrored=true"; - kitty_mod = "ctrl+shift"; - disable_ligatures = "never"; - font_features = "Cascadia-Mono +onum +zero"; - cursor_shape = "block"; - scrollback_lines = "10000"; - mouse_hide_wait = 3.0; - detect_urls = true; - background_opacity = 0.7; - }; - keybindings = let - prefix = "kitty_mod+space"; - in { - "alt+c" = "copy_to_clipboard"; - "kitty_mod+c" = "copy_to_clipboard"; - "alt+v" = "paste_from_clipboard"; - "kitty_mod+v" = "paste_from_clipboard"; - - "${prefix}>s>c" = "show_scrollback"; - "${prefix}>s>down" = "scroll_line_down"; - "${prefix}>s>t" = "scroll_line_down"; - "${prefix}>s>up" = "scroll_line_up"; - "${prefix}>s>s" = "scroll_line_up"; - "${prefix}>s>end" = "scroll_end"; - "${prefix}>s>home" = "scroll_home"; - "${prefix}>s>page_down" = "scroll_page_down"; - "${prefix}>s>page_up" = "scroll_page_up"; - - "${prefix}>enter" = "new_window"; - "${prefix}>w>q" = "close_window"; - "${prefix}>w>p" = "next_window"; - "${prefix}>w>n" = "previous_window"; - "${prefix}>w>f" = "move_window_forward"; - "${prefix}>w>b" = "move_window_backward"; - "${prefix}>w>t" = "move_window_to_top"; - "${prefix}>w>r" = "start_resizing_window"; - "${prefix}>w>1" = "first_window"; - "${prefix}>w>2" = "second_window"; - "${prefix}>w>3" = "third_window"; - "${prefix}>w>4" = "fourth_window"; - "${prefix}>w>5" = "fifth_window"; - "${prefix}>w>6" = "sixth_window"; - "${prefix}>w>7" = "seventh_window"; - "${prefix}>w>8" = "eighth_window"; - "${prefix}>w>9" = "ninth_window"; - "${prefix}>w>0" = "tenth_window"; - - "${prefix}>tab>n" = "next_tab"; - "${prefix}>tab>p" = "previous_tab"; - "${prefix}>tab>c" = "new_tab"; - "${prefix}>tab>q" = "close_tab"; - "${prefix}>tab>shift+n" = "move_tab_backward"; - "${prefix}>tab>shift+p" = "move_tab_forward"; - "${prefix}>tab>t" = "set_tab_title"; - - "${prefix}>l" = "next_layout"; - - "${prefix}>f>equal" = "change_font_size all 0"; - "${prefix}>f>kp_add" = "change_font_size all +2.0"; - "${prefix}>f>plus" = "change_font_size all +2.0"; - "${prefix}>f>kp_subtract" = "change_font_size all -2.0"; - "${prefix}>f>minus" = "change_font_size all -2.0"; - - "${prefix}>shift+h" = "kitten hints"; - "${prefix}>h>p" = "kitten hints --type path --program -"; - "${prefix}>h>shift+p" = "kitten hints --type path"; - "${prefix}>h>l" = "kitten hints --type line --program -"; - "${prefix}>h>w" = "kitten hints --type word --program -"; - "${prefix}>h>h" = "kitten hints --type hash --program -"; - "${prefix}>h>n" = "kitten hints --type linenum"; - "${prefix}>h>y" = "kitten hints --type hyperlink"; - - "${prefix}>f10" = "toggle_maximized"; - "${prefix}>f11" = "toggle_fullscreen"; - - "${prefix}>a>equal" = "set_background_opacity 1"; - "${prefix}>a>d" = "set_background_opacity default"; - "${prefix}>a>plus" = "set_background_opacity +0.1"; - "${prefix}>a>up" = "set_background_opacity +0.1"; - "${prefix}>a>kp_add" = "set_background_opacity +0.1"; - "${prefix}>a>minus" = "set_background_opacity -0.1"; - "${prefix}>a>down" = "set_background_opacity -0.1"; - "${prefix}>a>kp_substract" = "set_background_opacity -0.1"; - - "${prefix}>delete" = "clear_terminal reset active"; - "${prefix}>escape" = "kitty_shell window"; - "${prefix}>f2" = "edit_config_file"; - "${prefix}>n" = "new_os_window"; - "${prefix}>o" = "pass_selection_to_program"; - "${prefix}>u" = "kitten unicode_input"; - }; - }; -} diff --git a/users/modules/desktop/obs.nix b/users/modules/desktop/obs.nix deleted file mode 100644 index 71657b8..0000000 --- a/users/modules/desktop/obs.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.home.desktop.obs; - obs-image-reaction = pkgs.callPackage ../../../packages/obs-image-reaction.nix {}; -in { - options.home.desktop.obs.enable = mkEnableOption "Enables OBS Studio"; - config.programs.obs-studio = mkIf cfg.enable { - inherit (cfg) enable; - plugins = with pkgs.obs-studio-plugins; [ - input-overlay - obs-backgroundremoval - obs-markdown - obs-mute-filter - obs-pipewire-audio-capture - obs-scale-to-sound - obs-source-clone - obs-source-record - obs-tuna - obs-image-reaction - ]; - }; -} diff --git a/users/modules/desktop/rofi/default.nix b/users/modules/desktop/rofi/default.nix deleted file mode 100644 index dde9ddf..0000000 --- a/users/modules/desktop/rofi/default.nix +++ /dev/null @@ -1,107 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.home.desktop.rofi; - inherit (config.lib.formats.rasi) mkLiteral; -in { - options.home.desktop.rofi = { - enable = mkEnableOption "Enable Rofi"; - }; - config = mkIf cfg.enable { - home.packages = with pkgs; [rofi-bluetooth]; - programs.rofi = { - enable = true; - plugins = with pkgs; [ - rofi-calc - rofi-emoji - ]; - terminal = "${pkgs.kitty}/bin/kitty"; - location = "center"; - modes = ["drun" "emoji" "calc" "combi"]; - extraConfig.show-icons = true; - theme = { - "*" = { - font = "Cascadia Code 14"; - blur = true; - padding = mkLiteral "10px"; - background-color = mkLiteral "transparent"; - border-radius = mkLiteral "0px"; - }; - window = { - width = mkLiteral "1050px"; - height = mkLiteral "625px"; - location = mkLiteral "center"; - blur = true; - border = mkLiteral "2px"; - border-radius = mkLiteral "3px"; - border-color = mkLiteral "#61afef"; - background-color = mkLiteral "transparent"; - padding = mkLiteral "0px"; - margin = mkLiteral "30px 50px"; - }; - mainbox = { - orientation = mkLiteral "horizontal"; - children = map mkLiteral ["borderbox"]; - spacing = mkLiteral "0px"; - padding = mkLiteral "0px"; - }; - borderbox = { - orientation = mkLiteral "horizontal"; - children = map mkLiteral ["imagebox" "contentbox"]; - padding = mkLiteral "0px"; - spacing = mkLiteral "0px"; - border-radius = mkLiteral "3px"; - }; - contentbox = { - orientation = mkLiteral "vertical"; - children = map mkLiteral ["entry" "listview"]; - spacing = mkLiteral "0px"; - padding = mkLiteral "0px"; - expand = true; - }; - imagebox = { - background-image = mkLiteral "url(\"${./image.jpg}\")"; - background-repeat = false; - size = mkLiteral "200px 625px"; - }; - element = { - border-radius = mkLiteral "0px"; - }; - "element-text, element-icon" = { - padding = mkLiteral "6px 8px"; - spacing = mkLiteral "2px"; - text-color = mkLiteral "#fab387"; - }; - "element selected" = { - background-color = mkLiteral "#191919"; - text-color = mkLiteral "#e5c07b"; - border-radius = mkLiteral "3px"; - }; - prompt = { - enabled = false; - background-color = mkLiteral "transparent"; - text-color = mkLiteral "#61afef"; - padding = mkLiteral "5px 10px"; - }; - entry = { - padding = mkLiteral "8px"; - expand = false; - font = "Cascadia Code 14"; - text-color = mkLiteral "#fab387"; - border-radius = mkLiteral "0px 3px 0px 0px"; - background-color = mkLiteral "#292e36"; - }; - listview = { - lines = mkLiteral "1"; - background-color = mkLiteral "rgba(46, 52, 64, 0.8)"; - border-radius = mkLiteral "0px 0px 3px 0px"; - padding = mkLiteral "5px"; - }; - }; - }; - }; -} diff --git a/users/modules/desktop/spotify.nix b/users/modules/desktop/spotify.nix deleted file mode 100644 index 03ea81d..0000000 --- a/users/modules/desktop/spotify.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - pkgs, - config, - lib, - inputs, - ... -}: -with lib; let - inherit (pkgs.stdenv.hostPlatform) system; - cfg = config.home.desktop.spotify; - spicePkgs = inputs.spicetify.legacyPackages.${system}; -in { - options.home.desktop.spotify = { - enable = mkEnableOption "Enable Spotify"; - spicetify.enable = mkEnableOption "Enable Spicetify"; - }; - config.programs = mkIf cfg.enable { - spotify-player.enable = cfg.enable; - spicetify = mkIf cfg.spicetify.enable { - inherit (cfg.spicetify) enable; - theme = spicePkgs.themes.sleek; - colorScheme = "Nord"; - }; - }; -} diff --git a/users/modules/desktop/swaync.nix b/users/modules/desktop/swaync.nix deleted file mode 100644 index 37af829..0000000 --- a/users/modules/desktop/swaync.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.home.desktop.swaync; -in { - options.home.desktop.swaync.enable = mkEnableOption "Enables swaync"; - config = mkIf cfg.enable { - services.swaync.enable = true; - home.packages = [pkgs.swaynotificationcenter]; - }; -} diff --git a/users/modules/desktop/theme.nix b/users/modules/desktop/theme.nix deleted file mode 100644 index ea8d5c5..0000000 --- a/users/modules/desktop/theme.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: -with lib; let - cfg = config.home.desktop.theme; -in { - options.home.desktop.theme.enable = mkEnableOption "Enable theme options"; - config = mkIf cfg.enable { - gtk = { - enable = true; - colorScheme = "dark"; - iconTheme = { - name = "Nordzy-icons"; - package = pkgs.nordzy-icon-theme; - }; - theme = { - package = pkgs.nordic; - name = "Nordic"; - }; - gtk4.theme = config.gtk.theme; - }; - home.pointerCursor = { - enable = true; - gtk.enable = true; - hyprcursor.enable = config.home.desktop.hyprland.enable; - name = "Nordzy-cursors"; - package = pkgs.nordzy-cursor-theme; - }; - qt.enable = true; - }; -} diff --git a/users/modules/desktop/waybar.nix b/users/modules/desktop/waybar.nix deleted file mode 100644 index e90f74e..0000000 --- a/users/modules/desktop/waybar.nix +++ /dev/null @@ -1,154 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.desktop.waybar; -in { - options.home.desktop.waybar = { - enable = mkEnableOption "Enables waybar."; - battery = mkEnableOption "Enables battery support."; - style = mkOption { - type = types.path; - example = ./style.css; - }; - }; - config.programs.waybar = mkIf cfg.enable { - inherit (cfg) enable; - systemd.enable = true; - settings = { - topBar = { - height = 24; - spacing = 2; - modules-left = ["hyprland/workspaces" "hyprland/submap" "hyprland/window"]; - modules-center = []; - modules-right = [ - "idle_inhibitor" - "group/audio" - "group/hardware" - "network" - "privacy" - "clock" - "tray" - ]; - - idle_inhibitor = { - format = "{icon}"; - format-icons = { - activated = ""; - deactivated = ""; - }; - }; - - mpris = { - dynamic-order = ["title" "artist" "album"]; - dynamic-importance-order = ["title" "artist" "album"]; - format = "DEFAULT: {player_icon} {dynamic}"; - format-paused = "DEFAULT: {status_icon} {dynamic}"; - player-icons = { - default = "▶"; - mpv = "🎵"; - }; - status-icons.paused = "⏸"; - ignored-players = []; - }; - - pulseaudio = { - format = "{volume}% {icon} {format_source}"; - format-bluetooth = "{volume}% {icon} {format_source}"; - format-bluetooth-muted = " {icon} {format_source}"; - format-muted = " {format_source}"; - format-source = "{volume}% "; - format-source-muted = ""; - format-icons = { - headphone = ""; - hands-free = ""; - headset = ""; - phone = ""; - portable = ""; - car = ""; - default = ["" "" ""]; - }; - on-click = "pavucontrol"; - }; - - network = { - format-wifi = "{essid} ({signalStrength}%) "; - format-ethernet = "{ipaddr}/{cidr} "; - tooltip-format = "{ifname} via {gwaddr} "; - format-linked = "{ifname} (No IP) "; - format-disconnected = "Disconnected ⚠"; - format-alt = "{ifname}: {ipaddr}/{cidr}"; - }; - - "group/audio" = { - modules = ["pulseaudio" "pulseaudio/slider" "mpris"]; - orientation = "inherit"; - drawer.transition-duration = 300; - }; - - "group/hardware" = { - modules = lists.optional cfg.battery "battery" ++ ["cpu" "memory" "disk"]; - orientation = "inherit"; - drawer.transition-duration = 300; - }; - - cpu = { - format = "{usage}% "; - tooltip = false; - }; - - memory.format = "{}% "; - - disk = { - format = "{path}: {used}/{total} ({percentage_used}%)"; - unit = "GB"; - }; - - battery = { - states = { - good = 90; - warning = 30; - critical = 15; - }; - format = "{capacity}% {icon}"; - format-charging = "{capacity}% "; - format-plugged = "{capacity}% "; - format-alt = "{time} {icon}"; - # An empty format will hide the module - format-good = ""; - format-full = ""; - format-icons = ["" "" "" "" ""]; - }; - - clock = { - timezones = ["Europe/Paris" "Asia/Tokyo" "America/New_York" "America/Los_Angeles" "Asia/Kathmandu"]; - tooltip-format = "{:%Y %B}\n{calendar}"; - format-alt = "{:%Y-%m-%d}"; - actions = { - on-click-right = "mode"; - on-scroll-up = "tz_up"; - on-scroll-down = "tz_down"; - }; - calendar = { - mode = "year"; - mode-mon-col = 3; - weeks-pos = "right"; - on-scroll = 1; - format = { - months = "{}"; - days = "{}"; - weeks = "W{:%W}"; - weekdays = "{}"; - today = "{}"; - }; - }; - }; - - tray.spacing = 10; - }; - }; - style = builtins.readFile cfg.style; - }; -} diff --git a/users/modules/desktop/wl-kbptr.nix b/users/modules/desktop/wl-kbptr.nix deleted file mode 100644 index 95b5581..0000000 --- a/users/modules/desktop/wl-kbptr.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - configDir = config.xdg.configHome; - cfg = config.home.desktop.wl-kbptr; - iniFormat = pkgs.formats.ini {}; -in { - options.home.desktop.wl-kbptr = { - enable = mkEnableOption "enable wl-kbptr"; - config = mkOption { - inherit (iniFormat) type; - default = {}; - description = '' - Options to add to the {file}`config` file. See - - for options. - ''; - example = { - general = { - home_row_keys = "abcd"; - }; - }; - }; - }; - config = mkIf cfg.enable { - home = { - packages = [pkgs.wl-kbptr]; - file."${configDir}/wl-kbptr/config" = mkIf (cfg.config != {}) { - source = iniFormat.generate "wl-kbptr-config" cfg.config; - }; - }; - }; -} diff --git a/users/modules/desktop/wlr-which-key.nix b/users/modules/desktop/wlr-which-key.nix deleted file mode 100644 index 0c770d0..0000000 --- a/users/modules/desktop/wlr-which-key.nix +++ /dev/null @@ -1,189 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: let - inherit - (lib) - literalExpression - mkIf - mkOption - mkEnableOption - types - ; - cfg = config.home.desktop.wlr-which-key; - yamlFormat = pkgs.formats.yaml {}; - - # Convert kebab-case to snake_case - toSnakeCase = str: builtins.replaceStrings ["-"] ["_"] str; - - # Recursively filter out null values and convert kebab-case keys to snake_case - filterNulls = value: - if lib.isAttrs value - then lib.mapAttrs' (n: v: lib.nameValuePair (toSnakeCase n) (filterNulls v)) (lib.filterAttrs (_: v: v != null) value) - else if lib.isList value - then map filterNulls value - else value; - menuEntryType = types.submodule { - freeformType = yamlFormat.type; - options = with types; { - key = mkOption { - type = str; - example = "p"; - }; - desc = mkOption { - type = str; - example = "Power"; - }; - cmd = mkOption { - type = nullOr str; - default = null; - example = "echo example"; - }; - keep-open = mkOption { - type = nullOr bool; - default = null; - example = true; - }; - submenu = mkOption { - type = nullOr (listOf menuEntryType); - default = null; - example = literalExpression '' - [ - { key = "s"; desc = "Suspend"; cmd = "systemctl suspend"; } - { key = "r"; desc = "Reboot"; cmd = "systemctl reboot"; } - { key = "o"; desc = "Poweroff"; cmd = "systemctl poweroff"; } - ] - ''; - }; - }; - }; - settingsType = types.submodule { - freeformType = yamlFormat.type; - options = with types; { - background = mkOption { - type = nullOr str; - default = null; - example = "#282828FF"; - }; - color = mkOption { - type = nullOr str; - default = null; - example = "#FBF1C7FF"; - }; - border = mkOption { - type = nullOr str; - default = null; - example = "#8EC07CFF"; - }; - anchor = mkOption { - type = nullOr (enum ["center" "top" "bottom" "left" "right" "top-left" "top-right" "bottom-left" "bottom-right"]); - default = null; - example = "top-left"; - }; - margin-top = mkOption { - type = nullOr int; - default = null; - example = "0"; - }; - margin-right = mkOption { - type = nullOr int; - default = null; - example = "0"; - }; - margin-bottom = mkOption { - type = nullOr int; - default = null; - example = "0"; - }; - margin-left = mkOption { - type = nullOr int; - default = null; - example = "0"; - }; - font = mkOption { - type = nullOr str; - default = null; - example = "monospace 10"; - }; - separator = mkOption { - type = nullOr str; - default = null; - example = " ➜ "; - }; - border-width = mkOption { - type = nullOr (either float int); - default = null; - example = 4.0; - }; - corder-r = mkOption { - type = nullOr (either float int); - default = null; - example = 20.0; - }; - padding = mkOption { - type = nullOr (either float int); - default = null; - example = 15.0; - }; - rows-per-column = mkOption { - type = nullOr int; - default = null; - example = 5; - }; - column-padding = mkOption { - type = nullOr (either float int); - default = null; - example = 25.0; - }; - inhibit-compositor-keyboard-shortcuts = mkOption { - type = bool; - default = true; - example = false; - }; - auto_kbd_layout = mkOption { - type = bool; - default = true; - example = false; - }; - namespace = mkOption { - type = nullOr str; - default = null; - example = "wlr_which_key"; - }; - menu = mkOption { - type = listOf menuEntryType; - default = []; - example = literalExpression '' - [ - { - key = "p"; - desc = "Power"; - submenu = [ - { key = "s"; desc = "Suspend"; cmd = "systemctl suspend"; } - { key = "r"; desc = "Reboot"; cmd = "systemctl reboot"; } - { key = "o"; desc = "Poweroff"; cmd = "systemctl poweroff"; } - ]; - } - ] - ''; - }; - }; - }; -in { - options.home.desktop.wlr-which-key = { - enable = mkEnableOption "Enables wlr-which-key"; - package = lib.mkPackageOption pkgs "wlr-which-key" {}; - settings = mkOption { - type = settingsType; - default = {}; - description = "Configuration written to {file}`$XDG_CONFIG_HOME/wlr-which-key/config.yaml`."; - }; - }; - config = mkIf cfg.enable { - xdg.configFile = { - "wlr-which-key/config.yaml".source = yamlFormat.generate "wlr-which-key-config.yml" (filterNulls cfg.settings); - }; - }; -} diff --git a/users/modules/desktop/wlsunset.nix b/users/modules/desktop/wlsunset.nix deleted file mode 100644 index b94c8d0..0000000 --- a/users/modules/desktop/wlsunset.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.desktop.wlsunset; -in { - options.home.desktop.wlsunset = { - enable = mkEnableOption "Enables wlsunset"; - latitude = mkOption { - type = with types; nullOr (oneOf [str ints.unsigned float]); - default = 48.5; - }; - longitude = mkOption { - type = with types; nullOr (oneOf [str ints.unsigned float]); - default = 2.2; - }; - }; - - config.services.wlsunset = mkIf cfg.enable { - inherit (cfg) enable latitude longitude; - }; -} diff --git a/users/modules/dev/ai/claude.nix b/users/modules/dev/ai/claude.nix deleted file mode 100644 index 8f3d00f..0000000 --- a/users/modules/dev/ai/claude.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.home.dev.ai.claude; - jsonFormat = pkgs.formats.json {}; -in { - options.home.dev.ai.claude = { - enable = mkEnableOption "Enables Claude-related packages"; - mcpServers = mkOption { - inherit (jsonFormat) type; - default = {}; - }; - }; - config = mkIf cfg.enable { - home.packages = let - claude-jj = pkgs.writeShellScriptBin "claude-jj" '' - ${pkgs.claude-code}/bin/claude --append-system-prompt 'CRITICAL: This repository uses Jujutsu (jj), NOT git. Never use git commands. Use jj equivalents.' "$@" - ''; - in [claude-jj pkgs.sox]; - programs.claude-code = { - inherit (cfg) enable mcpServers; - }; - }; -} diff --git a/users/modules/dev/ai/default.nix b/users/modules/dev/ai/default.nix deleted file mode 100644 index d6a6a2f..0000000 --- a/users/modules/dev/ai/default.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.home.dev.ai; - jsonFormat = pkgs.formats.json {}; -in { - imports = [ - ./claude.nix - ./ollama.nix - ./opencode.nix - ]; - - options.home.dev.ai = { - enable = mkEnableOption "Enables AI features"; - lmStudio = mkOption { - default = cfg.enable; - example = true; - description = "Enables LM Studio. Enabled by default when AI is enabled."; - }; - mcpServers = mkOption { - inherit (jsonFormat) type; - default = {}; - }; - }; - config = { - home = mkIf cfg.enable { - dev.ai = { - claude = { - enable = mkDefault cfg.enable; - mcpServers = mkDefault cfg.mcpServers; - }; - ollama.enable = mkDefault cfg.enable; - opencode.enable = mkDefault cfg.enable; - }; - packages = lists.optional cfg.lmStudio pkgs.lmstudio; - }; - programs.mcp = mkIf (cfg.mcpServers != {}) { - enable = true; - servers = cfg.mcpServers; - }; - }; -} diff --git a/users/modules/dev/ai/ollama.nix b/users/modules/dev/ai/ollama.nix deleted file mode 100644 index 963429c..0000000 --- a/users/modules/dev/ai/ollama.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.dev.ai.ollama; -in { - options.home.dev.ai.ollama = { - enable = mkEnableOption "Enables Ollama"; - gpu = mkOption { - type = types.nullOr (types.enum [false "rocm" "cuda"]); - example = "rocm"; - default = null; - description = "Which type of GPU should be used for hardware acceleration"; - }; - }; - - config = { - services.ollama = mkIf cfg.enable { - inherit (cfg) enable; - acceleration = cfg.gpu; - host = "0.0.0.0"; - environmentVariables = { - OLLAMA_CONTEXT_LENGTH = "8192"; - OLLAMA_MAX_LOADED_MODELS = "1"; - OLLAMA_KEEP_ALIVE = "10m"; - }; - }; - home.sessionVariables.OLLAMA_API_BASE = "http://${config.services.ollama.host}:11434/"; - }; -} diff --git a/users/modules/dev/ai/opencode.nix b/users/modules/dev/ai/opencode.nix deleted file mode 100644 index 12c3433..0000000 --- a/users/modules/dev/ai/opencode.nix +++ /dev/null @@ -1,100 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.home.dev.ai.opencode; - - # On x86_64-linux CPUs without AVX2, use the baseline bun variant - # when building opencode - the regular `bun` from nixpkgs requires - # AVX2 and crashes on older hardware, such as my Thinkpad x220’s - # Intel Core i5 2640M. - needsBaselineBun = - pkgs.stdenv.hostPlatform.isx86_64 && !pkgs.stdenv.hostPlatform.avx2Support; - bunBaseline = pkgs.callPackage ../../../../packages/bun-baseline.nix {}; - - defaultPackageCli = - if needsBaselineBun - then pkgs.opencode.override {bun = bunBaseline;} - else pkgs.opencode; - - defaultPackageDesktop = - if needsBaselineBun - then pkgs.opencode-desktop.override {bun = bunBaseline;} - else pkgs.opencode-desktop; - - corsList = domains: lists.remove "" (lists.forEach (strings.splitString "," domains) trim); -in { - options.home.dev.ai.opencode = { - enable = mkEnableOption "Enables OpenCode"; - package = mkOption { - type = types.package; - default = defaultPackageCli; - description = "The CLI package for OpenCode"; - }; - settings = mkOption { - type = types.json; - default = {}; - }; - tui = mkOption { - type = types.json; - default = {}; - }; - desktop = { - enable = mkEnableOption "Enables the desktop app"; - package = mkOption { - type = types.package; - default = defaultPackageDesktop; - description = "The desktop package for OpenCode"; - }; - }; - web = { - enable = mkEnableOption "Enables OpenCode web"; - extraArgs = mkOption { - type = types.listOf types.str; - default = []; - example = [ - "--hostname" - "0.0.0.0" - ]; - }; - cors = mkOption { - type = types.nullOr (types.either types.str types.path); - default = null; - example = "opencode.example.com,code.example.com"; - description = '' - Either a string containing the domain allowed to connect to OpenCode’s web instance, or a file containing the target value. The latter is useful when using secret management if you don’t want to publicize the hostname of your OpenCode instance. - - If you want to use multiple domains, you can separate them with a comma. - ''; - }; - mdns = { - enable = mkEnableOption "Enables mDNS with OpenCode"; - hostname = mkOption { - type = types.nullOr types.str; - default = null; - example = "opencode.local"; - }; - }; - }; - }; - config.programs.opencode = mkIf cfg.enable { - inherit (cfg) enable tui package; - enableMcpIntegration = true; - extraPackages = with pkgs; [uv] ++ lists.optional cfg.desktop.enable cfg.desktop.package; - settings = - { - server = mkIf cfg.web.mdns.enable { - mdns = true; - mdnsDomain = mkIf (cfg.web.mdns.hostname != null) cfg.web.mdns.hostname; - cors = corsList cfg.web.cors; - }; - } - // cfg.settings; - web = { - inherit (cfg.web) enable extraArgs; - }; - }; -} diff --git a/users/modules/dev/default.nix b/users/modules/dev/default.nix deleted file mode 100644 index 74de0d9..0000000 --- a/users/modules/dev/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.dev; -in { - imports = [ - ./ai - ./editors - ./vcs - ]; - - options.home.dev.fullDesktop = mkEnableOption "Enables everything except AI"; - config.home.dev = { - vcs.fullDesktop = mkDefault cfg.fullDesktop; - editors.fullDesktop = mkDefault cfg.fullDesktop; - }; -} diff --git a/users/modules/dev/editors/default.nix b/users/modules/dev/editors/default.nix deleted file mode 100644 index 06023db..0000000 --- a/users/modules/dev/editors/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.dev.editors; -in { - imports = [ - ./emacs.nix - ]; - - options.home.dev.editors.fullDesktop = mkEnableOption "Enable all editors"; - config.home.dev.editors.emacs = { - enable = mkDefault cfg.fullDesktop; - service = mkDefault cfg.fullDesktop; - mu4eMime = mkDefault cfg.fullDesktop; - org-protocol = mkDefault cfg.fullDesktop; - }; -} diff --git a/users/modules/dev/editors/emacs.nix b/users/modules/dev/editors/emacs.nix deleted file mode 100644 index c553106..0000000 --- a/users/modules/dev/editors/emacs.nix +++ /dev/null @@ -1,68 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: -with lib; let - emacsDefaultPackage = with pkgs; ((emacsPackagesFor emacs).emacsWithPackages ( - epkgs: - with epkgs; [ - mu4e - pdf-tools - ] - )); - cfg = config.home.dev.editors.emacs; -in { - options.home.dev.editors.emacs = { - enable = mkEnableOption "enables Emacs"; - package = mkOption { - type = types.package; - default = emacsDefaultPackage; - }; - service = mkEnableOption "enables Emacs service"; - mu4eMime = mkEnableOption "Enables mu4e to handle mailto scheme"; - org-protocol = mkEnableOption "Enables org-protocol"; - }; - - config = { - home.packages = with pkgs; [ - emacs-all-the-icons-fonts - emacs-lsp-booster - ]; - programs.emacs = mkIf cfg.enable { - enable = true; - inherit (cfg) package; - }; - services.emacs = mkIf cfg.service { - enable = true; - inherit (cfg) package; - defaultEditor = true; - startWithUserSession = "graphical"; - client = { - enable = true; - arguments = ["-c" "-a" "${cfg.package}/bin/emacs"]; - }; - }; - - xdg.desktopEntries.mu4e = mkIf cfg.mu4eMime { - name = "mu4e"; - genericName = "mu4e"; - comment = "Maildir Utils for Emacs"; - mimeType = ["x-scheme-handler/mailto"]; - noDisplay = true; - exec = "${cfg.package}/bin/emacsclient -c -n -a ${cfg.package}/bin/emacs -e \"(browse-url-mail \\\"\\$*\\\")\""; - terminal = false; - categories = ["Network" "Email" "TextEditor" "Utility"]; - }; - - xdg.desktopEntries.org-protocol = mkIf cfg.org-protocol { - name = "org-protocol"; - exec = "${cfg.package}/bin/emacsclient -c -n -a ${cfg.package}/bin/emacs %u"; - terminal = false; - noDisplay = true; - categories = ["System"]; - mimeType = ["x-scheme-handler/org-protocol"]; - }; - }; -} diff --git a/users/modules/dev/vcs/default.nix b/users/modules/dev/vcs/default.nix deleted file mode 100644 index af1830b..0000000 --- a/users/modules/dev/vcs/default.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.home.dev.vcs; -in { - imports = [./git.nix ./jujutsu.nix]; - - options.home.dev.vcs = { - fullDesktop = mkEnableOption "Enable all optional values"; - name = mkOption { - type = types.str; - default = "Lucien Cartier-Tilet"; - }; - email = mkOption { - type = types.str; - default = "lucien@phundrak.com"; - }; - editor = mkOption { - type = types.str; - default = "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs"; - }; - publicKey = { - content = mkOption { - type = types.nullOr types.str; - example = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGj+J6N6SO+4P8dOZqfR1oiay2yxhhHnagH52avUqw5h"; - default = null; - }; - file = mkOption { - type = with types; nullOr path; - default = "/home/phundrak/.ssh/id_ed25519.pub"; - }; - }; - }; - - config.home.dev.vcs = { - git = { - enable = mkDefault true; - inherit (cfg) name email editor; - publicKeyFile = cfg.publicKey.file; - cliff = mkDefault cfg.fullDesktop; - completeConfig = mkDefault cfg.fullDesktop; - }; - jj = { - enable = mkDefault true; - inherit (cfg) name email editor; - signing.sshKey = mkDefault (cfg.publicKey.file or cfg.publicKey.content); - cz = { - enable = mkDefault true; - alias = mkDefault true; - }; - }; - }; -} diff --git a/users/modules/dev/vcs/git.nix b/users/modules/dev/vcs/git.nix deleted file mode 100644 index 7627e55..0000000 --- a/users/modules/dev/vcs/git.nix +++ /dev/null @@ -1,285 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -with lib; let - cfg = config.home.dev.vcs.git; -in { - options.home.dev.vcs.git = { - enable = mkEnableOption "enables git"; - email = mkOption { - type = types.str; - default = "lucien@phundrak.com"; - }; - name = mkOption { - type = types.str; - default = "Lucien Cartier-Tilet"; - }; - cliff = mkEnableOption "enables git-cliff support"; - sendmail = { - enable = mkOption { - type = types.bool; - default = true; - }; - server = mkOption { - type = types.nullOr types.str; - default = "mail.phundrak.com"; - }; - user = mkOption { - type = types.nullOr types.str; - default = null; - }; - encryption = mkOption { - type = types.enum ["tls" "ssl" "none"]; - default = "none"; - }; - port = mkOption { - type = types.nullOr types.int; - default = 587; - }; - passwordFile = mkOption { - type = types.nullOr types.path; - default = null; - description = '' - Path to a file containing the password necessary for authenticating - against the mailserver. - - This file should contain the password only, with no newline. - ''; - }; - }; - browser = mkOption { - type = types.nullOr types.str; - example = "${pkgs.firefox}/bin/firefox"; - default = null; - }; - completeConfig = mkEnableOption "Complete configuration for workstations"; - emacs = { - integration = mkOption { - description = "enables Emacs integration"; - type = types.bool; - default = config.home.dev.editors.emacs.enable; - }; - pkg = mkOption { - type = types.package; - default = pkgs.emacs; - }; - }; - mergeTool = mkOption { - type = types.str; - default = "ediff"; - }; - editor = mkOption { - type = types.str; - default = "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs"; - }; - publicKeyFile = mkOption { - type = types.nullOr types.str; - default = null; - }; - }; - - config = lib.mkIf cfg.enable { - programs.git-cliff.enable = cfg.cliff; - programs.git = let - smtpEmail = - if (cfg.sendmail.user == null) - then cfg.email - else cfg.sendmail.user; - in { - enable = true; - ignores = [ - ".env" - ".direnv/" - - "*~" - "\#*\#" - "*.elc" - "auto-save-list" - ".\#*" - "*_flymake.*" - "/auto/" - ".projectile" - ".dir-locals.el" - - "# Org mode files" - ".org-id-locations" - "*_archive" - - "*.out" - "*.o" - "*.so" - - "# Archives" - "*.7zz" - "*.dmg" - "*.gz" - "*.iso" - "*.jar" - "*.rar" - "*.tar" - "*.zip" - - "*.log" - "*.sqlite" - - "dist/" - ]; - signing = { - format = - if cfg.publicKeyFile != null - then "ssh" - else "openpgp"; - key = cfg.publicKeyFile; - signByDefault = true; - }; - settings = { - user = { - inherit (cfg) name email; - }; - color.ui = "auto"; - column.ui = "auto"; - tag.sort = "version:refname"; - core = mkIf cfg.completeConfig { - compression = 9; - inherit (cfg) editor; - whitespace = "fix,-indent-with-non-tab,trailing-space"; - preloadindex = true; - }; - status = { - branch = true; - showStash = true; - }; - diff = { - algorithm = "histogram"; - colorMoved = "plain"; - mnemonicPrefix = true; - renames = "copy"; - interHunkContext = 10; - }; - gpg.ssh.allowedSignersFile = "${config.home.homeDirectory}/.ssh/allowed_signers"; - init.defaultBranch = "main"; - pull.rebase = true; - push = { - default = "simple"; - autoSetupRemote = true; - followTags = true; - }; - rebase = { - autoSquash = true; - autoStash = true; - missingCommitsCheck = "warn"; - updateRefs = true; - }; - help.autocorrect = "prompt"; - web.browser = mkIf (cfg.browser != null) cfg.browser; - sendemail = mkIf cfg.sendmail.enable { - smtpserver = cfg.sendmail.server; - smtpuser = smtpEmail; - smtpencryption = cfg.sendmail.encryption; - smtpserverport = cfg.sendmail.port; - }; - credentials = mkIf (cfg.sendmail.passwordFile != null) { - "smtp://${smtpEmail}@${cfg.sendmail.server}:${toString cfg.sendmail.port}" = { - helper = "cat ${cfg.sendmail.passwordFile}"; - }; - }; - magithub = mkIf cfg.emacs.integration { - online = true; - "status" = { - includeStatusHeader = true; - includePullRequestsSection = true; - includeIssuesSection = true; - }; - }; - merge = { - tool = mkIf cfg.completeConfig cfg.mergeTool; - conflictstyle = "zdiff3"; - }; - mergetool.ediff.cmd = mkIf (cfg.emacs.integration && cfg.completeConfig) "\"${cfg.emacs.pkg} --eval \" (progn (defun ediff-write-merge-buffer () (let ((file ediff-merge-store-file)) (set-buffer ediff-buffer-C) (write-region (point-min) (point-max) file) (message \\\"Merge buffer saved in: %s\\\" file) (set-buffer-modified-p nil) (sit-for 1))) (setq ediff-quit-hook 'kill-emacs ediff-quit-merge-hook 'ediff-write-merge-buffer) (ediff-merge-files-with-ancestor \\\"$LOCAL\\\" \\\"$REMOTE\\\" \\\"$BASE\\\" nil \\\"$MERGED\\\"))\"\""; - github.user = "phundrak"; - url = { - "https://phundrak@github.com" = { - insteadOf = "https://github.com"; - }; - "https://phundrak@labs.phundrak.com" = { - insteadOf = "https://labs.phundrak.com"; - }; - "https://github.com/RustSec/advisory-db" = { - insteadOf = "https://github.com/RustSec/advisory-db"; - }; - "git@github.com:Phundrak/" = { - insteadOf = "pg:"; - }; - "git@labs.phundrak.com/phundrak:" = { - insteadOf = "p:"; - }; - "git@github.com" = { - insteadOf = "gh:"; - }; - "git@labs.phundrak.com" = { - insteadOf = "labs:"; - }; - }; - alias = { - a = "add --all"; - aca = "!git add --all && git commit --amend"; - acan = "!git add --all && git commit --amend --no-edit"; - ap = "add --patch"; - b = "branch"; - bd = "branch -d"; - bdd = "branch -D"; - c = "commit -S"; - ca = "commit -Sa"; - can = "commit -Sa --no-edit"; - cm = "commit -Sm"; - cam = "commit -Sam"; - co = "checkout"; - cob = "checkout -b"; - cod = "checkout develop"; - cl = "clone"; - cl1 = "clone --depth 1"; - f = "fetch"; - fp = "fetch --prune"; - ps = "push"; - psf = "push --force-with-lease"; - pso = "push origin"; - psfo = "push --force-with-lease origin"; - pushall = "!git remote \vert{} xargs -L1 git push"; - psl = "!git remote \vert{} xargs -L1 git push"; - pullall = "!git remote \vert{} xargs -L1 git pull"; - pll = "!git remote \vert{} xargs -L1 git pull"; - pl = "pull"; - pb = "pull --rebase"; - r = "rebase"; - ra = "rebase --abort"; - rc = "rebase --continue"; - rd = "rebase develop"; - ri = "rebase -i"; - rmf = "rm -f"; - rmd = "rm -r"; - rmdf = "rm -rf"; - sm = "submodule"; - sms = "submodule status"; - sma = "submodule add"; - smu = "submodule update"; - smui = "submodule update --init"; - smuir = "submodule update --init --recursive"; - st = "stash"; - stc = "stash clear"; - stp = "stash pop"; - stw = "stash show"; - u = "reset --"; - d = "diff -w"; - l = "log --all --oneline --graph --decorate --pretty=format':%C(magenta)%h %C(white) %an %ar%C(auto) %D%n%s%n'"; - s = "status"; - staged = "diff --cached"; - upstream = "!git push -u origin HEAD"; - unstage = "reset --"; - }; - }; - }; - }; -} diff --git a/users/modules/dev/vcs/jujutsu.nix b/users/modules/dev/vcs/jujutsu.nix deleted file mode 100644 index 182a712..0000000 --- a/users/modules/dev/vcs/jujutsu.nix +++ /dev/null @@ -1,135 +0,0 @@ -{ - lib, - config, - pkgs, - inputs, - ... -}: -with lib; let - inherit (pkgs.stdenv.hostPlatform) system; - cfg = config.home.dev.vcs.jj; - jj-cz = inputs.jj-cz.packages.${system}.default; -in { - options.home.dev.vcs.jj = { - enable = mkEnableOption "enables jj"; - name = mkOption { - type = types.str; - default = "Lucien Cartier-Tilet"; - }; - email = mkOption { - type = types.str; - default = "lucien@phundrak.com"; - }; - editor = mkOption { - type = types.str; - default = - if config.home.dev.editors.emacs.enable - then "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs" - else "${pkgs.nano}/bin/nano"; - }; - signing = { - enable = mkEnableOption "enables signing jj commits"; - sshKey = mkOption { - type = with types; nullOr (either path str); - example = "~/.ssh/id_ed25519.pub"; - default = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; - description = "Path to the private SSH key for signing."; - }; - }; - cz = { - enable = mkEnableOption "Enables jj-cz"; - alias = mkEnableOption "Enable `jj cz` as an alias to `jj-cz`"; - }; - # used in my shell .nix files - shellCompletion = mkOption { - description = "Enable Jujutsu shell completion"; - type = types.bool; - default = true; - }; - }; - - config = mkIf cfg.enable { - home.packages = mkIf cfg.cz.enable [jj-cz]; - programs.jujutsu = { - enable = true; - settings = { - user = { - inherit (cfg) name email; - }; - ui = { - inherit (cfg) editor; - default-command = "st"; - pager = ":builtin"; - show-cryptographic-signatures = true; - diff-editor = ":builtin"; - merge-editort = ":builtin"; - # These are for vc-jj.el in Emacs - diff-formatter = ":git"; - conflict-marker-style = "git"; - }; - signing = mkIf cfg.signing.enable { - behavior = "own"; - backend = "ssh"; - key = cfg.signing.sshKey; - backends.ssh.allowed-signers = "${config.home.homeDirectory}/.ssh/allowed_signers"; - backends.ssh.program = "${pkgs.openssh}/bin/ssh-keygen"; - }; - aliases = { - blame = ["file" "annotate"]; - consume = ["squash" "--into" "@" "--from"]; - cz = mkIf cfg.cz.alias ["util" "exec" "--" "${jj-cz}/bin/jj-cz"]; - eject = ["squash" "--from" "@" "--into"]; - d = ["diff"]; - dm = ["desc" "-m"]; - gc = ["git" "clone"]; - gcc = ["git" "clone" "--colocate"]; - l = ["log"]; - la = ["log" "-r" "::"]; - lc = ["log" "-r" "(remote_bookmarks()..@)::"]; - ll = ["log" "-T" "builtin_log_detailed"]; - open = ["log" "-r" "open()"]; - n = ["new"]; - nd = ["new" "dev()"]; - nt = ["new" "trunk()"]; - revlog = ["evolog"]; - s = ["show"]; - tug = ["bookmark" "move" "--from" "heads(::@- & bookmarks())" "--to" "@-"]; - }; - colors.working_copy.underline = true; - git = { - private-commits = "blacklist()"; - colocate = true; - subprocess = true; - }; - revset-aliases = { - "immutable_heads()" = "present(trunk()) | tags()"; - # Resolves by default to latest main/master remote bookmarks - "trunk()" = "latest((present(main) | present(master)) & remote_bookmarks())"; - # Same as trunk() but for `dev` or `develop` bookmarks - "dev()" = "latest((present(dev) | present(develop)) & remote_bookmarks())"; - - "user(x)" = "author(x) | committer(x)"; - "gh_pages()" = "ancestors(remote_bookmarks(exact:\"gh-pages\"))"; - - #Private and WIP commits that should never be pushed - "wip()" = "description(glob:\"wip:*\")"; - "private()" = "description(glob:\"private:*\")"; - "blacklist()" = "wip() | private()"; - - # stack(x, n) is the set of mutable commits reachable from - # 'x', with 'n' parents. 'n' is often useful to customize the - # display and return set for certain operations. 'x' can be - # used to target the set of 'roots' to traverse, e.g. @ is the - # current stack. - "stack()" = "ancestors(reachable(@, mutable()), 2)"; - "stack(x)" = "ancestors(reachable(x, mutable()), 2)"; - "stack(x, n)" = "ancestors(reachable(x, mutable()), n)"; - - "open()" = "stack(dev().. & mine(), 1)"; - "ready()" = "open() ~ blacklist()::"; - }; - remotes.origin.auto-track-bookmarks = "*"; - }; - }; - }; -} diff --git a/users/modules/media/default.nix b/users/modules/media/default.nix deleted file mode 100644 index 4d6d3cb..0000000 --- a/users/modules/media/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.media; -in { - imports = [ - ./mopidy.nix - ./mpd.nix - ./mpd-mpris.nix - ./mpv.nix - ./ncmpcpp.nix - ./streamlink.nix - ]; - - options.home.media.fullDesktop = mkEnableOption "Enables everything"; - config.home.media = { - mopidy.enable = mkDefault cfg.fullDesktop; - mpd.enable = mkDefault (cfg.fullDesktop or cfg.mpd-mpris.enable); - mpv.enable = mkDefault cfg.fullDesktop; - ncmpcpp.enable = mkDefault config.home.media.mpd.enable; - streamlink.enable = mkDefault config.home.media.mpv.enable; - }; -} diff --git a/users/modules/media/mopidy.nix b/users/modules/media/mopidy.nix deleted file mode 100644 index 8da37a7..0000000 --- a/users/modules/media/mopidy.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.home.media.mopidy; -in { - options.home.media.mopidy = { - enable = mkEnableOption "Enables Mopidy."; - }; - - config.services.mopidy = mkIf cfg.enable { - inherit (cfg) enable; - extensionPackages = with pkgs; [ - mopidy-bandcamp - mopidy-mpd - mopidy-mpris - mopidy-muse - mopidy-notify - mopidy-spotify - ]; - extraConfigFiles = [ - config.sops.secrets."mopidy/bandcamp".path - config.sops.secrets."mopidy/spotify".path - ]; - settings = { - mpd = { - enabled = true; - hostname = "::"; - port = 6600; - }; - mpris.enabled = true; - muse = { - enabled = true; - mopidy_host = "localhost"; - mopidy_port = 6690; - mopidy_ssl = false; - snapcast_host = "localhost"; - snapcast_port = 1780; - snapcast_ssl = false; - }; - }; - }; -} diff --git a/users/modules/media/mpd-mpris.nix b/users/modules/media/mpd-mpris.nix deleted file mode 100644 index 475adcd..0000000 --- a/users/modules/media/mpd-mpris.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.media.mpd-mpris; - cfgMpd = config.home.media.mpd; -in { - options.home.media.mpd-mpris.enable = mkOption { - type = types.bool; - default = cfgMpd.enable; - example = false; - }; - config.services.mpd-mpris.enable = cfg.enable; -} diff --git a/users/modules/media/mpd.nix b/users/modules/media/mpd.nix deleted file mode 100644 index c9888fa..0000000 --- a/users/modules/media/mpd.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.home.media.mpd; -in { - options.home.media.mpd.enable = mkEnableOption "Enables MPD"; - config.services.mpd = mkIf cfg.enable { - inherit (cfg) enable; - musicDirectory = "${config.home.homeDirectory}/Music"; - playlistDirectory = "${config.home.homeDirectory}/Music/playlists"; - network.startWhenNeeded = true; - extraConfig = '' - follow_outside_symlinks "yes" - follow_inside_symlinks "yes" - - bind_to_address "localhost" - auto_update "yes" - - audio_output { - type "pipewire" - name "PipeWire" - } - - audio_output { - type "fifo" - name "my_fifo" - path "/tmp/mpd.fifo" - format "44100:16:2" - } - ''; - }; -} diff --git a/users/modules/media/mpv.nix b/users/modules/media/mpv.nix deleted file mode 100644 index 939369f..0000000 --- a/users/modules/media/mpv.nix +++ /dev/null @@ -1,65 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: -with lib; let - cfg = config.home.media.mpv; -in { - options.home.media.mpv.enable = mkEnableOption "Enable MPV"; - config.programs.mpv = mkIf cfg.enable { - inherit (cfg) enable; - config = { - force-window = "immediate"; - force-seekable = true; # force streams to be seekable - slang = "jpn,jp,eng,en,fra,fr"; - alang = "eng,en,fra,fr"; - gpu-api = "auto"; - osc = true; - profile = "gpu-hq"; - # geometry = "50%x50%"; - # autofit-larger = "90%x90%"; - - # Screenshots - screenshot-format = "png"; - screenshot-high-bit-depth = true; - screenshot-png-compression = 6; - screenshot-directory = "${config.home.homeDirectory}/Pictures/Screenshots/mpv"; - - deband = true; - deband-iterations = 2; - deband-threshold = 35; - deband-range = 20; - - dither-depth = "auto"; - - sub-auto = "fuzzy"; - - scale = "ewa_lanczossharp"; - cscale = "ewa_lanczossharp"; - }; - scripts = with pkgs.mpvScripts; [ - crop - encode - inhibit-gnome - mpris - mpv-cheatsheet-ng - quality-menu - sponsorblock - thumbfast - twitch-chat - youtube-chat - youtube-upnext - ]; - bindings = { - Q = "quit-watch-later"; - P = "show-progress"; - "/" = "add volume -2"; - "*" = "add volume 2"; - m = "cycle mute"; - M = "vf toggle hflip"; - "Ctrl+r" = "cycle_values video-rotate \"90\" \"180\" \"270\" \"0\""; - }; - }; -} diff --git a/users/modules/media/ncmpcpp.nix b/users/modules/media/ncmpcpp.nix deleted file mode 100644 index 87c0610..0000000 --- a/users/modules/media/ncmpcpp.nix +++ /dev/null @@ -1,87 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.home.media.ncmpcpp; -in { - options.home.media.ncmpcpp.enable = mkEnableOption "Enable ncmpcpp"; - config.programs.ncmpcpp = let - musicDir = config.services.mpd.musicDirectory; - in - mkIf cfg.enable { - inherit (cfg) enable; - mpdMusicDir = musicDir; - settings = { - # directories - ncmpcpp_directory = "${config.home.homeDirectory}/.config/ncmpcpp"; - lyrics_directory = "${musicDir}/.lyrics"; - - # MPD - mpd_host = "localhost"; - mpd_port = 6600; - mpd_connection_timeout = 5; - mpd_crossfade_time = 0; - - # music visualizer - visualizer_output_name = "my_fifo"; - visualizer_in_stereo = "yes"; - # visualizer_type = "spectrum"; - visualizer_look = "+|"; - visualizer_color = "blue, cyan, green, yellow, magenta, red"; - - system_encoding = "UTF-8"; - - # song format - song_list_format = "(6)[]{} (23)[red]{a} (26)[yellow]{t|f} (40)[green]{b} (4)[blue]{l}"; - now_playing_prefix = "$b"; - now_playing_suffix = "$8$/b"; - - # columns settings - song_columns_list_format = "(6)[]{} (23)[red]{a} (26)[yellow]{t|f} (40)[green]{b} (4)[blue]{l}"; - - playlist_shorten_total_times = "yes"; - playlist_display_mode = "columns"; - browser_display_mode = "columns"; - search_engine_display_mode = "columns"; - playlist_editor_display_mode = "columns"; - autocenter_mode = "yes"; - centered_cursor = "yes"; - - progressbar_look = "─> "; - header_visibility = "no"; - statusbar_visibility = "no"; - titles_visibility = "no"; - allow_for_physical_item_deletion = "yes"; - - lastfm_preferred_language = "en"; - space_add_mode = "add_remove"; - - locked_screen_width_part = "50"; - ask_for_locked_screen_width_part = "yes"; - jump_to_now_playing_song_at_start = "yes"; - ask_before_clearing_playlists = "yes"; - clock_display_seconds = "no"; - display_volume_level = "yes"; - display_bitrate = "no"; - display_remaining_time = "yes"; - regular_expressions = "extended"; - ignore_leading_the = "yes"; - ignore_diacritics = "yes"; - mouse_support = "no"; - tags_separator = ";"; - enable_window_title = "yes"; - search_engine_default_search_mode = 1; - external_editor = "emacsclient -c"; - use_console_editor = "yes"; - - # colours - colors_enabled = "yes"; - volume_color = "default"; - progressbar_color = "black"; - progressbar_elapsed_color = "white"; - statusbar_color = "white"; - }; - }; -} diff --git a/users/modules/media/streamlink.nix b/users/modules/media/streamlink.nix deleted file mode 100644 index cbfd0a8..0000000 --- a/users/modules/media/streamlink.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -with lib; let - cfg = config.home.media.streamlink; -in { - options.home.media.streamlink.enable = mkEnableOption "Enable Streamlink"; - config.programs.streamlink = mkIf cfg.enable { - enable = true; - settings = { - player = "${pkgs.mpv}/bin/mpv"; - }; - }; -} diff --git a/users/modules/security/default.nix b/users/modules/security/default.nix deleted file mode 100644 index bed6ea1..0000000 --- a/users/modules/security/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.security; -in { - imports = [ - ./gpg.nix - ./ssh.nix - ]; - options.home.security.fullDesktop = mkEnableOption "Enable all modules"; - config.home.security = { - gpg.enable = mkDefault cfg.fullDesktop; - ssh.enable = mkDefault cfg.fullDesktop; - }; -} diff --git a/users/modules/security/gpg.nix b/users/modules/security/gpg.nix deleted file mode 100644 index c11e36f..0000000 --- a/users/modules/security/gpg.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: -with lib; let - cfg = config.home.security.gpg; -in { - options.home.security.gpg = { - enable = mkEnableOption "Enable GPG"; - pinentry.package = mkOption { - type = types.package; - default = pkgs.pinentry-gnome3; - }; - }; - config = mkIf cfg.enable { - programs.gpg = { - inherit (cfg) enable; - mutableKeys = true; - mutableTrust = true; - }; - services.gpg-agent = { - enable = true; - enableSshSupport = false; - pinentry.package = cfg.pinentry.package; - }; - }; -} diff --git a/users/modules/security/ssh.nix b/users/modules/security/ssh.nix deleted file mode 100644 index 78ae9e1..0000000 --- a/users/modules/security/ssh.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.security.ssh; -in { - options.home.security.ssh = { - enable = mkEnableOption "enables SSH"; - hosts = mkOption { - type = types.nullOr types.path; - default = null; - }; - }; - - config = { - programs.ssh = mkIf cfg.enable { - enable = true; - enableDefaultConfig = false; - includes = lists.optional (cfg.hosts != null) cfg.hosts; - }; - }; -} diff --git a/users/modules/services/blanket.nix b/users/modules/services/blanket.nix deleted file mode 100644 index 601f689..0000000 --- a/users/modules/services/blanket.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.home.myServices.blanket; -in { - options.home.myServices.blanket.enable = mkEnableOption "Enable blanket"; - config.services.blanket.enable = cfg.enable; -} diff --git a/users/modules/services/default.nix b/users/modules/services/default.nix deleted file mode 100644 index 949298a..0000000 --- a/users/modules/services/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.myServices; -in { - imports = [ - ./blanket.nix - ./mbsync.nix - ./mpris-proxy.nix - ./playerctld.nix - ]; - options.home.myServices.fullDesktop = mkOption { - description = "Enable all modules"; - type = types.bool; - default = config.home.fullDesktop; - }; - config.home.myServices = { - blanket.enable = mkDefault cfg.fullDesktop; - mbsync.enable = mkDefault cfg.fullDesktop; - mpris-proxy.enable = mkDefault cfg.fullDesktop; - playerctld.enable = mkDefault cfg.fullDesktop; - }; -} diff --git a/users/modules/services/mbsync.nix b/users/modules/services/mbsync.nix deleted file mode 100644 index 2f4f8e4..0000000 --- a/users/modules/services/mbsync.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.myServices.mbsync; -in { - options.home.myServices.mbsync = { - enable = mkEnableOption "Enables mbsync"; - service.enable = mkOption { - type = types.bool; - default = true; - }; - }; - - config = mkIf cfg.enable { - systemd.user.services.mbsync.unitConfig.After = ["sops-nix.service"]; - services.mbsync.enable = cfg.service.enable; - programs.mbsync.enable = true; - }; -} diff --git a/users/modules/services/mpris-proxy.nix b/users/modules/services/mpris-proxy.nix deleted file mode 100644 index 7de5061..0000000 --- a/users/modules/services/mpris-proxy.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.myServices.mpris-proxy; -in { - options.home.myServices.mpris-proxy.enable = mkEnableOption "Enable MPRIS forwarding towards bluetooth and MIDI"; - config.services.mpris-proxy.enable = cfg.enable; -} diff --git a/users/modules/services/playerctld.nix b/users/modules/services/playerctld.nix deleted file mode 100644 index b9b74a9..0000000 --- a/users/modules/services/playerctld.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.myServices.playerctld; -in { - options.home.myServices.playerctld.enable = mkEnableOption "Enable playerctld daemon"; - config.services.playerctld.enable = cfg.enable; -} diff --git a/users/modules/shell/bash.nix b/users/modules/shell/bash.nix deleted file mode 100644 index a5c5289..0000000 --- a/users/modules/shell/bash.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.shell.bash; -in { - options.home.shell.bash = { - enable = mkEnableOption "Enables bash"; - aliases = mkOption { - type = types.attrsOf types.str; - default = {}; - example = { - cp = "cp -i"; - lns = "ln -si"; - }; - }; - autocompletion = mkOption { - type = types.bool; - default = config.home.shell.autocompletion; - example = true; - }; - eatIntegration = mkEnableOption "Enable Emacs Eat integration"; - bashrcExtra = mkOption { - type = types.lines; - default = ""; - }; - }; - - config = mkIf cfg.enable { - programs.bash = { - enable = true; - # inherit (cfg) bashrcExtra; - bashrcExtra = - concatLines - [ - (strings.optionalString cfg.eatIntegration ''[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/bash"'') - (strings.optionalString config.home.dev.vcs.jj.shellCompletion "source <(jj util completion bash)") - cfg.bashrcExtra - ]; - enableCompletion = cfg.autocompletion; - shellAliases = cfg.aliases; - shellOptions = [ - "histappend" - "cmdhist" - "lithist" - "checkwinsize" - "extglob" - "globstar" - "checkjobs" - "autocd" - "cdspell" - "dirspell" - ]; - }; - }; -} diff --git a/users/modules/shell/default.nix b/users/modules/shell/default.nix deleted file mode 100644 index dc1d9ff..0000000 --- a/users/modules/shell/default.nix +++ /dev/null @@ -1,112 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - defaultAliases = { - df = "df -H"; - diskspace = "sudo df -h | grep -E \"sd|lv|Size\""; - du = "du -ch"; - meminfo = "free -m -l -t"; - gpumeminfo = "grep -i --color memory /var/log/Xorg.0.log"; - cpuinfo = "lscpu"; - pscpu = "ps auxf | sort -nr -k 3"; - pscpu10 = "ps auxf | sort -nr -k 3 | head -10"; - psmem = "ps auxf | sort -nr -k 4"; - psmem10 = "ps auxf | sort -nr -k 4 | head -10"; - - s = "systemctl"; - ss = "systemctl status"; - sst = "systemctl stop"; - sr = "systemctl restart"; - sre = "systemctl reload"; - se = "systemctl enable"; - sen = "systemctl enable --now"; - su = "systemctl --user"; - sus = "systemctl --user status"; - sust = "systemctl --user stop"; - sur = "systemctl --user restart"; - sure = "systemctl --user reload"; - sue = "systemctl --user enable"; - suen = "systemctl --user enable --now"; - - dc = "docker compose"; - dcd = "docker compose down"; - dcl = "docker compose logs"; - dclf = "docker compose logs -f"; - dcp = "docker compose pull"; - dcu = "docker compose up"; - dcud = "docker compose up -d"; - dcudp = "docker compose up -d --pull=always"; - dcr = "docker compose restart"; - pc = "podman compose"; - pcd = "podman compose down"; - pcl = "podman compose logs"; - pclf = "podman compose logs -f"; - pcp = "podman compose pull"; - pcu = "podman compose up"; - pcud = "podman compose up -d"; - pcudp = "podman compose up -d --pull=always"; - pcr = "podman compose restart"; - - enw = "emacsclient -nw"; - e = "emacsclient -n -c"; - - cp = "cp -i"; - rsync = "rsync -Pa --progress"; - ln = "ln -i"; - lns = "ln -si"; - mv = "mv -i"; - rm = "rm -Iv"; - rmd = "rm --preserve-root -Irv"; - rmdf = "rm --preserve-root -Irfv"; - rmf = "rm --preserve-root -Ifv"; - chgrp = "chgrp --preserve-root -v"; - chmod = "chmod --preserve-root -v"; - chown = "chown --preserve-root -v"; - lsl = "eza -halg@ --group-directories-first --git"; - - flac = "yt-dlp -x --audio-format flac --audio-quality 0 o \"~/Music/%(uploader)s/%(title)s.%(ext)s\""; - please = "sudo -A"; - wget = "wget --hsts-file=\"$XDG_DATA_HOME/wget-hsts\" -c"; - }; - cfg = config.home.shell; -in { - imports = [ - ./bash.nix - ./fish.nix - ./starship.nix - ./tmux.nix - ./zellij.nix - ./zsh.nix - ./zoxide.nix - ]; - options.home.shell = { - fullDesktop = mkEnableOption "Enable all shells"; - aliases = mkOption { - type = types.attrsOf types.str; - default = {}; - example = {la = "ls -a";}; - }; - autocompletion = mkOption { - type = types.bool; - default = true; - }; - }; - config.home.shell = { - enableShellIntegration = cfg.bash.enable or cfg.zsh.enable or cfg.fish.enable; - bash = { - aliases = defaultAliases // cfg.aliases; - enable = mkDefault cfg.fullDesktop; - }; - fish = { - abbrs = defaultAliases // cfg.aliases; - enable = mkDefault cfg.fullDesktop; - }; - zsh = { - abbrs = defaultAliases // cfg.aliases; - enable = mkDefault cfg.fullDesktop; - }; - }; -} diff --git a/users/modules/shell/fish.nix b/users/modules/shell/fish.nix deleted file mode 100644 index 394c448..0000000 --- a/users/modules/shell/fish.nix +++ /dev/null @@ -1,90 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.home.shell.fish; -in { - options.home.shell.fish = { - enable = lib.mkEnableOption "enables fish"; - abbrs = lib.mkOption { - type = types.attrsOf types.str; - default = {}; - example = { - cp = "cp -i"; - lns = "ln -si"; - }; - }; - autocompletion = mkOption { - type = types.bool; - default = config.home.shell.autocompletion; - example = true; - }; - extraShellInit = mkOption { - type = types.lines; - default = ""; - }; - }; - - config = lib.mkIf cfg.enable { - programs.fish = { - enable = true; - generateCompletions = cfg.autocompletion; - shellAbbrs = cfg.abbrs; - preferAbbrs = true; - shellInit = with lib; - concatLines [ - '' - function fish_command_not_found - __fish_default_command_not_found_handler $argv - end - '' - (strings.optionalString config.home.dev.vcs.jj.shellCompletion "jj util completion fish | source") - cfg.extraShellInit - ]; - plugins = [ - { - name = "bass"; - inherit (pkgs.fishPlugins.bass) src; - # src = pkgs.fishPlugins.bass.src; - } - { - name = "colored-man-pages"; - inherit (pkgs.fishPlugins.colored-man-pages) src; - } - { - name = "done"; - inherit (pkgs.fishPlugins.done) src; - } - { - name = "fzf"; - inherit (pkgs.fishPlugins.fzf) src; - } - { - name = "pisces"; - inherit (pkgs.fishPlugins.pisces) src; - } - { - name = "getopts.fish"; - src = pkgs.fetchFromGitHub { - owner = "jorgebucaran"; - repo = "getopts.fish"; - rev = "4b74206725c3e11d739675dc2bb84c77d893e901"; - sha256 = "9hRFBmjrCgIUNHuOJZvOufyLsfreJfkeS6XDcCPesvw="; - }; - } - { - name = "replay.fish"; - src = pkgs.fetchFromGitHub { - owner = "jorgebucaran"; - repo = "replay.fish"; - rev = "d2ecacd3fe7126e822ce8918389f3ad93b14c86c"; - sha256 = "TzQ97h9tBRUg+A7DSKeTBWLQuThicbu19DHMwkmUXdg="; - }; - } - ]; - }; - }; -} diff --git a/users/modules/shell/starship.nix b/users/modules/shell/starship.nix deleted file mode 100644 index 5df7248..0000000 --- a/users/modules/shell/starship.nix +++ /dev/null @@ -1,77 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.home.shell.starship; -in { - options.home.shell.starship = { - enable = mkEnableOption "Enables the starship prompt."; - jjIntegration = mkOption { - description = "Enable Jujutsu integration in starship"; - default = config.programs.jujutsu.enable; - type = types.bool; - }; - }; - - config.programs.starship = mkIf cfg.enable { - inherit (cfg) enable; - enableTransience = true; - settings = mkIf cfg.jjIntegration { - # Disabling these so they can be enabled conditionally - # See https://github.com/jj-vcs/jj/wiki/Starship - git_status.disabled = true; - git_commit.disabled = true; - git_metrics.disabled = true; - git_branch.disabled = true; - custom = let - when = "! jj --ignore-working-copy-root"; - description = "Only show if we’re not in a jj repository"; - style = ""; - in { - git_status = { - inherit when description style; - command = "starship module git_status"; - }; - git_commit = { - inherit when description style; - command = "starship module git_commit"; - }; - git_metrics = { - inherit when description style; - command = "starship module git_metrics"; - }; - git_branch = { - inherit when description style; - command = "starship module git_branch"; - }; - jj = { - description = "The current jj status"; - detect_folders = [".jj"]; - symbol = "🥋 "; - command = '' - jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template ' - separate(" ", - change_id.shortest(4), - bookmarks, - "|", - concat( - if(conflict, "💥"), - if(divergent, "🚧"), - if(hidden, "👻"), - if(immutable, "🔒"), - ), - raw_escape_sequence("\x1b[1;32m") ++ if(empty, "(empty)"), - raw_escape_sequence("\x1b[1;32m") ++ coalesce( - truncate_end(29, description.first_line(), "…"), - "(no description set)", - ) ++ raw_escape_sequence("\x1b[0m"), - ) - ' - ''; - }; - }; - }; - }; -} diff --git a/users/modules/shell/tmux.nix b/users/modules/shell/tmux.nix deleted file mode 100644 index 39a2101..0000000 --- a/users/modules/shell/tmux.nix +++ /dev/null @@ -1,81 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: -with lib; let - cfg = config.home.shell.tmux; - keyType = types.submodule { - options = { - key = mkOption { - type = types.str; - example = "C-b"; - }; - action = mkOption { - type = types.str; - example = "resize-pane -Z"; - }; - }; - }; -in { - options.home.shell.tmux = with types; { - enable = mkEnableOption "Enable tmux"; - bind = mkOption { - type = attrsOf (listOf keyType); - default = {}; - example = { - "prefix" = [ - { - key = "C-r"; - action = "resize-pane -R"; - } - ]; - }; - }; - unbind = mkOption { - type = listOf (either str (attrsOf (listOf str))); - default = []; - }; - extraConfig = mkOption { - type = types.lines; - default = ""; - }; - }; - config.programs.tmux = mkIf cfg.enable { - inherit (cfg) enable; - baseIndex = 1; - clock24 = true; - customPaneNavigationAndResize = true; - keyMode = "vi"; - mouse = true; - newSession = true; - prefix = "M-space"; - plugins = with pkgs.tmuxPlugins; [ - cpu - nord - prefix-highlight - resurrect - sensible - yank - ]; - extraConfig = let - generateBinds = concatLines ( - mapAttrsToList (table: keys: concatMapStrings (key: "bind -T ${table} ${key.key} ${key.action}\n") keys) cfg.bind - ); - generateUnbind = - concatMapStrings ( - entry: - if builtins.isString entry - then "unbind ${entry}\n" - else concatStrings (mapAttrsToList (table: keys: concatMapStrings (key: "unbind -T ${table} ${key}\n") keys) entry) - ) - cfg.unbind; - in '' - ${cfg.extraConfig} - - ${generateUnbind} - ${generateBinds} - ''; - }; -} diff --git a/users/modules/shell/zellij.nix b/users/modules/shell/zellij.nix deleted file mode 100644 index 97ab716..0000000 --- a/users/modules/shell/zellij.nix +++ /dev/null @@ -1,173 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: -with lib; let - cfg = config.home.shell.zellij; - isEmpty = list: list == []; - keybind = { - options = { - bind = mkOption { - type = types.either types.str (types.listOf types.str); - example = "Alt j"; - description = "Value used as a string after `bind` in zellij config"; - }; - actions = mkOption { - type = with types; let - allowed = oneOf [int str]; - in - attrsOf (either (listOf allowed) allowed); - default = {}; - example = { - SwitchToMode = ["normal"]; - SwitchFocus = []; - PaneNameInput = [0]; - }; - }; - useUnlockFirst = mkOption { - type = types.bool; - default = false; - description = '' - Go back to locked mode after the actions are done. - - Only works when `config.home.shell.zellij.useUnlockFirst` is true. - ''; - }; - }; - }; - convertBind = item: { - bind = let - useUnlockFirst = cfg.useUnlockFirst && item.useUnlockFirst; - children = - mapAttrsToList (action: args: let - actualArgs = - if isEmpty args - then {} - else {_args = lists.toList args;}; - in {"${action}" = actualArgs;}) - (item.actions - // ( - if useUnlockFirst - then {SwitchToMode = ["locked"];} - else {} - )); - in { - _args = lists.toList item.bind; - _children = children; - }; - }; - keybindsModule = { - options = mergeAttrsList (forEach [ - "normal" - "locked" - "resize" - "pane" - "move" - "tab" - "scroll" - "search" - "entersearch" - "renametab" - "renamepane" - "session" - "tmux" - ] - (x: { - "${x}" = mkOption { - type = types.listOf (types.submodule keybind); - default = []; - }; - })); - }; - makeKeybinds = keybinds: let - values = - attrsets.concatMapAttrs ( - mode: binds: - if (isEmpty binds) - then {} - else { - "${mode}"._children = lists.forEach binds convertBind; - } - ) - keybinds; - in - if values == {} - then {} - else { - keybinds = values; - }; -in { - options.home.shell.zellij = let - jsonFormat = pkgs.formats.yaml {}; - in { - enable = mkEnableOption "Enable Zellij"; - clearDefaultKeybinds = mkEnableOption "Clear default keybinds"; - settings = mkOption { - inherit (jsonFormat) type; - default = {}; - }; - layouts = mkOption { - inherit (jsonFormat) type; - default = {}; - }; - extraSettings = mkOption { - type = types.lines; - default = ""; - description = '' - Extra configuration lines to add to `$XDG_CONFIG_HOME/zellij/config.kdl` - ''; - }; - useUnlockFirst = mkEnableOption "Use Unlock-First (non-colliding) behaviour by default"; - plugins = mkOption { - type = types.listOf (types.submodule plugin); - default = {}; - example = [ - {name = "about";} - { - name = "filepicker"; - location = "zellij:strider"; - options = { - cwd = "/"; - }; - } - ]; - }; - keybinds = mkOption { - type = types.submodule keybindsModule; - default = {}; - example = { - pane = [ - { - bind = "c"; - actions = [ - { - action = "SwitchToMode"; - args = ["renamepane"]; - } - { - action = "PaneNameInput"; - args = [0]; - } - ]; - } - ]; - }; - }; - }; - config.programs.zellij = mkIf cfg.enable { - inherit (cfg) enable layouts; - extraConfig = cfg.extraSettings; - settings = let - resetKeybinds = - if cfg.clearDefaultKeybinds - then { - keybinds._props.clear-defaults = true; - } - else {}; - keybinds = makeKeybinds cfg.keybinds; - in - cfg.settings // (lib.recursiveUpdate resetKeybinds keybinds); - }; -} diff --git a/users/modules/shell/zoxide.nix b/users/modules/shell/zoxide.nix deleted file mode 100644 index a58ff97..0000000 --- a/users/modules/shell/zoxide.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - lib, - config, - ... -}: -with lib; let - cfg = config.home.shell.zoxide; -in { - options.home.shell.zoxide = { - enable = mkEnableOption "Enable zoxide"; - replaceCd = mkEnableOption "Replace cd with zoxide"; - }; - config.programs.zoxide = mkIf cfg.enable { - inherit (cfg) enable; - options = mkIf cfg.replaceCd [ - "--cmd cd" - ]; - }; -} diff --git a/users/modules/shell/zsh.nix b/users/modules/shell/zsh.nix deleted file mode 100644 index ca2997e..0000000 --- a/users/modules/shell/zsh.nix +++ /dev/null @@ -1,106 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.home.shell.zsh; -in { - options.home.shell.zsh = { - enable = lib.mkEnableOption "Enables zsh"; - abbrs = lib.mkOption { - type = types.attrsOf types.str; - default = {}; - example = { - cp = "cp -i"; - lns = "ln -si"; - }; - }; - autocompletion = mkOption { - type = types.bool; - default = config.home.shell.autocompletion; - example = true; - }; - eatIntegration = mkEnableOption "Enable Emacs Eat integration"; - zshrcExtra = lib.mkOption { - type = types.lines; - default = ""; - }; - }; - - config = lib.mkIf cfg.enable { - programs.zsh = { - enable = true; - autocd = true; - autosuggestion = { - enable = true; - strategy = ["match_prev_cmd" "completion"]; - }; - enableCompletion = cfg.autocompletion; - enableVteIntegration = true; - history = { - findNoDups = true; - ignoreAllDups = true; - ignoreDups = true; - ignoreSpace = true; - path = "${config.xdg.dataHome}/zsh/zsh_history"; - saveNoDups = true; - }; - historySubstringSearch.enable = true; - initContent = with lib; - concatLines [ - '' - bindkey -e - bindkey '^p' history-search-backward - bindkey '^n' history-search-forward - - # Completion styling - zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' - zstyle ':completion:*' list-colors "''${(s.:.)LS_COLORS}" - zstyle ':completion:*' menu no - zstyle ':fzf-tab:complete:cd:*' fzf-preview '${pkgs.eza}/bin/eza $realpath' - '' - (strings.optionalString cfg.eatIntegration ''[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/zsh"'') - (strings.optionalString config.home.dev.vcs.jj.shellCompletion '' - autoload -U compinit - compinit - source <(jj util completion zsh) - '') - cfg.zshrcExtra - ]; - oh-my-zsh = { - enable = true; - plugins = [ - "dirhistory" - "sudo" - ]; - }; - plugins = [ - { - name = "fzf-tab"; - src = pkgs.fetchFromGitHub { - owner = "Aloxaf"; - repo = "fzf-tab"; - rev = "v1.2.0"; - sha256 = "sha256-q26XVS/LcyZPRqDNwKKA9exgBByE0muyuNb0Bbar2lY="; - }; - } - { - name = "zsh-autopair"; - src = pkgs.fetchFromGitHub { - owner = "hlissner"; - repo = "zsh-autopair"; - rev = "449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d"; - sha256 = "sha256-3zvOgIi+q7+sTXrT+r/4v98qjeiEL4Wh64rxBYnwJvQ="; - }; - } - ]; - syntaxHighlighting.enable = true; - zsh-abbr = { - enable = true; - abbreviations = cfg.abbrs; - }; - }; - }; -} diff --git a/users/phundrak/ai.nix b/users/phundrak/ai.nix deleted file mode 100644 index 023a25c..0000000 --- a/users/phundrak/ai.nix +++ /dev/null @@ -1,58 +0,0 @@ -{config, ...}: { - home.dev.ai = { - enable = true; - opencode = { - tui = { - mouse = true; - theme = "nord"; - attention = { - enabled = true; - notifications = true; - }; - keybinds = { - leader = "ctrl+x"; - "command_list" = ""; - }; - }; - settings = { - autoupdate = false; - provider = { - ollama = { - npm = "@ai-sdk/openai-compatible"; - name = "Ollama (marpa)"; - options.baseURL = "http://marpa:11434/v1"; - }; - models = { - "qwen3.5:9b".name = "Qwen 3.5 Medium"; - "gemma4:e4b".name = "Gemma E4B"; - "qwen2.5-coder:1.5b-base".name = "Qwen 2.5 Coder Light"; - }; - }; - permission = { - "*" = "ask"; - glob = "allow"; - grep = "allow"; - read = { - "*" = "allow"; - "*.env" = "deny"; - "*.env.*" = "deny"; - "*.env.example" = "allow"; - }; - skill = "allow"; - question = "allow"; - task = "allow"; - todowrite = "allow"; - }; - formatter.nixfmt = { - command = ["nix" "fmt" "$FILE"]; - extensions = [".nix"]; - }; - }; - web = { - enable = true; - cors = config.sops.secrets."opencode/cors".path; - mdns.enable = true; - }; - }; - }; -} diff --git a/users/phundrak/config/waybar/config b/users/phundrak/config/waybar/config deleted file mode 100644 index 56cb85d..0000000 --- a/users/phundrak/config/waybar/config +++ /dev/null @@ -1,163 +0,0 @@ -// -*- mode: js-json -*- -{ - // "layer": "top", // Waybar at top layer - // "position": "bottom", // Waybar position (top|bottom|left|right) - "height": 24, // Waybar height (to be removed for auto height) - // "width": 1280, // Waybar width - "spacing": 2, // Gaps between modules (4px) - // Choose the order of the modules - "modules-left": ["hyprland/workspaces", "hyprland/language", "hyprland/submap", "hyprland/window"], - "modules-center": [], - "modules-right": ["idle_inhibitor", "mpd", "pulseaudio", "network", "cpu", - "memory", "temperature", "battery", "clock", "tray"], - // Modules configuration - // "sway/workspaces": { - // "disable-scroll": true, - // "all-outputs": true, - // "format": "{name}: {icon}", - // "format-icons": { - // "1": "", - // "2": "", - // "3": "", - // "4": "", - // "5": "", - // "urgent": "", - // "focused": "", - // "default": "" - // } - // }, - "keyboard-state": { - "numlock": true, - "capslock": true, - "format": "{name} {icon}", - "format-icons": { - "locked": "", - "unlocked": "" - } - }, - { -"hyprland/language": { - "format": "Lang: {}", - "format-en": "gaming", -}, - }, - "mpd": { - "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ", - "format-disconnected": "Disconnected ", - "format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ", - "unknown-tag": "N/A", - "interval": 2, - "consume-icons": { - "on": " " - }, - "random-icons": { - "off": " ", - "on": " " - }, - "repeat-icons": { - "on": " " - }, - "single-icons": { - "on": "1 " - }, - "state-icons": { - "paused": "", - "playing": "" - }, - "tooltip-format": "MPD (connected)", - "tooltip-format-disconnected": "MPD (disconnected)" - }, - "idle_inhibitor": { - "format": "{icon}", - "format-icons": { - "activated": "", - "deactivated": "" - } - }, - "tray": { - // "icon-size": 21, - "spacing": 10 - }, - "clock": { - // "timezone": "America/New_York", - "tooltip-format": "{:%Y %B}\n{calendar}", - "format-alt": "{:%Y-%m-%d}" - }, - "cpu": { - "format": "{usage}% ", - "tooltip": false - }, - "memory": { - "format": "{}% " - }, - "temperature": { - // "thermal-zone": 2, - // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", - "critical-threshold": 80, - // "format-critical": "{temperatureC}°C {icon}", - "format": "{temperatureC}°C {icon}", - "format-icons": ["", "", ""] - }, - "backlight": { - // "device": "acpi_video1", - "format": "{percent}% {icon}", - "format-icons": ["", "", "", "", "", "", "", "", ""] - }, - "battery": { - "states": { - // "good": 95, - "warning": 30, - "critical": 15 - }, - "format": "{capacity}% {icon}", - "format-charging": "{capacity}% ", - "format-plugged": "{capacity}% ", - "format-alt": "{time} {icon}", - // "format-good": "", // An empty format will hide the module - // "format-full": "", - "format-icons": ["", "", "", "", ""] - }, - "battery#bat2": { - "bat": "BAT2" - }, - "network": { - // "interface": "wlp2*", // (Optional) To force the use of this interface - "format-wifi": "{essid} ({signalStrength}%) ", - "format-ethernet": "{ipaddr}/{cidr} ", - "tooltip-format": "{ifname} via {gwaddr} ", - "format-linked": "{ifname} (No IP) ", - "format-disconnected": "Disconnected ⚠", - "format-alt": "{ifname}: {ipaddr}/{cidr}" - }, - "pulseaudio": { - // "scroll-step": 1, // %, can be a float - "format": "{volume}% {icon} {format_source}", - "format-bluetooth": "{volume}% {icon} {format_source}", - "format-bluetooth-muted": " {icon} {format_source}", - "format-muted": " {format_source}", - "format-source": "{volume}% ", - "format-source-muted": "", - "format-icons": { - "headphone": "", - "hands-free": "", - "headset": "", - "phone": "", - "portable": "", - "car": "", - "default": ["", "", ""] - }, - "on-click": "pavucontrol" - }, - "custom/media": { - "format": "{icon} {}", - "return-type": "json", - "max-length": 40, - "format-icons": { - "spotify": "", - "default": "🎜" - }, - "escape": true, - "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder - // "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name - } -} diff --git a/users/phundrak/config/waybar/style.css b/users/phundrak/config/waybar/style.css deleted file mode 100644 index cf5c5fb..0000000 --- a/users/phundrak/config/waybar/style.css +++ /dev/null @@ -1,280 +0,0 @@ -* { - /* `otf-font-awesome` is required to be installed for icons */ - font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif; - font-size: 13px; -} - -window#waybar { - background-color: rgba(43, 48, 59, 0.5); - border-bottom: 3px solid rgba(100, 114, 125, 0.5); - color: #ffffff; - transition-property: background-color; - transition-duration: .5s; -} - -window#waybar.hidden { - opacity: 0.2; -} - -/* -window#waybar.empty { - background-color: transparent; -} -window#waybar.solo { - background-color: #FFFFFF; -} -*/ - -window#waybar.termite { - background-color: #3F3F3F; -} - -window#waybar.chromium { - background-color: #000000; - border: none; -} - -button { - /* Use box-shadow instead of border so the text isn't offset */ - box-shadow: inset 0 -3px transparent; - /* Avoid rounded borders under each button name */ - border: none; - border-radius: 0; -} - -/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ -button:hover { - background: inherit; - box-shadow: inset 0 -3px #ffffff; -} - -#workspaces button { - padding: 0 5px; - background-color: transparent; - color: #ffffff; -} - -#workspaces button:hover { - background: rgba(0, 0, 0, 0.2); -} - -#workspaces button.focused { - background-color: #64727D; - box-shadow: inset 0 -3px #ffffff; -} - -#workspaces button.urgent { - background-color: #eb4d4b; -} - -#mode { - background-color: #64727D; - border-bottom: 3px solid #ffffff; -} - -#clock, -#battery, -#cpu, -#memory, -#disk, -#temperature, -#backlight, -#network, -#pulseaudio, -#wireplumber, -#custom-media, -#tray, -#mode, -#idle_inhibitor, -#scratchpad, -#mpd { - padding: 0 10px; - color: #ffffff; -} - -#window, -#workspaces { - margin: 0 4px; -} - -/* If workspaces is the leftmost module, omit left margin */ -.modules-left > widget:first-child > #workspaces { - margin-left: 0; -} - -/* If workspaces is the rightmost module, omit right margin */ -.modules-right > widget:last-child > #workspaces { - margin-right: 0; -} - -#clock { - background-color: #64727D; -} - -#battery { - background-color: #ffffff; - color: #000000; -} - -#battery.charging, #battery.plugged { - color: #ffffff; - background-color: #26A65B; -} - -@keyframes blink { - to { - background-color: #ffffff; - color: #000000; - } -} - -#battery.critical:not(.charging) { - background-color: #f53c3c; - color: #ffffff; - animation-name: blink; - animation-duration: 0.5s; - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; -} - -label:focus { - background-color: #000000; -} - -#cpu { - background-color: #2ecc71; - color: #000000; -} - -#memory { - background-color: #9b59b6; -} - -#disk { - background-color: #964B00; -} - -#backlight { - background-color: #90b1b1; -} - -#network { - background-color: #2980b9; -} - -#network.disconnected { - background-color: #f53c3c; -} - -#pulseaudio { - background-color: #f1c40f; - color: #000000; -} - -#pulseaudio.muted { - background-color: #90b1b1; - color: #2a5c45; -} - -#wireplumber { - background-color: #fff0f5; - color: #000000; -} - -#wireplumber.muted { - background-color: #f53c3c; -} - -#custom-media { - background-color: #66cc99; - color: #2a5c45; - min-width: 100px; -} - -#custom-media.custom-spotify { - background-color: #66cc99; -} - -#custom-media.custom-vlc { - background-color: #ffa000; -} - -#temperature { - background-color: #f0932b; -} - -#temperature.critical { - background-color: #eb4d4b; -} - -#tray { - background-color: #2980b9; -} - -#tray > .passive { - -gtk-icon-effect: dim; -} - -#tray > .needs-attention { - -gtk-icon-effect: highlight; - background-color: #eb4d4b; -} - -#idle_inhibitor { - background-color: #2d3436; -} - -#idle_inhibitor.activated { - background-color: #ecf0f1; - color: #2d3436; -} - -#mpd { - background-color: #66cc99; - color: #2a5c45; -} - -#mpd.disconnected { - background-color: #f53c3c; -} - -#mpd.stopped { - background-color: #90b1b1; -} - -#mpd.paused { - background-color: #51a37a; -} - -#language { - background: #00b093; - color: #740864; - padding: 0 5px; - margin: 0 5px; - min-width: 16px; -} - -#keyboard-state { - background: #97e1ad; - color: #000000; - padding: 0 0px; - margin: 0 5px; - min-width: 16px; -} - -#keyboard-state > label { - padding: 0 5px; -} - -#keyboard-state > label.locked { - background: rgba(0, 0, 0, 0.2); -} - -#scratchpad { - background: rgba(0, 0, 0, 0.2); -} - -#scratchpad.empty { - background-color: transparent; -} diff --git a/users/phundrak/email.nix b/users/phundrak/email.nix deleted file mode 100644 index b469cd5..0000000 --- a/users/phundrak/email.nix +++ /dev/null @@ -1,48 +0,0 @@ -{config, ...}: let - signature = '' - Lucien “Phundrak” Cartier-Tilet - https://phundrak.com (Français) - https://phundrak.com/en (English) - - Sent from GNU/Emacs - - @@@ Sauvez un arbre, mangez un castor @@@ - @@@ Save a tree, eat a beaver @@@ - @@@ Bjarg tré, et bjórr @@@ - ''; -in { - home.file.".signature" = { - target = ".signature"; - text = signature; - }; - accounts.email = { - maildirBasePath = "Mail"; - accounts."lucien@phundrak.com" = { - realName = "Lucien Cartier-Tilet"; - address = "lucien@phundrak.com"; - aliases = [ - "lucien@cartier-tilet.com" - "admin@phundrak.com" - "webmaster@phundrak.com" - "youdontknow@phundrak.com" - ]; - passwordCommand = "cat ${config.sops.secrets.emailPassword.path}"; - signature = { - text = signature; - showSignature = "append"; - }; - userName = "lucien@phundrak.com"; - imap.host = "mail.phundrak.com"; - smtp.host = "mail.phundrak.com"; - mu.enable = true; - primary = true; - - mbsync = { - create = "maildir"; - enable = true; - expunge = "both"; - remove = "both"; - }; - }; - }; -} diff --git a/users/phundrak/firefox.nix b/users/phundrak/firefox.nix deleted file mode 100644 index e1e9350..0000000 --- a/users/phundrak/firefox.nix +++ /dev/null @@ -1,88 +0,0 @@ -{pkgs, ...}: { - config.home.desktop.firefox = { - enable = true; - useZen = true; - tridactyl = { - enable = true; - preConfig = "sanitise tridactyllocal tridactylsync"; - config = { - editorcmd = "emacsclient -c"; - keyboardlayoutbase = "bepo"; - keyboardlayoutforce = "true"; - hintchars = "auiectsr"; - smothscroll = "true"; - }; - extraConfig = '' - command openTwitchInMpv js -d@\ - const url = new URL(document.location.href);\ - const cleanUrl = url.hostname + url.pathname;\ - const token = document.cookie.split("; ")\ - .find(item => item.startsWith("auth-token="))?.split("=")[1];\ - const auth = "--twitch-api-header=Authorization=OAuth " + token;\ - const cmd = `${pkgs.streamlink}/bin/streamlink "''${auth}" "''${cleanUrl}" best`;\ - tri.native.run(cmd)\ - @ - - unbind h - unbind j - unbind k - unbind l - unbind c - unbind t - unbind s - unbind r - unbind H - unbind J - unbind K - unbind L - unbind C - unbind T - unbind S - unbind R - - " === Bépo layout — scrolling (ctsr = hjkl) === - bind c scrollpx -300 0 - bind t scrollline 5 - bind s scrollline -5 - bind r scrollpx 300 0 - - " Half/full page scroll (replacing C-f/C-b/C-d/C-u) - bind scrollpage 0.5 - bind scrollpage -0.5 - - " === History navigation (C/R = H/L) === - bind C back - bind R forward - - " === Tab navigation === - bind T tabnext - bind S tabprev - - " === Displaced commands === - " reload was on r → move to h (bépo's 'replace' position) - bind h reload - bind H reloadhard - - " tabopen was on t → move to j (bépo's 'find char to' position) - bind j fillcmdline tabopen - - unbind ^http(s?)://youtube\.com f - unbind ^http(s?)://youtube\.com t - unbind ^http(s?)://youtube\.com l - unbind ^http(s?)://youtube\.com j - unbind ^http(s?)://twitch\.tv f - - bind n findnext - bind N findnext -f - bind p findnext --reverse - bind P findnext -f --reverse - - bind < urlincrement -1 - bind > urlincrement 1 - bind ypt openTwitchInMpv - bind ypv js tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${document.location.href}"`) - bind ypm hint -JF e => tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${e.href}"`) - ''; - }; - }; -} diff --git a/users/phundrak/home.nix b/users/phundrak/home.nix deleted file mode 100644 index d494ce7..0000000 --- a/users/phundrak/home.nix +++ /dev/null @@ -1,117 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: { - imports = [ - ./ai.nix - ./light-home.nix - ./packages.nix - ./email.nix - ./firefox.nix - ./tmux.nix - ./wlr-which-key - ../modules - ]; - - config = let - emacsPackage = with pkgs; ((emacsPackagesFor emacs).emacsWithPackages ( - epkgs: - with epkgs; [ - mu4e - pdf-tools - tree-sitter - tree-sitter-langs - (treesit-grammars.with-grammars (grammar: - with grammar; [ - tree-sitter-bash - tree-sitter-c - tree-sitter-cpp - tree-sitter-css - tree-sitter-dockerfile - tree-sitter-http - tree-sitter-javascript - tree-sitter-jsdoc - tree-sitter-json - tree-sitter-just - tree-sitter-markdown - tree-sitter-markdown-inline - tree-sitter-nix - tree-sitter-rust - tree-sitter-sql - tree-sitter-toml - tree-sitter-typescript - tree-sitter-typst - tree-sitter-vue - tree-sitter-yaml - ])) - ] - )); - askpass = import ../modules/cli/scripts/askpass.nix {inherit pkgs;}; - launchWithEmacsclient = import ../modules/cli/scripts/launch-with-emacsclient.nix { - inherit pkgs config; - }; - in { - sops.secrets = { - emailPassword = {}; - "mopidy/bandcamp" = {}; - "mopidy/spotify" = {}; - "opencode/cors" = {}; - }; - - home = { - sessionVariables = { - LAUNCH_EDITOR = "${launchWithEmacsclient}/bin/launch-with-emacsclient"; - SUDO_ASKPASS = "${askpass}/bin/askpass"; - LSP_USE_PLISTS = "true"; - OPENAI_API_URL = "http://localhost:1234/"; - }; - desktop = { - caelestia.enable = true; - spotify = { - enable = true; - spicetify.enable = true; - }; - wl-kbptr = { - enable = true; - config = { - general = { - # first eight chars to select areas, last three chars - # for left, right, middle click - # First eigh chars to select areas: auiectsr - # last three chars for left, right, and middle click: tsr - home_row_keys = "auiectsrtsr"; - modes = "tile,bisect,click"; - }; - }; - }; - }; - dev = { - editors.emacs.package = emacsPackage; - vcs.jj.signing.enable = true; - }; - fullDesktop = true; - file = { - ".XCompose".source = ./XCompose; - "${config.home.homeDirectory}/.ssh/allowed_signers" = { - enable = true; - text = lib.strings.join "\n" ( - map (file: let - content = lib.strings.trim (builtins.readFile file); - parts = lib.strings.splitString " " content; - email = lib.lists.last parts; - in "${email} namespaces=\"git\" ${content}") - (lib.filesystem.listFilesRecursive ./keys) - ); - }; - }; - media.mopidy.enable = false; - }; - - manual = { - html.enable = true; - manpages.enable = true; - }; - }; -} diff --git a/users/phundrak/host/alys.nix b/users/phundrak/host/alys.nix deleted file mode 100644 index 59d411c..0000000 --- a/users/phundrak/host/alys.nix +++ /dev/null @@ -1,7 +0,0 @@ -{config, ...}: { - imports = [../light-home.nix]; - home = { - cli.nh.flake = "${config.home.homeDirectory}/nixos"; - phundrak.sshKey.content = builtins.readFile ../keys/id_alys.pub; - }; -} diff --git a/users/phundrak/host/elcafe.nix b/users/phundrak/host/elcafe.nix deleted file mode 100644 index 65aa622..0000000 --- a/users/phundrak/host/elcafe.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - imports = [../light-home.nix]; - home = { - cli.nh.flake = "/home/phundrak/.dotfiles"; - dev.editors.emacs.enable = false; - phundrak.sshKey.content = builtins.readFile ../keys/id_elcafe.pub; - }; -} diff --git a/users/phundrak/host/gampo.nix b/users/phundrak/host/gampo.nix deleted file mode 100644 index 874849a..0000000 --- a/users/phundrak/host/gampo.nix +++ /dev/null @@ -1,10 +0,0 @@ -{config, ...}: { - imports = [../home.nix]; - home = { - cli.nh.flake = "${config.home.homeDirectory}/.dotfiles"; - dev.ai.lmStudio = false; - desktop.hyprland.host = "gampo"; - phundrak.sshKey.content = builtins.readFile ../keys/id_gampo.pub; - }; - programs.caelestia.settings.bar.persistent = false; -} diff --git a/users/phundrak/host/marpa.nix b/users/phundrak/host/marpa.nix deleted file mode 100644 index e868f46..0000000 --- a/users/phundrak/host/marpa.nix +++ /dev/null @@ -1,20 +0,0 @@ -{config, ...}: { - imports = [../home.nix]; - home = { - gpuType = "amd"; - cli.nh.flake = "${config.home.homeDirectory}/.dotfiles"; - dev.ai = { - enable = true; - ollama.gpu = "rocm"; - }; - desktop = { - hyprland.host = "marpa"; - caelestia.idleTimeout = 60 * 60 * 24; # a day - }; - phundrak.sshKey.content = builtins.readFile ../keys/id_marpa.pub; - }; - programs.caelestia.settings.bar.status = { - showBattery = false; - showWifi = false; - }; -} diff --git a/users/phundrak/host/naromk3.nix b/users/phundrak/host/naromk3.nix deleted file mode 100644 index 23a1603..0000000 --- a/users/phundrak/host/naromk3.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - imports = [../light-home.nix]; - home = { - cli.nh.flake = "/home/phundrak/.dotfiles"; - phundrak.sshKey.content = builtins.readFile ../keys/id_naromk3.pub; - }; -} diff --git a/users/phundrak/host/pinetab2.nix b/users/phundrak/host/pinetab2.nix deleted file mode 100644 index 6d3d859..0000000 --- a/users/phundrak/host/pinetab2.nix +++ /dev/null @@ -1,9 +0,0 @@ -{config, ...}: { - imports = [../home.nix]; - home = { - cli.nh.flake = "${config.home.homeDirectory}/.dotfiles"; - desktop.hyprland.host = "gampo"; - phundrak.sshKey.content = builtins.readFile ../keys/id_pinetab2.pub; - }; - programs.caelestia.settings.bar.persistent = false; -} diff --git a/users/phundrak/host/tilo.nix b/users/phundrak/host/tilo.nix deleted file mode 100644 index 09356f5..0000000 --- a/users/phundrak/host/tilo.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - imports = [../light-home.nix]; - home = { - cli.nh.flake = "/tank/phundrak/.dotfiles"; - phundrak.sshKey.content = builtins.readFile ../keys/id_tilo.pub; - }; -} diff --git a/users/phundrak/keys/id_alys.pub b/users/phundrak/keys/id_alys.pub deleted file mode 100644 index 51469fc..0000000 --- a/users/phundrak/keys/id_alys.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHTv1lb6d99O84jeh6GdjPm8Gnt/HncSRhGhmoTq7BMK lucien@phundrak.com diff --git a/users/phundrak/light-home.nix b/users/phundrak/light-home.nix deleted file mode 100644 index 37793cb..0000000 --- a/users/phundrak/light-home.nix +++ /dev/null @@ -1,81 +0,0 @@ -{ - lib, - pkgs, - config, - ... -}: -with lib; let - cfg = config.home.phundrak; -in { - imports = [../modules ./zellij.nix]; - - options.home.phundrak = { - sshKey = { - content = mkOption { - type = types.nullOr types.str; - example = "ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; - default = null; - }; - file = mkOption { - type = with types; nullOr path; - default = "/home/phundrak/.ssh/id_ed25519.pub"; - }; - }; - }; - - config = { - nixpkgs.config.allowUnfree = true; - - sops = { - defaultSopsFile = ../../secrets/secrets.yaml; - defaultSopsFormat = "yaml"; - secrets."ssh/hosts" = {}; - age = { - # automatically import user SSH keys as age keys - sshKeyPaths = ["${config.home.homeDirectory}/.ssh/id_ed25519"]; - # this will use an age key that is expected to already be in the filesystem - keyFile = "${config.home.homeDirectory}/.local/sops-nix/key.txt"; - # generate a new key if the key specified above does not exist - generateKey = true; - }; - }; - - home = { - username = "phundrak"; - homeDirectory = "/home/phundrak"; - packages = [pkgs.tree pkgs.ncdu]; - preferXdgDirectories = true; - - phundrak.sshKey.file = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; - - dev.vcs = { - jj.enable = true; - git.enable = true; - publicKey = cfg.sshKey; - }; - - security.ssh = { - enable = true; - hosts = config.sops.secrets."ssh/hosts".path; - }; - - shell = { - bash.enable = true; - zsh.enable = true; - starship = { - enable = true; - jjIntegration = true; - }; - tmux.enable = true; - zoxide = { - enable = true; - replaceCd = true; - }; - }; - - stateVersion = "24.11"; # Do not modify! - }; - - manual.manpages.enable = true; - }; -} diff --git a/users/phundrak/packages.nix b/users/phundrak/packages.nix deleted file mode 100644 index a35038c..0000000 --- a/users/phundrak/packages.nix +++ /dev/null @@ -1,91 +0,0 @@ -{ - pkgs, - inputs, - lib, - ... -}: -with lib; let - inherit (pkgs.stdenv.hostPlatform) system; - handy = pkgs.callPackage ../../packages/handy.nix {}; - pumo-system-info = inputs.pumo-system-info.packages.${system}.default; -in { - programs.bun.enable = true; - home.packages = with pkgs; [ - # Terminal stuff - duf - ffmpeg - ripgrep-all - unzip - - # Fonts - #nerdfonts - noto-fonts-cjk-sans - noto-fonts-cjk-serif - tibetan-machine - - # Browsers - amfora - - # Media - ani-cli - audacity - plexamp - plex-desktop - pavucontrol # Volume control - - # Social - vesktop # Discord alternative that works well with wayland - signal-desktop - - # Misc - # gplates - kicad-small - qgis - handy - libnotify - nextcloud-client - onlyoffice-desktopeditors - pumo-system-info - scrcpy - syncthing - watchmate - chatterino7 - - # Games - atlauncher - heroic - openmw - openttd-jgrpp - moonlight-qt - - # Gnome stuff - gnomeExtensions.tray-icons-reloaded - gthumb - - # Graphics - inkscape - gimp - gimpPlugins.gmic - - # Dev - dbeaver-bin - devenv - nodejs - sqlite - tectonic # better LaTeX engine - wakatime-cli - zeal - pandoc - - ## LSP servers - bash-language-server - docker-language-server - kdePackages.qtdeclarative # For QML LSP - nixd - nixfmt - marksman - python3 # for Emacs and LSP - vscode-json-languageserver - yaml-language-server # Yaml (Docker, GitHub Actions, ...) - ]; -} diff --git a/users/phundrak/tmux.nix b/users/phundrak/tmux.nix deleted file mode 100644 index 3854a49..0000000 --- a/users/phundrak/tmux.nix +++ /dev/null @@ -1,210 +0,0 @@ -{ - home.shell.tmux = { - enable = true; - extraConfig = "set-option -sa terminal-overrides \",xterm*:Tc\""; - unbind = [ - "C-b" - {"copy-mode-vi" = ["H" "J" "K" "L" "h" "j" "k" "l"];} - ]; - bind = { - prefix = [ - { - key = "«"; - action = "select-window -p"; - } - { - key = "»"; - action = "select-window -n"; - } - { - key = "Tab"; - action = "switch-client -T windows"; - } - { - key = "w"; - action = "switch-client -T pane"; - } - { - key = "y"; - action = "switch-client -T copy-mode"; - } - ]; - pane = [ - { - key = "/"; - action = "split-window -h -c \"#{pane-current_path}\""; - } - { - key = "-"; - action = "split-window -v -c \"#{pane-current_path}\""; - } - { - key = "c"; - action = "select-pane -L"; - } - { - key = "t"; - action = "select-pane -D"; - } - { - key = "s"; - action = "select-pane -U"; - } - { - key = "r"; - action = "select-pane -R"; - } - { - key = "f"; - action = "resize-pane -Z"; - } - { - key = "."; - action = "switch-client -T pane-resize"; - } - ]; - "pane-resize" = [ - { - key = "c"; - action = "resize-pane -L 5\\; switch-client -T pane-resize"; - } - { - key = "t"; - action = "resize-pane -D 5\\; switch-client -T pane-resize"; - } - { - key = "s"; - action = "resize-pane -U 5\\; switch-client -T pane-resize"; - } - { - key = "r"; - action = "resize-pane -R 5\\; switch-client -T pane-resize"; - } - { - key = "C"; - action = "resize-pane -L\\; switch-client -T pane-resize"; - } - { - key = "T"; - action = "resize-pane -D\\; switch-client -T pane-resize"; - } - { - key = "S"; - action = "resize-pane -U\\; switch-client -T pane-resize"; - } - { - key = "R"; - action = "resize-pane -R\\; switch-client -T pane-resize"; - } - ]; - windows = [ - { - key = "c"; - action = "new-window"; - } - { - key = "n"; - action = "next-window"; - } - { - key = "p"; - action = "previous-window"; - } - { - key = "r"; - action = "command-prompt \"rename-window '%%'\""; - } - { - key = "\\\""; - action = "select-window -t :=1"; - } - { - key = "«"; - action = "select-window -t :=2"; - } - { - key = "»"; - action = "select-window -t :=3"; - } - { - key = "("; - action = "select-window -t :=4"; - } - { - key = ")"; - action = "select-window -t :=5"; - } - { - key = "@"; - action = "select-window -t :=6"; - } - { - key = "+"; - action = "select-window -t :=7"; - } - { - key = "-"; - action = "select-window -t :=8"; - } - { - key = "/"; - action = "select-window -t :=9"; - } - { - key = "*"; - action = "select-window -t :=10"; - } - ]; - "copy-mode-vi" = [ - { - key = "v"; - action = "send-keys -X begin-selection"; - } - { - key = "C-v"; - action = "send-keys -X rectangle-toggle"; - } - { - key = "y"; - action = "send-keys -X copy-selection-and-cancel"; - } - { - key = "C"; - action = "send-keys -X top-line"; - } - { - key = "J"; - action = "send-keys -X jump-to-backward"; - } - { - key = "S"; - action = "send-keys -X scroll-up"; - } - { - key = "R"; - action = "send-keys -X bottom-line"; - } - { - key = "T"; - action = "send-keys -X scroll-down"; - } - { - key = "c"; - action = "send-keys -X cursor-left"; - } - { - key = "t"; - action = "send-keys -X cursor-down"; - } - { - key = "s"; - action = "send-keys -X cursor-up"; - } - { - key = "r"; - action = "send-keys -X cursor-right"; - } - ]; - }; - }; -} diff --git a/users/phundrak/zellij.nix b/users/phundrak/zellij.nix deleted file mode 100644 index b3fc65c..0000000 --- a/users/phundrak/zellij.nix +++ /dev/null @@ -1,264 +0,0 @@ -{lib, ...}: { - home.shell.zellij = with lib; { - enable = true; - clearDefaultKeybinds = true; - useUnlockFirst = true; - settings.copy_on_select = true; - extraSettings = '' - plugins { - about location="zellij:about" - compact-bar location="zellij:compact-bar" - configuration location="zellij:configuration" - filepicker location="zellij:strider" { - cwd "/" - } - plugin-manager location="zellij:plugin-manager" - session-manager location="zellij:session-manager" - status-bar location="zellij:status-bar" - strider location="zellij:strider" - tab-bar location="zellij:tab-bar" - welcome-screen location="zellij:session-manager" { - welcome_screen true - } - } - ''; - keybinds = let - # bépo layout - left = ["c" "Left"]; - down = ["t" "Down"]; - up = ["s" "Up"]; - right = ["r" "Right"]; - numRow = ["\"" "«" "»" "(" ")" "@" "+" "-" "/" "*"]; - in { - locked = [ - { - bind = "Ctrl Alt g"; - actions = {SwitchToMode = "normal";}; - } - ]; - pane = [ - { - bind = left; - actions = {MoveFocus = "Left";}; - } - { - bind = down; - actions = {MoveFocus = "Down";}; - } - { - bind = up; - actions = {MoveFocus = "Up";}; - } - { - bind = right; - actions = {MoveFocus = "Right";}; - } - { - bind = "n"; - actions = {NewPane = [];}; - useUnlockFirst = true; - } - { - bind = "T"; - actions = {NewPane = "Down";}; - useUnlockFirst = true; - } - { - bind = "R"; - actions = {NewPane = "Right";}; - useUnlockFirst = true; - } - { - bind = "S"; - actions = {NewPane = "stacked";}; - useUnlockFirst = true; - } - { - bind = "N"; - actions = {SwitchToMode = "normal";}; - } - { - bind = "e"; - actions = {TogglePaneEmbedOrFloating = [];}; - useUnlockFirst = true; - } - { - bind = "i"; - actions = {TogglePanePinned = [];}; - } - { - bind = "f"; - actions = {ToggleFocusFullscreen = [];}; - useUnlockFirst = true; - } - { - bind = "F"; - actions = {ToggleFloatingPanes = [];}; - } - { - bind = "q"; - actions = {CloseFocus = [];}; - useUnlockFirst = true; - } - { - bind = "p"; - actions = {SwitchToMode = "normal";}; - } - { - bind = "P"; - actions = { - SwitchToMode = "renamepane"; - PaneNameInput = 0; - }; - } - { - bind = "z"; - actions = {TogglePaneFrames = [];}; - useUnlockFirst = true; - } - { - bind = "tab"; - actions = {SwitchFocus = [];}; - } - ]; - resize = [ - { - bind = "n"; - actions = {SwitchToMode = "locked";}; - } - { - bind = left; - actions = {Resize = "Increase Left";}; - } - { - bind = down; - actions = {Resize = "Increase Down";}; - } - { - bind = up; - actions = {Resize = "Increase Up";}; - } - { - bind = right; - actions = {Resize = "Increase Right";}; - } - { - bind = "C"; - actions = {Resize = "Decrease Left";}; - } - { - bind = "T"; - actions = {Resize = "Decrease Down";}; - } - { - bind = "S"; - actions = {Resize = "Decrease Up";}; - } - { - bind = "R"; - actions = {Resize = "Decrease Right";}; - } - { - bind = "+"; - actions = {Resize = "Increase";}; - } - { - bind = "-"; - actions = {Resize = "Decrease";}; - } - ]; - move = [ - { - bind = left; - actions = {MovePane = "left";}; - } - { - bind = down; - actions = {MovePane = "down";}; - } - { - bind = up; - actions = {MovePane = "up";}; - } - { - bind = right; - actions = {MovePane = "right";}; - } - { - bind = "m"; - actions = {SwitchToMode = "normal";}; - } - { - bind = ["n" "tab"]; - actions = {MovePane = [];}; - } - { - bind = "p"; - actions = {MovePaneBackwards = [];}; - } - ]; - tab = - [ - { - bind = left ++ up; - actions = {GoToPreviousTab = [];}; - } - { - bind = down ++ right; - actions = {GoToNextTab = [];}; - } - { - bind = "["; - actions = {BreakPaneLeft = [];}; - useUnlockFirst = true; - } - { - bind = "]"; - actions = {BreakPaneRight = [];}; - useUnlockFirst = true; - } - { - bind = "b"; - actions = {BreakPane = [];}; - useUnlockFirst = true; - } - { - bind = "n"; - actions = {NewTab = [];}; - useUnlockFirst = true; - } - { - bind = "R"; - actions = { - SwitchToMode = "renametab"; - TabNameInput = 0; - }; - } - { - bind = "s"; - actions = {ToggleActiveSyncTab = [];}; - useUnlockFirst = true; - } - { - bind = "T"; - actions = {SwitchToMode = "normal";}; - } - { - bind = "x"; - actions = {CloseTab = [];}; - useUnlockFirst = true; - } - { - bind = "tab"; - actions = {ToggleTab = [];}; - } - ] - ++ (lists.imap1 (i: key: { - bind = key; - actions = {GoToTab = i;}; - useUnlockFirst = true; - }) - numRow); - }; - }; -} diff --git a/utils/pinetab.nix b/utils/pinetab.nix deleted file mode 100644 index 3613558..0000000 --- a/utils/pinetab.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - nixpkgs, - rockchip, - additionalModules, - specialArgs, - ... -}: buildPlatform: variant: -nixpkgs.lib.nixosSystem { - system = "aarch64-linux"; - inherit specialArgs; - modules = - [ - rockchip.nixosModules.sdImageRockchip - rockchip.nixosModules.dtOverlayPCIeFix - rockchip.nixosModules.noZFS - ../hosts/pinetab2 - variant - { - rockchip.uBoot = rockchip.packages.${buildPlatform}.uBootPineTab2; - boot.kernelPackages = rockchip.legacyPackages.${buildPlatform}.kernel_linux_7_0_pinetab_unstable; - hardware.firmware = [rockchip.packages.aarch64-linux.bes2600]; - nixpkgs.config.allowUnfreePredicate = pkg: - builtins.elem (nixpkgs.lib.getName pkg) [ - "bes2600-firmware" - ]; - } - ] - ++ additionalModules; -}