diff options
41 files changed, 473 insertions, 202 deletions
@@ -26,18 +26,29 @@ }; }; - outputs = { flake-utils, ... }@inputs: - flake-utils.lib.eachDefaultSystem (system: - let pkgs = inputs.nixpkgs.legacyPackages.${system}; - in { - formatter = pkgs.nixfmt; - devShells.default = - pkgs.mkShell { buildInputs = with pkgs; [ git gitui sops ]; }; - }) // { - nixosConfigurations = let + outputs = + { flake-utils, ... }@inputs: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = inputs.nixpkgs.legacyPackages.${system}; + in + { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + git + gitui + sops + nixfmt-rfc-style + ]; + }; + } + ) + // { + nixosConfigurations = + let generateNixosConfig = name: _value: { - system = - "x86_64-linux"; # I don't have any other type of machine yet + system = "x86_64-linux"; # I don't have any other type of machine yet modules = with inputs; [ home-manager.nixosModules.home-manager sops-nix.nixosModules.sops @@ -54,14 +65,14 @@ }; }; # wrapper around nixpkgs.lib.nixosSystem to enable using it on attrsets - generateNixosSystem = _name: value: - inputs.nixpkgs.lib.nixosSystem value; + generateNixosSystem = _name: value: inputs.nixpkgs.lib.nixosSystem value; hosts = builtins.readDir ./hosts; nixosConfigs = builtins.mapAttrs generateNixosConfig hosts; # If you want to add something to a particular system, do it here before # the `in ...` line - in builtins.mapAttrs generateNixosSystem nixosConfigs; - }; + in + builtins.mapAttrs generateNixosSystem nixosConfigs; + }; } diff --git a/hosts/sagittarius/default.nix b/hosts/sagittarius/default.nix index 946ecc7..2e45e03 100644 --- a/hosts/sagittarius/default.nix +++ b/hosts/sagittarius/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ imports = [ # Include the results of the hardware scan. ./hardware.nix @@ -21,7 +22,7 @@ matchConfig.Name = "enp1s0"; networkConfig.DHCP = "ipv4"; address = [ "2a01:4f9:c012:c7a7::/64" ]; - routes = [{ Gateway = "fe80::1"; }]; + routes = [ { Gateway = "fe80::1"; } ]; }; }; diff --git a/hosts/sagittarius/hardware.nix b/hosts/sagittarius/hardware.nix index 783b081..6b004d1 100644 --- a/hosts/sagittarius/hardware.nix +++ b/hosts/sagittarius/hardware.nix @@ -1,22 +1,33 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = - [ (modulesPath + "/profiles/qemu-guest.nix") - ]; + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; - boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + boot.initrd.availableKernelModules = [ + "ahci" + "xhci_pci" + "virtio_pci" + "virtio_scsi" + "sd_mod" + "sr_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/34d333d4-2298-47c7-b015-5c3e2fd1a27e"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/34d333d4-2298-47c7-b015-5c3e2fd1a27e"; + fsType = "ext4"; + }; swapDevices = [ ]; diff --git a/hosts/sagittarius/home.nix b/hosts/sagittarius/home.nix index accbd5d..5b2bcd0 100644 --- a/hosts/sagittarius/home.nix +++ b/hosts/sagittarius/home.nix @@ -1,8 +1,9 @@ -{ flakeRoot, ... }: { +{ flakeRoot, ... }: +{ home-manager = { useGlobalPkgs = true; useUserPackages = true; - sharedModules = [{ imports = [ (flakeRoot + /share/home/minimal.nix) ]; }]; + sharedModules = [ { imports = [ (flakeRoot + /share/home/minimal.nix) ]; } ]; users = { root.home.stateVersion = "23.05"; diff --git a/hosts/sagittarius/ssh.nix b/hosts/sagittarius/ssh.nix index 4951f3e..720f0c9 100644 --- a/hosts/sagittarius/ssh.nix +++ b/hosts/sagittarius/ssh.nix @@ -1,10 +1,14 @@ -{ ... }: { +{ ... }: +{ services.openssh = { enable = true; settings = { PermitRootLogin = "no"; PasswordAuthentication = false; - AllowUsers = [ "ascella" "nongzhangren" ]; + AllowUsers = [ + "ascella" + "nongzhangren" + ]; }; }; } diff --git a/hosts/sagittarius/web/acme.nix b/hosts/sagittarius/web/acme.nix index 4cde574..0d27f29 100644 --- a/hosts/sagittarius/web/acme.nix +++ b/hosts/sagittarius/web/acme.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ security.acme = { acceptTerms = true; defaults = { diff --git a/hosts/sagittarius/web/blog.nix b/hosts/sagittarius/web/blog.nix index 49ebb87..671674f 100644 --- a/hosts/sagittarius/web/blog.nix +++ b/hosts/sagittarius/web/blog.nix @@ -1,6 +1,10 @@ -{ inputs, pkgs, ... }: { +{ inputs, pkgs, ... }: +{ imports = [ ./acme.nix ]; - networking.firewall.allowedTCPPorts = [ 80 443 ]; + networking.firewall.allowedTCPPorts = [ + 80 + 443 + ]; services.nginx = { enable = true; diff --git a/hosts/sagittarius/web/default.nix b/hosts/sagittarius/web/default.nix index 3fc702e..611d11b 100644 --- a/hosts/sagittarius/web/default.nix +++ b/hosts/sagittarius/web/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ imports = [ ./blog.nix ./matrix.nix diff --git a/hosts/sagittarius/web/git.nix b/hosts/sagittarius/web/git.nix index 732f7d0..adea3c3 100644 --- a/hosts/sagittarius/web/git.nix +++ b/hosts/sagittarius/web/git.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ services.gitDaemon = { enable = true; repositories = [ "/srv/git/" ]; diff --git a/hosts/sagittarius/web/matrix.nix b/hosts/sagittarius/web/matrix.nix index d230edc..c971ddc 100644 --- a/hosts/sagittarius/web/matrix.nix +++ b/hosts/sagittarius/web/matrix.nix @@ -19,11 +19,20 @@ let } } ''; -in { +in +{ imports = [ ./acme.nix ]; - networking.firewall.allowedTCPPorts = [ 80 443 8448 ]; - networking.firewall.allowedUDPPorts = [ 80 443 8448 ]; + networking.firewall.allowedTCPPorts = [ + 80 + 443 + 8448 + ]; + networking.firewall.allowedUDPPorts = [ + 80 + 443 + 8448 + ]; services.matrix-conduit = { enable = true; @@ -102,8 +111,7 @@ in { }; upstreams."backend_conduit".servers = { - "[::1]:${toString config.services.matrix-conduit.settings.global.port}" = - { }; + "[::1]:${toString config.services.matrix-conduit.settings.global.port}" = { }; }; }; } diff --git a/hosts/sagittarius/web/mediadb.nix b/hosts/sagittarius/web/mediadb.nix index 78d76cd..4ff83af 100644 --- a/hosts/sagittarius/web/mediadb.nix +++ b/hosts/sagittarius/web/mediadb.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ networking.firewall.allowedTCPPorts = [ 5432 ]; services.postgresql = { @@ -7,7 +8,9 @@ enableTCPIP = true; enableJIT = true; - settings = { password_encryption = "scram-sha-256"; }; + settings = { + password_encryption = "scram-sha-256"; + }; authentication = '' # TYPE DATABASE USER ADDRESS METHOD diff --git a/hosts/underworld/default.nix b/hosts/underworld/default.nix index 81af671..cde0707 100644 --- a/hosts/underworld/default.nix +++ b/hosts/underworld/default.nix @@ -1,4 +1,10 @@ -{ pkgs, flakeRoot, inputs, ... }: { +{ + pkgs, + flakeRoot, + inputs, + ... +}: +{ imports = [ # Include the results of the hardware scan. ./hardware.nix @@ -7,7 +13,11 @@ ./home.nix (flakeRoot + /share/system/client-common.nix) #(flakeRoot + /share/system/spotifyd.nix) - { _module.args = { inherit inputs; }; } + { + _module.args = { + inherit inputs; + }; + } ]; programs.fish.enable = true; @@ -29,11 +39,19 @@ users.users = { osiris = { isNormalUser = true; - extraGroups = [ "wheel" "video" "network" "podman" ]; + extraGroups = [ + "wheel" + "video" + "network" + "podman" + ]; }; guest = { isNormalUser = true; - extraGroups = [ "video" "network" ]; + extraGroups = [ + "video" + "network" + ]; }; }; diff --git a/hosts/underworld/hardware.nix b/hosts/underworld/hardware.nix index 305d6ce..b66b797 100644 --- a/hosts/underworld/hardware.nix +++ b/hosts/underworld/hardware.nix @@ -1,15 +1,23 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, modulesPath, ... }: +{ + config, + lib, + modulesPath, + ... +}: { - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "usbhid" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; diff --git a/hosts/underworld/home.nix b/hosts/underworld/home.nix index 90a85e5..bf652d0 100644 --- a/hosts/underworld/home.nix +++ b/hosts/underworld/home.nix @@ -1,9 +1,12 @@ -{ flakeRoot, inputs, ... }: { +{ flakeRoot, inputs, ... }: +{ home-manager = { useGlobalPkgs = true; useUserPackages = true; - sharedModules = [{ programs.fish.enable = true; }]; - extraSpecialArgs = { inherit inputs; }; + sharedModules = [ { programs.fish.enable = true; } ]; + extraSpecialArgs = { + inherit inputs; + }; }; home-manager.users.osiris = { diff --git a/hosts/wonderland/default.nix b/hosts/wonderland/default.nix index 130feab..c294be9 100644 --- a/hosts/wonderland/default.nix +++ b/hosts/wonderland/default.nix @@ -1,4 +1,11 @@ -{ config, pkgs, flakeRoot, inputs, ... }: { +{ + config, + pkgs, + flakeRoot, + inputs, + ... +}: +{ imports = [ # Include the results of the hardware scan. ./hardware.nix @@ -10,7 +17,11 @@ }) (flakeRoot + /share/system/client-common.nix) #(flakeRoot + /share/system/spotifyd.nix) - { _module.args = { inherit inputs; }; } + { + _module.args = { + inherit inputs; + }; + } ]; programs.fish.enable = true; @@ -81,15 +92,26 @@ users.users = { alice = { isNormalUser = true; - extraGroups = [ "wheel" "video" "network" "podman" ]; + extraGroups = [ + "wheel" + "video" + "network" + "podman" + ]; }; madhatter = { isNormalUser = true; - extraGroups = [ "video" "network" ]; + extraGroups = [ + "video" + "network" + ]; }; guest = { isNormalUser = true; - extraGroups = [ "video" "network" ]; + extraGroups = [ + "video" + "network" + ]; }; }; diff --git a/hosts/wonderland/hardware.nix b/hosts/wonderland/hardware.nix index a99d2a3..8c7246a 100644 --- a/hosts/wonderland/hardware.nix +++ b/hosts/wonderland/hardware.nix @@ -1,31 +1,39 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/fc1a2a05-efb0-45e7-83f2-2b9dae515b0a"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/fc1a2a05-efb0-45e7-83f2-2b9dae515b0a"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/FEB7-A352"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/FEB7-A352"; + fsType = "vfat"; + }; - swapDevices = - [ { device = "/dev/disk/by-uuid/f16d9af0-4043-4d39-a8d6-e788451f8e9e"; } - ]; + swapDevices = [ { device = "/dev/disk/by-uuid/f16d9af0-4043-4d39-a8d6-e788451f8e9e"; } ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/wonderland/home.nix b/hosts/wonderland/home.nix index 43611b9..710aab6 100644 --- a/hosts/wonderland/home.nix +++ b/hosts/wonderland/home.nix @@ -1,9 +1,12 @@ -{ flakeRoot, inputs, ... }: { +{ flakeRoot, inputs, ... }: +{ home-manager = { useGlobalPkgs = true; useUserPackages = true; - sharedModules = [{ imports = [ (flakeRoot + /share/cfg) ]; }]; - extraSpecialArgs = { inherit inputs; }; + sharedModules = [ { imports = [ (flakeRoot + /share/cfg) ]; } ]; + extraSpecialArgs = { + inherit inputs; + }; }; home-manager.users.alice = { diff --git a/hosts/wonderland/sops.nix b/hosts/wonderland/sops.nix index 0ac9d3d..5b77bc2 100644 --- a/hosts/wonderland/sops.nix +++ b/hosts/wonderland/sops.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ sops = { age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; defaultSopsFile = ../../secrets/credentials.json; diff --git a/share/cfg/default.nix b/share/cfg/default.nix index 9a6407d..ed290a7 100644 --- a/share/cfg/default.nix +++ b/share/cfg/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ imports = [ ../hm-modules diff --git a/share/cfg/firefox/default.nix b/share/cfg/firefox/default.nix index 5590d5d..9c486e4 100644 --- a/share/cfg/firefox/default.nix +++ b/share/cfg/firefox/default.nix @@ -1,10 +1,10 @@ { pkgs, ... }: let # Concatenate all files in the `./usercss` directory into one string - css-files = - map (n: ./usercss/${n}) (builtins.attrNames (builtins.readDir ./usercss)); + css-files = map (n: ./usercss/${n}) (builtins.attrNames (builtins.readDir ./usercss)); userChrome = builtins.concatStringsSep "\n" (map builtins.readFile css-files); -in { +in +{ home.sessionVariables.BROWSER = "firefox"; programs.firefox = { @@ -18,29 +18,28 @@ in { default = "DuckDuckGo"; engines = { "Nix Packages" = { - urls = [{ - template = "https://search.nixos.org/packages"; - params = [ - { - name = "type"; - value = "packages"; - } - { - name = "query"; - value = "{searchTerms}"; - } - ]; - }]; + urls = [ + { + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; - icon = - "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = [ "@np" ]; }; "NixOS Wiki" = { - urls = [{ - template = "https://nixos.wiki/index.php?search={searchTerms}"; - }]; + urls = [ { template = "https://nixos.wiki/index.php?search={searchTerms}"; } ]; iconUpdateURL = "https://nixos.wiki/favicon.png"; updateInterval = 24 * 60 * 60 * 1000; # every day definedAliases = [ "@nw" ]; diff --git a/share/cfg/fish.nix b/share/cfg/fish.nix index d697942..62cb6ee 100644 --- a/share/cfg/fish.nix +++ b/share/cfg/fish.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ imports = [ ./shellenv.nix ]; programs.starship.enableFishIntegration = true; diff --git a/share/cfg/gallery-dl.nix b/share/cfg/gallery-dl.nix index 802141f..3ee065b 100644 --- a/share/cfg/gallery-dl.nix +++ b/share/cfg/gallery-dl.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ programs.gallery-dl = { settings.extractor = { base-directory = "${config.xdg.userDirs.download}/gallery-dl"; @@ -7,15 +8,24 @@ { name = "metadata"; mode = "json"; - whitelist = - [ "danbooru" "moebooru" "gelbooru" "sankaku" "nhentai" "rule34" ]; + whitelist = [ + "danbooru" + "moebooru" + "gelbooru" + "sankaku" + "nhentai" + "rule34" + ]; } { name = "zip"; compression = "store"; extension = "cbz"; filter = "extension not in ('zip', 'rar')"; - whitelist = [ "nhentai" "mangadex" ]; + whitelist = [ + "nhentai" + "mangadex" + ]; } ]; @@ -24,14 +34,21 @@ reddit = { archive-format = "s_{subreddit}{filename}"; directory = { - "locals().get('is_gallery')" = - [ "Reddit" "S" "{subreddit!C}" "{title[:120]!t:?/_/R /_/}{id}" ]; - "" = [ "Reddit" "S" "{subreddit!C}" ]; + "locals().get('is_gallery')" = [ + "Reddit" + "S" + "{subreddit!C}" + "{title[:120]!t:?/_/R /_/}{id}" + ]; + "" = [ + "Reddit" + "S" + "{subreddit!C}" + ]; }; filename = { - "locals().get('is_gallery')" = - "{title[:120]!t:?/_/R /_/}{id}{num:?_//>02}.{extension}"; + "locals().get('is_gallery')" = "{title[:120]!t:?/_/R /_/}{id}{num:?_//>02}.{extension}"; "" = "{title[:120]!t:?/_/R /_/}{id}.{extension}"; }; }; diff --git a/share/cfg/git.nix b/share/cfg/git.nix index 67170a0..eb05865 100644 --- a/share/cfg/git.nix +++ b/share/cfg/git.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ programs.git = { userEmail = "miran.bastaja04@gmail.com"; userName = "Miran Bastaja"; diff --git a/share/cfg/helix.nix b/share/cfg/helix.nix index 78c22fe..dd99557 100644 --- a/share/cfg/helix.nix +++ b/share/cfg/helix.nix @@ -1,9 +1,11 @@ { -# inputs, -pkgs, -# config, -# lib, -... }: { + # inputs, + pkgs, + # config, + # lib, + ... +}: +{ programs.helix = { defaultEditor = true; extraPackages = with pkgs; [ @@ -64,8 +66,7 @@ pkgs, command = "astro-ls"; args = [ "--stdio" ]; config = { - typescript.tsdk = - "${pkgs.typescript}/lib/node_modules/typescript/lib"; + typescript.tsdk = "${pkgs.typescript}/lib/node_modules/typescript/lib"; environment = "node"; }; # language-server.snippets-html = { @@ -96,8 +97,14 @@ pkgs, scope = "source.astro"; injection-regex = "astro"; file-types = [ "astro" ]; - roots = [ "package.json" "astro.config.mjs" ]; - language-servers = [ "astro-ls" "emmet-ls" ]; + roots = [ + "package.json" + "astro.config.mjs" + ]; + language-servers = [ + "astro-ls" + "emmet-ls" + ]; auto-format = true; } { @@ -124,14 +131,22 @@ pkgs, { name = "typescript"; shebangs = [ "deno" ]; - roots = [ "deno.json" "deno.jsonc" "package.json" ]; + roots = [ + "deno.json" + "deno.jsonc" + "package.json" + ]; auto-format = true; language-servers = [ "deno-lsp" ]; } ]; }; # end of languages - ignores = [ "*.lock" "!.gitignore" "!.cargo" ]; + ignores = [ + "*.lock" + "!.gitignore" + "!.cargo" + ]; }; # end of programs.helix # xdg.configFile = { diff --git a/share/cfg/hyprland.nix b/share/cfg/hyprland.nix index 629f105..b9353ef 100644 --- a/share/cfg/hyprland.nix +++ b/share/cfg/hyprland.nix @@ -17,7 +17,8 @@ let }; terminal = "kitty"; }; -in { +in +{ wayland.windowManager.hyprland = { extraConfig = '' $mod = SUPER @@ -35,12 +36,22 @@ in { # workspaces # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} - ${builtins.concatStringsSep "\n" (builtins.genList (x: - let ws = let c = (x + 1) / 10; in builtins.toString (x + 1 - (c * 10)); - in '' - bind = $mod, ${ws}, workspace, ${toString (x + 1)} - bind = $mod SHIFT, ${ws}, movetoworkspacesilent, ${toString (x + 1)} - '') 10)} + ${builtins.concatStringsSep "\n" ( + builtins.genList ( + x: + let + ws = + let + c = (x + 1) / 10; + in + builtins.toString (x + 1 - (c * 10)); + in + '' + bind = $mod, ${ws}, workspace, ${toString (x + 1)} + bind = $mod SHIFT, ${ws}, movetoworkspacesilent, ${toString (x + 1)} + '' + ) 10 + )} bind = $mod SHIFT, C, killactive bind = $mod SHIFT, F, togglefloating diff --git a/share/cfg/kitty.nix b/share/cfg/kitty.nix index a28091b..9cf33f8 100644 --- a/share/cfg/kitty.nix +++ b/share/cfg/kitty.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +{ programs.kitty = { theme = "Mayukai"; @@ -24,5 +25,7 @@ }; }; - home.shellAliases = { s = "kitty +kitten ssh"; }; + home.shellAliases = { + s = "kitty +kitten ssh"; + }; } diff --git a/share/cfg/mpv.nix b/share/cfg/mpv.nix index 427ed33..f86da15 100644 --- a/share/cfg/mpv.nix +++ b/share/cfg/mpv.nix @@ -1,4 +1,5 @@ -{ config, ... }: { +{ config, ... }: +{ programs.mpv = { config = { # The format is '<Filename without extension> [<screenshot number>].<ext>' diff --git a/share/cfg/shellenv.nix b/share/cfg/shellenv.nix index 16b28ac..0b1e7d6 100644 --- a/share/cfg/shellenv.nix +++ b/share/cfg/shellenv.nix @@ -1,11 +1,16 @@ -{ ... }: { +{ ... }: +{ home.shellAliases = { ltg = "ls --git --tree"; ltgi = "ltg --git-ignore"; }; programs.eza = { icons = true; - extraOptions = [ "--header" "--group-directories-first" "--long" ]; + extraOptions = [ + "--header" + "--group-directories-first" + "--long" + ]; }; programs.starship = { diff --git a/share/cfg/tofi.nix b/share/cfg/tofi.nix index 998b6dc..433a911 100644 --- a/share/cfg/tofi.nix +++ b/share/cfg/tofi.nix @@ -1,4 +1,5 @@ -{ lib, config, ... }: { +{ lib, config, ... }: +{ # Tofi's cache seems to get messed up sometimes, so we regenerate it when # building the system. # https://github.com/philj56/tofi/issues/115#issuecomment-1701748297 diff --git a/share/cfg/waybar.nix b/share/cfg/waybar.nix index 892850a..bd6cc96 100644 --- a/share/cfg/waybar.nix +++ b/share/cfg/waybar.nix @@ -1,4 +1,5 @@ -{ lib, ... }: { +{ lib, ... }: +{ programs.waybar = { systemd = { enable = true; @@ -24,15 +25,34 @@ ]; # TODO: fix clock format - clock = { format = "{:%H:%M}"; }; + clock = { + format = "{:%H:%M}"; + }; "battery#capacity" = { - format = lib.concatStringsSep "\n" [ "{icon}" "{capacity}%" ]; - format-icons = [ "" "" "" "" "" "" "" "" "" "" ]; + format = lib.concatStringsSep "\n" [ + "{icon}" + "{capacity}%" + ]; + format-icons = [ + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + ]; }; "battery#power" = { - format = lib.concatStringsSep "\n" [ "" "{power:4.1f}W" ]; + format = lib.concatStringsSep "\n" [ + "" + "{power:4.1f}W" + ]; interval = 1; }; diff --git a/share/cfg/wpaperd.nix b/share/cfg/wpaperd.nix index f5e58b4..3760caf 100644 --- a/share/cfg/wpaperd.nix +++ b/share/cfg/wpaperd.nix @@ -2,8 +2,10 @@ # /share/hm-modules/wpaperd.nix. In order to use this config you have to also # import that module. { config, ... }: -let wallpapers-dir = "${config.xdg.userDirs.pictures}/Wallpapers"; -in { +let + wallpapers-dir = "${config.xdg.userDirs.pictures}/Wallpapers"; +in +{ services.wpaperd = { settings.default = { path = wallpapers-dir; diff --git a/share/hm-modules/default.nix b/share/hm-modules/default.nix index e20d424..c4ddc87 100644 --- a/share/hm-modules/default.nix +++ b/share/hm-modules/default.nix @@ -1 +1,7 @@ -{ ... }: { imports = [ ./hyprdesktop.nix ./wpaperd.nix ]; } +{ ... }: +{ + imports = [ + ./hyprdesktop.nix + ./wpaperd.nix + ]; +} diff --git a/share/hm-modules/hyprdesktop.nix b/share/hm-modules/hyprdesktop.nix index a9f2ed4..20e52ab 100644 --- a/share/hm-modules/hyprdesktop.nix +++ b/share/hm-modules/hyprdesktop.nix @@ -1,8 +1,21 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let - inherit (lib) mkIf mkOption mkEnableOption types mdDoc lists; + inherit (lib) + mkIf + mkOption + mkEnableOption + types + mdDoc + lists + ; cfg = config.custom.hyprdesktop; -in { +in +{ imports = [ ../home/minimal.nix ]; options.custom.hyprdesktop = { @@ -49,7 +62,8 @@ in { config = mkIf cfg.enable { wayland.windowManager.hyprland.enable = true; - home.packages = with pkgs; + home.packages = + with pkgs; [ xh # Nice to use HTTP client bc # CLI calculator @@ -107,20 +121,28 @@ in { # Flat-Remix icon themes don't contain all the icons that Foliate uses, # so I'm bringing in the adwaita icons as a fallback. gnome3.adwaita-icon-theme - ] ++ lists.optionals cfg.hasBluetooth [ overskride ] + ] + ++ lists.optionals cfg.hasBluetooth [ overskride ] ++ lists.optionals cfg.enableGaming [ jdk17_headless superTuxKart wineWowPackages.full winetricks - ] ++ lists.optionals (cfg.enableWindowsCompat || cfg.enableGaming) [ + ] + ++ lists.optionals (cfg.enableWindowsCompat || cfg.enableGaming) [ wineWowPackages.full winetricks qemu_kvm - ] ++ lists.optionals cfg.hasBrightnessCtl [ brightnessctl ] - ++ lists.optionals cfg.enableGitAnnex [ git-annex git-remote-gcrypt ]; + ] + ++ lists.optionals cfg.hasBrightnessCtl [ brightnessctl ] + ++ lists.optionals cfg.enableGitAnnex [ + git-annex + git-remote-gcrypt + ]; - home.shellAliases = { sl = "sl -awFc5"; }; + home.shellAliases = { + sl = "sl -awFc5"; + }; services.dunst.enable = true; services.wpaperd.enable = true; @@ -152,22 +174,28 @@ in { }; xdg = { - systemDirs.data = let - gds = pkgs.gsettings-desktop-schemas; - gtk3 = pkgs.gtk3; - in [ - "${gds}/share/gsettings-schemas/${gds.name}" - "${gtk3}/share/gsettings-schemas/${gtk3.name}" - ]; - userDirs = let annex = "${config.home.homeDirectory}/Annex"; - in { - enable = true; - createDirectories = true; - } // mkIf cfg.enableGitAnnex { - pictures = "${annex}/Pictures"; - music = "${annex}/Music"; - documents = "${annex}/Documents"; - }; + systemDirs.data = + let + gds = pkgs.gsettings-desktop-schemas; + gtk3 = pkgs.gtk3; + in + [ + "${gds}/share/gsettings-schemas/${gds.name}" + "${gtk3}/share/gsettings-schemas/${gtk3.name}" + ]; + userDirs = + let + annex = "${config.home.homeDirectory}/Annex"; + in + { + enable = true; + createDirectories = true; + } + // mkIf cfg.enableGitAnnex { + pictures = "${annex}/Pictures"; + music = "${annex}/Music"; + documents = "${annex}/Documents"; + }; portal.xdgOpenUsePortal = true; }; diff --git a/share/hm-modules/wpaperd.nix b/share/hm-modules/wpaperd.nix index 022f54d..82aacb5 100644 --- a/share/hm-modules/wpaperd.nix +++ b/share/hm-modules/wpaperd.nix @@ -1,9 +1,15 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; let cfg = config.services.wpaperd; tomlFormat = pkgs.formats.toml { }; -in { +in +{ options.services.wpaperd = { enable = mkEnableOption "enable wpaperd"; @@ -44,9 +50,7 @@ in { }; config = mkIf cfg.enable { - assertions = [ - (hm.assertions.assertPlatform "services.wpaperd" pkgs platforms.linux) - ]; + assertions = [ (hm.assertions.assertPlatform "services.wpaperd" pkgs platforms.linux) ]; home.packages = [ cfg.package ]; diff --git a/share/home/minimal.nix b/share/home/minimal.nix index 566fa42..e78862d 100644 --- a/share/home/minimal.nix +++ b/share/home/minimal.nix @@ -1,6 +1,7 @@ # This module contains a bunch of things that make up a minimal environment that # I want on ALL of my machines. -{ pkgs, config, ... }: { +{ pkgs, config, ... }: +{ home.packages = with pkgs; [ curl git diff --git a/share/nixos-modules/iwd-ext.nix b/share/nixos-modules/iwd-ext.nix index 09327a9..754be40 100644 --- a/share/nixos-modules/iwd-ext.nix +++ b/share/nixos-modules/iwd-ext.nix @@ -1,6 +1,17 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let - inherit (lib) mkEnableOption mkIf mkOption types recursiveUpdate; + inherit (lib) + mkEnableOption + mkIf + mkOption + types + recursiveUpdate + ; cfg = config.networking.wireless.iwd-ext; ini = pkgs.formats.ini { }; @@ -8,12 +19,14 @@ let # without UseDefaultInterface, sometimes wlan0 simply goes AWOL with # NetworkManager # https://iwd.wiki.kernel.org/interface_lifecycle#interface_management_in_iwd - General.UseDefaultInterface = with config.networking.networkmanager; + General.UseDefaultInterface = + with config.networking.networkmanager; (enable && (wifi.backend == "iwd")); }; configFile = ini.generate "main.conf" (recursiveUpdate defaults cfg.settings); -in { +in +{ options.networking.wireless.iwd-ext = { enable = mkEnableOption (lib.mdDoc "iwd"); @@ -50,8 +63,12 @@ in { type = types.attrsOf ini.type; default = { }; example = { - HomeNetwork = { Security.PreSharedKey = "totallysecurepsk"; }; - "@NETWORK_2_SSID@" = { Security.PreSharedKey = "@NETWORK_2_PSK@"; }; + HomeNetwork = { + Security.PreSharedKey = "totallysecurepsk"; + }; + "@NETWORK_2_SSID@" = { + Security.PreSharedKey = "@NETWORK_2_PSK@"; + }; }; description = lib.mdDoc '' diff --git a/share/system/client-common.nix b/share/system/client-common.nix index 4d3c3ca..e3d2b60 100644 --- a/share/system/client-common.nix +++ b/share/system/client-common.nix @@ -1,9 +1,13 @@ # Common configuration options for client machines (i.e. not servers) -{ pkgs, ... }: { +{ pkgs, ... }: +{ imports = [ ./steam.nix ]; programs.hyprland.enable = true; - boot.supportedFilesystems = [ "ntfs" "bcachefs" ]; + boot.supportedFilesystems = [ + "ntfs" + "bcachefs" + ]; nixpkgs.config.allowUnfree = true; nix.gc = { @@ -17,7 +21,11 @@ useNetworkd = true; firewall = { enable = true; - allowedTCPPorts = [ 80 443 34197 ]; + allowedTCPPorts = [ + 80 + 443 + 34197 + ]; }; }; services.mullvad-vpn.enable = true; @@ -34,7 +42,9 @@ enable = true; enableSSHSupport = true; pinentryPackage = pkgs.pinentry-gnome3; - settings = { default-cache-ttl = 1200; }; + settings = { + default-cache-ttl = 1200; + }; }; sound.enable = true; @@ -49,7 +59,12 @@ noto-fonts-cjk noto-fonts-emoji proggyfonts - (nerdfonts.override { fonts = [ "FiraCode" "CascadiaCode" ]; }) + (nerdfonts.override { + fonts = [ + "FiraCode" + "CascadiaCode" + ]; + }) overpass inter ]; diff --git a/share/system/common.nix b/share/system/common.nix index b280667..a785573 100644 --- a/share/system/common.nix +++ b/share/system/common.nix @@ -1,8 +1,12 @@ # Common system settings shared across every machine # Used mostly for adding substituters and such -{ ... }: { +{ ... }: +{ nix.settings = { - experimental-features = [ "nix-command" "flakes" ]; + experimental-features = [ + "nix-command" + "flakes" + ]; auto-optimise-store = true; }; } diff --git a/share/system/spotifyd.nix b/share/system/spotifyd.nix index 5e04898..406d5bf 100644 --- a/share/system/spotifyd.nix +++ b/share/system/spotifyd.nix @@ -1,6 +1,8 @@ { config, ... }: -let secrets = config.sops.secrets; -in { +let + secrets = config.sops.secrets; +in +{ services.spotifyd = { enable = true; settings.global = { diff --git a/share/system/steam.nix b/share/system/steam.nix index 7137bfa..4217d9d 100644 --- a/share/system/steam.nix +++ b/share/system/steam.nix @@ -1,23 +1,23 @@ -{ lib, ... }: { +{ lib, ... }: +{ programs.steam.enable = true; nixpkgs.config = { - allowUnfreePredicate = pkg: + allowUnfreePredicate = + pkg: builtins.elem (lib.getName pkg) [ "steam" "steam-original" "steam-runtime" ]; packageOverrides = pkgs: { - steam = - pkgs.steam.override { extraPkgs = pkgs: with pkgs; [ libgdiplus ]; }; + steam = pkgs.steam.override { extraPkgs = pkgs: with pkgs; [ libgdiplus ]; }; }; }; environment.sessionVariables = rec { # Steam needs this to find Proton-GE - STEAM_EXTRA_COMPAT_TOOLS_PATHS = - "\${HOME}/.steam/root/compatibilitytools.d"; + STEAM_EXTRA_COMPAT_TOOLS_PATHS = "\${HOME}/.steam/root/compatibilitytools.d"; # note: this doesn't replace PATH, it just adds this to it PATH = [ "\${XDG_BIN_HOME}" ]; }; diff --git a/share/system/virt.nix b/share/system/virt.nix index 6f5a9fe..ac74332 100644 --- a/share/system/virt.nix +++ b/share/system/virt.nix @@ -1,10 +1,18 @@ -{ pkgs, virt-users ? [ ], ... }: +{ + pkgs, + virt-users ? [ ], + ... +}: let # https://stackoverflow.com/questions/75855410/nix-map-list-of-keys-to-attribute-set-members - attrSetRepeatValue = value: list: - let acc = { }; # accumulator - in builtins.foldl' (acc: key: acc // { "${key}" = value; }) acc list; -in { + attrSetRepeatValue = + value: list: + let + acc = { }; # accumulator + in + builtins.foldl' (acc: key: acc // { "${key}" = value; }) acc list; +in +{ users.users = attrSetRepeatValue { extraGroups = [ "libvirtd" ]; } virt-users; home-manager.users = attrSetRepeatValue { |
