diff --git a/common.nix b/common.nix index fc56d65..fd6889a 100644 --- a/common.nix +++ b/common.nix @@ -1,9 +1,14 @@ -{ inputs, config, lib, pkgs, ... }: +{ + inputs, + lib, + pkgs, + ... +}: -with lib; -with lib.my; { - imports = [ inputs.home-manager.nixosModules.home-manager ] - ++ (mapModulesRec' (toString ./modules) import); +{ + imports = [ + inputs.home-manager.nixosModules.home-manager + ] ++ (lib.my.mapModulesRec' (toString ./modules) import); nix = { package = pkgs.nixFlakes; @@ -23,22 +28,22 @@ with lib.my; { }; }; - system.configurationRevision = with inputs; mkIf (self ? rev) self.rev; + system.configurationRevision = lib.mkIf (inputs.self ? rev) inputs.self.rev; - time.timeZone = mkDefault "Europe/Amsterdam"; + time.timeZone = lib.mkDefault "Europe/Amsterdam"; - i18n.defaultLocale = mkDefault "en_US.UTF-8"; + i18n.defaultLocale = lib.mkDefault "en_US.UTF-8"; console = { keyMap = lib.mkDefault "fr"; - font = mkDefault "${pkgs.terminus_font}/share/consolefonts/ter-v32n.psf.gz"; + font = lib.mkDefault "${pkgs.terminus_font}/share/consolefonts/ter-v32n.psf.gz"; earlySetup = true; }; - fonts.fontconfig.antialias = mkDefault true; + fonts.fontconfig.antialias = lib.mkDefault true; fonts.fontconfig.subpixel = { - rgba = mkDefault "none"; - lcdfilter = mkDefault "none"; + rgba = lib.mkDefault "none"; + lcdfilter = lib.mkDefault "none"; }; environment.systemPackages = with pkgs; [ @@ -60,7 +65,10 @@ with lib.my; { ]; networking.hosts = { - "127.0.0.1" = [ "localhost" "membres.yourcoop.local" ]; + "127.0.0.1" = [ + "localhost" + "membres.yourcoop.local" + ]; }; services.resolved.dnssec = "false"; } diff --git a/flake.nix b/flake.nix index da92a4f..79951a6 100644 --- a/flake.nix +++ b/flake.nix @@ -25,16 +25,24 @@ }; }; - outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, ... }: + outputs = + inputs@{ + self, + nixpkgs, + nixpkgs-unstable, + ... + }: let inherit (lib.my) mapHosts; system = "x86_64-linux"; - mkPkgs = pkgs: extraOverlays: + mkPkgs = + pkgs: extraOverlays: import pkgs { inherit system; - config.allowUnfreePredicate = pkg: + config.allowUnfreePredicate = + pkg: builtins.elem (pkgs.lib.getName pkg) [ "corefonts" "steam" @@ -46,24 +54,30 @@ pkgs = mkPkgs nixpkgs [ self.overlay ]; pkgs-unstable = mkPkgs nixpkgs-unstable [ ]; - lib = nixpkgs.lib.extend (self: super: { - my = import ./lib { - inherit pkgs inputs; - lib = self; - }; - }); + lib = nixpkgs.lib.extend ( + self: super: { + my = import ./lib { + inherit pkgs inputs; + lib = self; + }; + } + ); in { lib = lib.my; overlay = final: prev: { unstable = pkgs-unstable; }; - overlays = { my = (import ./overlay.nix); }; + overlays = { + my = import ./overlay.nix; + }; nixosConfigurations = (mapHosts ./hosts { }) // { rpi3 = nixpkgs.lib.nixosSystem { system = "aarch64-linux"; - specialArgs = { inherit inputs; }; + specialArgs = { + inherit inputs; + }; modules = [ ./hosts/rpi3/default.nix ]; }; }; diff --git a/hosts/froidmpa-laptop/default.nix b/hosts/froidmpa-laptop/default.nix index fa14d70..8e09cae 100644 --- a/hosts/froidmpa-laptop/default.nix +++ b/hosts/froidmpa-laptop/default.nix @@ -1,4 +1,5 @@ -{ pkgs, config, lib, ... }: { +{ config, ... }: +{ imports = [ ./hardware-configuration.nix ]; modules = { @@ -26,20 +27,27 @@ services.tlp.enable = true; - home-manager.users.${config.user.name} = { pkgs, config, ... }: { - services.network-manager-applet.enable = true; - services.blueman-applet.enable = true; - wayland.windowManager.hyprland.settings = { - dwindle.no_gaps_when_only = 1; + home-manager.users.${config.user.name} = + { _ }: + { + services.network-manager-applet.enable = true; + services.blueman-applet.enable = true; + wayland.windowManager.hyprland.settings = { + dwindle.no_gaps_when_only = 1; + }; }; - }; services.pipewire.wireplumber.extraConfig = { "monitor.bluez.properties" = { "bluez5.enable-sbc-xq" = true; "bluez5.enable-msbc" = true; "bluez5.enable-hw-volume" = true; - "bluez5.roles" = [ "hsp_hs" "hsp_ag" "hfp_hf" "hfp_ag" ]; + "bluez5.roles" = [ + "hsp_hs" + "hsp_ag" + "hfp_hf" + "hfp_ag" + ]; }; }; system.stateVersion = "21.05"; diff --git a/hosts/froidmpa-laptop/hardware-configuration.nix b/hosts/froidmpa-laptop/hardware-configuration.nix index bd5ac83..3909a85 100644 --- a/hosts/froidmpa-laptop/hardware-configuration.nix +++ b/hosts/froidmpa-laptop/hardware-configuration.nix @@ -1,19 +1,28 @@ -{ config, lib, pkgs, modulesPath, ... }: +{ modulesPath, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; boot = { - initrd.availableKernelModules = [ "nvme" "xhci_pci" "sdhci_pci" ]; - initrd.kernelModules = [ "dm-snapshot" ]; + initrd = { + availableKernelModules = [ + "nvme" + "xhci_pci" + "sdhci_pci" + ]; + kernelModules = [ "dm-snapshot" ]; + }; kernelModules = [ "kvm-amd" ]; # Required, otherwise the kernel freezes on boot - kernelParams = [ "amd_iommu=on" "iommu=pt" "pci=noats" ]; + kernelParams = [ + "amd_iommu=on" + "iommu=pt" + "pci=noats" + ]; extraModulePackages = [ ]; loader.systemd-boot.enable = true; loader.efi.canTouchEfiVariables = true; - initrd.luks.devices."crypted".device = - "/dev/disk/by-uuid/1e900b2e-daea-4558-b18f-3d3a5843de61"; + initrd.luks.devices."crypted".device = "/dev/disk/by-uuid/1e900b2e-daea-4558-b18f-3d3a5843de61"; }; hardware.cpu.amd.updateMicrocode = true; @@ -28,8 +37,7 @@ fsType = "vfat"; }; - swapDevices = - [{ device = "/dev/disk/by-uuid/bb8fa9ef-9b8f-413d-913a-6c891649a954"; }]; + swapDevices = [ { device = "/dev/disk/by-uuid/bb8fa9ef-9b8f-413d-913a-6c891649a954"; } ]; zramSwap.enable = true; @@ -37,7 +45,11 @@ bluetooth = { enable = true; # Enable A2DP Sink - settings = { General = { Enable = "Source,Sink,Media,Socket"; }; }; + settings = { + General = { + Enable = "Source,Sink,Media,Socket"; + }; + }; }; }; diff --git a/hosts/nixos-desktop/default.nix b/hosts/nixos-desktop/default.nix index 7fccfda..e844676 100644 --- a/hosts/nixos-desktop/default.nix +++ b/hosts/nixos-desktop/default.nix @@ -1,4 +1,5 @@ -{ pkgs, config, lib, ... }: { +{ ... }: +{ imports = [ ./hardware-configuration.nix ]; modules = { diff --git a/hosts/nixos-desktop/hardware-configuration.nix b/hosts/nixos-desktop/hardware-configuration.nix index d0dc051..a736fa3 100644 --- a/hosts/nixos-desktop/hardware-configuration.nix +++ b/hosts/nixos-desktop/hardware-configuration.nix @@ -19,28 +19,29 @@ loader.efi.canTouchEfiVariables = true; }; - fileSystems."/" = { - device = "/dev/disk/by-uuid/f1e21558-88e6-413e-b56a-04e0b25e9ddd"; - fsType = "ext4"; + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/f1e21558-88e6-413e-b56a-04e0b25e9ddd"; + fsType = "ext4"; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/CCD1-0415"; + fsType = "vfat"; + }; + + "/home/froidmpa/Nextcloud" = { + device = "/dev/disk/by-uuid/a4ba8b21-ea33-4487-b6f6-9bb7470a0acb"; + fsType = "ext4"; + }; + + "/home/froidmpa/Backup" = { + device = "/dev/disk/by-uuid/7fdc4e44-ecb4-49c7-9fb0-cb1ef6235b05"; + fsType = "ext4"; + }; }; - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/CCD1-0415"; - fsType = "vfat"; - }; - - fileSystems."/home/froidmpa/Nextcloud" = { - device = "/dev/disk/by-uuid/a4ba8b21-ea33-4487-b6f6-9bb7470a0acb"; - fsType = "ext4"; - }; - - fileSystems."/home/froidmpa/Backup" = { - device = "/dev/disk/by-uuid/7fdc4e44-ecb4-49c7-9fb0-cb1ef6235b05"; - fsType = "ext4"; - }; - - swapDevices = - [{ device = "/dev/disk/by-uuid/f714775c-b5af-4c0c-8330-999b43db4794"; }]; + swapDevices = [ { device = "/dev/disk/by-uuid/f714775c-b5af-4c0c-8330-999b43db4794"; } ]; zramSwap.enable = true; @@ -54,11 +55,14 @@ enable = true; driSupport = true; driSupport32Bit = true; - extraPackages = with pkgs; [ rocm-opencl-icd rocm-opencl-runtime amdvlk ]; + extraPackages = with pkgs; [ + rocm-opencl-icd + rocm-opencl-runtime + amdvlk + ]; }; - hardware.cpu.amd.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; services.resolved.dnssec = "false"; } diff --git a/hosts/rpi3/default.nix b/hosts/rpi3/default.nix index aaccbba..b48da97 100644 --- a/hosts/rpi3/default.nix +++ b/hosts/rpi3/default.nix @@ -1,23 +1,28 @@ -{ inputs, pkgs, ... }: { +{ inputs, pkgs, ... }: +{ nix = { registry.nixpkgs.flake = inputs.nixpkgs; nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; }; - boot.loader.grub.enable = false; - boot.loader.generic-extlinux-compatible.enable = true; - boot.kernelParams = [ "cma=256M" ]; + boot = { + loader.grub.enable = false; + loader.generic-extlinux-compatible.enable = true; + kernelParams = [ "cma=256M" ]; + }; fileSystems."/" = { device = "/dev/disk/by-label/NIXOS_SD"; fsType = "ext4"; }; - swapDevices = [{ - device = "/swapfile"; - size = 1024; - }]; + swapDevices = [ + { + device = "/swapfile"; + size = 1024; + } + ]; services.openssh.enable = true; users.users.root.openssh.authorizedKeys.keyFiles = [ @@ -33,15 +38,20 @@ mutableSettings = false; settings = { - http = { address = "0.0.0.0:80"; }; + http = { + address = "0.0.0.0:80"; + }; auth_attempts = 5; block_auth_min = 15; dns = { bind_hosts = [ "0.0.0.0" ]; port = 53; statistics_interval = 90; - upstream_dns = - [ "tls://doh.mullvad.net" "[/lan/]192.168.1.1" "[//]192.168.1.1" ]; + upstream_dns = [ + "tls://doh.mullvad.net" + "[/lan/]192.168.1.1" + "[//]192.168.1.1" + ]; local_ptr_upstreams = [ "192.168.1.1" ]; use_private_ptr_resolvers = true; resolve_clients = true; @@ -64,11 +74,19 @@ }; }; - networking.hostName = "rpi3"; - networking.firewall.allowedTCPPorts = [ 53 80 ]; - networking.firewall.allowedUDPPorts = [ 53 ]; + networking = { + hostName = "rpi3"; + firewall.allowedTCPPorts = [ + 53 + 80 + ]; + firewall.allowedUDPPorts = [ 53 ]; + }; - environment.systemPackages = with pkgs; [ vim htop-vim ]; + environment.systemPackages = with pkgs; [ + vim + htop-vim + ]; system.stateVersion = "22.05"; } diff --git a/lib/attrs.nix b/lib/attrs.nix index 0f8ebd1..6ec067c 100644 --- a/lib/attrs.nix +++ b/lib/attrs.nix @@ -1,26 +1,22 @@ { lib, ... }: - -with builtins; -with lib; rec { # attrsToList - attrsToList = attrs: - mapAttrsToList (name: value: { inherit name value; }) attrs; + attrsToList = attrs: lib.mapAttrsToList (name: value: { inherit name value; }) attrs; # mapFilterAttrs :: # (name -> value -> bool) # (name -> value -> { name = any; value = any; }) # attrs - mapFilterAttrs = pred: f: attrs: filterAttrs pred (mapAttrs' f attrs); + mapFilterAttrs = + pred: f: attrs: + lib.filterAttrs pred (lib.mapAttrs' f attrs); # Generate an attribute set by mapping a function over a list of values. - genAttrs' = values: f: listToAttrs (map f values); + genAttrs' = values: f: lib.listToAttrs (map f values); # anyAttrs :: (name -> value -> bool) attrs - anyAttrs = pred: attrs: - any (attr: pred attr.name attr.value) (attrsToList attrs); + anyAttrs = pred: attrs: lib.any (attr: pred attr.name attr.value) (attrsToList attrs); # countAttrs :: (name -> value -> bool) attrs - countAttrs = pred: attrs: - count (attr: pred attr.name attr.value) (attrsToList attrs); + countAttrs = pred: attrs: lib.count (attr: pred attr.name attr.value) (attrsToList attrs); } diff --git a/lib/default.nix b/lib/default.nix index a275c09..be56181 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,4 +1,9 @@ -{ inputs, lib, pkgs, ... }: +{ + inputs, + lib, + pkgs, + ... +}: let inherit (lib) makeExtensible attrValues foldr; @@ -6,13 +11,25 @@ let modules = import ./modules.nix { inherit lib; - self.attrs = import ./attrs.nix { inherit lib; self = { }; }; + self.attrs = import ./attrs.nix { + inherit lib; + self = { }; + }; }; - mylib = makeExtensible (self: - with self; mapModules ./. - (file: import file { inherit self lib pkgs inputs; })); + mylib = makeExtensible ( + self: + mapModules ./. ( + file: + import file { + inherit + self + lib + pkgs + inputs + ; + } + ) + ); in -mylib.extend - (self: super: - foldr (a: b: a // b) { } (attrValues super)) +mylib.extend (self: super: foldr (a: b: a // b) { } (attrValues super)) diff --git a/lib/modules.nix b/lib/modules.nix index ef7c289..76d4fee 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -1,52 +1,62 @@ { self, lib, ... }: let - inherit (builtins) attrValues readDir pathExists concatLists; - inherit (lib) id mapAttrsToList filterAttrs hasPrefix hasSuffix nameValuePair removeSuffix; + inherit (builtins) + attrValues + readDir + pathExists + concatLists + ; + inherit (lib) + id + mapAttrsToList + filterAttrs + hasPrefix + hasSuffix + nameValuePair + removeSuffix + ; inherit (self.attrs) mapFilterAttrs; in rec { - mapModules = dir: fn: - mapFilterAttrs - (n: v: - v != null && - !(hasPrefix "_" n)) - (n: v: - let path = "${toString dir}/${n}"; in - if v == "directory" && pathExists "${path}/default.nix" - then nameValuePair n (fn path) - else if v == "regular" && - n != "default.nix" && - hasSuffix ".nix" n - then nameValuePair (removeSuffix ".nix" n) (fn path) - else nameValuePair "" null) - (readDir dir); + mapModules = + dir: fn: + mapFilterAttrs (n: v: v != null && !(hasPrefix "_" n)) ( + n: v: + let + path = "${toString dir}/${n}"; + in + if v == "directory" && pathExists "${path}/default.nix" then + nameValuePair n (fn path) + else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n then + nameValuePair (removeSuffix ".nix" n) (fn path) + else + nameValuePair "" null + ) (readDir dir); - mapModules' = dir: fn: - attrValues (mapModules dir fn); + mapModules' = dir: fn: attrValues (mapModules dir fn); - mapModulesRec = dir: fn: - mapFilterAttrs - (n: v: - v != null && - !(hasPrefix "_" n)) - (n: v: - let path = "${toString dir}/${n}"; in - if v == "directory" - then nameValuePair n (mapModulesRec path fn) - else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n - then nameValuePair (removeSuffix ".nix" n) (fn path) - else nameValuePair "" null) - (readDir dir); + mapModulesRec = + dir: fn: + mapFilterAttrs (n: v: v != null && !(hasPrefix "_" n)) ( + n: v: + let + path = "${toString dir}/${n}"; + in + if v == "directory" then + nameValuePair n (mapModulesRec path fn) + else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n then + nameValuePair (removeSuffix ".nix" n) (fn path) + else + nameValuePair "" null + ) (readDir dir); - mapModulesRec' = dir: fn: + mapModulesRec' = + dir: fn: let - dirs = - mapAttrsToList - (k: _: "${dir}/${k}") - (filterAttrs - (n: v: v == "directory" && !(hasPrefix "_" n)) - (readDir dir)); + dirs = mapAttrsToList (k: _: "${dir}/${k}") ( + filterAttrs (n: v: v == "directory" && !(hasPrefix "_" n)) (readDir dir) + ); files = attrValues (mapModules dir id); paths = files ++ concatLists (map (d: mapModulesRec' d id) dirs); in diff --git a/lib/nixos.nix b/lib/nixos.nix index e904ecd..3eb25dd 100644 --- a/lib/nixos.nix +++ b/lib/nixos.nix @@ -1,26 +1,42 @@ -{ inputs, lib, pkgs, ... }: +{ + inputs, + lib, + pkgs, + ... +}: -with lib; -with lib.my; -let sys = "x86_64-linux"; -in { - mkHost = path: attrs @ { system ? sys, ... }: - nixosSystem { +let + sys = "x86_64-linux"; +in +rec { + mkHost = + path: + attrs@{ + system ? sys, + ... + }: + lib.nixosSystem { inherit system; - specialArgs = { inherit lib inputs system; }; + specialArgs = { + inherit lib inputs system; + }; modules = [ { nixpkgs.pkgs = pkgs; nix.registry.nixpkgs.flake = inputs.nixpkgs; - networking.hostName = mkDefault (removeSuffix ".nix" (baseNameOf path)); + networking.hostName = lib.mkDefault (lib.removeSuffix ".nix" (baseNameOf path)); } - (filterAttrs (n: v: !elem n [ "system" ]) attrs) + (lib.filterAttrs (n: v: !lib.elem n [ "system" ]) attrs) ../common.nix (import path) ]; }; - mapHosts = dir: attrs @ { system ? system, ... }: - mapModules dir - (hostPath: mkHost hostPath attrs); + mapHosts = + dir: + attrs@{ + system ? system, + ... + }: + lib.my.mapModules dir (hostPath: mkHost hostPath attrs); } diff --git a/lib/options.nix b/lib/options.nix index 13610ba..5e99928 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -3,16 +3,18 @@ let inherit (lib) mkOption types; in -rec { - mkOpt = type: default: - mkOption { inherit type default; }; +{ + mkOpt = type: default: mkOption { inherit type default; }; - mkOpt' = type: default: description: + mkOpt' = + type: default: description: mkOption { inherit type default description; }; - mkBoolOpt = default: mkOption { - inherit default; - type = types.bool; - example = true; - }; + mkBoolOpt = + default: + mkOption { + inherit default; + type = types.bool; + example = true; + }; } diff --git a/modules/apps/rofi/rofi.nix b/modules/apps/rofi/rofi.nix index ca06c01..f476efa 100644 --- a/modules/apps/rofi/rofi.nix +++ b/modules/apps/rofi/rofi.nix @@ -1,12 +1,19 @@ -{ inputs, config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; -let cfg = config.modules.apps.rofi; -in { - options.modules.apps.rofi = { enable = mkBoolOpt false; }; +let + cfg = config.modules.apps.rofi; +in +{ + options.modules.apps.rofi = { + enable = lib.my.mkBoolOpt false; + }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { home-manager.users.${config.user.name} = { programs.rofi = { @@ -31,7 +38,10 @@ in { }; theme = ./theme.rasi; }; - home.packages = with pkgs.unstable; [ paper-icon-theme rofi-power-menu ]; + home.packages = with pkgs.unstable; [ + paper-icon-theme + rofi-power-menu + ]; }; }; } diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 61f8638..ad76c61 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -1,9 +1,13 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let wallpaper = pkgs.fetchurl { - url = - "https://raw.githubusercontent.com/AngelJumbo/gruvbox-wallpapers/main/wallpapers/irl/houseonthesideofalake.jpg"; + url = "https://raw.githubusercontent.com/AngelJumbo/gruvbox-wallpapers/main/wallpapers/irl/houseonthesideofalake.jpg"; sha256 = "sha256-obKI4qZvucogqRCl51lwV9X8SRaMqcbBwWMfc9TupIo="; }; in @@ -23,9 +27,16 @@ in corefonts # Microsoft free fonts noto-fonts-emoji meslo-lg - (nerdfonts.override { fonts = [ "Meslo" "NerdFontsSymbolsOnly" ]; }) + (nerdfonts.override { + fonts = [ + "Meslo" + "NerdFontsSymbolsOnly" + ]; + }) ]; - fontconfig.defaultFonts = { monospace = [ "MesloLGS Nerd Font Mono" ]; }; + fontconfig.defaultFonts = { + monospace = [ "MesloLGS Nerd Font Mono" ]; + }; }; programs.adb.enable = true; @@ -57,7 +68,9 @@ in key = lib.mkDefault "3AC6F170F01133CE393BCD94BE948AFD7E7873BE"; signByDefault = true; }; - extraConfig = { init.defaultBranch = "master"; }; + extraConfig = { + init.defaultBranch = "master"; + }; }; ssh = { enable = true; @@ -121,10 +134,8 @@ in "application/pdf" = "org.pwmt.zathura-pdf-mupdf.desktop"; "application/msword" = "onlyoffice-desktopeditors.desktop"; - "application/vnd.openxmlformats-officedocument.presentationml.presentation" = - "onlyoffice-desktopeditors.desktop"; - "application/vnd.openxmlformats-officedocument*" = - "onlyoffice-desktopeditors.desktop"; + "application/vnd.openxmlformats-officedocument.presentationml.presentation" = "onlyoffice-desktopeditors.desktop"; + "application/vnd.openxmlformats-officedocument*" = "onlyoffice-desktopeditors.desktop"; "text/*" = "nvim.desktop"; }; @@ -139,37 +150,37 @@ in sessionVariables.EDITOR = "vim"; - packages = (with pkgs.unstable; [ - brave - ungoogled-chromium - mullvad-browser - keepassxc - krita - element-desktop - swayimg - mpv - mumble - libreoffice-fresh - onlyoffice-bin - thunderbird - portfolio - gnucash - transmission-remote-gtk - monero-gui + packages = + (with pkgs.unstable; [ + brave + ungoogled-chromium + mullvad-browser + keepassxc + krita + element-desktop + swayimg + mpv + mumble + libreoffice-fresh + onlyoffice-bin + thunderbird + portfolio + gnucash + transmission-remote-gtk + monero-gui - scala-cli - jdk - jetbrains.idea-community - httpie + scala-cli + jdk + jetbrains.idea-community + httpie - zsh-syntax-highlighting - R - tldr - ark - linuxPackages.perf - ]) ++ [ - pkgs.jellyfin-mpv-shim - ]; + zsh-syntax-highlighting + R + tldr + ark + linuxPackages.perf + ]) + ++ [ pkgs.jellyfin-mpv-shim ]; }; }; diff --git a/modules/desktop/dunst.nix b/modules/desktop/dunst.nix index 3ccad58..1c58c82 100644 --- a/modules/desktop/dunst.nix +++ b/modules/desktop/dunst.nix @@ -1,11 +1,18 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; -let cfg = config.modules.desktop.dunst; -in { - options.modules.desktop.dunst = { enable = mkBoolOpt false; }; - config = mkIf cfg.enable { +let + cfg = config.modules.desktop.dunst; +in +{ + options.modules.desktop.dunst = { + enable = lib.my.mkBoolOpt false; + }; + config = lib.mkIf cfg.enable { home-manager.users.${config.user.name} = { services.dunst = { enable = true; diff --git a/modules/desktop/file-manager.nix b/modules/desktop/file-manager.nix index 67c82b4..33627fa 100644 --- a/modules/desktop/file-manager.nix +++ b/modules/desktop/file-manager.nix @@ -1,11 +1,18 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; -let cfg = config.modules.desktop.file-manager; -in { - options.modules.desktop.file-manager = { enable = mkBoolOpt false; }; - config = mkIf cfg.enable { +let + cfg = config.modules.desktop.file-manager; +in +{ + options.modules.desktop.file-manager = { + enable = lib.my.mkBoolOpt false; + }; + config = lib.mkIf cfg.enable { home-manager.users.${config.user.name} = { programs.yazi = { @@ -39,11 +46,13 @@ in { desc = "Copy files to clipboard"; } ]; - input.prepend_keymap = [{ - on = [ "" ]; - run = "close"; - desc = "Cancel input"; - }]; + input.prepend_keymap = [ + { + on = [ "" ]; + run = "close"; + desc = "Cancel input"; + } + ]; }; theme = { status = { diff --git a/modules/desktop/flameshot.nix b/modules/desktop/flameshot.nix index a8839ee..7087492 100644 --- a/modules/desktop/flameshot.nix +++ b/modules/desktop/flameshot.nix @@ -1,34 +1,44 @@ -{ config, lib, pkgs, inputs, ... }: +{ + config, + lib, + pkgs, + inputs, + ... +}: -with lib; -with lib.my; -let cfg = config.modules.desktop.flameshot; -in { - options.modules.desktop.flameshot = { enable = mkBoolOpt false; }; - config = mkIf cfg.enable { - home-manager.users.${config.user.name} = { config, ... }: { - services.flameshot = { - enable = true; - package = pkgs.flameshot.overrideAttrs (old: { - src = inputs.flameshot-git; - cmakeFlags = [ "-DUSE_WAYLAND_GRIM=1" ]; - }); - settings = { - General = { - showStartupLaunchMessage = false; - disabledTrayIcon = true; - showHelp = false; - showDesktopNotification = false; - filenamePattern = "%F_%T"; - savePath = "${config.home.homeDirectory}/Pictures/Screenshots"; - savePathFixed = true; - saveAfterCopy = true; - uiColor = "#83A598"; +let + cfg = config.modules.desktop.flameshot; +in +{ + options.modules.desktop.flameshot = { + enable = lib.my.mkBoolOpt false; + }; + config = lib.mkIf cfg.enable { + home-manager.users.${config.user.name} = + { config, ... }: + { + services.flameshot = { + enable = true; + package = pkgs.flameshot.overrideAttrs (old: { + src = inputs.flameshot-git; + cmakeFlags = [ "-DUSE_WAYLAND_GRIM=1" ]; + }); + settings = { + General = { + showStartupLaunchMessage = false; + disabledTrayIcon = true; + showHelp = false; + showDesktopNotification = false; + filenamePattern = "%F_%T"; + savePath = "${config.home.homeDirectory}/Pictures/Screenshots"; + savePathFixed = true; + saveAfterCopy = true; + uiColor = "#83A598"; + }; }; }; - }; - home.packages = with pkgs.unstable; [ grim ]; + home.packages = with pkgs.unstable; [ grim ]; - }; + }; }; } diff --git a/modules/desktop/htop.nix b/modules/desktop/htop.nix index f6632db..9ef9535 100644 --- a/modules/desktop/htop.nix +++ b/modules/desktop/htop.nix @@ -1,45 +1,61 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; -let cfg = config.modules.desktop.htop; -in { - options.modules.desktop.htop = { enable = mkBoolOpt false; }; - config = mkIf cfg.enable { - home-manager.users.${config.user.name} = { config, ... }: { - programs.htop = { - enable = true; - package = pkgs.htop-vim; - settings = { - hide_userland_threads = true; - highlight_base_name = true; - vim_mode = true; - fields = with config.lib.htop.fields; [ - PID - USER - M_RESIDENT - M_SHARE - STATE - PERCENT_CPU - PERCENT_MEM - IO_RATE - TIME - COMM - ]; - } // (with config.lib.htop; - leftMeters [ - (bar "LeftCPUs2") - (bar "CPU") - (bar "Memory") - (bar "Swap") - ]) // (with config.lib.htop; - rightMeters [ - (bar "RightCPUs2") - (text "Tasks") - (text "LoadAverage") - (text "Uptime") - ]); +let + cfg = config.modules.desktop.htop; +in +{ + options.modules.desktop.htop = { + enable = lib.my.mkBoolOpt false; + }; + config = lib.mkIf cfg.enable { + home-manager.users.${config.user.name} = + { config, ... }: + { + programs.htop = { + enable = true; + package = pkgs.htop-vim; + settings = + { + hide_userland_threads = true; + highlight_base_name = true; + vim_mode = true; + fields = with config.lib.htop.fields; [ + PID + USER + M_RESIDENT + M_SHARE + STATE + PERCENT_CPU + PERCENT_MEM + IO_RATE + TIME + COMM + ]; + } + // ( + with config.lib.htop; + leftMeters [ + (bar "LeftCPUs2") + (bar "CPU") + (bar "Memory") + (bar "Swap") + ] + ) + // ( + with config.lib.htop; + rightMeters [ + (bar "RightCPUs2") + (text "Tasks") + (text "LoadAverage") + (text "Uptime") + ] + ); + }; }; - }; }; } diff --git a/modules/desktop/themes/gtk.nix b/modules/desktop/themes/gtk.nix index 8657d6b..5413efd 100644 --- a/modules/desktop/themes/gtk.nix +++ b/modules/desktop/themes/gtk.nix @@ -1,7 +1,10 @@ -{ inputs, config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; let cfg = config.modules.desktop.themes.gtk; @@ -9,8 +12,7 @@ let name = "gruvbox-plus"; version = "5.1"; src = pkgs.fetchurl { - url = - "https://github.com/SylEleuth/gruvbox-plus-icon-pack/releases/download/v${version}/gruvbox-plus-icon-pack-${version}.zip"; + url = "https://github.com/SylEleuth/gruvbox-plus-icon-pack/releases/download/v${version}/gruvbox-plus-icon-pack-${version}.zip"; sha256 = "1n3hqwk1mqaj8vbmy0pqbiq6v5jqrhmhin506xbpnccl28f907j0"; }; dontUnpack = true; @@ -20,10 +22,13 @@ let ''; }; -in { - options.modules.desktop.themes.gtk = { enable = mkBoolOpt false; }; +in +{ + options.modules.desktop.themes.gtk = { + enable = lib.my.mkBoolOpt false; + }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { systemd.packages = [ pkgs.dconf ]; @@ -48,8 +53,12 @@ in { }; xdg.configFile = { - "gtk-3.0/gtk.css" = { source = ./gtk.css; }; - "gtk-4.0/gtk.css" = { source = ./gtk.css; }; + "gtk-3.0/gtk.css" = { + source = ./gtk.css; + }; + "gtk-4.0/gtk.css" = { + source = ./gtk.css; + }; }; home = { diff --git a/modules/desktop/themes/qt.nix b/modules/desktop/themes/qt.nix index 60c70cb..3d81b16 100644 --- a/modules/desktop/themes/qt.nix +++ b/modules/desktop/themes/qt.nix @@ -1,13 +1,20 @@ -{ inputs, config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; -let cfg = config.modules.desktop.themes.qt; +let + cfg = config.modules.desktop.themes.qt; -in { - options.modules.desktop.themes.qt = { enable = mkBoolOpt false; }; +in +{ + options.modules.desktop.themes.qt = { + enable = lib.my.mkBoolOpt false; + }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { environment.systemPackages = with pkgs; [ libsForQt5.qt5.qtquickcontrols2 diff --git a/modules/desktop/vscode.nix b/modules/desktop/vscode.nix index f2c43ee..15cdf6b 100644 --- a/modules/desktop/vscode.nix +++ b/modules/desktop/vscode.nix @@ -1,29 +1,32 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; -let cfg = config.modules.desktop.vscode; -in { +let + cfg = config.modules.desktop.vscode; +in +{ options.modules.desktop.vscode = { - enable = mkBoolOpt false; + enable = lib.my.mkBoolOpt false; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { home-manager.users.${config.user.name} = { programs.vscode = { enable = true; package = pkgs.vscodium; - extensions = ( - with pkgs.vscode-extensions; [ - pkief.material-icon-theme - jnoortheen.nix-ide - arrterian.nix-env-selector - scala-lang.scala - scalameta.metals - hashicorp.terraform - bradlc.vscode-tailwindcss - asciidoctor.asciidoctor-vscode - ] - ); + extensions = with pkgs.vscode-extensions; [ + pkief.material-icon-theme + jnoortheen.nix-ide + arrterian.nix-env-selector + scala-lang.scala + scalameta.metals + hashicorp.terraform + bradlc.vscode-tailwindcss + asciidoctor.asciidoctor-vscode + ]; userSettings = { "editor.formatOnSave" = true; "editor.quickSuggestions" = { @@ -33,8 +36,14 @@ in { "scala" = "html"; }; "tailwindCSS.experimental.classRegex" = [ - [ "cls\\(([^)]*)\\)" "\"([^']*)\"" ] - [ "cls\\s*:=\\s*\\(?([^,^\\n^\\)]*)" "\"([^']*)\"" ] + [ + "cls\\(([^)]*)\\)" + "\"([^']*)\"" + ] + [ + "cls\\s*:=\\s*\\(?([^,^\\n^\\)]*)" + "\"([^']*)\"" + ] ]; "files.autoSave" = "onFocusChange"; @@ -50,9 +59,7 @@ in { "terraform.languageServer" = { "external" = true; "pathToBinary" = ""; - "args" = [ - "serve" - ]; + "args" = [ "serve" ]; "maxNumberOfProblems" = 100; "trace.server" = "off"; }; diff --git a/modules/desktop/wm.nix b/modules/desktop/wm.nix index 1c3875c..f0f5fa4 100644 --- a/modules/desktop/wm.nix +++ b/modules/desktop/wm.nix @@ -1,18 +1,20 @@ -{ options, config, lib, pkgs, ... }: - -with lib; -with lib.my; +{ + config, + lib, + pkgs, + ... +}: let cfg = config.modules.desktop.wm; - term = "${ - config.home-manager.users.${config.user.name}.programs.kitty.package - }/bin/kitty"; + term = "${config.home-manager.users.${config.user.name}.programs.kitty.package}/bin/kitty"; in { - options.modules.desktop.wm = { enable = mkBoolOpt false; }; + options.modules.desktop.wm = { + enable = lib.my.mkBoolOpt false; + }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { modules = { desktop = { @@ -28,7 +30,9 @@ in htop.enable = true; flameshot.enable = true; }; - hardware = { audio.enable = true; }; + hardware = { + audio.enable = true; + }; apps.rofi.enable = true; }; @@ -113,14 +117,20 @@ in wayland.windowManager.hyprland = { enable = true; + package = pkgs.unstable.hyprland; systemd.enable = true; xwayland.enable = true; settings = { "$mod" = "SUPER"; - env = [ "XCURSOR_SIZE,24" "WLR_NO_HARDWARE_CURSORS,1" ]; + env = [ + "XCURSOR_SIZE,24" + "WLR_NO_HARDWARE_CURSORS,1" + ]; - xwayland = { force_zero_scaling = true; }; + xwayland = { + force_zero_scaling = true; + }; general = { layout = "dwindle"; @@ -134,7 +144,9 @@ in hover_icon_on_border = false; }; - dwindle = { preserve_split = true; }; + dwindle = { + preserve_split = true; + }; input = { kb_layout = "fr"; @@ -294,9 +306,19 @@ in height = 25; spacing = 2; reload-style-on-change = true; - modules-left = [ "cpu" "memory" "disk" "hyprland/window" ]; + modules-left = [ + "cpu" + "memory" + "disk" + "hyprland/window" + ]; modules-center = [ "hyprland/workspaces" ]; - modules-right = [ "mpd" "battery" "clock" "tray" ]; + modules-right = [ + "mpd" + "battery" + "clock" + "tray" + ]; tray = { icon-size = 14; @@ -391,7 +413,11 @@ in }; home = { - packages = with pkgs.unstable; [ wlr-randr wl-clipboard wdisplays ]; + packages = with pkgs.unstable; [ + wlr-randr + wl-clipboard + wdisplays + ]; }; programs.swaylock = { diff --git a/modules/desktop/zsh.nix b/modules/desktop/zsh.nix index 9073cca..45ab473 100644 --- a/modules/desktop/zsh.nix +++ b/modules/desktop/zsh.nix @@ -1,67 +1,95 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -let cfg = config.modules.desktop.zsh; -in { - options.modules.desktop.zsh = { enable = lib.my.mkBoolOpt false; }; +let + cfg = config.modules.desktop.zsh; +in +{ + options.modules.desktop.zsh = { + enable = lib.my.mkBoolOpt false; + }; config = lib.mkIf cfg.enable { environment.pathsToLink = [ "/share/zsh" ]; programs.zsh.enable = true; - users.users.${config.user.name} = { shell = pkgs.zsh; }; + users.users.${config.user.name} = { + shell = pkgs.zsh; + }; home-manager.users.${config.user.name} = { - programs.zsh = { - enable = true; - history = { - save = 50000; - size = 50000; - }; - enableCompletion = true; - autosuggestion.enable = true; - syntaxHighlighting.enable = true; - initExtra = /*bash*/'' - autoload -Uz up-line-or-beginning-search down-line-or-beginning-search - zle -N up-line-or-beginning-search - zle -N down-line-or-beginning-search - - [[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search - [[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search - ''; - oh-my-zsh = { + programs = { + zsh = { enable = true; - plugins = [ "git" "terraform" "systemd" ]; - }; - plugins = [ - { - name = "nix-zsh-completions"; - src = pkgs.nix-zsh-completions; - } - { - name = "zsh-completions"; - src = pkgs.zsh-completions; - } - ]; - }; - programs.thefuck = { - enable = true; - enableZshIntegration = true; - }; - programs.starship = { - enable = true; - enableZshIntegration = true; - settings = { - add_newline = true; - cmd_duration = { - min_time = 0; - show_milliseconds = true; + history = { + save = 50000; + size = 50000; + }; + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + initExtra = # bash + '' + autoload -Uz up-line-or-beginning-search down-line-or-beginning-search + zle -N up-line-or-beginning-search + zle -N down-line-or-beginning-search + + [[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search + [[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search + ''; + oh-my-zsh = { + enable = true; + plugins = [ + "git" + "terraform" + "systemd" + ]; + }; + plugins = [ + { + name = "nix-zsh-completions"; + src = pkgs.nix-zsh-completions; + } + { + name = "zsh-completions"; + src = pkgs.zsh-completions; + } + ]; + }; + thefuck = { + enable = true; + enableZshIntegration = true; + }; + starship = { + enable = true; + enableZshIntegration = true; + settings = { + add_newline = true; + cmd_duration = { + min_time = 0; + show_milliseconds = true; + }; + scala = { + symbol = " "; + }; + terraform = { + symbol = "󱁢 "; + }; + nix_shell = { + symbol = "󱄅 "; + }; + nodejs = { + symbol = " "; + }; + php = { + symbol = " "; + }; }; - scala = { symbol = " "; }; - terraform = { symbol = "󱁢 "; }; - nix_shell = { symbol = "󱄅 "; }; - nodejs = { symbol = " "; }; - php = { symbol = " "; }; }; }; }; diff --git a/modules/editor/emacs/emacs.nix b/modules/editor/emacs/emacs.nix index 373b51e..4a367ea 100644 --- a/modules/editor/emacs/emacs.nix +++ b/modules/editor/emacs/emacs.nix @@ -1,73 +1,93 @@ -{ inputs, config, lib, pkgs, ... }: +{ + inputs, + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; -let cfg = config.modules.editor.emacs; -in { - options.modules.editor.emacs = { enable = mkBoolOpt false; }; +let + cfg = config.modules.editor.emacs; +in +{ + options.modules.editor.emacs = { + enable = lib.my.mkBoolOpt false; + }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { home-manager.users.${config.user.name} = { nixpkgs.overlays = [ inputs.emacs-overlay.overlay ]; - home.packages = with pkgs.unstable; [ - binutils - ripgrep - fd - findutils.locate - python311 - libsecret - gcc - gnumake - cmake - nodejs + home = { + packages = [ + pkgs.unstable.binutils + pkgs.unstable.ripgrep + pkgs.unstable.fd + pkgs.unstable.findutils.locate + pkgs.unstable.python311 + pkgs.unstable.libsecret + pkgs.unstable.gcc + pkgs.unstable.gnumake + pkgs.unstable.cmake + pkgs.unstable.nodejs - opentofu - pandoc + pkgs.unstable.opentofu + pkgs.unstable.pandoc - # Formatters and linters - nixfmt-rfc-style # nix formatter - nixpkgs-fmt - shfmt # sh formatter - shellcheck # sh linter - html-tidy # HTML formatter - nodePackages.stylelint # CSS linter - nodePackages.js-beautify # JS/CSS/HTML formatter + # Formatters and linters + pkgs.unstable.nixfmt-rfc-style # nix formatter + pkgs.unstable.nixpkgs-fmt + pkgs.unstable.shfmt # sh formatter + pkgs.unstable.shellcheck # sh linter + pkgs.unstable.html-tidy # HTML formatter + pkgs.unstable.nodePackages.stylelint # CSS linter + pkgs.unstable.nodePackages.js-beautify # JS/CSS/HTML formatter - # LSPs - coursier - # metals # Scala + # LSPs + pkgs.unstable.coursier + # metals # Scala - # Nix - nil + # Nix + pkgs.unstable.nil - pkgs.phpactor # PHP - #OCaml - ocaml - dune_3 - ocamlPackages.ocaml-lsp - ocamlPackages.ocamlformat - ocamlPackages.utop - ocamlPackages.ocp-indent - ocamlPackages.merlin + pkgs.phpactor # PHP + #OCaml + pkgs.unstable.ocaml + pkgs.unstable.dune_3 + pkgs.unstable.ocamlPackages.ocaml-lsp + pkgs.unstable.ocamlPackages.ocamlformat + pkgs.unstable.ocamlPackages.utop + pkgs.unstable.ocamlPackages.ocp-indent + pkgs.unstable.ocamlPackages.merlin - # Used by org-roam - sqlite - graphviz + # Used by org-roam + pkgs.unstable.sqlite + pkgs.unstable.graphviz - # Used by elfeed-tube - yt-dlp - mpv + # Used by elfeed-tube + pkgs.unstable.yt-dlp + pkgs.unstable.mpv - # Used by dirvish - imagemagick - ffmpegthumbnailer - mediainfo - poppler - gnutar - unzip - ]; + # Used by dirvish + pkgs.unstable.imagemagick + pkgs.unstable.ffmpegthumbnailer + pkgs.unstable.mediainfo + pkgs.unstable.poppler + pkgs.unstable.gnutar + pkgs.unstable.unzip + ]; + sessionPath = [ "${config.home-manager.users.${config.user.name}.xdg.configHome}/emacs/bin" ]; + activation = { + installDoomEmacs = '' + if [ ! -d "${config.home-manager.users.${config.user.name}.xdg.configHome}/emacs" ]; then + git clone --depth=1 --single-branch https://github.com/doomemacs/doomemacs "${ + config.home-manager.users.${config.user.name}.xdg.configHome + }/emacs" + fi + ''; + }; + }; services.emacs = { enable = true; @@ -83,29 +103,17 @@ in { withTreeSitter = true; withWebP = true; }; - extraPackages = epkgs: - with epkgs; [ + extraPackages = + epkgs: with epkgs; [ vterm pdf-tools treesit-grammars.with-all-grammars ]; }; - xdg.configFile = { "doom" = { source = ./doom.d; }; }; - home.sessionPath = [ - "${ - config.home-manager.users.${config.user.name}.xdg.configHome - }/emacs/bin" - ]; - home.activation = { - installDoomEmacs = '' - if [ ! -d "${ - config.home-manager.users.${config.user.name}.xdg.configHome - }/emacs" ]; then - git clone --depth=1 --single-branch https://github.com/doomemacs/doomemacs "${ - config.home-manager.users.${config.user.name}.xdg.configHome - }/emacs" - fi - ''; + xdg.configFile = { + "doom" = { + source = ./doom.d; + }; }; }; }; diff --git a/modules/hardware/audio.nix b/modules/hardware/audio.nix index 03bcb4d..ab2f5a2 100644 --- a/modules/hardware/audio.nix +++ b/modules/hardware/audio.nix @@ -1,12 +1,19 @@ -{ options, config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; -let cfg = config.modules.hardware.audio; -in { - options.modules.hardware.audio = { enable = mkBoolOpt false; }; +let + cfg = config.modules.hardware.audio; +in +{ + options.modules.hardware.audio = { + enable = lib.my.mkBoolOpt false; + }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { sound.enable = true; security.rtkit.enable = true; diff --git a/modules/media/emulators.nix b/modules/media/emulators.nix index 8a8ec9a..ff026e1 100644 --- a/modules/media/emulators.nix +++ b/modules/media/emulators.nix @@ -1,24 +1,29 @@ -{ options, config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; -let cfg = config.modules.media.emulators; -in { +let + cfg = config.modules.media.emulators; +in +{ options.modules.media.emulators = { - psx.enable = mkBoolOpt false; # Playstation - ds.enable = mkBoolOpt false; # Nintendo DS - gc.enable = mkBoolOpt false; # GameCube - gb.enable = mkBoolOpt false; # GameBoy + GameBoy Color - gba.enable = mkBoolOpt false; # GameBoy Advance - snes.enable = mkBoolOpt false; # Super Nintendo + psx.enable = lib.my.mkBoolOpt false; # Playstation + ds.enable = lib.my.mkBoolOpt false; # Nintendo DS + gc.enable = lib.my.mkBoolOpt false; # GameCube + gb.enable = lib.my.mkBoolOpt false; # GameBoy + GameBoy Color + gba.enable = lib.my.mkBoolOpt false; # GameBoy Advance + snes.enable = lib.my.mkBoolOpt false; # Super Nintendo }; config = { - user.packages = with pkgs; [ - (mkIf cfg.psx.enable duckstation) - (mkIf cfg.ds.enable desmume) - (mkIf cfg.gc.enable dolphinEmu) - (mkIf (cfg.gba.enable || cfg.gb.enable || cfg.snes.enable) higan) + user.packages = [ + (lib.mkIf cfg.psx.enable pkgs.duckstation) + (lib.mkIf cfg.ds.enable pkgs.desmume) + (lib.mkIf cfg.gc.enable pkgs.dolphinEmu) + (lib.mkIf (cfg.gba.enable || cfg.gb.enable || cfg.snes.enable) pkgs.higan) ]; }; } diff --git a/modules/media/games.nix b/modules/media/games.nix index 5353938..fed0888 100644 --- a/modules/media/games.nix +++ b/modules/media/games.nix @@ -1,20 +1,25 @@ -{ options, config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; -let cfg = config.modules.media; -in { +let + cfg = config.modules.media; +in +{ options.modules.media = { - steam.enable = mkBoolOpt false; - lutris.enable = mkBoolOpt false; + steam.enable = lib.my.mkBoolOpt false; + lutris.enable = lib.my.mkBoolOpt false; }; config = { - user.packages = with pkgs; [ - (mkIf cfg.steam.enable steam) - (mkIf cfg.lutris.enable lutris) - (mkIf cfg.lutris.enable wine) - (mkIf (cfg.steam.enable || cfg.lutris.enable) protontricks) + user.packages = [ + (lib.mkIf cfg.steam.enable pkgs.steam) + (lib.mkIf cfg.lutris.enable pkgs.lutris) + (lib.mkIf cfg.lutris.enable pkgs.wine) + (lib.mkIf (cfg.steam.enable || cfg.lutris.enable) pkgs.protontricks) ]; }; } diff --git a/modules/media/mpd.nix b/modules/media/mpd.nix index b23376f..97070b4 100644 --- a/modules/media/mpd.nix +++ b/modules/media/mpd.nix @@ -1,34 +1,38 @@ -{ config, lib, pkgs, ... }: +{ config, lib, ... }: -with lib; -with lib.my; -let cfg = config.modules.media.mpd; -in { - options.modules.media.mpd = { enable = mkBoolOpt false; }; - config = mkIf cfg.enable { - home-manager.users.${config.user.name} = { config, ... }: { - services.mpd = { - enable = true; - network.listenAddress = "any"; - musicDirectory = "${config.home.homeDirectory}/Nextcloud/Media/Music"; - playlistDirectory = "${config.home.homeDirectory}/Nextcloud/Playlists"; - extraConfig = '' - max_output_buffer_size "16384" - auto_update "yes" - audio_output { - type "pulse" - name "pulse audio" - device "pulse" - mixer_type "hardware" - } - audio_output { - type "fifo" - name "toggle_visualizer" - path "/tmp/mpd.fifo" - format "44100:16:2" - } - ''; +let + cfg = config.modules.media.mpd; +in +{ + options.modules.media.mpd = { + enable = lib.my.mkBoolOpt false; + }; + config = lib.mkIf cfg.enable { + home-manager.users.${config.user.name} = + { config, ... }: + { + services.mpd = { + enable = true; + network.listenAddress = "any"; + musicDirectory = "${config.home.homeDirectory}/Nextcloud/Media/Music"; + playlistDirectory = "${config.home.homeDirectory}/Nextcloud/Playlists"; + extraConfig = '' + max_output_buffer_size "16384" + auto_update "yes" + audio_output { + type "pulse" + name "pulse audio" + device "pulse" + mixer_type "hardware" + } + audio_output { + type "fifo" + name "toggle_visualizer" + path "/tmp/mpd.fifo" + format "44100:16:2" + } + ''; + }; }; - }; }; } diff --git a/modules/media/ncmpcpp/ncmpcpp.nix b/modules/media/ncmpcpp/ncmpcpp.nix index bc3aafe..2fc6d16 100644 --- a/modules/media/ncmpcpp/ncmpcpp.nix +++ b/modules/media/ncmpcpp/ncmpcpp.nix @@ -1,12 +1,19 @@ -{ inputs, config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; -let cfg = config.modules.media.ncmpcpp; -in { - options.modules.media.ncmpcpp = { enable = mkBoolOpt false; }; +let + cfg = config.modules.media.ncmpcpp; +in +{ + options.modules.media.ncmpcpp = { + enable = lib.my.mkBoolOpt false; + }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { home-manager.users.${config.user.name} = { home = { diff --git a/modules/options.nix b/modules/options.nix index cf3b9f3..7682492 100644 --- a/modules/options.nix +++ b/modules/options.nix @@ -1,19 +1,28 @@ -{ config, options, lib, home-manager, ... }: +{ + config, + options, + lib, + ... +}: -with lib; -with lib.my; { - options = with types; { user = mkOpt attrs { }; }; +{ + options = { + user = lib.my.mkOpt lib.types.attrs { }; + }; config = { user = { name = "froidmpa"; description = "The primary user account"; - extraGroups = [ "wheel" "adbusers" ]; + extraGroups = [ + "wheel" + "adbusers" + ]; isNormalUser = true; }; - users.users.${config.user.name} = mkAliasDefinitions options.user; + users.users.${config.user.name} = lib.mkAliasDefinitions options.user; home-manager = { useUserPackages = true; @@ -21,7 +30,7 @@ with lib.my; { users.${config.user.name} = { home = { enableNixpkgsReleaseCheck = true; - stateVersion = config.system.stateVersion; + inherit (config.system) stateVersion; }; }; }; diff --git a/modules/services/belgian-eid.nix b/modules/services/belgian-eid.nix index 5c9c44d..e23c9cd 100644 --- a/modules/services/belgian-eid.nix +++ b/modules/services/belgian-eid.nix @@ -1,13 +1,19 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; +let + cfg = config.modules.services.belgian-eid; +in +{ + options.modules.services.belgian-eid = { + enable = lib.my.mkBoolOpt false; + }; -let cfg = config.modules.services.belgian-eid; -in { - options.modules.services.belgian-eid = { enable = mkBoolOpt false; }; - - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { services.pcscd.enable = true; diff --git a/modules/services/docker.nix b/modules/services/docker.nix index d6ebf58..686f928 100644 --- a/modules/services/docker.nix +++ b/modules/services/docker.nix @@ -1,19 +1,25 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; +let + cfg = config.modules.services.docker; +in +{ + options.modules.services.docker = { + enable = lib.my.mkBoolOpt false; + }; -let cfg = config.modules.services.docker; -in { - options.modules.services.docker = { enable = mkBoolOpt false; }; - - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { virtualisation = { docker = { enable = true; autoPrune.enable = true; - enableOnBoot = mkDefault false; + enableOnBoot = lib.mkDefault false; }; }; diff --git a/modules/services/flatpak.nix b/modules/services/flatpak.nix index c582ae5..37332e2 100644 --- a/modules/services/flatpak.nix +++ b/modules/services/flatpak.nix @@ -1,13 +1,19 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; +let + cfg = config.modules.services.flatpak; +in +{ + options.modules.services.flatpak = { + enable = lib.my.mkBoolOpt false; + }; -let cfg = config.modules.services.flatpak; -in { - options.modules.services.flatpak = { enable = mkBoolOpt false; }; - - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { services.flatpak.enable = true; xdg.portal = { diff --git a/modules/services/languagetool.nix b/modules/services/languagetool.nix index b01ca29..c7a9e6b 100644 --- a/modules/services/languagetool.nix +++ b/modules/services/languagetool.nix @@ -1,13 +1,14 @@ -{ config, lib, pkgs, ... }: +{ config, lib, ... }: -with lib; -with lib.my; +let + cfg = config.modules.services.languagetool; +in +{ + options.modules.services.languagetool = { + enable = lib.my.mkBoolOpt false; + }; -let cfg = config.modules.services.languagetool; -in { - options.modules.services.languagetool = { enable = mkBoolOpt false; }; - - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { services.languagetool = { enable = true; allowOrigin = "*"; diff --git a/modules/services/libvirt.nix b/modules/services/libvirt.nix index 672838c..1783ed7 100644 --- a/modules/services/libvirt.nix +++ b/modules/services/libvirt.nix @@ -1,13 +1,19 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: -with lib; -with lib.my; +let + cfg = config.modules.services.libvirt; +in +{ + options.modules.services.libvirt = { + enable = lib.my.mkBoolOpt false; + }; -let cfg = config.modules.services.libvirt; -in { - options.modules.services.libvirt = { enable = mkBoolOpt false; }; - - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { virtualisation = { libvirtd.enable = true; diff --git a/overlay.nix b/overlay.nix index 54f3c62..2b8d37a 100644 --- a/overlay.nix +++ b/overlay.nix @@ -1,3 +1 @@ -final: prev: { - activitywatch-bin = prev.callPackage ./packages/activitywatch.nix { }; -} +final: prev: { activitywatch-bin = prev.callPackage ./packages/activitywatch.nix { }; } diff --git a/packages/activitywatch.nix b/packages/activitywatch.nix index b8be614..410e973 100644 --- a/packages/activitywatch.nix +++ b/packages/activitywatch.nix @@ -1,12 +1,13 @@ -{ lib -, stdenv -, fetchzip -, autoPatchelfHook -, libGL -, freetype -, libdrm -, fontconfig -, harfbuzz +{ + lib, + stdenv, + fetchzip, + autoPatchelfHook, + libGL, + freetype, + libdrm, + fontconfig, + harfbuzz, }: stdenv.mkDerivation rec { @@ -18,7 +19,14 @@ stdenv.mkDerivation rec { sha256 = "sha256-4lfUxJTBpjrsRO+pmW7DNKV69tMr2wiarA5Fy4wPgMk="; }; - nativeBuildInputs = [ autoPatchelfHook libGL freetype libdrm fontconfig harfbuzz ]; + nativeBuildInputs = [ + autoPatchelfHook + libGL + freetype + libdrm + fontconfig + harfbuzz + ]; installPhase = '' mkdir -p $out/bin cp -r * $out/