diff --git a/flake.nix b/flake.nix index 564570e..424a32d 100644 --- a/flake.nix +++ b/flake.nix @@ -29,7 +29,10 @@ devshell.url = "github:numtide/devshell"; disko.url = "github:nix-community/disko/latest"; flake-parts.url = "github:hercules-ci/flake-parts"; - flake-registry = { url = "github:NixOS/flake-registry"; flake = false; }; + flake-registry = { + url = "github:NixOS/flake-registry"; + flake = false; + }; home-manager.url = "github:nix-community/home-manager"; impermanence.url = "github:nix-community/impermanence"; nix-index-database.url = "github:nix-community/nix-index-database"; @@ -56,7 +59,10 @@ conduwuit.url = "github:girlbossceo/conduwuit"; ## Vencord - vencord = { url = "github:Vendicated/Vencord"; flake = false; }; + vencord = { + url = "github:Vendicated/Vencord"; + flake = false; + }; ## Qtile qtile.url = "github:qtile/qtile"; @@ -130,129 +136,146 @@ universe-cli.inputs.systems.follows = "systems"; }; - outputs = inputs@{ flake-parts, nixpkgs, private, ... }: flake-parts.lib.mkFlake { inherit inputs; } ({ self, lib, ... }: { - systems = [ "x86_64-linux" ]; + outputs = + inputs@{ + flake-parts, + nixpkgs, + private, + ... + }: + flake-parts.lib.mkFlake { inherit inputs; } ( + { self, lib, ... }: + { + systems = [ "x86_64-linux" ]; - debug = true; + debug = true; - perSystem = { pkgs, system, ... }: { - _module.args.pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; - overlays = [ - self.overlays.overrides - self.overlays.patches - ]; - }; - - treefmt.projectRootFile = "flake.nix"; - treefmt.programs.nixfmt.enable = true; - }; - - flake = { - lib = import ./lib { inherit (nixpkgs) lib; }; - - users = self.lib.rakeLeaves ./users; - - overlays = { - overrides = import ./overlays/overrides.nix inputs; - patches = import ./overlays/patches; - }; - - nixosConfigurations = - let - libOverlay = (lfinal: lprev: { - our = self.lib; - hm = inputs.home-manager.lib.hm; - }); - in - lib.mapAttrs - (self.lib.mkHost { - specialArgs = { - lib = nixpkgs.lib.extend libOverlay; - inherit private self inputs; + perSystem = + { pkgs, system, ... }: + { + _module.args.pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + overlays = [ + self.overlays.overrides + self.overlays.patches + ]; }; - modules = [ - self.users.root - self.users.infinidoge - { - nixpkgs.hostPlatform = "x86_64-linux"; - system.configurationRevision = lib.mkIf (self ? rev) self.rev; - nixpkgs.overlays = [ - (final: prev: { - lib = prev.lib.extend libOverlay; + treefmt.projectRootFile = "flake.nix"; + treefmt.programs.nixfmt.enable = true; + }; - inherit (inputs.home-manager.packages.${prev.system}) home-manager; - }) - self.overlays.packages - self.overlays.patches - self.overlays.overrides + flake = { + lib = import ./lib { inherit (nixpkgs) lib; }; - # --- Domain-Specific Overlays - inputs.agenix.overlays.default - inputs.nix-minecraft.overlay - inputs.qtile.overlays.default - inputs.rust-overlay.overlays.default - inputs.universe-cli.overlays.default + users = self.lib.rakeLeaves ./users; + + overlays = { + overrides = import ./overlays/overrides.nix inputs; + patches = import ./overlays/patches; + }; + + nixosConfigurations = + let + libOverlay = ( + lfinal: lprev: { + our = self.lib; + hm = inputs.home-manager.lib.hm; + } + ); + in + lib.mapAttrs (self.lib.mkHost { + specialArgs = { + lib = nixpkgs.lib.extend libOverlay; + inherit private self inputs; + }; + + modules = [ + self.users.root + self.users.infinidoge + { + nixpkgs.hostPlatform = "x86_64-linux"; + system.configurationRevision = lib.mkIf (self ? rev) self.rev; + nixpkgs.overlays = [ + (final: prev: { + lib = prev.lib.extend libOverlay; + + inherit (inputs.home-manager.packages.${prev.system}) home-manager; + }) + self.overlays.packages + self.overlays.patches + self.overlays.overrides + + # --- Domain-Specific Overlays + inputs.agenix.overlays.default + inputs.nix-minecraft.overlay + inputs.qtile.overlays.default + inputs.rust-overlay.overlays.default + inputs.universe-cli.overlays.default + ]; + home-manager = { + sharedModules = [ + inputs.impermanence.nixosModules.home-manager.impermanence + inputs.nix-index-database.hmModules.nix-index + inputs.nixvim.homeManagerModules.nixvim + ] ++ (self.lib.leaves ./users/modules); + }; + } + + # --- Universe Modules --- + ./secrets + private.nixosModules.secrets + + # --- Library Modules --- + inputs.agenix.nixosModules.age + inputs.disko.nixosModules.disko + inputs.home-manager.nixosModules.home-manager + inputs.impermanence.nixosModules.impermanence + inputs.nix-index-database.nixosModules.nix-index + inputs.nixos-wsl.nixosModules.wsl + + # --- Domain-Specific Modules --- + inputs.authentik-nix.nixosModules.default + inputs.lix-module.nixosModules.default + inputs.hydra.nixosModules.overlayNixpkgsForThisHydra + inputs.nix-minecraft.nixosModules.minecraft-servers + ] ++ (self.lib.leaves ./modules); + }) (self.lib.flattenLeaves ./hosts); + + homeConfigurations = self.lib.mkHomeConfigurations { + inherit (self.nixosConfigurations) + "data.cs.purdue.edu" + vulcan + ; + }; + + hydraJobs = { + packages = lib.mapAttrs ( + _: lib.filterAttrs (n: v: v ? meta -> v.meta ? broken -> !v.meta.broken) + ) self.packages; + nixosConfigurations.x86_64-linux = + lib.flip lib.genAttrs + (name: { toplevel = self.nixosConfigurations.${name}.config.system.build.toplevel; }) + [ + "Infini-DESKTOP" + "Infini-DL360" + "Infini-FRAMEWORK" + "Infini-OPTIPLEX" + "Infini-SERVER" + "hermes" + "hestia" ]; - home-manager = { - sharedModules = [ - inputs.impermanence.nixosModules.home-manager.impermanence - inputs.nix-index-database.hmModules.nix-index - inputs.nixvim.homeManagerModules.nixvim - ] ++ (self.lib.leaves ./users/modules); - }; - } + }; + }; - # --- Universe Modules --- - ./secrets - private.nixosModules.secrets - - # --- Library Modules --- - inputs.agenix.nixosModules.age - inputs.disko.nixosModules.disko - inputs.home-manager.nixosModules.home-manager - inputs.impermanence.nixosModules.impermanence - inputs.nix-index-database.nixosModules.nix-index - inputs.nixos-wsl.nixosModules.wsl - - # --- Domain-Specific Modules --- - inputs.authentik-nix.nixosModules.default - inputs.lix-module.nixosModules.default - inputs.hydra.nixosModules.overlayNixpkgsForThisHydra - inputs.nix-minecraft.nixosModules.minecraft-servers - ] ++ (self.lib.leaves ./modules); - }) - (self.lib.flattenLeaves ./hosts); - - homeConfigurations = self.lib.mkHomeConfigurations { - inherit (self.nixosConfigurations) - "data.cs.purdue.edu" - vulcan - ; - }; - - hydraJobs = { - packages = lib.mapAttrs (_: lib.filterAttrs (n: v: v ? meta -> v.meta ? broken -> !v.meta.broken)) self.packages; - nixosConfigurations.x86_64-linux = lib.flip lib.genAttrs (name: { toplevel = self.nixosConfigurations.${name}.config.system.build.toplevel; }) [ - "Infini-DESKTOP" - "Infini-DL360" - "Infini-FRAMEWORK" - "Infini-OPTIPLEX" - "Infini-SERVER" - "hermes" - "hestia" + imports = [ + ./pkgs + ./shell + ./templates + inputs.devshell.flakeModule + inputs.treefmt-nix.flakeModule ]; - }; - }; - - imports = [ - ./pkgs - ./shell - ./templates - inputs.devshell.flakeModule - inputs.treefmt-nix.flakeModule - ]; - }); + } + ); } diff --git a/hosts/Infini-DESKTOP/default.nix b/hosts/Infini-DESKTOP/default.nix index a63a73b..f82a1e3 100644 --- a/hosts/Infini-DESKTOP/default.nix +++ b/hosts/Infini-DESKTOP/default.nix @@ -1,4 +1,10 @@ -{ config, pkgs, lib, ... }: { +{ + config, + pkgs, + lib, + ... +}: +{ imports = lib.lists.flatten [ ./hardware-configuration.nix ./filesystems.nix @@ -69,7 +75,6 @@ razergenie # TODO: replace with polychromatic ]; - programs.ns-usbloader.enable = true; programs.minipro.enable = true; @@ -90,11 +95,13 @@ address = [ "10.10.0.3/32" ]; listenPort = 51820; privateKeyFile = "/home/infinidoge/tmp/bb-vpn.key"; - peers = [{ - publicKey = "SYpnrGvxx8l4w9c7KVRVW6GyNDr/iK+maPPMw/Ua7XY="; - allowedIPs = [ "10.9.0.0/24" ]; - endpoint = "66.23.193.252:55555"; - persistentKeepalive = 25; - }]; + peers = [ + { + publicKey = "SYpnrGvxx8l4w9c7KVRVW6GyNDr/iK+maPPMw/Ua7XY="; + allowedIPs = [ "10.9.0.0/24" ]; + endpoint = "66.23.193.252:55555"; + persistentKeepalive = 25; + } + ]; }; } diff --git a/hosts/Infini-DESKTOP/filesystems.nix b/hosts/Infini-DESKTOP/filesystems.nix index e6b4473..0ebca3e 100644 --- a/hosts/Infini-DESKTOP/filesystems.nix +++ b/hosts/Infini-DESKTOP/filesystems.nix @@ -7,14 +7,22 @@ let backup = uuid "dabfc36b-20d1-4b09-8f55-4f9df7499741"; hydrus = uuid "2a025f29-4058-4a76-8f38-483f0925375d"; - commonOptions = [ "autodefrag" "noatime" "ssd" ]; + commonOptions = [ + "autodefrag" + "noatime" + "ssd" + ]; in { fileSystems = { "/" = { device = "none"; fsType = "tmpfs"; - options = [ "defaults" "size=28G" "mode=755" ]; + options = [ + "defaults" + "size=28G" + "mode=755" + ]; }; "/media/main" = { diff --git a/hosts/Infini-DESKTOP/hardware-configuration.nix b/hosts/Infini-DESKTOP/hardware-configuration.nix index 4c18da9..4dd4df5 100644 --- a/hosts/Infini-DESKTOP/hardware-configuration.nix +++ b/hosts/Infini-DESKTOP/hardware-configuration.nix @@ -1,7 +1,13 @@ { ... }: { - boot.initrd.availableKernelModules = [ "nvme" "ahci" "xhci_pci" "usbhid" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "ahci" + "xhci_pci" + "usbhid" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; diff --git a/hosts/Infini-DL360/authentik.nix b/hosts/Infini-DL360/authentik.nix index 199178b..440629e 100644 --- a/hosts/Infini-DL360/authentik.nix +++ b/hosts/Infini-DL360/authentik.nix @@ -1,4 +1,9 @@ -{ config, common, secrets, ... }: +{ + config, + common, + secrets, + ... +}: let domain = common.subdomain "auth"; ldap = common.subdomain "ldap"; @@ -32,7 +37,10 @@ in environmentFile = secrets.authentik-ldap; }; - networking.firewall.allowedTCPPorts = [ 3389 6636 ]; + networking.firewall.allowedTCPPorts = [ + 3389 + 6636 + ]; security.acme.certs.${ldap} = { group = "nginx"; diff --git a/hosts/Infini-DL360/conduwuit.nix b/hosts/Infini-DL360/conduwuit.nix index 7f12735..eea1fc3 100644 --- a/hosts/Infini-DL360/conduwuit.nix +++ b/hosts/Infini-DL360/conduwuit.nix @@ -1,4 +1,9 @@ -{ config, common, inputs, ... }: +{ + config, + common, + inputs, + ... +}: let domain = common.subdomain "matrix"; cfg = config.services.conduwuit; diff --git a/hosts/Infini-DL360/default.nix b/hosts/Infini-DL360/default.nix index cd2e9d7..f668a4e 100644 --- a/hosts/Infini-DL360/default.nix +++ b/hosts/Infini-DL360/default.nix @@ -1,4 +1,11 @@ -{ config, lib, pkgs, private, ... }: { +{ + config, + lib, + pkgs, + private, + ... +}: +{ imports = [ ./hardware-configuration.nix ./disks.nix @@ -57,19 +64,39 @@ networking = { firewall = { - allowedUDPPorts = [ 80 443 ]; - allowedTCPPorts = [ 80 443 25565 ]; + allowedUDPPorts = [ + 80 + 443 + ]; + allowedTCPPorts = [ + 80 + 443 + 25565 + ]; }; bridges = { br0 = { - interfaces = [ "eno1" "eno2" "eno3" "eno4" ]; + interfaces = [ + "eno1" + "eno2" + "eno3" + "eno4" + ]; }; }; - interfaces.br0.ipv4.addresses = [{ address = "192.168.137.11"; prefixLength = 24; }]; + interfaces.br0.ipv4.addresses = [ + { + address = "192.168.137.11"; + prefixLength = 24; + } + ]; dhcpcd.denyInterfaces = [ "eno*" ]; - defaultGateway = { address = "192.168.137.1"; interface = "br0"; }; + defaultGateway = { + address = "192.168.137.1"; + interface = "br0"; + }; nat = { enable = true; @@ -89,10 +116,12 @@ services.fail2ban.enable = true; - environment.etc."fail2ban/filter.d/nginx-url-probe.local".text = lib.mkDefault (lib.mkAfter '' - [Definition] - failregex = ^.*GET.*(\.php|admin|wp\-).* HTTP/\d.\d\" 404.*$ - ''); + environment.etc."fail2ban/filter.d/nginx-url-probe.local".text = lib.mkDefault ( + lib.mkAfter '' + [Definition] + failregex = ^.*GET.*(\.php|admin|wp\-).* HTTP/\d.\d\" 404.*$ + '' + ); services.fail2ban.jails.nginx-url-probe.settings = { enabled = true; @@ -127,22 +156,26 @@ services.minecraft-servers.servers.emd-server.autoStart = lib.mkForce false; - services.borgbackup.jobs."persist" = let tmux = lib.getExe pkgs.tmux; in { - preHook = '' - ${tmux} -S /run/minecraft/friend-server.sock send-keys "say Server is backing up..." Enter - ${tmux} -S /run/minecraft/friend-server.sock send-keys save-off Enter - ${tmux} -S /run/minecraft/friend-server.sock send-keys save-all Enter - ${tmux} -S /run/minecraft/sister-server.sock send-keys "say Server is backing up..." Enter - ${tmux} -S /run/minecraft/sister-server.sock send-keys save-off Enter - ${tmux} -S /run/minecraft/sister-server.sock send-keys save-all Enter - ''; - postHook = '' - ${tmux} -S /run/minecraft/friend-server.sock send-keys save-on Enter - ${tmux} -S /run/minecraft/friend-server.sock send-keys "say Backup complete" Enter - ${tmux} -S /run/minecraft/sister-server.sock send-keys save-on Enter - ${tmux} -S /run/minecraft/sister-server.sock send-keys "say Backup complete" Enter - ''; - }; + services.borgbackup.jobs."persist" = + let + tmux = lib.getExe pkgs.tmux; + in + { + preHook = '' + ${tmux} -S /run/minecraft/friend-server.sock send-keys "say Server is backing up..." Enter + ${tmux} -S /run/minecraft/friend-server.sock send-keys save-off Enter + ${tmux} -S /run/minecraft/friend-server.sock send-keys save-all Enter + ${tmux} -S /run/minecraft/sister-server.sock send-keys "say Server is backing up..." Enter + ${tmux} -S /run/minecraft/sister-server.sock send-keys save-off Enter + ${tmux} -S /run/minecraft/sister-server.sock send-keys save-all Enter + ''; + postHook = '' + ${tmux} -S /run/minecraft/friend-server.sock send-keys save-on Enter + ${tmux} -S /run/minecraft/friend-server.sock send-keys "say Backup complete" Enter + ${tmux} -S /run/minecraft/sister-server.sock send-keys save-on Enter + ${tmux} -S /run/minecraft/sister-server.sock send-keys "say Backup complete" Enter + ''; + }; systemd.services.setup-infiniband = { wantedBy = [ "network.target" ]; diff --git a/hosts/Infini-DL360/disks.nix b/hosts/Infini-DL360/disks.nix index e0645fc..0af4605 100644 --- a/hosts/Infini-DL360/disks.nix +++ b/hosts/Infini-DL360/disks.nix @@ -3,7 +3,10 @@ with lib.our.disko; { boot.kernelPackages = pkgs.linuxPackages; - boot.zfs.extraPools = [ "zssd" "zhdd" ]; + boot.zfs.extraPools = [ + "zssd" + "zhdd" + ]; disko.devices = { nodev."/" = mkTmpfs "64G"; diff --git a/hosts/Infini-DL360/forgejo.nix b/hosts/Infini-DL360/forgejo.nix index 7ea987e..9d7c27f 100644 --- a/hosts/Infini-DL360/forgejo.nix +++ b/hosts/Infini-DL360/forgejo.nix @@ -1,4 +1,10 @@ -{ config, common, secrets, pkgs, ... }: +{ + config, + common, + secrets, + pkgs, + ... +}: let cfg = config.services.forgejo; domain = common.subdomain "git"; diff --git a/hosts/Infini-DL360/hardware-configuration.nix b/hosts/Infini-DL360/hardware-configuration.nix index b71478d..ac548ea 100644 --- a/hosts/Infini-DL360/hardware-configuration.nix +++ b/hosts/Infini-DL360/hardware-configuration.nix @@ -5,12 +5,22 @@ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "uhci_hcd" "hpsa" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ehci_pci" + "uhci_hcd" + "hpsa" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; boot.kernelParams = [ "boot.shell_on_fail" ]; - boot.supportedFilesystems = [ "btrfs" "zfs" ]; + boot.supportedFilesystems = [ + "btrfs" + "zfs" + ]; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; info.model = "HPE ProLiant DL360 Gen 9"; diff --git a/hosts/Infini-DL360/hedgedoc.nix b/hosts/Infini-DL360/hedgedoc.nix index a1998b7..749ecd0 100644 --- a/hosts/Infini-DL360/hedgedoc.nix +++ b/hosts/Infini-DL360/hedgedoc.nix @@ -1,4 +1,9 @@ -{ config, common, secrets, ... }: +{ + config, + common, + secrets, + ... +}: let cfg = config.services.hedgedoc; domain = common.subdomain "md"; @@ -12,7 +17,10 @@ in protocolUseSSL = true; port = 4003; - db = { dialect = "sqlite"; storage = "/srv/hedgedoc/db.sqlite"; }; + db = { + dialect = "sqlite"; + storage = "/srv/hedgedoc/db.sqlite"; + }; uploadsPath = "/srv/hedgedoc/uploads"; allowFreeURL = true; diff --git a/hosts/Infini-DL360/hydra.nix b/hosts/Infini-DL360/hydra.nix index 056b126..fe6eb76 100644 --- a/hosts/Infini-DL360/hydra.nix +++ b/hosts/Infini-DL360/hydra.nix @@ -1,4 +1,10 @@ -{ config, common, secrets, pkgs, ... }: +{ + config, + common, + secrets, + pkgs, + ... +}: let domain = common.subdomain "hydra"; in @@ -61,7 +67,12 @@ in { hostName = "localhost"; system = "x86_64-linux"; - supportedFeatures = [ "kvm" "nixos-test" "big-parallel" "benchmark" ]; + supportedFeatures = [ + "kvm" + "nixos-test" + "big-parallel" + "benchmark" + ]; protocol = null; maxJobs = 32; speedFactor = 16; diff --git a/hosts/Infini-DL360/immich.nix b/hosts/Infini-DL360/immich.nix index 9a90ae2..594c40b 100644 --- a/hosts/Infini-DL360/immich.nix +++ b/hosts/Infini-DL360/immich.nix @@ -1,4 +1,9 @@ -{ config, pkgs, common, ... }: +{ + config, + pkgs, + common, + ... +}: let domain = common.subdomain "photos"; cfg = config.services.immich; diff --git a/hosts/Infini-DL360/jellyfin.nix b/hosts/Infini-DL360/jellyfin.nix index 8d54390..32c3f9d 100644 --- a/hosts/Infini-DL360/jellyfin.nix +++ b/hosts/Infini-DL360/jellyfin.nix @@ -25,9 +25,11 @@ in locations."/" = { proxyPass = jellyfin; recommendedProxySettings = false; - extraConfig = proxyConfig + '' - proxy_buffering off; - ''; + extraConfig = + proxyConfig + + '' + proxy_buffering off; + ''; }; locations."= /web/" = { @@ -51,5 +53,9 @@ in openFirewall = true; }; - persist.directories = with config.services.jellyfin; [ dataDir cacheDir logDir ]; + persist.directories = with config.services.jellyfin; [ + dataDir + cacheDir + logDir + ]; } diff --git a/hosts/Infini-DL360/jupyter.nix b/hosts/Infini-DL360/jupyter.nix index d791031..a000633 100644 --- a/hosts/Infini-DL360/jupyter.nix +++ b/hosts/Infini-DL360/jupyter.nix @@ -1,11 +1,22 @@ -{ config, common, pkgs, ... }: +{ + config, + common, + pkgs, + ... +}: let cfg = config.services.jupyter; mkPythonKernel = displayName: env: { inherit displayName; language = "python"; - argv = [ "${env.interpreter}" "-m" "ipykernel_launcher" "-f" "{connection_file}" ]; + argv = [ + "${env.interpreter}" + "-m" + "ipykernel_launcher" + "-f" + "{connection_file}" + ]; logo32 = "${env}/${env.sitePackages}/ipykernel/resources/logo-32x32.png"; logo64 = "${env}/${env.sitePackages}/ipykernel/resources/logo-64x64.png"; }; @@ -59,24 +70,32 @@ in notebookDir = "~/Notebooks"; kernels = { - python3 = mkPythonKernel "Python 3" (pkgs.python3.withPackages (p: with p; [ - ipykernel + python3 = mkPythonKernel "Python 3" ( + pkgs.python3.withPackages ( + p: with p; [ + ipykernel - matplotlib - numpy - pandas - scipy - ])); - vpython = mkPythonKernel "VPython" (pkgs.python3.withPackages (p: with p; [ - ipykernel - jupyterlab-vpython + matplotlib + numpy + pandas + scipy + ] + ) + ); + vpython = mkPythonKernel "VPython" ( + pkgs.python3.withPackages ( + p: with p; [ + ipykernel + jupyterlab-vpython - vpython-jupyter - matplotlib - numpy - pandas - scipy - ])); + vpython-jupyter + matplotlib + numpy + pandas + scipy + ] + ) + ); }; }; diff --git a/hosts/Infini-DL360/postgresql.nix b/hosts/Infini-DL360/postgresql.nix index bbd0051..89d1845 100644 --- a/hosts/Infini-DL360/postgresql.nix +++ b/hosts/Infini-DL360/postgresql.nix @@ -4,7 +4,13 @@ let directory = "/srv/postgresql"; in { - persist.directories = [{ inherit directory; user = "postgres"; group = "postgres"; }]; + persist.directories = [ + { + inherit directory; + user = "postgres"; + group = "postgres"; + } + ]; services.postgresql = { enable = true; diff --git a/hosts/Infini-DL360/searx.nix b/hosts/Infini-DL360/searx.nix index e4f9725..10cc2c7 100644 --- a/hosts/Infini-DL360/searx.nix +++ b/hosts/Infini-DL360/searx.nix @@ -1,4 +1,9 @@ -{ config, common, secrets, ... }: +{ + config, + common, + secrets, + ... +}: let cfg = config.services.searx; domain = common.subdomain "search"; diff --git a/hosts/Infini-DL360/ssh.nix b/hosts/Infini-DL360/ssh.nix index 7de3aa7..70577fa 100644 --- a/hosts/Infini-DL360/ssh.nix +++ b/hosts/Infini-DL360/ssh.nix @@ -50,8 +50,15 @@ in security.pam.services.sshd.allowNullPassword = true; systemd.tmpfiles.settings."30-external" = { - "/srv/external".d = { user = "root"; group = "root"; }; - "/srv/external/incoming".d = { user = "incoming"; group = "incoming"; mode = "0770"; }; + "/srv/external".d = { + user = "root"; + group = "root"; + }; + "/srv/external/incoming".d = { + user = "incoming"; + group = "incoming"; + mode = "0770"; + }; }; # https://enotacoes.wordpress.com/2021/10/05/limiting-user-to-sshfs-or-sftp-of-one-directory-only/ diff --git a/hosts/Infini-DL360/thelounge.nix b/hosts/Infini-DL360/thelounge.nix index dbef6b9..e9fe118 100644 --- a/hosts/Infini-DL360/thelounge.nix +++ b/hosts/Infini-DL360/thelounge.nix @@ -1,4 +1,9 @@ -{ config, common, pkgs, ... }: +{ + config, + common, + pkgs, + ... +}: { services.nginx.virtualHosts."thelounge.inx.moe" = common.nginx.ssl // { diff --git a/hosts/Infini-DL360/torrenting.nix b/hosts/Infini-DL360/torrenting.nix index 8dca7c2..59a5fbc 100644 --- a/hosts/Infini-DL360/torrenting.nix +++ b/hosts/Infini-DL360/torrenting.nix @@ -1,4 +1,10 @@ -{ pkgs, private, config, lib, ... }: +{ + pkgs, + private, + config, + lib, + ... +}: { containers.torrenting = { diff --git a/hosts/Infini-DL360/vaultwarden.nix b/hosts/Infini-DL360/vaultwarden.nix index b85e589..02d2f64 100644 --- a/hosts/Infini-DL360/vaultwarden.nix +++ b/hosts/Infini-DL360/vaultwarden.nix @@ -1,4 +1,11 @@ -{ config, common, secrets, lib, pkgs, ... }: +{ + config, + common, + secrets, + lib, + pkgs, + ... +}: let domain = common.subdomain "bitwarden"; in diff --git a/hosts/Infini-DL360/web.nix b/hosts/Infini-DL360/web.nix index e9bb8bc..f865c1f 100644 --- a/hosts/Infini-DL360/web.nix +++ b/hosts/Infini-DL360/web.nix @@ -1,4 +1,10 @@ -{ config, common, pkgs, lib, ... }: +{ + config, + common, + pkgs, + lib, + ... +}: let inherit (common.nginx) ssl ssl-optional; @@ -14,21 +20,23 @@ let location ~ "/\..+" { deny all; } ''; - mkWebsite = name: ssl // { - locations."/" = { - root = "/srv/web/${name}"; - inherit tryFiles; - extraConfig = websiteConfig; + mkWebsite = + name: + ssl + // { + locations."/" = { + root = "/srv/web/${name}"; + inherit tryFiles; + extraConfig = websiteConfig; + }; }; - }; mkRedirect = from: to: ssl-optional // { globalRedirect = to; }; websites = lib.genAttrs [ "inx.moe" "stickers.inx.moe" - ] - mkWebsite; + ] mkWebsite; redirects = lib.mapAttrs mkRedirect { "nitter.inx.moe" = "twitter.com"; @@ -44,52 +52,55 @@ in } ''; - services.nginx.virtualHosts = websites // redirects // { - "j.inx.moe" = ssl-optional // { - locations."/" = { - return = "302 $jump_link"; + services.nginx.virtualHosts = + websites + // redirects + // { + "j.inx.moe" = ssl-optional // { + locations."/" = { + return = "302 $jump_link"; + }; + }; + "blahaj.inx.moe" = ssl-optional // { + locations."/" = { + tryFiles = "/Blahaj.png =404"; + root = ./static; + }; + locations."/buy" = { + return = "301 https://www.ikea.com/us/en/p/blahaj-soft-toy-shark-90373590/"; + }; + }; + "swedish.fish" = ssl-optional // { + locations."/" = { + tryFiles = "/Blahaj.png =404"; + root = ./static; + }; + locations."/buy" = { + return = "301 https://www.ikea.com/us/en/p/blahaj-soft-toy-shark-90373590/"; + }; + }; + "files.inx.moe" = ssl // { + locations."/" = { + root = "/srv/web/files.inx.moe"; + extraConfig = '' + autoindex on; + ''; + }; + locations."/p/" = { + root = "/srv/web/files.inx.moe"; + }; + }; + "old.inx.moe" = ssl-optional // { + locations."/" = { + root = "/srv/web/inx.moe"; + inherit tryFiles; + extraConfig = websiteConfig; + }; + }; + "foxy.software" = ssl-optional // { + locations."/".return = "301 https://inx.moe"; }; }; - "blahaj.inx.moe" = ssl-optional // { - locations."/" = { - tryFiles = "/Blahaj.png =404"; - root = ./static; - }; - locations."/buy" = { - return = "301 https://www.ikea.com/us/en/p/blahaj-soft-toy-shark-90373590/"; - }; - }; - "swedish.fish" = ssl-optional // { - locations."/" = { - tryFiles = "/Blahaj.png =404"; - root = ./static; - }; - locations."/buy" = { - return = "301 https://www.ikea.com/us/en/p/blahaj-soft-toy-shark-90373590/"; - }; - }; - "files.inx.moe" = ssl // { - locations."/" = { - root = "/srv/web/files.inx.moe"; - extraConfig = '' - autoindex on; - ''; - }; - locations."/p/" = { - root = "/srv/web/files.inx.moe"; - }; - }; - "old.inx.moe" = ssl-optional // { - locations."/" = { - root = "/srv/web/inx.moe"; - inherit tryFiles; - extraConfig = websiteConfig; - }; - }; - "foxy.software" = ssl-optional // { - locations."/".return = "301 https://inx.moe"; - }; - }; services.uwsgi = { enable = true; diff --git a/hosts/Infini-FRAMEWORK/default.nix b/hosts/Infini-FRAMEWORK/default.nix index 52270f4..8f607af 100644 --- a/hosts/Infini-FRAMEWORK/default.nix +++ b/hosts/Infini-FRAMEWORK/default.nix @@ -1,4 +1,10 @@ -{ config, pkgs, lib, ... }: { +{ + config, + pkgs, + lib, + ... +}: +{ imports = [ ./hardware-configuration.nix ./filesystems.nix @@ -11,7 +17,10 @@ persist = { directories = [ - { directory = "/var/lib/dnsmasq/"; user = "dnsmasq"; } + { + directory = "/var/lib/dnsmasq/"; + user = "dnsmasq"; + } ]; files = [ @@ -82,7 +91,10 @@ "sys-devices-pci0000:00-0000:00:02.0-drm-card0-card0\\x2deDP\\x2d1-intel_backlight.device" "sys-devices-pci0000:00-0000:00:02.0-drm-card1-card1\\x2deDP\\x2d1-intel_backlight.device" ]; - after = [ "system-systemd\\x2dbacklight.slice" "systemd-backlight@backlight:intel_backlight.service" ]; + after = [ + "system-systemd\\x2dbacklight.slice" + "systemd-backlight@backlight:intel_backlight.service" + ]; serviceConfig.Type = "oneshot"; script = "${lib.getExe pkgs.brightnessctl} set 50%"; }; @@ -99,8 +111,16 @@ #} { hostName = "infini-dl360"; - systems = [ "x86_64-linux" "aarch64-linux" ]; - supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + supportedFeatures = [ + "nixos-test" + "benchmark" + "big-parallel" + "kvm" + ]; protocol = "ssh-ng"; maxJobs = 32; speedFactor = 16; @@ -114,26 +134,33 @@ address = [ "10.10.0.3/32" ]; listenPort = 51820; privateKeyFile = "/home/infinidoge/tmp/bb-vpn.key"; - peers = [{ - publicKey = "SYpnrGvxx8l4w9c7KVRVW6GyNDr/iK+maPPMw/Ua7XY="; - allowedIPs = [ "10.9.0.0/24" ]; - endpoint = "66.23.193.252:55555"; - persistentKeepalive = 25; - }]; + peers = [ + { + publicKey = "SYpnrGvxx8l4w9c7KVRVW6GyNDr/iK+maPPMw/Ua7XY="; + allowedIPs = [ "10.9.0.0/24" ]; + endpoint = "66.23.193.252:55555"; + persistentKeepalive = 25; + } + ]; }; specialisation.router.configuration = { networking = { interfaces."enp0s13f0u1" = { - ipv4.addresses = [{ - address = "192.168.100.1"; - prefixLength = 24; - }]; + ipv4.addresses = [ + { + address = "192.168.100.1"; + prefixLength = 24; + } + ]; }; firewall.interfaces."enp0s13f0u1" = { allowedTCPPorts = [ 53 ]; - allowedUDPPorts = [ 53 67 ]; + allowedUDPPorts = [ + 53 + 67 + ]; }; nat = { @@ -146,7 +173,10 @@ services.dnsmasq = { enable = true; settings = { - server = [ "8.8.8.8" "1.1.1.1" ]; + server = [ + "8.8.8.8" + "1.1.1.1" + ]; domain-needed = true; bogus-priv = true; no-resolv = true; diff --git a/hosts/Infini-FRAMEWORK/displays.nix b/hosts/Infini-FRAMEWORK/displays.nix index 5482ca5..addf689 100644 --- a/hosts/Infini-FRAMEWORK/displays.nix +++ b/hosts/Infini-FRAMEWORK/displays.nix @@ -13,12 +13,26 @@ in services.autorandr.profiles = let - scale = { x = scaleFactor'; y = scaleFactor'; }; + scale = { + x = scaleFactor'; + y = scaleFactor'; + }; config = { - framework = { mode = "2256x1504"; primary = true; inherit scale; }; - portable-second = { mode = "1920x1080"; rotate = "left"; }; - dock = { mode = "1280x1024"; }; - dorm = { mode = "1920x1080"; }; + framework = { + mode = "2256x1504"; + primary = true; + inherit scale; + }; + portable-second = { + mode = "1920x1080"; + rotate = "left"; + }; + dock = { + mode = "1280x1024"; + }; + dorm = { + mode = "1920x1080"; + }; }; fingerprints = { framework = "00ffffffffffff0009e5ca0b000000002f200104a51c137803de50a3544c99260f505400000001010101010101010101010101010101115cd01881e02d50302036001dbe1000001aa749d01881e02d50302036001dbe1000001a000000fe00424f452043510a202020202020000000fe004e4531333546424d2d4e34310a0073"; @@ -32,30 +46,57 @@ in config = lib.mapAttrs (_: v: lib.removeAttrs v [ "fingerprint" ]) config; }; in - lib.mapAttrs (_: mkConfig) (with config'; { - main = { - eDP-1 = framework // { position = "0x0"; }; - }; - portable-second = { - eDP-1 = framework // { position = "1080x716"; }; - DP-4 = portable-second // { position = "0x0"; }; - }; - docked = { - eDP-1 = framework // { position = "0x210"; }; - DP-1-3 = dock // { position = "1805x0"; }; - }; - docked-alt = { - eDP-1 = framework // { position = "1080x716"; }; - DP-4 = portable-second // { position = "0x0"; }; - DP-1-3 = dock // { position = "2885x506"; }; - }; - dorm = { - eDP-1 = framework // { position = "1920x0"; }; - DP-4 = dorm // { position = "0x0"; }; - }; - dorm-2 = { - eDP-1 = framework // { position = "1920x0"; }; - DP-3 = dorm // { position = "0x0"; }; - }; - }); + lib.mapAttrs (_: mkConfig) ( + with config'; + { + main = { + eDP-1 = framework // { + position = "0x0"; + }; + }; + portable-second = { + eDP-1 = framework // { + position = "1080x716"; + }; + DP-4 = portable-second // { + position = "0x0"; + }; + }; + docked = { + eDP-1 = framework // { + position = "0x210"; + }; + DP-1-3 = dock // { + position = "1805x0"; + }; + }; + docked-alt = { + eDP-1 = framework // { + position = "1080x716"; + }; + DP-4 = portable-second // { + position = "0x0"; + }; + DP-1-3 = dock // { + position = "2885x506"; + }; + }; + dorm = { + eDP-1 = framework // { + position = "1920x0"; + }; + DP-4 = dorm // { + position = "0x0"; + }; + }; + dorm-2 = { + eDP-1 = framework // { + position = "1920x0"; + }; + DP-3 = dorm // { + position = "0x0"; + }; + }; + } + ); } diff --git a/hosts/Infini-FRAMEWORK/hardware-configuration.nix b/hosts/Infini-FRAMEWORK/hardware-configuration.nix index 858eb83..e562e70 100644 --- a/hosts/Infini-FRAMEWORK/hardware-configuration.nix +++ b/hosts/Infini-FRAMEWORK/hardware-configuration.nix @@ -1,7 +1,13 @@ { lib, ... }: { - boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "thunderbolt" + "nvme" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; diff --git a/hosts/Infini-OPTIPLEX/default.nix b/hosts/Infini-OPTIPLEX/default.nix index a4963ee..800f34a 100644 --- a/hosts/Infini-OPTIPLEX/default.nix +++ b/hosts/Infini-OPTIPLEX/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ imports = [ ./hardware-configuration.nix ./filesystems.nix diff --git a/hosts/Infini-OPTIPLEX/filesystems.nix b/hosts/Infini-OPTIPLEX/filesystems.nix index d130187..21682ee 100644 --- a/hosts/Infini-OPTIPLEX/filesystems.nix +++ b/hosts/Infini-OPTIPLEX/filesystems.nix @@ -3,7 +3,12 @@ let uuid = uuid: "/dev/disk/by-uuid/${uuid}"; main = uuid "9d4bf2d8-f139-42e7-937a-541a7870d806"; data = uuid "456cebd3-f800-4733-a783-90ed7c8978f7"; - commonOptions = [ "autodefrag" "noatime" "ssd" "compress=zstd:1" ]; + commonOptions = [ + "autodefrag" + "noatime" + "ssd" + "compress=zstd:1" + ]; mkMain' = options: { device = main; @@ -26,7 +31,11 @@ in "/" = { device = "none"; fsType = "tmpfs"; - options = [ "defaults" "size=16G" "mode=755" ]; + options = [ + "defaults" + "size=16G" + "mode=755" + ]; }; "/media/main" = mkMain' [ ]; diff --git a/hosts/Infini-OPTIPLEX/hardware-configuration.nix b/hosts/Infini-OPTIPLEX/hardware-configuration.nix index 6a6ed5d..6619fb8 100644 --- a/hosts/Infini-OPTIPLEX/hardware-configuration.nix +++ b/hosts/Infini-OPTIPLEX/hardware-configuration.nix @@ -1,7 +1,14 @@ { lib, ... }: { - boot.initrd.availableKernelModules = [ "ahci" "nvme" "sd_mod" "usb_storage" "usbhid" "xhci_pci" ]; + boot.initrd.availableKernelModules = [ + "ahci" + "nvme" + "sd_mod" + "usb_storage" + "usbhid" + "xhci_pci" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; diff --git a/hosts/Infini-RASPBERRY/default.nix b/hosts/Infini-RASPBERRY/default.nix index 5d7c716..57366d5 100644 --- a/hosts/Infini-RASPBERRY/default.nix +++ b/hosts/Infini-RASPBERRY/default.nix @@ -1,4 +1,10 @@ -{ inputs, config, lib, pkgs, ... }: +{ + inputs, + config, + lib, + pkgs, + ... +}: with lib; { imports = [ @@ -13,8 +19,7 @@ with lib; nixpkgs.overlays = [ (final: super: { - makeModulesClosure = x: - super.makeModulesClosure (x // { allowMissing = true; }); + makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; }); }) ]; @@ -31,7 +36,12 @@ with lib; kernelPackages = mkForce pkgs.linuxPackages_rpi4; # Removes ZFS >:( - supportedFilesystems = mkForce [ "btrfs" "ntfs" "vfat" "ext4" ]; + supportedFilesystems = mkForce [ + "btrfs" + "ntfs" + "vfat" + "ext4" + ]; tmp.useTmpfs = true; # kernelParams = [ diff --git a/hosts/Infini-RASPBERRY/sd-image.nix b/hosts/Infini-RASPBERRY/sd-image.nix index 8aea489..a3b91b2 100644 --- a/hosts/Infini-RASPBERRY/sd-image.nix +++ b/hosts/Infini-RASPBERRY/sd-image.nix @@ -1,4 +1,10 @@ -{ modulesPath, config, lib, pkgs, ... }: +{ + modulesPath, + config, + lib, + pkgs, + ... +}: { #formatAttr = "sdImage"; @@ -18,7 +24,11 @@ # The serial ports listed here are: # - ttyS0: for Tegra (Jetson TX1) # - ttyAMA0: for QEMU's -machine virt - boot.kernelParams = [ "console=ttyS0,115200n8" "console=ttyAMA0,115200n8" "console=tty0" ]; + boot.kernelParams = [ + "console=ttyS0,115200n8" + "console=ttyAMA0,115200n8" + "console=tty0" + ]; #sdImage = { # populateFirmwareCommands = @@ -34,29 +44,29 @@ # kernel=u-boot-rpi4.bin # enable_gic=1 # armstub=armstub8-gic.bin - # + # # # Otherwise the resolution will be weird in most cases, compared to # # what the pi3 firmware does by default. # disable_overscan=1 - # + # # # Supported in newer board revisions # arm_boost=1 - # + # # [cm4] # # Enable host mode on the 2711 built-in XHCI USB controller. # # This line should be removed if the legacy DWC2 controller is required # # (e.g. for USB device mode) or if USB support is not required. # otg_mode=1 - # + # # [all] # # Boot in 64-bit mode. # arm_64bit=1 - # + # # # U-Boot needs this to work, regardless of whether UART is actually used or not. # # Look in arch/arm/mach-bcm283x/Kconfig in the U-Boot tree to see if this is still # # a requirement in the future. # enable_uart=1 - # + # # # Prevent the firmware from smashing the framebuffer setup done by the mainline kernel # # when attempting to show low-voltage or overtemperature warnings. # avoid_warnings=1 diff --git a/hosts/Infini-SD/default.nix b/hosts/Infini-SD/default.nix index cadbeb9..06441ed 100644 --- a/hosts/Infini-SD/default.nix +++ b/hosts/Infini-SD/default.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ imports = [ ./hardware-configuration.nix ./filesystems.nix @@ -20,10 +21,12 @@ networking = { interfaces.eno4 = { - ipv4.addresses = [{ - address = "128.210.6.109"; - prefixLength = 28; - }]; + ipv4.addresses = [ + { + address = "128.210.6.109"; + prefixLength = 28; + } + ]; }; defaultGateway = { address = "128.210.6.97"; diff --git a/hosts/Infini-SD/filesystems.nix b/hosts/Infini-SD/filesystems.nix index 281c425..e07ecde 100644 --- a/hosts/Infini-SD/filesystems.nix +++ b/hosts/Infini-SD/filesystems.nix @@ -3,7 +3,11 @@ let uuid = uuid: "/dev/disk/by-uuid/${uuid}"; main = uuid "527062b3-7a48-4456-8527-30887c6e9f52"; - commonOptions = [ "autodefrag" "noatime" "compress-force=zstd:1" ]; + commonOptions = [ + "autodefrag" + "noatime" + "compress-force=zstd:1" + ]; mkMain' = options: { device = main; @@ -17,7 +21,11 @@ in "/" = { device = "none"; fsType = "tmpfs"; - options = [ "defaults" "size=64G" "mode=755" ]; + options = [ + "defaults" + "size=64G" + "mode=755" + ]; }; "/media/main" = mkMain' [ ]; diff --git a/hosts/Infini-SD/hardware-configuration.nix b/hosts/Infini-SD/hardware-configuration.nix index 730f52e..c4daa17 100644 --- a/hosts/Infini-SD/hardware-configuration.nix +++ b/hosts/Infini-SD/hardware-configuration.nix @@ -5,12 +5,25 @@ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "ahci" "usbhid" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "thunderbolt" + "ahci" + "usbhid" + "sd_mod" + ]; boot.initrd.kernelModules = [ "usb_storage" ]; - boot.kernelModules = [ "kvm-amd" "kvm-intel" ]; + boot.kernelModules = [ + "kvm-amd" + "kvm-intel" + ]; boot.extraModulePackages = [ ]; boot.kernelParams = [ "boot.shell_on_fail" ]; - boot.supportedFilesystems = [ "btrfs" "zfs" ]; + boot.supportedFilesystems = [ + "btrfs" + "zfs" + ]; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; info.model = "SD Card Installation"; diff --git a/hosts/Infini-SERVER/default.nix b/hosts/Infini-SERVER/default.nix index 8045cd0..8d870ef 100644 --- a/hosts/Infini-SERVER/default.nix +++ b/hosts/Infini-SERVER/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ imports = [ ./hardware-configuration.nix ./filesystems.nix diff --git a/hosts/Infini-SERVER/filesystems.nix b/hosts/Infini-SERVER/filesystems.nix index 5c65da6..383fc70 100644 --- a/hosts/Infini-SERVER/filesystems.nix +++ b/hosts/Infini-SERVER/filesystems.nix @@ -7,7 +7,11 @@ let esp = uuid "A2B8-4C6E"; data = uuid "59abb0ff-fe4e-4061-87d2-b728b937656a"; - commonOptions = [ "autodefrag" "noatime" "ssd" ]; + commonOptions = [ + "autodefrag" + "noatime" + "ssd" + ]; in { @@ -15,7 +19,11 @@ in "/" = { device = "tmpfs"; fsType = "tmpfs"; - options = [ "defaults" "size=4G" "mode=755" ]; + options = [ + "defaults" + "size=4G" + "mode=755" + ]; }; "/media/main" = { diff --git a/hosts/Infini-SERVER/hardware-configuration.nix b/hosts/Infini-SERVER/hardware-configuration.nix index ff6d44b..f6e8c25 100644 --- a/hosts/Infini-SERVER/hardware-configuration.nix +++ b/hosts/Infini-SERVER/hardware-configuration.nix @@ -1,9 +1,19 @@ { lib, ... }: { - boot.initrd.availableKernelModules = [ "nvme" "usb_storage" "xhci_pci" "ahci" "usbhid" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "usb_storage" + "xhci_pci" + "ahci" + "usbhid" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" "kvm-intel" ]; + boot.kernelModules = [ + "kvm-amd" + "kvm-intel" + ]; boot.extraModulePackages = [ ]; powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; diff --git a/hosts/Infini-SWIFT/hardware-configuration.nix b/hosts/Infini-SWIFT/hardware-configuration.nix index b9a9829..d47e4b1 100644 --- a/hosts/Infini-SWIFT/hardware-configuration.nix +++ b/hosts/Infini-SWIFT/hardware-configuration.nix @@ -1,12 +1,15 @@ { lib, modulesPath, ... }: { - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; diff --git a/hosts/data.cs.purdue.edu/default.nix b/hosts/data.cs.purdue.edu/default.nix index 6b36ee3..39d1e5c 100644 --- a/hosts/data.cs.purdue.edu/default.nix +++ b/hosts/data.cs.purdue.edu/default.nix @@ -1,4 +1,10 @@ -{ private, config, lib, pkgs, ... }: +{ + private, + config, + lib, + pkgs, + ... +}: { modules.hardware.form.server = true; @@ -14,40 +20,45 @@ home-manager.useUserPackages = false; - home = { main, config, ... }: { - home = { - username = lib.mkForce private.variables.purdue-username; + home = + { main, config, ... }: + { + home = { + username = lib.mkForce private.variables.purdue-username; - packages = with pkgs; [ - home-manager - ] ++ main.universe.packages; + packages = + with pkgs; + [ + home-manager + ] + ++ main.universe.packages; - inherit (main.universe) shellAliases; + inherit (main.universe) shellAliases; - sessionVariables = { - TMPDIR = "${config.home.homeDirectory}/scratch/tmp"; - UNIVERSE_FLAKE_ROOT = "${config.home.homeDirectory}/universe"; - UNIVERSE_USERNAME = main.user.name; - SHELL = "zsh"; + sessionVariables = { + TMPDIR = "${config.home.homeDirectory}/scratch/tmp"; + UNIVERSE_FLAKE_ROOT = "${config.home.homeDirectory}/universe"; + UNIVERSE_USERNAME = main.user.name; + SHELL = "zsh"; + }; + + file.".profile".target = ".profile-hm"; + + homeDirectory = lib.mkForce "/homes/${config.home.username}"; }; - file.".profile".target = ".profile-hm"; - - homeDirectory = lib.mkForce "/homes/${config.home.username}"; + nix.settings = { + inherit (main.nix.settings) + auto-optimise-store + experimental-features + fallback + flake-registry + keep-derivations + keep-outputs + min-free + sandbox + use-xdg-base-directories + ; + }; }; - - nix.settings = { - inherit (main.nix.settings) - auto-optimise-store - experimental-features - fallback - flake-registry - keep-derivations - keep-outputs - min-free - sandbox - use-xdg-base-directories - ; - }; - }; } diff --git a/hosts/hermes/default.nix b/hosts/hermes/default.nix index 1c9f448..8a640a4 100644 --- a/hosts/hermes/default.nix +++ b/hosts/hermes/default.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ imports = [ ./hardware-configuration.nix ./disks.nix diff --git a/hosts/hermes/hardware-configuration.nix b/hosts/hermes/hardware-configuration.nix index f66ccdd..f020635 100644 --- a/hosts/hermes/hardware-configuration.nix +++ b/hosts/hermes/hardware-configuration.nix @@ -5,12 +5,25 @@ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "ahci" "usbhid" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "thunderbolt" + "ahci" + "usbhid" + "sd_mod" + ]; boot.initrd.kernelModules = [ "usb_storage" ]; - boot.kernelModules = [ "kvm-amd" "kvm-intel" ]; + boot.kernelModules = [ + "kvm-amd" + "kvm-intel" + ]; boot.extraModulePackages = [ ]; boot.kernelParams = [ "boot.shell_on_fail" ]; - boot.supportedFilesystems = [ "btrfs" "zfs" ]; + boot.supportedFilesystems = [ + "btrfs" + "zfs" + ]; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; info.model = "Portable Installation"; diff --git a/hosts/hestia/hardware-configuration.nix b/hosts/hestia/hardware-configuration.nix index 4540756..59b8f88 100644 --- a/hosts/hestia/hardware-configuration.nix +++ b/hosts/hestia/hardware-configuration.nix @@ -5,12 +5,20 @@ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; boot.kernelParams = [ "boot.shell_on_fail" ]; - boot.supportedFilesystems = [ "btrfs" "zfs" ]; + boot.supportedFilesystems = [ + "btrfs" + "zfs" + ]; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; info.model = "Dell R330"; diff --git a/hosts/vulcan/default.nix b/hosts/vulcan/default.nix index c05eeac..dcb25f2 100644 --- a/hosts/vulcan/default.nix +++ b/hosts/vulcan/default.nix @@ -10,21 +10,26 @@ home-manager.useUserPackages = false; - home = { main, config, ... }: { - home = { - packages = with pkgs; [ - home-manager - ] ++ main.universe.packages; + home = + { main, config, ... }: + { + home = { + packages = + with pkgs; + [ + home-manager + ] + ++ main.universe.packages; - inherit (main.universe) shellAliases; + inherit (main.universe) shellAliases; - sessionVariables = { - UNIVERSE_FLAKE_ROOT = "${config.home.homeDirectory}/universe"; - UNIVERSE_MODE = "home-manager"; + sessionVariables = { + UNIVERSE_FLAKE_ROOT = "${config.home.homeDirectory}/universe"; + UNIVERSE_MODE = "home-manager"; + }; }; - }; - nix.settings.use-xdg-base-directories = true; + nix.settings.use-xdg-base-directories = true; - universe.programming.all.enable = true; - }; + universe.programming.all.enable = true; + }; } diff --git a/lib/default.nix b/lib/default.nix index 18c61d7..a13185c 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,107 +1,133 @@ { lib }: -lib.makeExtensible (self: -with lib; -rec { - flattenListSet = imports: (flatten (concatLists (attrValues imports))); - flattenSetList = attrSet: (mapAttrs (name: value: flatten value) attrSet); +lib.makeExtensible ( + self: + with lib; + rec { + flattenListSet = imports: (flatten (concatLists (attrValues imports))); + flattenSetList = attrSet: (mapAttrs (name: value: flatten value) attrSet); - # ["/home/user/" "/.screenrc"] -> ["home" "user" ".screenrc"] - splitPath = paths: - (filter - (s: builtins.typeOf s == "string" && s != "") - (concatMap (builtins.split "/") paths) - ); + # ["/home/user/" "/.screenrc"] -> ["home" "user" ".screenrc"] + splitPath = + paths: + (filter (s: builtins.typeOf s == "string" && s != "") (concatMap (builtins.split "/") paths)); - # ["home" "user" ".screenrc"] -> "home/user/.screenrc" - dirListToPath = dirList: (concatStringsSep "/" dirList); + # ["home" "user" ".screenrc"] -> "home/user/.screenrc" + dirListToPath = dirList: (concatStringsSep "/" dirList); - # ["/home/user/" "/.screenrc"] -> "/home/user/.screenrc" - concatPaths = paths: - let - prefix = optionalString (hasPrefix "/" (head paths)) "/"; - path = dirListToPath (splitPath paths); - in - prefix + path; + # ["/home/user/" "/.screenrc"] -> "/home/user/.screenrc" + concatPaths = + paths: + let + prefix = optionalString (hasPrefix "/" (head paths)) "/"; + path = dirListToPath (splitPath paths); + in + prefix + path; - sanitizeName = name: - replaceStrings - [ "." ] [ "" ] - (sanitizeDerivationName (removePrefix "/" name)); + sanitizeName = name: replaceStrings [ "." ] [ "" ] (sanitizeDerivationName (removePrefix "/" name)); - mapGenAttrs = list: func: attrs: - lib.genAttrs list (name: func (if builtins.typeOf attrs == "lambda" then attrs name else attrs)); + mapGenAttrs = + list: func: attrs: + lib.genAttrs list (name: func (if builtins.typeOf attrs == "lambda" then attrs name else attrs)); - dirsOf = dir: lib.attrNames (lib.filterAttrs (file: type: type == "directory") (builtins.readDir dir)); + dirsOf = + dir: lib.attrNames (lib.filterAttrs (file: type: type == "directory") (builtins.readDir dir)); - # Only useful for functors - recMap = f: list: - if list == [ ] then f - else recMap (f (head list)) (tail list) - ; + # Only useful for functors + recMap = f: list: if list == [ ] then f else recMap (f (head list)) (tail list); - chain = { - func = id; - __functor = self: input: - if (typeOf input) == "lambda" - then self // { func = e: input (self.func e); } - else self.func input; - }; + chain = { + func = id; + __functor = + self: input: + if (typeOf input) == "lambda" then self // { func = e: input (self.func e); } else self.func input; + }; - spread = function: list: if list == [ ] then function else spread (function (head list)) (tail list); + spread = + function: list: if list == [ ] then function else spread (function (head list)) (tail list); - isFunction = obj: (typeOf obj) == "lambda" || ((typeOf obj) == "set" && obj ? __functor); + isFunction = obj: (typeOf obj) == "lambda" || ((typeOf obj) == "set" && obj ? __functor); - # Takes a function and makes it lazy, by consuming arguments and applying it to the inner function first - # before calling the original function - # if the inner object is not actually a function, then just calls the original function - lazy = func: inner: if !(isFunction inner) then func inner else { - inherit func; - app = inner; - __functor = self: input: - let app = self.app input; in - if isFunction app then self // { inherit app; } - else self.func app; - }; + # Takes a function and makes it lazy, by consuming arguments and applying it to the inner function first + # before calling the original function + # if the inner object is not actually a function, then just calls the original function + lazy = + func: inner: + if !(isFunction inner) then + func inner + else + { + inherit func; + app = inner; + __functor = + self: input: + let + app = self.app input; + in + if isFunction app then self // { inherit app; } else self.func app; + }; - toBase64 = text: - let - inherit (lib) sublist mod stringToCharacters concatMapStrings; - inherit (lib.strings) charToInt; - inherit (builtins) substring foldl' genList elemAt length concatStringsSep stringLength; - lookup = stringToCharacters "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - sliceN = size: list: n: sublist (n * size) size list; - pows = [ (64 * 64 * 64) (64 * 64) 64 1 ]; - intSextets = i: map (j: mod (i / j) 64) pows; - compose = f: g: x: f (g x); - intToChar = elemAt lookup; - convertTripletInt = sliceInt: concatMapStrings intToChar (intSextets sliceInt); - sliceToInt = foldl' (acc: val: acc * 256 + val) 0; - convertTriplet = compose convertTripletInt sliceToInt; - join = concatStringsSep ""; - convertLastSlice = slice: - let - len = length slice; - in - if len == 1 - then (substring 0 2 (convertTripletInt ((sliceToInt slice) * 256 * 256))) + "==" - else if len == 2 - then (substring 0 3 (convertTripletInt ((sliceToInt slice) * 256))) + "=" - else ""; - len = stringLength text; - nFullSlices = len / 3; - bytes = map charToInt (stringToCharacters text); - tripletAt = sliceN 3 bytes; - head = genList (compose convertTriplet tripletAt) nFullSlices; - tail = convertLastSlice (tripletAt nFullSlices); - in - join (head ++ [ tail ]); + toBase64 = + text: + let + inherit (lib) + sublist + mod + stringToCharacters + concatMapStrings + ; + inherit (lib.strings) charToInt; + inherit (builtins) + substring + foldl' + genList + elemAt + length + concatStringsSep + stringLength + ; + lookup = stringToCharacters "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + sliceN = + size: list: n: + sublist (n * size) size list; + pows = [ + (64 * 64 * 64) + (64 * 64) + 64 + 1 + ]; + intSextets = i: map (j: mod (i / j) 64) pows; + compose = + f: g: x: + f (g x); + intToChar = elemAt lookup; + convertTripletInt = sliceInt: concatMapStrings intToChar (intSextets sliceInt); + sliceToInt = foldl' (acc: val: acc * 256 + val) 0; + convertTriplet = compose convertTripletInt sliceToInt; + join = concatStringsSep ""; + convertLastSlice = + slice: + let + len = length slice; + in + if len == 1 then + (substring 0 2 (convertTripletInt ((sliceToInt slice) * 256 * 256))) + "==" + else if len == 2 then + (substring 0 3 (convertTripletInt ((sliceToInt slice) * 256))) + "=" + else + ""; + len = stringLength text; + nFullSlices = len / 3; + bytes = map charToInt (stringToCharacters text); + tripletAt = sliceN 3 bytes; + head = genList (compose convertTriplet tripletAt) nFullSlices; + tail = convertLastSlice (tripletAt nFullSlices); + in + join (head ++ [ tail ]); - disko = import ./disko.nix { inherit lib; }; - filesystems = import ./filesystems.nix { inherit lib self; }; -} // ( - import ./digga.nix { inherit lib; } -) // ( - import ./hosts.nix { inherit lib; } -) // ( - import ./options.nix { inherit lib; } -)) + disko = import ./disko.nix { inherit lib; }; + filesystems = import ./filesystems.nix { inherit lib self; }; + } + // (import ./digga.nix { inherit lib; }) + // (import ./hosts.nix { inherit lib; }) + // (import ./options.nix { inherit lib; }) +) diff --git a/lib/digga.nix b/lib/digga.nix index 6c0d86b..bca1fa7 100644 --- a/lib/digga.nix +++ b/lib/digga.nix @@ -4,63 +4,58 @@ let flattenTree' = /* - * - Synopsis: flattenTree' _cond_ _sep_ _tree_ + * + Synopsis: flattenTree' _cond_ _sep_ _tree_ - Flattens a _tree_ of the shape that is produced by rakeLeaves. - _cond_ determines when to stop recursing - _sep_ is the separator to join the path with + Flattens a _tree_ of the shape that is produced by rakeLeaves. + _cond_ determines when to stop recursing + _sep_ is the separator to join the path with - Output Format: - An attrset with names in the spirit of the Reverse DNS Notation form - that fully preserve information about grouping from nesting. + Output Format: + An attrset with names in the spirit of the Reverse DNS Notation form + that fully preserve information about grouping from nesting. - Example input: - ``` - { - a = { - b = { - c = ; - }; - }; - } - ``` + Example input: + ``` + { + a = { + b = { + c = ; + }; + }; + } + ``` - Example output: - ``` - { - "a.b.c" = ; - } - ``` - * - */ - cond: - sep: - tree: + Example output: + ``` + { + "a.b.c" = ; + } + ``` + * + */ + cond: sep: tree: let - op = sum: path: val: + op = + sum: path: val: let pathStr = builtins.concatStringsSep sep path; # dot-based reverse DNS notation in - if cond val - then - # builtins.trace "${toString val} matches condition" + if cond val then + # builtins.trace "${toString val} matches condition" (sum // { "${pathStr}" = val; }) - else if builtins.isAttrs val - then - # builtins.trace "${builtins.toJSON val} is an attrset" - # recurse into that attribute set + else if builtins.isAttrs val then + # builtins.trace "${builtins.toJSON val} is an attrset" + # recurse into that attribute set (recurse sum path val) else - # ignore that value - # builtins.trace "${toString path} is something else" + # ignore that value + # builtins.trace "${toString path} is something else" sum; - recurse = sum: path: val: - builtins.foldl' - (sum: key: op sum (path ++ [ key ]) val.${key}) - sum - (builtins.attrNames val); + recurse = + sum: path: val: + builtins.foldl' (sum: key: op sum (path ++ [ key ]) val.${key}) sum (builtins.attrNames val); in recurse { } [ ] tree; @@ -68,40 +63,41 @@ let rakeLeaves = /* - * - Synopsis: rakeLeaves _path_ + * + Synopsis: rakeLeaves _path_ - Recursively collect the nix files of _path_ into attrs. + Recursively collect the nix files of _path_ into attrs. - Output Format: - An attribute set where all `.nix` files and directories with `default.nix` in them - are mapped to keys that are either the file with .nix stripped or the folder name. - All other directories are recursed further into nested attribute sets with the same format. + Output Format: + An attribute set where all `.nix` files and directories with `default.nix` in them + are mapped to keys that are either the file with .nix stripped or the folder name. + All other directories are recursed further into nested attribute sets with the same format. - Example file structure: - ``` - ./core/default.nix - ./base.nix - ./main/dev.nix - ./main/os/default.nix - ``` + Example file structure: + ``` + ./core/default.nix + ./base.nix + ./main/dev.nix + ./main/os/default.nix + ``` - Example output: - ``` - { - core = ./core; - base = base.nix; - main = { - dev = ./main/dev.nix; - os = ./main/os; - }; - } - ``` - * - */ + Example output: + ``` + { + core = ./core; + base = base.nix; + main = { + dev = ./main/dev.nix; + os = ./main/os; + }; + } + ``` + * + */ dirPath: let - seive = file: type: + seive = + file: type: # Only rake `.nix` files or directories (type == "regular" && lib.hasSuffix ".nix" file) || (type == "directory"); @@ -111,12 +107,11 @@ let let path = dirPath + "/${file}"; in - if - (type == "regular") - || (type == "directory" && builtins.pathExists (path + "/default.nix")) - then path + if (type == "regular") || (type == "directory" && builtins.pathExists (path + "/default.nix")) then + path # recurse on directories that don't contain a `default.nix` - else rakeLeaves path; + else + rakeLeaves path; }; files = lib.filterAttrs seive (builtins.readDir dirPath); @@ -125,42 +120,44 @@ let flattenLeaves = dir: flattenTree (rakeLeaves dir); - getFqdn = c: + getFqdn = + c: let net = c.config.networking; fqdn = - if (net ? domain) && (net.domain != null) - then "${net.hostName}.${net.domain}" - else net.hostName; + if (net ? domain) && (net.domain != null) then "${net.hostName}.${net.domain}" else net.hostName; in fqdn; in { - inherit rakeLeaves flattenTree flattenTree' flattenLeaves; + inherit + rakeLeaves + flattenTree + flattenTree' + flattenLeaves + ; leaves = dir: builtins.attrValues (flattenLeaves dir); - mkHomeConfigurations = systemConfigurations: + mkHomeConfigurations = + systemConfigurations: /* - * - Synopsis: mkHomeConfigurations _systemConfigurations_ + * + Synopsis: mkHomeConfigurations _systemConfigurations_ - Generate the `homeConfigurations` attribute expected by `home-manager` cli - from _nixosConfigurations_ or _darwinConfigurations_ in the form - _user@hostname_. - * - */ + Generate the `homeConfigurations` attribute expected by `home-manager` cli + from _nixosConfigurations_ or _darwinConfigurations_ in the form + _user@hostname_. + * + */ let - op = attrs: c: + op = + attrs: c: attrs - // ( - lib.mapAttrs' - (user: v: { - name = "${user}@${getFqdn c}"; - value = v.home; - }) - c.config.home-manager.users - ); + // (lib.mapAttrs' (user: v: { + name = "${user}@${getFqdn c}"; + value = v.home; + }) c.config.home-manager.users); mkHmConfigs = lib.foldl op { }; in mkHmConfigs (builtins.attrValues systemConfigurations); diff --git a/lib/disko.nix b/lib/disko.nix index e750fd3..a6f5388 100644 --- a/lib/disko.nix +++ b/lib/disko.nix @@ -34,62 +34,84 @@ rec { mkTmpfs' = mountOptions: size: mode: { fsType = "tmpfs"; - mountOptions = mountOptions ++ [ "size=${size}" "mode=${mode}" ]; + mountOptions = mountOptions ++ [ + "size=${size}" + "mode=${mode}" + ]; }; mkTmpfs = size: mkTmpfs' defaultMountOptions size "755"; # btrfs - mkBtrfsPart' = base: mountpoint: content': { - content = { - inherit mountpoint; - type = "btrfs"; - } // content'; - } // base; + mkBtrfsPart' = + base: mountpoint: content': + { + content = { + inherit mountpoint; + type = "btrfs"; + } // content'; + } + // base; mkBtrfsPart = size: mkBtrfsPart' { inherit size; }; mkBtrfsPartEndAt = end: mkBtrfsPart' { inherit end; }; - mkBtrfsSubvols' = mountOptions: mapAttrs (n: v: { - mountpoint = n; - mountOptions = mountOptions ++ (optionals (v ? mountOptions) v.mountOptions); - } // (removeAttrs v [ "mountOptions" ])); + mkBtrfsSubvols' = + mountOptions: + mapAttrs ( + n: v: + { + mountpoint = n; + mountOptions = mountOptions ++ (optionals (v ? mountOptions) v.mountOptions); + } + // (removeAttrs v [ "mountOptions" ]) + ); mkBtrfsSubvols = mkBtrfsSubvols' defaultMountOptions; # ZFS - mkZPart' = base: content: pool: { - content = { - type = "zfs"; - inherit pool; - } // content; - } // base; + mkZPart' = + base: content: pool: + { + content = { + type = "zfs"; + inherit pool; + } // content; + } + // base; mkZPart = size: mkZPart' { inherit size; } { }; mkZPartEndAt = end: mkZPart' { inherit end; } { }; - mkZDisk = id: pool: mkDisk id { - partitions = { - zfs = mkZPart "100%" pool; + mkZDisk = + id: pool: + mkDisk id { + partitions = { + zfs = mkZPart "100%" pool; + }; }; - }; - mkZPool' = mountOptions: name: options: { - type = "zpool"; - mode = "raidz"; - mountpoint = "/media/${name}"; - rootFsOptions = { - mountpoint = "legacy"; - compression = "zstd"; - atime = "off"; - }; - inherit mountOptions; - } // options; + mkZPool' = + mountOptions: name: options: + { + type = "zpool"; + mode = "raidz"; + mountpoint = "/media/${name}"; + rootFsOptions = { + mountpoint = "legacy"; + compression = "zstd"; + atime = "off"; + }; + inherit mountOptions; + } + // options; mkZPool = mkZPool' defaultMountOptions; mkZPools = mapAttrs mkZPool; mkZfs' = mountOptions: mountpoint: options: { type = "zfs_fs"; inherit mountpoint mountOptions; - options = { mountpoint = "legacy"; } // options; + options = { + mountpoint = "legacy"; + } // options; }; mkZfs = mkZfs' defaultMountOptions; @@ -98,5 +120,7 @@ rec { inherit size content; }; - markNeededForBoot = flip genAttrs (_: { neededForBoot = true; }); + markNeededForBoot = flip genAttrs (_: { + neededForBoot = true; + }); } diff --git a/lib/filesystems.nix b/lib/filesystems.nix index 63f4228..f802ae8 100644 --- a/lib/filesystems.nix +++ b/lib/filesystems.nix @@ -10,25 +10,33 @@ rec { neededForBoot = self.lazy (fs: fs // { neededForBoot = true; }); - mkFilesystemDev' = f: d: c: o: + mkFilesystemDev' = + f: d: c: o: neededForBoot (mkFilesystemDev f d c o); - mkFilesystem = fsType: uuid: - mkFilesystemDev fsType (diskByUuid uuid); + mkFilesystem = fsType: uuid: mkFilesystemDev fsType (diskByUuid uuid); - mkFilesystem' = f: d: c: o: + mkFilesystem' = + f: d: c: o: neededForBoot (mkFilesystemDev f d c o); - - mkEFI = uuid: neededForBoot { - device = diskByUuid uuid; - fsType = "vfat"; - }; - mkTmpfs = name: size: neededForBoot { - device = name; - fsType = "tmpfs"; - options = [ "defaults" "size=${size}" "mode=755" ]; - }; + mkEFI = + uuid: + neededForBoot { + device = diskByUuid uuid; + fsType = "vfat"; + }; + mkTmpfs = + name: size: + neededForBoot { + device = name; + fsType = "tmpfs"; + options = [ + "defaults" + "size=${size}" + "mode=755" + ]; + }; mkBtrfs' = options: uuid: extraOptions: { device = diskByUuid uuid; fsType = "btrfs"; diff --git a/lib/hosts.nix b/lib/hosts.nix index 48c4cff..abf6ef8 100644 --- a/lib/hosts.nix +++ b/lib/hosts.nix @@ -1,12 +1,21 @@ { lib }: { - mkHost = attrs@{ modules ? [ ], ... }: name: path: lib.nixosSystem (attrs // { - modules = [ - { - networking.hostName = lib.mkDefault name; + mkHost = + attrs@{ + modules ? [ ], + ... + }: + name: path: + lib.nixosSystem ( + attrs + // { + modules = [ + { + networking.hostName = lib.mkDefault name; + } + (import path) + ] ++ attrs.modules; } - (import path) - ] ++ attrs.modules; - }); + ); } diff --git a/lib/options.nix b/lib/options.nix index dc94a5b..ed4ed33 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -3,25 +3,30 @@ let inherit (lib) mkOption types flatten; 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; + }; - mkBoolOpt' = default: description: mkOption { - inherit default description; - type = types.bool; - example = true; - }; + mkBoolOpt' = + default: description: + mkOption { + inherit default description; + type = types.bool; + example = true; + }; - coercedPackageList = with types; + coercedPackageList = + with types; let packageListType = listOf (either package packageListType); in @@ -29,7 +34,11 @@ rec { packageListOpt = mkOpt coercedPackageList [ ]; - addPackageLists = lib.mapAttrs (name: value: value // { - packages = packageListOpt; - }); + addPackageLists = lib.mapAttrs ( + name: value: + value + // { + packages = packageListOpt; + } + ); } diff --git a/modules/functionality/soft-serve.nix b/modules/functionality/soft-serve.nix index fa8c04b..df54ab5 100644 --- a/modules/functionality/soft-serve.nix +++ b/modules/functionality/soft-serve.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; with lib.our; let @@ -88,4 +93,3 @@ in ]; }; } - diff --git a/modules/functionality/ssh-tunnel.nix b/modules/functionality/ssh-tunnel.nix index 8016f82..2857ebe 100644 --- a/modules/functionality/ssh-tunnel.nix +++ b/modules/functionality/ssh-tunnel.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; let cfg = config.services.ssh-tunnel; @@ -50,11 +55,13 @@ in local = mkParams "-L" cfg.forwards.local; remote = mkParams "-R" cfg.forwards.remote; - options = mkParams "-o" (mapAttrsToList (n: v: "${n}=${toString v}") { - ServerAliveInterval = 60; - ExitOnForwardFailure = "yes"; - KbdInteractiveAuthentication = "no"; - }); + options = mkParams "-o" ( + mapAttrsToList (n: v: "${n}=${toString v}") { + ServerAliveInterval = 60; + ExitOnForwardFailure = "yes"; + KbdInteractiveAuthentication = "no"; + } + ); in { script = '' diff --git a/modules/global/backup.nix b/modules/global/backup.nix index 7a9621d..ef4eb4e 100644 --- a/modules/global/backup.nix +++ b/modules/global/backup.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: # Borg Backup public key: # ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINhldH579ixPRSBtTjnzWoDCNyUxUSl1BjogWN3keYBR borg@universe # This is used to connect to my rsync.net @@ -7,11 +12,7 @@ with lib.our; let append = root: path: (root + "/" + path); - excludes' = concatLists - (mapAttrsToList - (root: map (append root)) - cfg.excludes - ); + excludes' = concatLists (mapAttrsToList (root: map (append root)) cfg.excludes); commonArgs = { environment = { @@ -36,12 +37,19 @@ let }; }; - mkJob = paths: commonArgs // { - inherit paths; - inherit (cfg) repo; - exclude = map (append paths) (excludes' ++ cfg.extraExcludes); - startAt = if cfg.backupTimes ? "${config.networking.hostName}" then "*-*-* ${cfg.backupTimes.${config.networking.hostName}}" else [ ]; - }; + mkJob = + paths: + commonArgs + // { + inherit paths; + inherit (cfg) repo; + exclude = map (append paths) (excludes' ++ cfg.extraExcludes); + startAt = + if cfg.backupTimes ? "${config.networking.hostName}" then + "*-*-* ${cfg.backupTimes.${config.networking.hostName}}" + else + [ ]; + }; cfg = config.modules.backups; in @@ -106,11 +114,12 @@ in (mkIf cfg.enable { services.borgbackup.jobs = mapAttrs (_: mkJob) cfg.jobs; - systemd.timers = lib.mapAttrs' - (n: _: lib.nameValuePair "borgbackup-job-${n}" { + systemd.timers = lib.mapAttrs' ( + n: _: + lib.nameValuePair "borgbackup-job-${n}" { requires = [ "network-online.target" ]; - }) - cfg.jobs; + } + ) cfg.jobs; persist.directories = [ "/root/.cache/borg" diff --git a/modules/global/caches/personal.nix b/modules/global/caches/personal.nix index d2d0c1e..0e35a5a 100644 --- a/modules/global/caches/personal.nix +++ b/modules/global/caches/personal.nix @@ -2,7 +2,9 @@ { nix.settings = { substituters = lib.flatten [ - (lib.optional (config.networking.hostName != "Infini-DESKTOP" && config.info.loc.home) "ssh://infini-desktop?priority=9") + (lib.optional ( + config.networking.hostName != "Infini-DESKTOP" && config.info.loc.home + ) "ssh://infini-desktop?priority=9") "https://hydra.inx.moe?priority=10" ]; trusted-public-keys = [ diff --git a/modules/global/general.nix b/modules/global/general.nix index a3b35a4..55b850e 100644 --- a/modules/global/general.nix +++ b/modules/global/general.nix @@ -1,4 +1,10 @@ -{ config, common, secrets, lib, ... }: +{ + config, + common, + secrets, + lib, + ... +}: { programs = { # Enable dconf for programs that need it diff --git a/modules/global/home-manager.nix b/modules/global/home-manager.nix index e1d2af2..3f5e27b 100644 --- a/modules/global/home-manager.nix +++ b/modules/global/home-manager.nix @@ -1,4 +1,10 @@ -{ config, lib, pkgs, ... }: { +{ + config, + lib, + pkgs, + ... +}: +{ home-manager = { useUserPackages = lib.mkDefault true; useGlobalPkgs = true; diff --git a/modules/global/networking.nix b/modules/global/networking.nix index b6ee4ed..fefc708 100644 --- a/modules/global/networking.nix +++ b/modules/global/networking.nix @@ -1,4 +1,9 @@ -{ config, pkgs, private, ... }: +{ + config, + pkgs, + private, + ... +}: { imports = [ private.nixosModules.networking ]; @@ -27,7 +32,10 @@ #"100.100.100.100" ]; - firewall.trustedInterfaces = [ "br-+" "tailscale0" ]; + firewall.trustedInterfaces = [ + "br-+" + "tailscale0" + ]; nftables = { enable = true; diff --git a/modules/global/nix.nix b/modules/global/nix.nix index ca5b3eb..827373f 100644 --- a/modules/global/nix.nix +++ b/modules/global/nix.nix @@ -1,6 +1,17 @@ -{ config, inputs, pkgs, lib, ... }: +{ + config, + inputs, + pkgs, + lib, + ... +}: let - inherit (lib) mkIf mkDefault filterAttrs mapAttrs'; + inherit (lib) + mkIf + mkDefault + filterAttrs + mapAttrs' + ; in { nix = { @@ -8,9 +19,19 @@ in settings = { allowed-users = [ "*" ]; - trusted-users = [ "root" "@wheel" "remotebuild" "nix-ssh" ]; + trusted-users = [ + "root" + "@wheel" + "remotebuild" + "nix-ssh" + ]; - system-features = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; + system-features = [ + "nixos-test" + "benchmark" + "big-parallel" + "kvm" + ]; experimental-features = [ "flakes" "nix-command" @@ -52,7 +73,12 @@ in let flakes = filterAttrs (n: v: v ? outputs) inputs; in - (mapAttrs' (n: v: { name = if n == "self" then "universe" else n; value = { flake = v; }; }) flakes) + (mapAttrs' (n: v: { + name = if n == "self" then "universe" else n; + value = { + flake = v; + }; + }) flakes) // { nixpkgs-git = { exact = false; diff --git a/modules/global/options.nix b/modules/global/options.nix index 34a4939..1e98a9f 100644 --- a/modules/global/options.nix +++ b/modules/global/options.nix @@ -1,5 +1,10 @@ # Heavily inspired by hlissner: https://github.com/hlissner/dotfiles/blob/master/modules/options.nix -{ config, options, lib, ... }: +{ + config, + options, + lib, + ... +}: with lib; with lib.our; let @@ -40,7 +45,11 @@ in universe = { packages = packageListOpt; shellAliases = mkOpt (attrsOf str) { }; - variables = mkOpt (attrsOf (oneOf [ (listOf str) str path ])) { }; + variables = mkOpt (attrsOf (oneOf [ + (listOf str) + str + path + ])) { }; media.enable = mkBoolOpt false; minimal.enable = mkBoolOpt false; }; diff --git a/modules/global/packages.nix b/modules/global/packages.nix index efb123a..7484612 100644 --- a/modules/global/packages.nix +++ b/modules/global/packages.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: { # Use the latest Linux kernel boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; @@ -7,80 +12,96 @@ environment.defaultPackages = lib.mkForce [ ]; # Packages wanted everywhere - universe.packages = with pkgs; [ - universe-cli + universe.packages = + with pkgs; + [ + universe-cli - agenix - bat - cloc - cryptsetup - curl - difftastic - direnv - dnsutils - erdtree - eza - fd - fzf - gnumake - gptfdisk - gum - htop - hyfetch - iputils - jq - man-pages - man-pages-posix - nmap - openssl - parallel - parted - pciutils - perl - rhash - ripgrep - rsync - skim - sshfs - strace - tealdeer - unixtools.whereis - unrar-wrapper - unzip - util-linux - wget - whois - xxHash - yq - zip - ] ++ (lib.optionals config.universe.media.enable (with pkgs; [ - ghostscript - graphviz - imagemagick - pandoc - yt-dlp - ])); + agenix + bat + cloc + cryptsetup + curl + difftastic + direnv + dnsutils + erdtree + eza + fd + fzf + gnumake + gptfdisk + gum + htop + hyfetch + iputils + jq + man-pages + man-pages-posix + nmap + openssl + parallel + parted + pciutils + perl + rhash + ripgrep + rsync + skim + sshfs + strace + tealdeer + unixtools.whereis + unrar-wrapper + unzip + util-linux + wget + whois + xxHash + yq + zip + ] + ++ (lib.optionals config.universe.media.enable ( + with pkgs; + [ + ghostscript + graphviz + imagemagick + pandoc + yt-dlp + ] + )); - environment.systemPackages = config.universe.packages ++ (with pkgs; [ - binutils - btrfs-progs - bubblewrap - compsize - coreutils-doge - dosfstools - exfat # Windows drives - kitty.terminfo - ntfs3g # Windows drives - smartmontools - usbutils + environment.systemPackages = + config.universe.packages + ++ (with pkgs; [ + binutils + btrfs-progs + bubblewrap + compsize + coreutils-doge + dosfstools + exfat # Windows drives + kitty.terminfo + ntfs3g # Windows drives + smartmontools + usbutils - # covered by home manager - git - vim - ]) ++ (lib.optionals config.info.graphical (with pkgs; [ - arandr - ])) ++ (lib.optionals config.universe.media.enable (with pkgs; [ - ffmpeg-full - mpv - ])); + # covered by home manager + git + vim + ]) + ++ (lib.optionals config.info.graphical ( + with pkgs; + [ + arandr + ] + )) + ++ (lib.optionals config.universe.media.enable ( + with pkgs; + [ + ffmpeg-full + mpv + ] + )); } diff --git a/modules/global/persist.nix b/modules/global/persist.nix index 8593e2f..275b07f 100644 --- a/modules/global/persist.nix +++ b/modules/global/persist.nix @@ -6,13 +6,22 @@ in persist = { directories = flatten [ "/home" - { directory = "/etc/nixos"; user = "infinidoge"; } - { directory = "/etc/nixos-private"; user = "infinidoge"; } + { + directory = "/etc/nixos"; + user = "infinidoge"; + } + { + directory = "/etc/nixos-private"; + user = "infinidoge"; + } "/var/log" "/var/lib/nixos" "/var/lib/systemd/" - { directory = "/var/lib/tailscale"; mode = "0700"; } + { + directory = "/var/lib/tailscale"; + mode = "0700"; + } "/root/.ssh" diff --git a/modules/global/programming.nix b/modules/global/programming.nix index 7c43b7f..d044ba0 100644 --- a/modules/global/programming.nix +++ b/modules/global/programming.nix @@ -1,33 +1,39 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let inherit (lib) flip; inherit (lib.our) mkBoolOpt' addPackageLists; cfg = config.universe.programming; - programmingOpt' = kind: flip mkBoolOpt' "Programming: ${kind}"; programmingOpt = flip programmingOpt' cfg.all.enable; in { - options.universe.programming = (addPackageLists { - base.enable = programmingOpt' "Base packages" true; + options.universe.programming = + (addPackageLists { + base.enable = programmingOpt' "Base packages" true; - c.enable = programmingOpt' "C" true; - csharp.enable = programmingOpt "C#"; - haskell.enable = programmingOpt "Haskell"; - java.enable = programmingOpt "Java"; - lua.enable = programmingOpt "Lua"; - nim.enable = programmingOpt "Nim"; - python.enable = programmingOpt' "Python" true; - racket.enable = programmingOpt "Racket"; - rust.enable = programmingOpt "Rust"; - zig.enable = programmingOpt "Zig"; - latex.enable = programmingOpt "LaTeX"; - html.enable = programmingOpt "HTML"; - }) // { - all.enable = programmingOpt' "All languages" false; - }; + c.enable = programmingOpt' "C" true; + csharp.enable = programmingOpt "C#"; + haskell.enable = programmingOpt "Haskell"; + java.enable = programmingOpt "Java"; + lua.enable = programmingOpt "Lua"; + nim.enable = programmingOpt "Nim"; + python.enable = programmingOpt' "Python" true; + racket.enable = programmingOpt "Racket"; + rust.enable = programmingOpt "Rust"; + zig.enable = programmingOpt "Zig"; + latex.enable = programmingOpt "LaTeX"; + html.enable = programmingOpt "HTML"; + }) + // { + all.enable = programmingOpt' "All languages" false; + }; config = { universe.programming = with pkgs; { @@ -60,7 +66,6 @@ in cabal2nix ]; - java.packages = [ openjdk clang-tools @@ -75,15 +80,17 @@ in ]; python.packages = [ - (python312.withPackages (p: with p; [ - black - isort - jupyter - mypy - pip - pyflakes - pytest - ])) + (python312.withPackages ( + p: with p; [ + black + isort + jupyter + mypy + pip + pyflakes + pytest + ] + )) pipenv ruff ]; @@ -93,12 +100,15 @@ in ]; rust.packages = [ - (rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override { - extensions = [ - "rust-src" - "rust-analyzer" - ]; - })) + (rust-bin.selectLatestNightlyWith ( + toolchain: + toolchain.default.override { + extensions = [ + "rust-src" + "rust-analyzer" + ]; + } + )) gcc ]; @@ -142,9 +152,9 @@ in ]; }; - universe.packages = lib.concatMap - (v: lib.optionals (v ? packages && v.enable) v.packages) - (lib.attrValues cfg); + universe.packages = lib.concatMap (v: lib.optionals (v ? packages && v.enable) v.packages) ( + lib.attrValues cfg + ); programs.java.enable = cfg.java.enable; diff --git a/modules/global/security.nix b/modules/global/security.nix index 4835798..d4461b1 100644 --- a/modules/global/security.nix +++ b/modules/global/security.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; let inherit (config.nixpkgs.hostPlatform) system; @@ -32,8 +37,12 @@ in hardware = { enableRedistributableFirmware = mkDefault true; - cpu.intel.updateMicrocode = mkDefault (config.hardware.enableRedistributableFirmware && system == "x86_64-linux"); - cpu.amd.updateMicrocode = mkDefault (config.hardware.enableRedistributableFirmware && system == "x86_64-linux"); + cpu.intel.updateMicrocode = mkDefault ( + config.hardware.enableRedistributableFirmware && system == "x86_64-linux" + ); + cpu.amd.updateMicrocode = mkDefault ( + config.hardware.enableRedistributableFirmware && system == "x86_64-linux" + ); }; users.mutableUsers = false; diff --git a/modules/global/shell.nix b/modules/global/shell.nix index bb15da1..9cdbd15 100644 --- a/modules/global/shell.nix +++ b/modules/global/shell.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let ifSudo = lib.mkIf config.security.sudo.enable; ifSudo' = text: if config.security.sudo.enable then "sudo ${text}" else text; @@ -43,7 +48,6 @@ in gcd = "cd $(git root || echo \".\")"; ucd = "cd $(uni cd || echo \".\")"; - # grep grep = "rg"; gi = "grep -i"; diff --git a/modules/global/ssh.nix b/modules/global/ssh.nix index 7a32537..be80844 100644 --- a/modules/global/ssh.nix +++ b/modules/global/ssh.nix @@ -12,14 +12,19 @@ with lib; ClientAliveInterval = 60; TCPKeepAlive = "yes"; }; - hostKeys = mkDefault [{ - path = "/etc/ssh/ssh_host_ed25519_key"; - type = "ed25519"; - }]; + hostKeys = mkDefault [ + { + path = "/etc/ssh/ssh_host_ed25519_key"; + type = "ed25519"; + } + ]; knownHosts = { "github.com" = { publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl"; - extraHostNames = [ "ssh.github.com" "ssh.github.com:443" ]; + extraHostNames = [ + "ssh.github.com" + "ssh.github.com:443" + ]; }; }; }; diff --git a/modules/global/virtualisation.nix b/modules/global/virtualisation.nix index 52f7417..9d247a0 100644 --- a/modules/global/virtualisation.nix +++ b/modules/global/virtualisation.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; with lib.our; let @@ -16,7 +21,8 @@ in }; programs.dconf.enable = mkIf cfg.libvirtd.enable true; - environment.systemPackages = (optional cfg.libvirtd.enable pkgs.virt-manager) + environment.systemPackages = + (optional cfg.libvirtd.enable pkgs.virt-manager) ++ (optional cfg.docker.enable pkgs.docker-compose); persist.directories = optional cfg.libvirtd.enable "/var/lib/libvirt"; }; diff --git a/modules/modules/desktop/gaming.nix b/modules/modules/desktop/gaming.nix index 52ab149..9b864a3 100644 --- a/modules/modules/desktop/gaming.nix +++ b/modules/modules/desktop/gaming.nix @@ -1,4 +1,10 @@ -{ config, options, lib, pkgs, ... }: +{ + config, + options, + lib, + pkgs, + ... +}: with lib; with lib.our; let @@ -32,16 +38,23 @@ in config = mkMerge [ { - assertions = [{ - assertion = (any id (with cfg; [ - steam.enable - prismlauncher.enable - lutris.enable - olympus.enable - puzzles.enable - ])) -> config.info.graphical; - message = "Games cannot be enabled in a non-graphical environment"; - }]; + assertions = [ + { + assertion = + (any id ( + with cfg; + [ + steam.enable + prismlauncher.enable + lutris.enable + olympus.enable + puzzles.enable + ] + )) + -> config.info.graphical; + message = "Games cannot be enabled in a non-graphical environment"; + } + ]; home.home.packages = with pkgs; [ (mkIf cfg.prismlauncher.enable cfg.prismlauncher.package) @@ -56,12 +69,14 @@ in programs.steam = { enable = mkAliasDefinitions opt.steam.enable; - package = cfg.steam.package.override (optionalAttrs config.modules.hardware.gpu.nvidia { - extraProfile = '' - unset VK_ICD_FILENAMES - export VK_ICD_FILENAMES=${config.hardware.nvidia.package}/share/vulkan/icd.d/nvidia_icd.json:${config.hardware.nvidia.package.lib32}/share/vulkan/icd.d/nvidia_icd32.json - ''; - }); + package = cfg.steam.package.override ( + optionalAttrs config.modules.hardware.gpu.nvidia { + extraProfile = '' + unset VK_ICD_FILENAMES + export VK_ICD_FILENAMES=${config.hardware.nvidia.package}/share/vulkan/icd.d/nvidia_icd.json:${config.hardware.nvidia.package.lib32}/share/vulkan/icd.d/nvidia_icd32.json + ''; + } + ); extraCompatPackages = with pkgs; [ proton-ge-bin ]; diff --git a/modules/modules/desktop/wm.nix b/modules/modules/desktop/wm.nix index 6674669..9a72a31 100644 --- a/modules/modules/desktop/wm.nix +++ b/modules/modules/desktop/wm.nix @@ -1,4 +1,10 @@ -{ config, common, pkgs, lib, ... }: +{ + config, + common, + pkgs, + lib, + ... +}: with lib; with lib.our; let @@ -50,29 +56,34 @@ in ''; }; - home-manager.sharedModules = [{ - xsession.enable = true; - }]; - - environment.systemPackages = with pkgs; flatten [ - (with xorg; [ - xwininfo - xprop - ]) - xclip - xdotool - - pavucontrol - - common.wm.locker + home-manager.sharedModules = [ + { + xsession.enable = true; + } ]; + + environment.systemPackages = + with pkgs; + flatten [ + (with xorg; [ + xwininfo + xprop + ]) + xclip + xdotool + + pavucontrol + + common.wm.locker + ]; } (mkIf cfg.qtile.enable { services.xserver.windowManager.qtile = { enable = true; - extraPackages = p: with p; [ - qtile-extras - ]; + extraPackages = + p: with p; [ + qtile-extras + ]; }; info.env.wm = "qtile"; diff --git a/modules/modules/hardware/audio.nix b/modules/modules/hardware/audio.nix index 84b80c1..4293776 100644 --- a/modules/modules/hardware/audio.nix +++ b/modules/modules/hardware/audio.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; with lib.our; diff --git a/modules/modules/hardware/form.nix b/modules/modules/hardware/form.nix index bc2830b..e1d444c 100644 --- a/modules/modules/hardware/form.nix +++ b/modules/modules/hardware/form.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; with lib.our; let @@ -58,7 +63,13 @@ in environment = { variables.LAPTOP = "True"; - systemPackages = with pkgs; [ acpi brightnessctl ] ++ optional config.powerManagement.powertop.enable pkgs.powertop; + systemPackages = + with pkgs; + [ + acpi + brightnessctl + ] + ++ optional config.powerManagement.powertop.enable pkgs.powertop; }; }) diff --git a/modules/modules/hardware/gpu.nix b/modules/modules/hardware/gpu.nix index e3c8b9b..3782352 100644 --- a/modules/modules/hardware/gpu.nix +++ b/modules/modules/hardware/gpu.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; with lib.our; let @@ -13,27 +18,39 @@ in }; config = mkMerge [ - (mkIf (any' (with cfg; [ amdgpu nvidia intel ])) { - hardware.graphics = { - enable = true; - enable32Bit = true; + (mkIf + (any' ( + with cfg; + [ + amdgpu + nvidia + intel + ] + )) + { + hardware.graphics = { + enable = true; + enable32Bit = true; - extraPackages = with pkgs; flatten [ - libvdpau-va-gl - vaapiVdpau + extraPackages = + with pkgs; + flatten [ + libvdpau-va-gl + vaapiVdpau - (optionals cfg.intel [ - intel-compute-runtime - intel-media-driver - vaapiIntel - ]) + (optionals cfg.intel [ + intel-compute-runtime + intel-media-driver + vaapiIntel + ]) - (optionals cfg.nvidia [ - nvidia-vaapi-driver - ]) - ]; - }; - }) + (optionals cfg.nvidia [ + nvidia-vaapi-driver + ]) + ]; + }; + } + ) (mkIf cfg.amdgpu { boot.initrd.kernelModules = [ "amdgpu" ]; diff --git a/modules/modules/hardware/peripherals/printing.nix b/modules/modules/hardware/peripherals/printing.nix index 5b1462a..89652f1 100644 --- a/modules/modules/hardware/peripherals/printing.nix +++ b/modules/modules/hardware/peripherals/printing.nix @@ -1,4 +1,9 @@ -{ config, lib, private, ... }: +{ + config, + lib, + private, + ... +}: with lib; with lib.our; let diff --git a/modules/modules/hardware/peripherals/yubikey.nix b/modules/modules/hardware/peripherals/yubikey.nix index 259140d..e0ce339 100644 --- a/modules/modules/hardware/peripherals/yubikey.nix +++ b/modules/modules/hardware/peripherals/yubikey.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; with lib.our; let diff --git a/modules/modules/hardware/wireless.nix b/modules/modules/hardware/wireless.nix index ff4cd3a..8c673bc 100644 --- a/modules/modules/hardware/wireless.nix +++ b/modules/modules/hardware/wireless.nix @@ -1,4 +1,10 @@ -{ config, lib, private, pkgs, ... }: +{ + config, + lib, + private, + pkgs, + ... +}: with lib; with lib.our; let diff --git a/modules/modules/services/apcupsd.nix b/modules/modules/services/apcupsd.nix index aa899d0..46a5f1c 100644 --- a/modules/modules/services/apcupsd.nix +++ b/modules/modules/services/apcupsd.nix @@ -20,26 +20,32 @@ in config = mkIf cfg.enable { services.apcupsd = { enable = true; - configText = '' - UPSNAME UPS - UPSCLASS standalone - UPSMODE disable - NETSERVER on - NISPORT ${toString port} + configText = + '' + UPSNAME UPS + UPSCLASS standalone + UPSMODE disable + NETSERVER on + NISPORT ${toString port} - BATTERYLEVEL ${toString cfg.config.battery_level} - MINUTES ${toString cfg.config.minutes} - '' + - (if cfg.primary then '' - UPSTYPE usb - UPSCABLE usb - NISIP ${cfg.config.address} - '' else '' - UPSCABLE ether - UPSTYPE net - DEVICE ${cfg.config.address}:${toString port} - POLLTIME 10 - ''); + BATTERYLEVEL ${toString cfg.config.battery_level} + MINUTES ${toString cfg.config.minutes} + '' + + ( + if cfg.primary then + '' + UPSTYPE usb + UPSCABLE usb + NISIP ${cfg.config.address} + '' + else + '' + UPSCABLE ether + UPSTYPE net + DEVICE ${cfg.config.address}:${toString port} + POLLTIME 10 + '' + ); hooks = cfg.config.hooks; }; networking.firewall.allowedTCPPorts = mkIf cfg.primary [ port ]; diff --git a/modules/vendored/factorio.nix b/modules/vendored/factorio.nix index 7f91c11..801c98e 100644 --- a/modules/vendored/factorio.nix +++ b/modules/vendored/factorio.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; @@ -48,19 +53,25 @@ let savePath = "${cfg.stateDir}/saves/${cfg.saveName}.zip"; - mkCmd = options: toString ([ - "${lib.getExe cfg.package}" - "--config=${cfg.configFile}" - (optionalString (cfg.mods != [ ]) "--mod-directory=${modDir}") - (optionalString (cfg.mods != [ ]) "--mod-directory=${modDir}") - (optionalString (cfg.mapGenSettings != { }) "--map-gen-settings=${mapGenSettingsFile}") - (optionalString (cfg.mapSettings != { }) "--map-settings=${mapSettingsFile}") - "--server-settings=${ - if (cfg.extraSettingsFile != null) - then "${cfg.stateDir}/server-settings.json" - else serverSettingsFile - }" - ] ++ options); + mkCmd = + options: + toString ( + [ + "${lib.getExe cfg.package}" + "--config=${cfg.configFile}" + (optionalString (cfg.mods != [ ]) "--mod-directory=${modDir}") + (optionalString (cfg.mods != [ ]) "--mod-directory=${modDir}") + (optionalString (cfg.mapGenSettings != { }) "--map-gen-settings=${mapGenSettingsFile}") + (optionalString (cfg.mapSettings != { }) "--map-settings=${mapSettingsFile}") + "--server-settings=${ + if (cfg.extraSettingsFile != null) then + "${cfg.stateDir}/server-settings.json" + else + serverSettingsFile + }" + ] + ++ options + ); in { disabledModules = [ "services/games/factorio.nix" ]; @@ -234,7 +245,9 @@ in extraSettings = mkOption { type = types.attrs; default = { }; - example = { admins = [ "username" ]; }; + example = { + admins = [ "username" ]; + }; description = lib.mdDoc '' Extra game configuration that will go into server-settings.json ''; @@ -338,18 +351,20 @@ in wantedBy = [ "multi-user.target" ]; after = [ "network.target" ]; - preStart = '' - if [[ ! -e "${savePath}" ]]; then - ${mkCmd [ - "--create=${savePath}" - ]} - fi - '' + (optionalString (cfg.extraSettingsFile != null) '' - echo ${lib.strings.escapeShellArg serverSettingsString} \ - "$(cat ${cfg.extraSettingsFile})" \ - | ${lib.getExe pkgs.jq} -s add \ - > ${cfg.stateDir}/server-settings.json - ''); + preStart = + '' + if [[ ! -e "${savePath}" ]]; then + ${mkCmd [ + "--create=${savePath}" + ]} + fi + '' + + (optionalString (cfg.extraSettingsFile != null) '' + echo ${lib.strings.escapeShellArg serverSettingsString} \ + "$(cat ${cfg.extraSettingsFile})" \ + | ${lib.getExe pkgs.jq} -s add \ + > ${cfg.stateDir}/server-settings.json + ''); serviceConfig = { User = cfg.user; @@ -362,11 +377,7 @@ in ExecStart = mkCmd [ "--port=${toString cfg.port}" "--bind=${cfg.bind}" - ( - if cfg.loadLatestSave - then "--start-server-load-latest" - else "--start-server=${savePath}" - ) + (if cfg.loadLatestSave then "--start-server-load-latest" else "--start-server=${savePath}") (optionalString (cfg.admins != [ ]) "--server-adminlist=${serverAdminsFile}") ]; @@ -379,7 +390,12 @@ in ProtectControlGroups = true; ProtectKernelModules = true; ProtectKernelTunables = true; - RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" "AF_NETLINK" ]; + RestrictAddressFamilies = [ + "AF_UNIX" + "AF_INET" + "AF_INET6" + "AF_NETLINK" + ]; RestrictRealtime = true; RestrictNamespaces = true; MemoryDenyWriteExecute = true; diff --git a/modules/vendored/hydra.nix b/modules/vendored/hydra.nix index bf0adff..3bc428d 100644 --- a/modules/vendored/hydra.nix +++ b/modules/vendored/hydra.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: with lib; @@ -16,22 +21,29 @@ let HYDRA_DATA = "${baseDir}"; }; - env = { - NIX_REMOTE = "daemon"; - SSL_CERT_FILE = "/etc/ssl/certs/ca-certificates.crt"; # Remove in 16.03 - PGPASSFILE = "${baseDir}/pgpass"; - NIX_REMOTE_SYSTEMS = concatStringsSep ":" cfg.buildMachinesFiles; - } // optionalAttrs (cfg.smtpHost != null) { - EMAIL_SENDER_TRANSPORT = "SMTP"; - EMAIL_SENDER_TRANSPORT_host = cfg.smtpHost; - } // hydraEnv // cfg.extraEnv; + env = + { + NIX_REMOTE = "daemon"; + SSL_CERT_FILE = "/etc/ssl/certs/ca-certificates.crt"; # Remove in 16.03 + PGPASSFILE = "${baseDir}/pgpass"; + NIX_REMOTE_SYSTEMS = concatStringsSep ":" cfg.buildMachinesFiles; + } + // optionalAttrs (cfg.smtpHost != null) { + EMAIL_SENDER_TRANSPORT = "SMTP"; + EMAIL_SENDER_TRANSPORT_host = cfg.smtpHost; + } + // hydraEnv + // cfg.extraEnv; - serverEnv = env // { - HYDRA_TRACKER = cfg.tracker; - XDG_CACHE_HOME = "${baseDir}/www/.cache"; - COLUMNS = "80"; - PGPASSFILE = "${baseDir}/pgpass-www"; # grrr - } // (optionalAttrs cfg.debugServer { DBIC_TRACE = "1"; }); + serverEnv = + env + // { + HYDRA_TRACKER = cfg.tracker; + XDG_CACHE_HOME = "${baseDir}/www/.cache"; + COLUMNS = "80"; + PGPASSFILE = "${baseDir}/pgpass-www"; # grrr + } + // (optionalAttrs cfg.debugServer { DBIC_TRACE = "1"; }); localDB = "dbi:Pg:dbname=hydra;user=hydra;"; @@ -39,7 +51,9 @@ let hydra-package = let - makeWrapperArgs = concatStringsSep " " (mapAttrsToList (key: value: "--set-default \"${key}\" \"${value}\"") hydraEnv); + makeWrapperArgs = concatStringsSep " " ( + mapAttrsToList (key: value: "--set-default \"${key}\" \"${value}\"") hydraEnv + ); in pkgs.buildEnv rec { name = "hydra-env"; @@ -236,7 +250,10 @@ in type = types.listOf types.path; default = optional (config.nix.buildMachines != [ ]) "/etc/nix/machines"; defaultText = literalExpression ''optional (config.nix.buildMachines != []) "/etc/nix/machines"''; - example = [ "/etc/nix/machines" "/var/lib/hydra/provisioner/machines" ]; + example = [ + "/etc/nix/machines" + "/var/lib/hydra/provisioner/machines" + ]; description = "List of files containing build machines."; }; @@ -257,7 +274,6 @@ in }; - ###### implementation config = mkIf cfg.enable { @@ -312,7 +328,10 @@ in use-substitutes = ${if cfg.useSubstitutes then "1" else "0"} ''; - environment.systemPackages = [ hydra-package pkgs.git ]; + environment.systemPackages = [ + hydra-package + pkgs.git + ]; environment.variables = hydraEnv; @@ -320,7 +339,11 @@ in { keep-outputs = true; keep-derivations = true; - extra-trusted-users = [ "hydra" "hydra-queue-runner" "hydra-www" ]; + extra-trusted-users = [ + "hydra" + "hydra-queue-runner" + "hydra-www" + ]; } (mkIf (versionOlder (getVersion config.nix.package.out) "2.4pre") { @@ -419,8 +442,17 @@ in wantedBy = [ "multi-user.target" ]; requires = [ "hydra-init.service" ]; wants = [ "network-online.target" ]; - after = [ "hydra-init.service" "network.target" ]; - path = [ hydra-package pkgs.nettools pkgs.openssh pkgs.bzip2 config.nix.package ]; + after = [ + "hydra-init.service" + "network.target" + ]; + path = [ + hydra-package + pkgs.nettools + pkgs.openssh + pkgs.bzip2 + config.nix.package + ]; restartTriggers = [ hydraConf ]; environment = env // { PGPASSFILE = "${baseDir}/pgpass-queue-runner"; # grrr @@ -444,8 +476,16 @@ in wantedBy = [ "multi-user.target" ]; requires = [ "hydra-init.service" ]; wants = [ "network-online.target" ]; - after = [ "hydra-init.service" "network.target" "network-online.target" ]; - path = with pkgs; [ hydra-package nettools jq ]; + after = [ + "hydra-init.service" + "network.target" + "network-online.target" + ]; + path = with pkgs; [ + hydra-package + nettools + jq + ]; restartTriggers = [ hydraConf ]; environment = env // { HYDRA_DBI = "${env.HYDRA_DBI};application_name=hydra-evaluator"; diff --git a/modules/vendored/steam.nix b/modules/vendored/steam.nix index 6d419ef..099331a 100644 --- a/modules/vendored/steam.nix +++ b/modules/vendored/steam.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.steam; @@ -8,7 +13,9 @@ let steam-gamescope = let - exports = builtins.attrValues (builtins.mapAttrs (n: v: "export ${n}=${v}") cfg.gamescopeSession.env); + exports = builtins.attrValues ( + builtins.mapAttrs (n: v: "export ${n}=${v}") cfg.gamescopeSession.env + ); in pkgs.writeShellScriptBin "steam-gamescope" '' ${builtins.concatStringsSep "\n" exports} @@ -22,7 +29,10 @@ let Comment=A digital distribution platform Exec=${steam-gamescope}/bin/steam-gamescope Type=Application - '').overrideAttrs (_: { passthru.providedSessions = [ "steam" ]; }); + '').overrideAttrs + (_: { + passthru.providedSessions = [ "steam" ]; + }); in { disabledModules = [ "programs/steam.nix" ]; @@ -46,29 +56,40 @@ in ]; } ''; - apply = steam: steam.override (prev: { - extraEnv = (lib.optionalAttrs (cfg.extraCompatPackages != [ ]) { - STEAM_EXTRA_COMPAT_TOOLS_PATHS = extraCompatPaths; - }) // (lib.optionalAttrs cfg.extest.enable { - LD_PRELOAD = "${pkgs.pkgsi686Linux.extest}/lib/libextest.so"; - }) // (prev.extraEnv or { }); - extraLibraries = pkgs: - let - prevLibs = if prev ? extraLibraries then prev.extraLibraries pkgs else [ ]; - additionalLibs = with config.hardware.graphics; - if pkgs.stdenv.hostPlatform.is64bit - then [ package ] ++ extraPackages - else [ package32 ] ++ extraPackages32; - in - prevLibs ++ additionalLibs; - extraPkgs = p: (cfg.extraPackages ++ lib.optionals (prev ? extraPkgs) (prev.extraPkgs p)); - } // lib.optionalAttrs (cfg.gamescopeSession.enable && gamescopeCfg.capSysNice) - { - buildFHSEnv = pkgs.buildFHSEnv.override { - # use the setuid wrapped bubblewrap - bubblewrap = "${config.security.wrapperDir}/.."; - }; - }); + apply = + steam: + steam.override ( + prev: + { + extraEnv = + (lib.optionalAttrs (cfg.extraCompatPackages != [ ]) { + STEAM_EXTRA_COMPAT_TOOLS_PATHS = extraCompatPaths; + }) + // (lib.optionalAttrs cfg.extest.enable { + LD_PRELOAD = "${pkgs.pkgsi686Linux.extest}/lib/libextest.so"; + }) + // (prev.extraEnv or { }); + extraLibraries = + pkgs: + let + prevLibs = if prev ? extraLibraries then prev.extraLibraries pkgs else [ ]; + additionalLibs = + with config.hardware.graphics; + if pkgs.stdenv.hostPlatform.is64bit then + [ package ] ++ extraPackages + else + [ package32 ] ++ extraPackages32; + in + prevLibs ++ additionalLibs; + extraPkgs = p: (cfg.extraPackages ++ lib.optionals (prev ? extraPkgs) (prev.extraPkgs p)); + } + // lib.optionalAttrs (cfg.gamescopeSession.enable && gamescopeCfg.capSysNice) { + buildFHSEnv = pkgs.buildFHSEnv.override { + # use the setuid wrapped bubblewrap + bubblewrap = "${config.security.wrapperDir}/.."; + }; + } + ); description = '' The Steam package to use. Additional libraries are added from the system configuration to ensure graphics work properly. @@ -201,18 +222,24 @@ in programs.steam.extraPackages = cfg.fontPackages; programs.gamescope.enable = lib.mkDefault cfg.gamescopeSession.enable; - services.displayManager.sessionPackages = lib.mkIf cfg.gamescopeSession.enable [ gamescopeSessionFile ]; + services.displayManager.sessionPackages = lib.mkIf cfg.gamescopeSession.enable [ + gamescopeSessionFile + ]; # optionally enable 32bit pulseaudio support if pulseaudio is enabled services.pulseaudio.support32Bit = config.services.pulseaudio.enable; hardware.steam-hardware.enable = true; - home.home.packages = [ - cfg.package - cfg.package.run - ] ++ lib.optional cfg.gamescopeSession.enable steam-gamescope - ++ lib.optional cfg.protontricks.enable (cfg.protontricks.package.override { inherit extraCompatPaths; }); + home.home.packages = + [ + cfg.package + cfg.package.run + ] + ++ lib.optional cfg.gamescopeSession.enable steam-gamescope + ++ lib.optional cfg.protontricks.enable ( + cfg.protontricks.package.override { inherit extraCompatPaths; } + ); networking.firewall = lib.mkMerge [ (lib.mkIf (cfg.remotePlay.openFirewall || cfg.localNetworkGameTransfers.openFirewall) { @@ -221,7 +248,12 @@ in (lib.mkIf cfg.remotePlay.openFirewall { allowedTCPPorts = [ 27036 ]; - allowedUDPPortRanges = [{ from = 27031; to = 27035; }]; + allowedUDPPortRanges = [ + { + from = 27031; + to = 27035; + } + ]; }) (lib.mkIf cfg.dedicatedServer.openFirewall { diff --git a/modules/vendored/thelounge.nix b/modules/vendored/thelounge.nix index 94b5a87..1851c79 100644 --- a/modules/vendored/thelounge.nix +++ b/modules/vendored/thelounge.nix @@ -1,27 +1,42 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: with lib; let cfg = config.services.thelounge; - configJsData = "module.exports = " + builtins.toJSON ( - { inherit (cfg) public port; } // cfg.extraConfig - ); + configJsData = + "module.exports = " + builtins.toJSON ({ inherit (cfg) public port; } // cfg.extraConfig); pluginManifest = { - dependencies = builtins.listToAttrs (builtins.map (pkg: { name = getName pkg; value = getVersion pkg; }) cfg.plugins); + dependencies = builtins.listToAttrs ( + builtins.map (pkg: { + name = getName pkg; + value = getVersion pkg; + }) cfg.plugins + ); }; plugins = pkgs.runCommandLocal "thelounge-plugins" { } '' mkdir -p $out/node_modules echo ${escapeShellArg (builtins.toJSON pluginManifest)} >> $out/package.json ${concatMapStringsSep "\n" (pkg: '' - ln -s ${pkg}/lib/node_modules/${getName pkg} $out/node_modules/${getName pkg} + ln -s ${pkg}/lib/node_modules/${getName pkg} $out/node_modules/${getName pkg} '') cfg.plugins} ''; in { disabledModules = [ "services/networking/thelounge.nix" ]; - imports = [ (mkRemovedOptionModule [ "services" "thelounge" "private" ] "The option was renamed to `services.thelounge.public` to follow upstream changes.") ]; + imports = [ + (mkRemovedOptionModule [ + "services" + "thelounge" + "private" + ] "The option was renamed to `services.thelounge.public` to follow upstream changes.") + ]; options.services.thelounge = { enable = mkEnableOption (lib.mdDoc "The Lounge web IRC client"); diff --git a/modules/vendored/vaultwarden.nix b/modules/vendored/vaultwarden.nix index e39c86b..5c23c86 100644 --- a/modules/vendored/vaultwarden.nix +++ b/modules/vendored/vaultwarden.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; @@ -8,17 +13,27 @@ let group = config.users.groups.vaultwarden.name; # Convert name from camel case (e.g. disable2FARemember) to upper case snake case (e.g. DISABLE_2FA_REMEMBER). - nameToEnvVar = name: + nameToEnvVar = + name: let parts = builtins.split "([A-Z0-9]+)" name; - partsToEnvVar = parts: foldl' - (key: x: - let last = stringLength key - 1; in - if isList x then key + optionalString (key != "" && substring last 1 key != "_") "_" + head x + partsToEnvVar = + parts: + foldl' ( + key: x: + let + last = stringLength key - 1; + in + if isList x then + key + optionalString (key != "" && substring last 1 key != "_") "_" + head x else if key != "" && elem (substring 0 1 x) lowerChars then # to handle e.g. [ "disable" [ "2FAR" ] "emember" ] - substring 0 last key + optionalString (substring (last - 1) 1 key != "_") "_" + substring last 1 key + toUpper x - else key + toUpper x) "" - parts; + substring 0 last key + + optionalString (substring (last - 1) 1 key != "_") "_" + + substring last 1 key + + toUpper x + else + key + toUpper x + ) "" parts; in if builtins.match "[A-Z0-9_]+" name != null then name else partsToEnvVar parts; @@ -26,17 +41,24 @@ let # we can only check for values consistently after converting them to their corresponding environment variable name. configEnv = let - configEnv = concatMapAttrs - (name: value: optionalAttrs (value != null) { + configEnv = concatMapAttrs ( + name: value: + optionalAttrs (value != null) { ${nameToEnvVar name} = if isBool value then boolToString value else toString value; - }) - cfg.config; + } + ) cfg.config; in - { DATA_FOLDER = cfg.dataDir; } // optionalAttrs (!(configEnv ? WEB_VAULT_ENABLED) || configEnv.WEB_VAULT_ENABLED == "true") { + { + DATA_FOLDER = cfg.dataDir; + } + // optionalAttrs (!(configEnv ? WEB_VAULT_ENABLED) || configEnv.WEB_VAULT_ENABLED == "true") { WEB_VAULT_FOLDER = "${cfg.webVaultPackage}/share/vaultwarden/vault"; - } // configEnv; + } + // configEnv; - configFile = pkgs.writeText "vaultwarden.env" (concatStrings (mapAttrsToList (name: value: "${name}=${value}\n") configEnv)); + configFile = pkgs.writeText "vaultwarden.env" ( + concatStrings (mapAttrsToList (name: value: "${name}=${value}\n") configEnv) + ); vaultwarden = cfg.package.override { inherit (cfg) dbBackend; }; @@ -52,7 +74,11 @@ in enable = mkEnableOption (lib.mdDoc "vaultwarden"); dbBackend = mkOption { - type = enum [ "sqlite" "mysql" "postgresql" ]; + type = enum [ + "sqlite" + "mysql" + "postgresql" + ]; default = "sqlite"; description = lib.mdDoc '' Which database backend vaultwarden will be using. @@ -77,7 +103,13 @@ in }; config = mkOption { - type = attrsOf (nullOr (oneOf [ bool int str ])); + type = attrsOf ( + nullOr (oneOf [ + bool + int + str + ]) + ); default = { ROCKET_ADDRESS = "::1"; # default to localhost ROCKET_PORT = 8222; @@ -186,10 +218,12 @@ in }; config = mkIf cfg.enable { - assertions = [{ - assertion = cfg.backupDir != null -> cfg.dbBackend == "sqlite"; - message = "Backups for database backends other than sqlite will need customization"; - }]; + assertions = [ + { + assertion = cfg.backupDir != null -> cfg.dbBackend == "sqlite"; + message = "Backups for database backends other than sqlite will need customization"; + } + ]; users.users.vaultwarden = { inherit group; @@ -218,11 +252,19 @@ in wantedBy = [ "multi-user.target" ]; }; - systemd.tmpfiles.settings."10-vaultwarden" = { - ${cfg.dataDir}.d = { inherit user group; mode = "0700"; }; - } // optionalAttrs (cfg.backupDir != null) { - ${cfg.backupDir}.d = { inherit user group; mode = "0770"; }; - }; + systemd.tmpfiles.settings."10-vaultwarden" = + { + ${cfg.dataDir}.d = { + inherit user group; + mode = "0700"; + }; + } + // optionalAttrs (cfg.backupDir != null) { + ${cfg.backupDir}.d = { + inherit user group; + mode = "0770"; + }; + }; systemd.services.backup-vaultwarden = mkIf (cfg.backupDir != null) { aliases = [ "backup-bitwarden_rs.service" ]; diff --git a/overlays/overrides.nix b/overlays/overrides.nix index 7abf9d5..28acd95 100644 --- a/overlays/overrides.nix +++ b/overlays/overrides.nix @@ -1,17 +1,20 @@ inputs: final: prev: let mkPkgs = channel: channel.legacyPackages.${final.system}; - mkPkgsUnfree = channel: import channel { - inherit (final) system; - config.allowUnfree = true; - }; + mkPkgsUnfree = + channel: + import channel { + inherit (final) system; + config.allowUnfree = true; + }; latest = mkPkgsUnfree inputs.latest; fork = mkPkgsUnfree inputs.fork; stable = mkPkgs inputs.stable; old-stable = mkPkgs inputs.old-stable; - versionFromInput = input: + versionFromInput = + input: let slice = a: b: builtins.substring a b input.lastModifiedDate; in diff --git a/overlays/patches/default.nix b/overlays/patches/default.nix index 431c3fd..f2bfe40 100644 --- a/overlays/patches/default.nix +++ b/overlays/patches/default.nix @@ -1,9 +1,11 @@ final: prev: let - addPatches = package: patches: package.overrideAttrs (old: { - patches = (old.patches or [ ]) ++ patches; - }); + addPatches = + package: patches: + package.overrideAttrs (old: { + patches = (old.patches or [ ]) ++ patches; + }); in { # coreutils-doge = addPatches prev.coreutils [ ./coreutils.patch ]; @@ -20,7 +22,9 @@ in # }) #]; - hydra_unstable = addPatches prev.hydra_unstable [ ./hydra-force-allow-import-from-derivation.patch ]; + hydra_unstable = addPatches prev.hydra_unstable [ + ./hydra-force-allow-import-from-derivation.patch + ]; openssh-srv = addPatches prev.openssh [ ./srv-records.patch ]; diff --git a/pkgs/all-packages.nix b/pkgs/all-packages.nix index 5d37dbc..f4c3d96 100644 --- a/pkgs/all-packages.nix +++ b/pkgs/all-packages.nix @@ -14,8 +14,12 @@ rec { tmx-cups-ppd = pkgs.callPackage ./tmx-cups-ppd.nix { }; unbted = pkgs.callPackage ./unbted.nix { }; unmap = pkgs.callPackage ./unmap { }; - vpython-jupyter = pkgs.python3Packages.callPackage ./vpython-jupyter.nix { inherit jupyterlab-vpython; }; + vpython-jupyter = pkgs.python3Packages.callPackage ./vpython-jupyter.nix { + inherit jupyterlab-vpython; + }; jupyterlab-vpython = pkgs.python3Packages.callPackage ./jupyterlab-vpython { }; - jupyter-server-proxy = pkgs.python3Packages.callPackage ./jupyter-server-proxy { inherit simpervisor; }; + jupyter-server-proxy = pkgs.python3Packages.callPackage ./jupyter-server-proxy { + inherit simpervisor; + }; simpervisor = pkgs.python3Packages.callPackage ./simpervisor.nix { }; } diff --git a/pkgs/bytecode-viewer.nix b/pkgs/bytecode-viewer.nix index 2d3a1fe..c9ae841 100644 --- a/pkgs/bytecode-viewer.nix +++ b/pkgs/bytecode-viewer.nix @@ -1,9 +1,10 @@ -{ stdenv -, lib -, fetchFromGitHub -, jre -, makeWrapper -, maven +{ + stdenv, + lib, + fetchFromGitHub, + jre, + makeWrapper, + maven, }: maven.buildMavenPackage rec { diff --git a/pkgs/default.nix b/pkgs/default.nix index cbff4fa..264c4f3 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,6 +1,7 @@ { self, lib, ... }: { - perSystem = { pkgs, ... }: + perSystem = + { pkgs, ... }: let allPackages = import ./all-packages.nix { inherit pkgs; }; in diff --git a/pkgs/ears-cli.nix b/pkgs/ears-cli.nix index 28286df..4c38ab4 100644 --- a/pkgs/ears-cli.nix +++ b/pkgs/ears-cli.nix @@ -1,8 +1,9 @@ -{ lib -, stdenvNoCC -, fetchFromGitea -, makeWrapper -, jdk +{ + lib, + stdenvNoCC, + fetchFromGitea, + makeWrapper, + jdk, }: stdenvNoCC.mkDerivation rec { pname = "ears-cli"; @@ -16,7 +17,10 @@ stdenvNoCC.mkDerivation rec { sha256 = "sha256-3ov7wjw8nxjwrNRH0wHICbZjXR4j2DPkUl5WlxJZsLA="; }; - nativeBuildInputs = [ jdk makeWrapper ]; + nativeBuildInputs = [ + jdk + makeWrapper + ]; buildPhase = '' bash ./build.sh diff --git a/pkgs/fw-ectool.nix b/pkgs/fw-ectool.nix index 71b57a4..a7bf240 100644 --- a/pkgs/fw-ectool.nix +++ b/pkgs/fw-ectool.nix @@ -1,11 +1,12 @@ -{ stdenv -, lib -, fetchFromGitLab -, pkg-config -, cmake -, hostname -, libusb1 -, libftdi1 +{ + stdenv, + lib, + fetchFromGitLab, + pkg-config, + cmake, + hostname, + libusb1, + libftdi1, }: stdenv.mkDerivation { diff --git a/pkgs/hexagon.nix b/pkgs/hexagon.nix index 496c006..2cc7b68 100644 --- a/pkgs/hexagon.nix +++ b/pkgs/hexagon.nix @@ -1,4 +1,8 @@ -{ lib, fetchFromGitHub, rustPlatform }: +{ + lib, + fetchFromGitHub, + rustPlatform, +}: rustPlatform.buildRustPackage rec { pname = "hexagon"; diff --git a/pkgs/jupyter-server-proxy/default.nix b/pkgs/jupyter-server-proxy/default.nix index 0b70cc1..b9d96fc 100644 --- a/pkgs/jupyter-server-proxy/default.nix +++ b/pkgs/jupyter-server-proxy/default.nix @@ -1,19 +1,20 @@ -{ buildPythonPackage -, fetchFromGitHub +{ + buildPythonPackage, + fetchFromGitHub, -, yarnConfigHook -, fetchYarnDeps -, hatchling -, hatch-jupyter-builder -, nodejs + yarnConfigHook, + fetchYarnDeps, + hatchling, + hatch-jupyter-builder, + nodejs, -, jupyterlab -, aiohttp -, importlib-metadata -, jupyter-server -, simpervisor -, tornado -, traitlets + jupyterlab, + aiohttp, + importlib-metadata, + jupyter-server, + simpervisor, + tornado, + traitlets, }: buildPythonPackage { diff --git a/pkgs/jupyterlab-myst/default.nix b/pkgs/jupyterlab-myst/default.nix index afabb9e..350c145 100644 --- a/pkgs/jupyterlab-myst/default.nix +++ b/pkgs/jupyterlab-myst/default.nix @@ -1,16 +1,17 @@ -{ lib -, buildPythonPackage -, fetchFromGitHub -, yarnConfigHook -, fetchYarnDeps +{ + lib, + buildPythonPackage, + fetchFromGitHub, + yarnConfigHook, + fetchYarnDeps, -, jupyterlab -, jupyter -, jupyter-packaging -, hatchling -, hatch-jupyter-builder -, hatch-nodejs-version -, nodejs + jupyterlab, + jupyter, + jupyter-packaging, + hatchling, + hatch-jupyter-builder, + hatch-nodejs-version, + nodejs, }: buildPythonPackage rec { @@ -35,7 +36,6 @@ buildPythonPackage rec { --replace-fail '"@myst-theme/frontmatter": "^0.9.0"' '"@myst-theme/frontmatter": "^0.13.2"' ''; - yarnOfflineCache = fetchYarnDeps { yarnLock = ./yarn.lock; hash = "sha256-ou3Tjml5VU1O14k/oIDufj3QV2sQYD8EzVGAPhF9RZI="; @@ -46,7 +46,6 @@ buildPythonPackage rec { nodejs ]; - build-system = [ hatchling hatch-jupyter-builder @@ -86,4 +85,3 @@ buildPythonPackage rec { maintainers = [ ]; }; } - diff --git a/pkgs/jupyterlab-vim/default.nix b/pkgs/jupyterlab-vim/default.nix index 8d41adc..27bc4d1 100644 --- a/pkgs/jupyterlab-vim/default.nix +++ b/pkgs/jupyterlab-vim/default.nix @@ -1,16 +1,17 @@ -{ lib -, buildPythonPackage -, fetchFromGitHub -, yarnConfigHook -, fetchYarnDeps +{ + lib, + buildPythonPackage, + fetchFromGitHub, + yarnConfigHook, + fetchYarnDeps, -, jupyterlab -, jupyter -, jupyter-packaging -, hatchling -, hatch-jupyter-builder -, hatch-nodejs-version -, nodejs + jupyterlab, + jupyter, + jupyter-packaging, + hatchling, + hatch-jupyter-builder, + hatch-nodejs-version, + nodejs, }: buildPythonPackage rec { @@ -29,7 +30,6 @@ buildPythonPackage rec { cp ${./yarn.lock} yarn.lock ''; - yarnOfflineCache = fetchYarnDeps { yarnLock = ./yarn.lock; hash = "sha256-z82r763EG+QGu2KbZ2PaKueAs9wrpTYul/O/O7It7lY="; @@ -40,7 +40,6 @@ buildPythonPackage rec { nodejs ]; - build-system = [ hatchling hatch-jupyter-builder @@ -65,7 +64,6 @@ buildPythonPackage rec { yarn --offline run build:prod ''; - # has no tests doCheck = false; @@ -78,4 +76,3 @@ buildPythonPackage rec { maintainers = [ ]; }; } - diff --git a/pkgs/jupyterlab-vpython/default.nix b/pkgs/jupyterlab-vpython/default.nix index cff64e8..ad4edc8 100644 --- a/pkgs/jupyterlab-vpython/default.nix +++ b/pkgs/jupyterlab-vpython/default.nix @@ -1,16 +1,17 @@ -{ buildPythonPackage -, fetchFromGitHub +{ + buildPythonPackage, + fetchFromGitHub, -, yarnConfigHook -, fetchYarnDeps + yarnConfigHook, + fetchYarnDeps, -, jupyterlab -, jupyter -, jupyter-packaging -, hatchling -, hatch-jupyter-builder -, hatch-nodejs-version -, nodejs + jupyterlab, + jupyter, + jupyter-packaging, + hatchling, + hatch-jupyter-builder, + hatch-nodejs-version, + nodejs, }: buildPythonPackage rec { diff --git a/pkgs/mcaselector.nix b/pkgs/mcaselector.nix index da30626..4d5b52e 100644 --- a/pkgs/mcaselector.nix +++ b/pkgs/mcaselector.nix @@ -1,10 +1,11 @@ -{ stdenv -, lib -, fetchurl -, jre -, gtk3 -, makeWrapper -, wrapGAppsHook +{ + stdenv, + lib, + fetchurl, + jre, + gtk3, + makeWrapper, + wrapGAppsHook, }: let diff --git a/pkgs/nix-modrinth-prefetch.nix b/pkgs/nix-modrinth-prefetch.nix index 36311bf..53dca75 100644 --- a/pkgs/nix-modrinth-prefetch.nix +++ b/pkgs/nix-modrinth-prefetch.nix @@ -1,4 +1,10 @@ -{ runtimeShell, writeShellScriptBin, curl, jq, gnused }: +{ + runtimeShell, + writeShellScriptBin, + curl, + jq, + gnused, +}: writeShellScriptBin "nix-modrinth-prefetch" '' input=$(${curl}/bin/curl --no-progress-meter https://api.modrinth.com/v2/version/$1) diff --git a/pkgs/olympus.nix b/pkgs/olympus.nix index f0543a2..a449c3c 100644 --- a/pkgs/olympus.nix +++ b/pkgs/olympus.nix @@ -1,10 +1,11 @@ # Taken from https://github.com/VergeDX/config-nixpkgs/blob/899f13750c9c1795d455eeee9cb28d3aa74a0866/packages/gui/olympus.nix -{ stdenv -, lib -, fetchzip -, unzip -, makeDesktopItem -, buildFHSEnv +{ + stdenv, + lib, + fetchzip, + unzip, + makeDesktopItem, + buildFHSEnv, }: let olympus = stdenv.mkDerivation rec { diff --git a/pkgs/sim65.nix b/pkgs/sim65.nix index 7d678e9..bbe0c5d 100644 --- a/pkgs/sim65.nix +++ b/pkgs/sim65.nix @@ -1,7 +1,8 @@ -{ stdenv -, fetchFromGitHub -, lib -, wxGTK32 +{ + stdenv, + fetchFromGitHub, + lib, + wxGTK32, }: stdenv.mkDerivation { diff --git a/pkgs/simpervisor.nix b/pkgs/simpervisor.nix index 368fc08..35385ae 100644 --- a/pkgs/simpervisor.nix +++ b/pkgs/simpervisor.nix @@ -1,4 +1,8 @@ -{ buildPythonPackage, fetchFromGitHub, hatchling }: +{ + buildPythonPackage, + fetchFromGitHub, + hatchling, +}: buildPythonPackage { pname = "simpervisor"; diff --git a/pkgs/substitute-subset.nix b/pkgs/substitute-subset.nix index 2edc1ee..66e338c 100644 --- a/pkgs/substitute-subset.nix +++ b/pkgs/substitute-subset.nix @@ -2,26 +2,29 @@ args: -stdenv.mkDerivation ({ - name = if args ? name then args.name else baseNameOf (toString args.src); - builder = builtins.toFile "builder.sh" '' - source $stdenv/setup - set -o pipefail +stdenv.mkDerivation ( + { + name = if args ? name then args.name else baseNameOf (toString args.src); + builder = builtins.toFile "builder.sh" '' + source $stdenv/setup + set -o pipefail - eval "$preInstall" + eval "$preInstall" - args= + args= - cp -r "$src" "$out" + cp -r "$src" "$out" - pushd "$out" - echo -ne "${lib.concatStringsSep "\\0" args.files}" | xargs -0 -n1 -I {} -- find {} -type f -print0 | while read -d "" line; do - substituteAllInPlace "$line" - done - popd + pushd "$out" + echo -ne "${lib.concatStringsSep "\\0" args.files}" | xargs -0 -n1 -I {} -- find {} -type f -print0 | while read -d "" line; do + substituteAllInPlace "$line" + done + popd - eval "$postInstall" - ''; - preferLocalBuild = true; - allowSubstitutes = false; -} // args) + eval "$postInstall" + ''; + preferLocalBuild = true; + allowSubstitutes = false; + } + // args +) diff --git a/pkgs/tmx-cups-ppd.nix b/pkgs/tmx-cups-ppd.nix index 42c747c..b5916f2 100644 --- a/pkgs/tmx-cups-ppd.nix +++ b/pkgs/tmx-cups-ppd.nix @@ -1,8 +1,9 @@ -{ stdenv -, fetchurl -, bintools -, cups -, autoPatchelfHook +{ + stdenv, + fetchurl, + bintools, + cups, + autoPatchelfHook, }: stdenv.mkDerivation rec { @@ -14,7 +15,11 @@ stdenv.mkDerivation rec { sha256 = "sha256-8WA6Q5z9//UJj20VHOsPA/nCCd50CcaHRVArtmTjeiQ="; }; - buildInputs = [ bintools cups autoPatchelfHook ]; + buildInputs = [ + bintools + cups + autoPatchelfHook + ]; buildPhase = '' ar p filter/tmx-cups_*_amd64.deb data.tar.gz \ diff --git a/pkgs/unbted.nix b/pkgs/unbted.nix index c0d67fd..d44e95c 100644 --- a/pkgs/unbted.nix +++ b/pkgs/unbted.nix @@ -1,9 +1,10 @@ # Based on this example: https://git.marvid.fr/scolobb/nix-GINsim -{ stdenv -, fetchurl -, makeWrapper -, lib -, jre +{ + stdenv, + fetchurl, + makeWrapper, + lib, + jre, }: stdenv.mkDerivation rec { pname = "unbted"; diff --git a/pkgs/unmap/default.nix b/pkgs/unmap/default.nix index 830ae93..5b7fea7 100644 --- a/pkgs/unmap/default.nix +++ b/pkgs/unmap/default.nix @@ -1,6 +1,7 @@ -{ lib -, buildNpmPackage -, fetchFromGitHub +{ + lib, + buildNpmPackage, + fetchFromGitHub, }: buildNpmPackage rec { diff --git a/pkgs/vpython-jupyter.nix b/pkgs/vpython-jupyter.nix index 40f09e7..fd7d574 100644 --- a/pkgs/vpython-jupyter.nix +++ b/pkgs/vpython-jupyter.nix @@ -1,16 +1,17 @@ -{ buildPythonPackage -, fetchFromGitHub +{ + buildPythonPackage, + fetchFromGitHub, -, cython -, setuptools -, setuptools_scm + cython, + setuptools, + setuptools_scm, -, autobahn -, ipykernel -, jupyter -, notebook -, numpy -, jupyterlab-vpython + autobahn, + ipykernel, + jupyter, + notebook, + numpy, + jupyterlab-vpython, }: buildPythonPackage { diff --git a/secrets/default.nix b/secrets/default.nix index 2347a53..44238d8 100644 --- a/secrets/default.nix +++ b/secrets/default.nix @@ -1,17 +1,33 @@ -{ lib, self, config, ... }: +{ + lib, + self, + config, + ... +}: with lib; let inherit (lib.our) mkOpt; inherit (lib.types) bool attrsOf path; - mkSecret = name: nameValuePair - (removeSuffix ".age" name) - { file = "${./.}/${name}"; }; + mkSecret = name: nameValuePair (removeSuffix ".age" name) { file = "${./.}/${name}"; }; secrets = listToAttrs (map mkSecret (attrNames (import ./secrets.nix))); - withOwnerGroup = name: secret: secret // { owner = name; group = name; mode = "440"; }; + withOwnerGroup = + name: secret: + secret + // { + owner = name; + group = name; + mode = "440"; + }; withOwner = name: secret: secret // { owner = name; }; - withGroup = name: secret: secret // { group = name; mode = "440"; }; + withGroup = + name: secret: + secret + // { + group = name; + mode = "440"; + }; in { options = { @@ -31,8 +47,16 @@ in "ovpn" ; - "borg-password" = secrets."borg-password" // { group = "borg"; mode = "440"; }; - "binary-cache-private-key" = secrets.binary-cache-private-key // lib.optionalAttrs config.services.hydra.enable { group = "hydra"; mode = "440"; }; + "borg-password" = secrets."borg-password" // { + group = "borg"; + mode = "440"; + }; + "binary-cache-private-key" = + secrets.binary-cache-private-key + // lib.optionalAttrs config.services.hydra.enable { + group = "hydra"; + mode = "440"; + }; "smtp-password" = withGroup "smtp" secrets."smtp-password"; "personal-smtp-password" = withOwner "infinidoge" secrets."personal-smtp-password"; } diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 2044238..07e6967 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -2,9 +2,11 @@ with builtins; let flatten = x: if isList x then concatMap (y: flatten y) x else [ x ]; hasPrefix = pref: str: (substring 0 (stringLength pref) str == pref); - isValidKey = key: all (keyPrefix: !(hasPrefix keyPrefix key)) [ - "sk-ssh-ed25519" - ]; + isValidKey = + key: + all (keyPrefix: !(hasPrefix keyPrefix key)) [ + "sk-ssh-ed25519" + ]; systems = { Infini-DESKTOP = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID7uX1myj9ghv7wMoL038oGDCdScdyLd7RvYdnoioSBh root@Infini-DESKTOP"; diff --git a/shell/default.nix b/shell/default.nix index 0f48fa6..80197ee 100644 --- a/shell/default.nix +++ b/shell/default.nix @@ -1,26 +1,35 @@ { self, lib, ... }: { - perSystem = { pkgs, inputs', ... }: { - devshells.default = - let - pythonEnv = (pkgs.python3.withPackages (p: with p; [ - qtile - qtile-extras - ])); - in - { - devshell.name = "universe"; - devshell.motd = ""; + perSystem = + { pkgs, inputs', ... }: + { + devshells.default = + let + pythonEnv = ( + pkgs.python3.withPackages ( + p: with p; [ + qtile + qtile-extras + ] + ) + ); + in + { + devshell.name = "universe"; + devshell.motd = ""; - devshell.packages = [ - pythonEnv - inputs'.disko.packages.disko - ]; + devshell.packages = [ + pythonEnv + inputs'.disko.packages.disko + ]; - env = [ - { name = "PYTHONPATH"; prefix = "${pythonEnv}/${pythonEnv.sitePackages}"; } - ]; - }; - }; + env = [ + { + name = "PYTHONPATH"; + prefix = "${pythonEnv}/${pythonEnv.sitePackages}"; + } + ]; + }; + }; } diff --git a/templates/default.nix b/templates/default.nix index dfdec16..a833ee1 100644 --- a/templates/default.nix +++ b/templates/default.nix @@ -1,13 +1,13 @@ { lib, ... }: let - mkTemplate = name: + mkTemplate = + name: let path = ./. + "/${name}"; flakePath = path + "/flake.nix"; meta = if builtins.pathExists flakePath then import flakePath else { }; in - { inherit path; } - // lib.optionalAttrs (meta ? description) { inherit (meta) description; }; + { inherit path; } // lib.optionalAttrs (meta ? description) { inherit (meta) description; }; templates = lib.attrNames (lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./.)); in diff --git a/templates/default/flake.nix b/templates/default/flake.nix index ebcc44d..c2dd4a1 100644 --- a/templates/default/flake.nix +++ b/templates/default/flake.nix @@ -10,20 +10,27 @@ flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; }; - outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } ({ ... }: { - systems = [ "x86_64-linux" ]; + outputs = + inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } ( + { ... }: + { + systems = [ "x86_64-linux" ]; - imports = with inputs; [ - devshell.flakeModule - ]; + imports = with inputs; [ + devshell.flakeModule + ]; - perSystem = { pkgs, ... }: { - devshells.default.devshell = { - name = "template"; - motd = ""; + perSystem = + { pkgs, ... }: + { + devshells.default.devshell = { + name = "template"; + motd = ""; - packages = with pkgs; [ ]; - }; - }; - }); + packages = with pkgs; [ ]; + }; + }; + } + ); } diff --git a/templates/discord-bot/flake.nix b/templates/discord-bot/flake.nix index 7310bf1..e3ad6b5 100644 --- a/templates/discord-bot/flake.nix +++ b/templates/discord-bot/flake.nix @@ -12,55 +12,66 @@ pyproject-nix.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } { - systems = [ "x86_64-linux" ]; + outputs = + inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" ]; - imports = with inputs; [ - devshell.flakeModule - ]; + imports = with inputs; [ + devshell.flakeModule + ]; - perSystem = { config, pkgs, ... }: - let - project = inputs.pyproject-nix.lib.project.loadPyproject { - projectRoot = ./.; - }; + perSystem = + { config, pkgs, ... }: + let + project = inputs.pyproject-nix.lib.project.loadPyproject { + projectRoot = ./.; + }; - python = pkgs.python3; + python = pkgs.python3; - in - { - packages.default = (python.pkgs.buildPythonPackage ( - project.renderers.buildPythonPackage { inherit python; } - )).overrideAttrs { allowSubstitutes = false; preferLocalBuild = true; }; + in + { + packages.default = + (python.pkgs.buildPythonPackage (project.renderers.buildPythonPackage { inherit python; })) + .overrideAttrs + { + allowSubstitutes = false; + preferLocalBuild = true; + }; - devshells.default = - let - env = python.withPackages ( - project.renderers.withPackages { - inherit python; - extraPackages = p: with p; [ - python-lsp-server - python-lsp-ruff - pylsp-rope - isort - black + devshells.default = + let + env = python.withPackages ( + project.renderers.withPackages { + inherit python; + extraPackages = + p: with p; [ + python-lsp-server + python-lsp-ruff + pylsp-rope + isort + black + ]; + } + ); + in + { + devshell = { + name = "rename"; + motd = ""; + + packages = [ + env ]; - } - ); - in - { - devshell = { - name = "rename"; - motd = ""; - - packages = [ - env + }; + env = [ + { + name = "PYTHONPATH"; + prefix = "${env}/${env.sitePackages}"; + } ]; }; - env = [ - { name = "PYTHONPATH"; prefix = "${env}/${env.sitePackages}"; } - ]; - }; - }; - }; + }; + }; } diff --git a/templates/python/flake.nix b/templates/python/flake.nix index 857efe8..6971d3a 100644 --- a/templates/python/flake.nix +++ b/templates/python/flake.nix @@ -12,55 +12,66 @@ pyproject-nix.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } { - systems = [ "x86_64-linux" ]; + outputs = + inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" ]; - imports = with inputs; [ - devshell.flakeModule - ]; + imports = with inputs; [ + devshell.flakeModule + ]; - perSystem = { config, pkgs, ... }: - let - project = inputs.pyproject-nix.lib.project.loadPyproject { - projectRoot = ./.; - }; + perSystem = + { config, pkgs, ... }: + let + project = inputs.pyproject-nix.lib.project.loadPyproject { + projectRoot = ./.; + }; - python = pkgs.python3; + python = pkgs.python3; - in - { - packages.default = (python.pkgs.buildPythonPackage ( - project.renderers.buildPythonPackage { inherit python; } - )).overrideAttrs { allowSubstitutes = false; preferLocalBuild = true; }; + in + { + packages.default = + (python.pkgs.buildPythonPackage (project.renderers.buildPythonPackage { inherit python; })) + .overrideAttrs + { + allowSubstitutes = false; + preferLocalBuild = true; + }; - devshells.default = - let - env = python.withPackages ( - project.renderers.withPackages { - inherit python; - extraPackages = p: with p; [ - python-lsp-server - python-lsp-ruff - pylsp-rope - isort - black + devshells.default = + let + env = python.withPackages ( + project.renderers.withPackages { + inherit python; + extraPackages = + p: with p; [ + python-lsp-server + python-lsp-ruff + pylsp-rope + isort + black + ]; + } + ); + in + { + devshell = { + name = "rename"; + motd = ""; + + packages = [ + env ]; - } - ); - in - { - devshell = { - name = "rename"; - motd = ""; - - packages = [ - env + }; + env = [ + { + name = "PYTHONPATH"; + prefix = "${env}/${env.sitePackages}"; + } ]; }; - env = [ - { name = "PYTHONPATH"; prefix = "${env}/${env.sitePackages}"; } - ]; - }; - }; - }; + }; + }; } diff --git a/users/infinidoge/config/default.nix b/users/infinidoge/config/default.nix index 7b95c74..2e259e2 100644 --- a/users/infinidoge/config/default.nix +++ b/users/infinidoge/config/default.nix @@ -1,37 +1,45 @@ -{ config, main, lib, pkgs, ... }: +{ + config, + main, + lib, + pkgs, + ... +}: with lib; { - xdg.configFile = { - "neofetch/config.conf".source = pkgs.substituteAll { - src = ./neofetch.conf; + xdg.configFile = + { + "neofetch/config.conf".source = pkgs.substituteAll { + src = ./neofetch.conf; - image = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/ad-oliviero/uwufetch/main/res/nixos.png"; - sha256 = "007q947q2a5c8z9r6cc6mj3idq0ss9zsi9xvij8l8chkjnh8fwn2"; + image = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/ad-oliviero/uwufetch/main/res/nixos.png"; + sha256 = "007q947q2a5c8z9r6cc6mj3idq0ss9zsi9xvij8l8chkjnh8fwn2"; + }; + inherit (main.info) model; + inherit (main.info.env) wm; }; - inherit (main.info) model; - inherit (main.info.env) wm; - }; - "black".text = '' - [tool.black] - line-length = 120 - target-version = ["py310"] - ''; - } // optionalAttrs main.info.graphical { - "qtile".source = pkgs.substituteSubset { - src = ./qtile; - files = [ "config.py" ]; + "black".text = '' + [tool.black] + line-length = 120 + target-version = ["py310"] + ''; + } + // optionalAttrs main.info.graphical { + "qtile".source = pkgs.substituteSubset { + src = ./qtile; + files = [ "config.py" ]; - wallpaper = pkgs.fetchurl { - name = "BotanWallpaper.jpg"; - # Source: https://www.pixiv.net/en/artworks/86093828 - url = "https://safebooru.org//images/3159/6c2d22b1fcac19a679de61f713c56503bca5aad9.jpg"; - sha256 = "sha256-3oVx9k+IN8GI8EWx3kPiQWdPGSO645abrEIL8C6sNq8="; + wallpaper = pkgs.fetchurl { + name = "BotanWallpaper.jpg"; + # Source: https://www.pixiv.net/en/artworks/86093828 + url = "https://safebooru.org//images/3159/6c2d22b1fcac19a679de61f713c56503bca5aad9.jpg"; + sha256 = "sha256-3oVx9k+IN8GI8EWx3kPiQWdPGSO645abrEIL8C6sNq8="; + }; + wallpaper_mode = "fill"; + firefox = config.programs.firefox.package.meta.mainProgram; + locker = main.common.wm.locker.meta.mainProgram; }; - wallpaper_mode = "fill"; - firefox = config.programs.firefox.package.meta.mainProgram; - locker = main.common.wm.locker.meta.mainProgram; }; - }; } diff --git a/users/infinidoge/default.nix b/users/infinidoge/default.nix index 09aa04d..45b60da 100644 --- a/users/infinidoge/default.nix +++ b/users/infinidoge/default.nix @@ -1,4 +1,11 @@ -{ config, common, secrets, lib, pkgs, ... }: +{ + config, + common, + secrets, + lib, + pkgs, + ... +}: let inherit (lib) flatten optional mkIf; ifGraphical = lib.optionals config.info.graphical; @@ -8,66 +15,78 @@ in imports = [ ]; - home = { config, main, ... }: { - imports = [ - ./config - ]; + home = + { config, main, ... }: + { + imports = [ + ./config + ]; - programs = { - git = { - userEmail = "infinidoge@inx.moe"; - userName = "Infinidoge"; - extraConfig = { - gpg.format = "ssh"; - commit.gpgsign = true; - user.signingkey = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; + programs = { + git = { + userEmail = "infinidoge@inx.moe"; + userName = "Infinidoge"; + extraConfig = { + gpg.format = "ssh"; + commit.gpgsign = true; + user.signingkey = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; + }; + }; + firefox = { + enable = main.info.graphical; + package = pkgs.firefox-devedition; }; }; - firefox = { - enable = main.info.graphical; - package = pkgs.firefox-devedition; + + home.sessionVariables = { + KEYID = "0x30E7A4C03348641E"; + POP_SMTP_HOST = common.email.smtp.address; + POP_SMTP_PORT = common.email.smtp.STARTTLS; + POP_SMTP_USERNAME = common.email.withUser "infinidoge"; + POP_SMTP_PASSWORD = "$(cat ${secrets.personal-smtp-password})"; }; + + home.packages = + with pkgs; + flatten [ + bitwarden-cli + bsd-finger + jmtpfs + ncdu + peaclock + pop + + (lib.optionals (!main.universe.minimal.enable) [ + packwiz + toot + ]) + + (ifGraphical [ + speedcrunch + (discord-canary.override { + withVencord = true; + withOpenASAR = true; + withTTS = false; + }) + ]) + + (lib.optionals (!main.universe.minimal.enable && main.info.graphical) [ + (discord.override { + withVencord = true; + withOpenASAR = true; + withTTS = false; + }) + schildichat-desktop + signal-desktop + teams-for-linux + thunderbird + tor-browser + bitwarden + qbittorrent + ]) + ]; }; - home.sessionVariables = { - KEYID = "0x30E7A4C03348641E"; - POP_SMTP_HOST = common.email.smtp.address; - POP_SMTP_PORT = common.email.smtp.STARTTLS; - POP_SMTP_USERNAME = common.email.withUser "infinidoge"; - POP_SMTP_PASSWORD = "$(cat ${secrets.personal-smtp-password})"; - }; - - home.packages = with pkgs; flatten [ - bitwarden-cli - bsd-finger - jmtpfs - ncdu - peaclock - pop - - (lib.optionals (!main.universe.minimal.enable) [ - packwiz - toot - ]) - - (ifGraphical [ - speedcrunch - (discord-canary.override { withVencord = true; withOpenASAR = true; withTTS = false; }) - ]) - - (lib.optionals (!main.universe.minimal.enable && main.info.graphical) [ - (discord.override { withVencord = true; withOpenASAR = true; withTTS = false; }) - schildichat-desktop - signal-desktop - teams-for-linux - thunderbird - tor-browser - bitwarden - qbittorrent - ]) - ]; - }; - systemd.user.tmpfiles.users.infinidoge.rules = mkIf config.universe.media.enable [ "L+ /home/infinidoge/.local/share/jellyfinmediaplayer/scripts/mpris.so - - - - ${pkgs.mpvScripts.mpris}/share/mpv/scripts/mpris.so" ]; @@ -82,7 +101,6 @@ in monospace = [ "DejaVuSansMono" ]; }; - modules = { desktop.wm.qtile.enable = true; }; diff --git a/users/modules/functionality/bindmounts.nix b/users/modules/functionality/bindmounts.nix index ebf77fc..e1c3694 100644 --- a/users/modules/functionality/bindmounts.nix +++ b/users/modules/functionality/bindmounts.nix @@ -1,4 +1,9 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: # Modified from https://github.com/nix-community/impermanence/blob/master/home-manager.nix @@ -14,54 +19,60 @@ in home.bindmounts = mkOption { default = { }; - type = with types; attrsOf ( - submodule ({ name, ... }: { - options = + type = + with types; + attrsOf ( + submodule ( + { name, ... }: { - directories = mkOption { - type = with types; listOf (submodule { - options = { - source = mkOption { - type = with types; str; - }; + options = { + directories = mkOption { + type = + with types; + listOf (submodule { + options = { + source = mkOption { + type = with types; str; + }; - target = mkOption { - type = with types; str; - }; - }; - }); - default = [ ]; - description = '' - A list of directories and target locations that you wish to bind-mount from the initial source. - ''; - }; + target = mkOption { + type = with types; str; + }; + }; + }); + default = [ ]; + description = '' + A list of directories and target locations that you wish to bind-mount from the initial source. + ''; + }; - allowOther = mkOption { - type = with types; nullOr bool; - default = null; - example = true; - apply = x: - if x == null then - warn '' - home.bindmounts."${name}".allowOther not set; assuming 'false'. - See https://github.com/nix-community/impermanence#home-manager for more info. - '' - false - else - x; - description = '' - Whether to allow other users, such as - root, access to files through the - bind mounted directories listed in - directories. Requires the NixOS - configuration parameter - programs.fuse.userAllowOther to - be true. - ''; + allowOther = mkOption { + type = with types; nullOr bool; + default = null; + example = true; + apply = + x: + if x == null then + warn '' + home.bindmounts."${name}".allowOther not set; assuming 'false'. + See https://github.com/nix-community/impermanence#home-manager for more info. + '' false + else + x; + description = '' + Whether to allow other users, such as + root, access to files through the + bind mounted directories listed in + directories. Requires the NixOS + configuration parameter + programs.fuse.userAllowOther to + be true. + ''; + }; }; - }; - }) - ); + } + ) + ); }; }; @@ -69,11 +80,18 @@ in config = { systemd.user.services = let - mkBindMountService = persistentStoragePath: dir: + mkBindMountService = + persistentStoragePath: dir: let inherit (dir) source target; - targetDir = escapeShellArg (concatPaths [ persistentStoragePath source ]); - mountPoint = escapeShellArg (concatPaths [ config.home.homeDirectory target ]); + targetDir = escapeShellArg (concatPaths [ + persistentStoragePath + source + ]); + mountPoint = escapeShellArg (concatPaths [ + config.home.homeDirectory + target + ]); name = "bindMount-${sanitizeName targetDir}"; bindfsOptions = concatStringsSep "," ( optional (!cfg.${persistentStoragePath}.allowOther) "no-allow-other" @@ -125,21 +143,25 @@ in Service = { ExecStart = "${startScript}"; ExecStop = "${stopScript}"; - Environment = "PATH=${makeBinPath [ pkgs.coreutils pkgs.util-linux pkgs.gnugrep pkgs.bindfs ]}:/run/wrappers/bin"; + Environment = "PATH=${ + makeBinPath [ + pkgs.coreutils + pkgs.util-linux + pkgs.gnugrep + pkgs.bindfs + ] + }:/run/wrappers/bin"; }; }; }; - mkBindMountServicesForPath = persistentStoragePath: - listToAttrs (map - (mkBindMountService persistentStoragePath) - cfg.${persistentStoragePath}.directories + mkBindMountServicesForPath = + persistentStoragePath: + listToAttrs ( + map (mkBindMountService persistentStoragePath) cfg.${persistentStoragePath}.directories ); in - builtins.foldl' - recursiveUpdate - { } - (map mkBindMountServicesForPath persistentStoragePaths); + builtins.foldl' recursiveUpdate { } (map mkBindMountServicesForPath persistentStoragePaths); home.activation = let @@ -148,17 +170,20 @@ in # The name of the activation script entry responsible for # reloading systemd user services. The name was initially # `reloadSystemD` but has been changed to `reloadSystemd`. - reloadSystemd = - if config.home.activation ? reloadSystemD then - "reloadSystemD" - else - "reloadSystemd"; + reloadSystemd = if config.home.activation ? reloadSystemD then "reloadSystemD" else "reloadSystemd"; - mkBindMount = persistentStoragePath: dir: + mkBindMount = + persistentStoragePath: dir: let inherit (dir) source target; - targetDir = escapeShellArg (concatPaths [ persistentStoragePath source ]); - mountPoint = escapeShellArg (concatPaths [ config.home.homeDirectory target ]); + targetDir = escapeShellArg (concatPaths [ + persistentStoragePath + source + ]); + mountPoint = escapeShellArg (concatPaths [ + config.home.homeDirectory + target + ]); mount = "${pkgs.util-linux}/bin/mount"; bindfsOptions = concatStringsSep "," ( optional (!cfg.${persistentStoragePath}.allowOther) "no-allow-other" @@ -189,15 +214,18 @@ in fi ''; - mkBindMountsForPath = persistentStoragePath: - concatMapStrings - (mkBindMount persistentStoragePath) - cfg.${persistentStoragePath}.directories; + mkBindMountsForPath = + persistentStoragePath: + concatMapStrings (mkBindMount persistentStoragePath) cfg.${persistentStoragePath}.directories; - mkUnmount = persistentStoragePath: dir: + mkUnmount = + persistentStoragePath: dir: let inherit (dir) target; - mountPoint = escapeShellArg (concatPaths [ config.home.homeDirectory target ]); + mountPoint = escapeShellArg (concatPaths [ + config.home.homeDirectory + target + ]); in '' if [[ -n ''${mountedPaths[${mountPoint}]+x} ]]; then @@ -218,39 +246,29 @@ in fi ''; - mkUnmountsForPath = persistentStoragePath: - concatMapStrings - (mkUnmount persistentStoragePath) - cfg.${persistentStoragePath}.directories; + mkUnmountsForPath = + persistentStoragePath: + concatMapStrings (mkUnmount persistentStoragePath) cfg.${persistentStoragePath}.directories; in mkIf (any (path: cfg.${path}.directories != [ ]) persistentStoragePaths) { - createAndMountPersistentStoragePaths = - dag.entryBefore - [ "writeBoundary" ] - '' - declare -A mountedPaths - ${(concatMapStrings mkBindMountsForPath persistentStoragePaths)} - ''; + createAndMountPersistentStoragePaths = dag.entryBefore [ "writeBoundary" ] '' + declare -A mountedPaths + ${(concatMapStrings mkBindMountsForPath persistentStoragePaths)} + ''; - unmountPersistentStoragePaths = - dag.entryBefore - [ "createAndMountPersistentStoragePaths" ] - '' - unmountBindMounts() { - ${concatMapStrings mkUnmountsForPath persistentStoragePaths} - } - # Run the unmount function on error to clean up stray - # bind mounts - trap "unmountBindMounts" ERR - ''; + unmountPersistentStoragePaths = dag.entryBefore [ "createAndMountPersistentStoragePaths" ] '' + unmountBindMounts() { + ${concatMapStrings mkUnmountsForPath persistentStoragePaths} + } + # Run the unmount function on error to clean up stray + # bind mounts + trap "unmountBindMounts" ERR + ''; - runUnmountPersistentStoragePaths = - dag.entryBefore - [ reloadSystemd ] - '' - unmountBindMounts - ''; + runUnmountPersistentStoragePaths = dag.entryBefore [ reloadSystemd ] '' + unmountBindMounts + ''; }; }; diff --git a/users/modules/global/gpg.nix b/users/modules/global/gpg.nix index bf77234..4a966d7 100644 --- a/users/modules/global/gpg.nix +++ b/users/modules/global/gpg.nix @@ -1,4 +1,9 @@ -{ config, main, pkgs, ... }: +{ + config, + main, + pkgs, + ... +}: { programs.gpg = { enable = true; @@ -17,7 +22,13 @@ }; publicKeys = [ - { source = pkgs.fetchurl { url = "https://inx.moe/pub.txt"; sha256 = "sha256-Eocb+3TbeWmwkxQNQ3XKmRi5N9vz7QoLni0b8b0zw2k="; }; trust = "ultimate"; } + { + source = pkgs.fetchurl { + url = "https://inx.moe/pub.txt"; + sha256 = "sha256-Eocb+3TbeWmwkxQNQ3XKmRi5N9vz7QoLni0b8b0zw2k="; + }; + trust = "ultimate"; + } ]; }; diff --git a/users/modules/global/htop.nix b/users/modules/global/htop.nix index 9d1ccd6..3282465 100644 --- a/users/modules/global/htop.nix +++ b/users/modules/global/htop.nix @@ -2,48 +2,57 @@ { programs.htop = { enable = true; - settings = { - fields = with config.lib.htop.fields; [ - PID - USER - PRIORITY - NICE - M_SIZE - M_RESIDENT - M_SHARE - STATE - PERCENT_CPU - PERCENT_MEM - TIME - COMM - ]; - color_scheme = 0; - cpu_count_from_one = 0; - delay = 15; - highlight_base_name = 1; - highlight_megabytes = 1; - highlight_threads = 1; - find_comm_in_cmdline = 1; - tree_view = 1; - header_margin = 1; - show_cpu_usage = 1; - show_cpu_frequency = 1; - show_cpu_temperature = 1; - update_process_names = 1; - } // (with config.lib.htop; leftMeters [ - (bar "AllCPUs") - (bar "CPU") - ]) // (with config.lib.htop; rightMeters [ - (bar "Memory") - (bar "Swap") - (text "Blank") - (text "Tasks") - (text "LoadAverage") - (text "Uptime") - (text "Systemd") - (text "DiskIO") - (text "NetworkIO") - ]); + settings = + { + fields = with config.lib.htop.fields; [ + PID + USER + PRIORITY + NICE + M_SIZE + M_RESIDENT + M_SHARE + STATE + PERCENT_CPU + PERCENT_MEM + TIME + COMM + ]; + color_scheme = 0; + cpu_count_from_one = 0; + delay = 15; + highlight_base_name = 1; + highlight_megabytes = 1; + highlight_threads = 1; + find_comm_in_cmdline = 1; + tree_view = 1; + header_margin = 1; + show_cpu_usage = 1; + show_cpu_frequency = 1; + show_cpu_temperature = 1; + update_process_names = 1; + } + // ( + with config.lib.htop; + leftMeters [ + (bar "AllCPUs") + (bar "CPU") + ] + ) + // ( + with config.lib.htop; + rightMeters [ + (bar "Memory") + (bar "Swap") + (text "Blank") + (text "Tasks") + (text "LoadAverage") + (text "Uptime") + (text "Systemd") + (text "DiskIO") + (text "NetworkIO") + ] + ); }; } diff --git a/users/modules/global/media.nix b/users/modules/global/media.nix index 35112f8..2f0bba2 100644 --- a/users/modules/global/media.nix +++ b/users/modules/global/media.nix @@ -1,6 +1,10 @@ -{ main, lib, pkgs, ... }: -lib.mkIf main.universe.media.enable { + main, + lib, + pkgs, + ... +}: +lib.mkIf main.universe.media.enable { services = { mpris-proxy.enable = true; playerctld.enable = true; diff --git a/users/modules/global/neovim.nix b/users/modules/global/neovim.nix index 5999f34..80edcdf 100644 --- a/users/modules/global/neovim.nix +++ b/users/modules/global/neovim.nix @@ -1,19 +1,40 @@ -{ main, pkgs, lib, ... }: +{ + main, + pkgs, + lib, + ... +}: let flattenTree = lib.our.flattenTree' (val: val ? action) ""; - mkLeader = { leader, mode }: name: value: { - key = leader + name; - inherit mode; - } // value; + mkLeader = + { leader, mode }: + name: value: + { + key = leader + name; + inherit mode; + } + // value; - mkLeaderMap = tree: - builtins.concatMap - (leader: lib.mapAttrsToList (mkLeader leader) (flattenTree tree)) - [ - { leader = ""; mode = [ "n" "v" ]; } - { leader = ""; mode = [ "n" "v" "i" ]; } - ]; + mkLeaderMap = + tree: + builtins.concatMap (leader: lib.mapAttrsToList (mkLeader leader) (flattenTree tree)) [ + { + leader = ""; + mode = [ + "n" + "v" + ]; + } + { + leader = ""; + mode = [ + "n" + "v" + "i" + ]; + } + ]; inherit (main.universe) programming; inherit (main) universe; @@ -34,7 +55,10 @@ in shiftwidth = 4; }; - clipboard.register = [ "unnamedplus" "unnamed" ]; + clipboard.register = [ + "unnamedplus" + "unnamed" + ]; globals = { doom_one_cursor_coloring = true; @@ -51,50 +75,58 @@ in globals.mapleader = " "; autoCmd = [ - { event = [ "TermOpen" ]; command = "setlocal nonumber norelativenumber"; } + { + event = [ "TermOpen" ]; + command = "setlocal nonumber norelativenumber"; + } ]; - keymaps = [ - { - key = ""; - action = ""; - mode = [ "n" "v" ]; - options = { - silent = true; + keymaps = + [ + { + key = ""; + action = ""; + mode = [ + "n" + "v" + ]; + options = { + silent = true; + }; + } + { + key = "n"; + action = ""; + mode = "t"; + } + ] + ++ mkLeaderMap { + c = { + a.action.__raw = "vim.lsp.buf.code_action"; + f.action = ":Format"; + t = { + f.action = ":FormatToggle"; + }; }; - } - { - key = "n"; - action = ""; - mode = "t"; - } - ] ++ mkLeaderMap { - c = { - a.action.__raw = "vim.lsp.buf.code_action"; - f.action = ":Format"; - t = { - f.action = ":FormatToggle"; + w = { + q.action = ":close"; + d.action = ":close"; + v.action = ":vsplit"; + s.action = ":split"; + V.action = ":vsplit "; + S.action = ":split "; + n.action = ":next"; + p.action = ":previous"; + }; + f = { + s.action = ":w"; + }; + q = { + q.action = ":q"; + Q.action = ":q!"; + x.action = ":x"; }; }; - w = { - q.action = ":close"; - d.action = ":close"; - v.action = ":vsplit"; - s.action = ":split"; - V.action = ":vsplit "; - S.action = ":split "; - n.action = ":next"; - p.action = ":previous"; - }; - f = { - s.action = ":w"; - }; - q = { - q.action = ":q"; - Q.action = ":q!"; - x.action = ":x"; - }; - }; plugins = { autoclose = { @@ -119,10 +151,16 @@ in neorg = { enable = true; settings = { - load = let empty = { __empty = null; }; in { - "core.defaults" = empty; - "core.concealer" = empty; - }; + load = + let + empty = { + __empty = null; + }; + in + { + "core.defaults" = empty; + "core.concealer" = empty; + }; }; }; diff --git a/users/modules/global/shells/zsh.nix b/users/modules/global/shells/zsh.nix index a1d2de4..d6a555b 100644 --- a/users/modules/global/shells/zsh.nix +++ b/users/modules/global/shells/zsh.nix @@ -1,4 +1,9 @@ -{ config, main, pkgs, ... }: +{ + config, + main, + pkgs, + ... +}: { programs.zsh = rec { enable = true; @@ -35,10 +40,13 @@ history.path = "$HOME/${dotDir}/.zsh_history"; - shellAliases = builtins.removeAttrs - (main.environment.shellAliases // config.home.shellAliases // { + shellAliases = builtins.removeAttrs ( + main.environment.shellAliases + // config.home.shellAliases + // { lsdiskw = "while true; do clear; lsdisk; sleep 1; done"; - }) [ "mktmp" ]; + } + ) [ "mktmp" ]; oh-my-zsh = { enable = true; diff --git a/users/modules/global/themeing.nix b/users/modules/global/themeing.nix index d08ceaf..1bb4e0b 100644 --- a/users/modules/global/themeing.nix +++ b/users/modules/global/themeing.nix @@ -1,6 +1,11 @@ -{ config, main, lib, pkgs, ... }: -lib.mkIf main.info.graphical { + config, + main, + lib, + pkgs, + ... +}: +lib.mkIf main.info.graphical { gtk = { enable = true; gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; diff --git a/users/root/default.nix b/users/root/default.nix index 40c693b..1d400ba 100644 --- a/users/root/default.nix +++ b/users/root/default.nix @@ -1,4 +1,10 @@ -{ config, lib, pkgs, ... }: { +{ + config, + lib, + pkgs, + ... +}: +{ users.users.root = { shell = pkgs.zsh; hashedPasswordFile = lib.mkIf config.modules.secrets.enable config.secrets.root-password;