diff options
| author | Miran Bastaja <miran.bastaja04@gmail.com> | 2024-07-04 22:58:28 +0200 |
|---|---|---|
| committer | Miran Bastaja <miran.bastaja04@gmail.com> | 2024-07-04 22:58:28 +0200 |
| commit | 333f134ec64739abf0c3e46e59a4a8ad88b883b5 (patch) | |
| tree | 5c41313437176f100116883b353c7efd4b9b7ab3 | |
| parent | 430d063f50824b0b268e73c8577705dc2c4fc318 (diff) | |
formatting
| -rw-r--r-- | flake.nix | 109 | ||||
| -rw-r--r-- | hosts/sagittarius/default.nix | 3 | ||||
| -rw-r--r-- | hosts/sagittarius/home.nix | 4 | ||||
| -rw-r--r-- | hosts/sagittarius/web/matrix.nix | 3 | ||||
| -rw-r--r-- | hosts/underworld/default.nix | 25 | ||||
| -rw-r--r-- | hosts/underworld/home.nix | 1 | ||||
| -rw-r--r-- | hosts/wonderland/default.nix | 31 | ||||
| -rw-r--r-- | hosts/wonderland/home.nix | 4 | ||||
| -rw-r--r-- | share/cfg/firefox/default.nix | 3 | ||||
| -rw-r--r-- | share/cfg/gallery-dl.nix | 35 | ||||
| -rw-r--r-- | share/cfg/hyprland.nix | 25 | ||||
| -rw-r--r-- | share/cfg/waybar.nix | 7 | ||||
| -rw-r--r-- | share/hm-modules/default.nix | 7 | ||||
| -rw-r--r-- | share/hm-modules/hyprdesktop.nix | 77 | ||||
| -rw-r--r-- | share/hm-modules/wpaperd.nix | 13 | ||||
| -rw-r--r-- | share/home/minimal.nix | 4 | ||||
| -rw-r--r-- | share/nixos-modules/iwd-ext.nix | 11 | ||||
| -rw-r--r-- | share/system/client-common.nix | 11 | ||||
| -rw-r--r-- | share/system/virt.nix | 29 |
19 files changed, 134 insertions, 268 deletions
@@ -41,8 +41,7 @@ }; }; - outputs = - inputs@{ flake-parts, ... }: + outputs = inputs@{ flake-parts, ... }: inputs.flake-parts.lib.mkFlake { inherit inputs; } { systems = [ "x86_64-linux" ]; imports = [ @@ -51,70 +50,66 @@ inputs.pre-commit-hooks-nix.flakeModule ]; - flake.nixosConfigurations = - let - generateNixosConfig = name: _value: { - system = "x86_64-linux"; # I don't have any other type of machine yet - modules = [ - inputs.home-manager.nixosModules.home-manager - inputs.sops-nix.nixosModules.sops - inputs.disko.nixosModules.disko - ./share/system/common.nix + flake.nixosConfigurations = let + generateNixosConfig = name: _value: { + system = "x86_64-linux"; # I don't have any other type of machine yet + modules = [ + inputs.home-manager.nixosModules.home-manager + inputs.sops-nix.nixosModules.sops + inputs.disko.nixosModules.disko + ./share/system/common.nix - # This directory has to exist and have a `default.nix` in it, see - # `./hosts` directory for examples - ./hosts/${name} - ]; - specialArgs = { - inherit inputs; - flakeRoot = ./.; - }; + # This directory has to exist and have a `default.nix` in it, see + # `./hosts` directory for examples + ./hosts/${name} + ]; + specialArgs = { + inherit inputs; + flakeRoot = ./.; }; - # wrapper around nixpkgs.lib.nixosSystem to enable using it on attrsets - generateNixosSystem = _name: value: inputs.nixpkgs.lib.nixosSystem value; + }; + # wrapper around nixpkgs.lib.nixosSystem to enable using it on attrsets + 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 + 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; - perSystem = - { pkgs, config, ... }: - { - devshells.default = { - name = "nixconf-sh"; + perSystem = { pkgs, config, ... }: { + devshells.default = { + name = "nixconf-sh"; - devshell.startup.pre-commit-install.text = config.pre-commit.installationScript; + devshell.startup.pre-commit-install.text = + config.pre-commit.installationScript; - packages = (builtins.attrValues config.treefmt.build.programs); - commands = with pkgs; [ - { package = git; } - { package = gitui; } - { package = sops; } - { package = config.treefmt.build.wrapper; } - ]; - }; + packages = (builtins.attrValues config.treefmt.build.programs); + commands = with pkgs; [ + { package = git; } + { package = gitui; } + { package = sops; } + { package = config.treefmt.build.wrapper; } + ]; + }; - treefmt = { - projectRootFile = ./flake.nix; - programs = { - nixpkgs-fmt.enable = true; - }; - }; + treefmt = { + projectRootFile = ./flake.nix; + programs = { nixfmt.enable = true; }; + }; - pre-commit = { - check.enable = false; - settings = { - hooks = { - treefmt.enable = true; - treefmt.package = config.treefmt.build.wrapper; - deadnix.enable = true; - }; + pre-commit = { + check.enable = false; + settings = { + hooks = { + treefmt.enable = true; + treefmt.package = config.treefmt.build.wrapper; + deadnix.enable = true; }; - }; # end of pre-commit - }; # end of perSystem + }; + }; # end of pre-commit + }; # end of perSystem }; # end of inputs.flake-parts.lib.mkFlake } diff --git a/hosts/sagittarius/default.nix b/hosts/sagittarius/default.nix index 12e25ab..946ecc7 100644 --- a/hosts/sagittarius/default.nix +++ b/hosts/sagittarius/default.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{ ... }: { imports = [ # Include the results of the hardware scan. ./hardware.nix diff --git a/hosts/sagittarius/home.nix b/hosts/sagittarius/home.nix index 11d2b06..accbd5d 100644 --- a/hosts/sagittarius/home.nix +++ b/hosts/sagittarius/home.nix @@ -2,9 +2,7 @@ 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/web/matrix.nix b/hosts/sagittarius/web/matrix.nix index 1d0ecf5..d230edc 100644 --- a/hosts/sagittarius/web/matrix.nix +++ b/hosts/sagittarius/web/matrix.nix @@ -19,8 +19,7 @@ let } } ''; -in -{ +in { imports = [ ./acme.nix ]; networking.firewall.allowedTCPPorts = [ 80 443 8448 ]; diff --git a/hosts/underworld/default.nix b/hosts/underworld/default.nix index e47fe65..81af671 100644 --- a/hosts/underworld/default.nix +++ b/hosts/underworld/default.nix @@ -1,9 +1,4 @@ -{ pkgs -, flakeRoot -, inputs -, ... -}: -{ +{ pkgs, flakeRoot, inputs, ... }: { imports = [ # Include the results of the hardware scan. ./hardware.nix @@ -12,11 +7,7 @@ ./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; @@ -38,19 +29,11 @@ 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/home.nix b/hosts/underworld/home.nix index bd41e89..90a85e5 100644 --- a/hosts/underworld/home.nix +++ b/hosts/underworld/home.nix @@ -18,6 +18,5 @@ home.stateVersion = "23.11"; }; - home-manager.users.root.home.stateVersion = "23.11"; } diff --git a/hosts/wonderland/default.nix b/hosts/wonderland/default.nix index 037f787..130feab 100644 --- a/hosts/wonderland/default.nix +++ b/hosts/wonderland/default.nix @@ -1,10 +1,4 @@ -{ config -, pkgs -, flakeRoot -, inputs -, ... -}: -{ +{ config, pkgs, flakeRoot, inputs, ... }: { imports = [ # Include the results of the hardware scan. ./hardware.nix @@ -16,11 +10,7 @@ }) (flakeRoot + /share/system/client-common.nix) #(flakeRoot + /share/system/spotifyd.nix) - { - _module.args = { - inherit inputs; - }; - } + { _module.args = { inherit inputs; }; } ]; programs.fish.enable = true; @@ -91,26 +81,15 @@ 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/home.nix b/hosts/wonderland/home.nix index 556391c..43611b9 100644 --- a/hosts/wonderland/home.nix +++ b/hosts/wonderland/home.nix @@ -2,9 +2,7 @@ home-manager = { useGlobalPkgs = true; useUserPackages = true; - sharedModules = [{ - imports = [ (flakeRoot + /share/cfg) ]; - }]; + sharedModules = [{ imports = [ (flakeRoot + /share/cfg) ]; }]; extraSpecialArgs = { inherit inputs; }; }; diff --git a/share/cfg/firefox/default.nix b/share/cfg/firefox/default.nix index 07281ec..5590d5d 100644 --- a/share/cfg/firefox/default.nix +++ b/share/cfg/firefox/default.nix @@ -4,8 +4,7 @@ let 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 = { diff --git a/share/cfg/gallery-dl.nix b/share/cfg/gallery-dl.nix index 3ee065b..802141f 100644 --- a/share/cfg/gallery-dl.nix +++ b/share/cfg/gallery-dl.nix @@ -1,5 +1,4 @@ -{ config, ... }: -{ +{ config, ... }: { programs.gallery-dl = { settings.extractor = { base-directory = "${config.xdg.userDirs.download}/gallery-dl"; @@ -8,24 +7,15 @@ { 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" ]; } ]; @@ -34,21 +24,14 @@ 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/hyprland.nix b/share/cfg/hyprland.nix index b9353ef..629f105 100644 --- a/share/cfg/hyprland.nix +++ b/share/cfg/hyprland.nix @@ -17,8 +17,7 @@ let }; terminal = "kitty"; }; -in -{ +in { wayland.windowManager.hyprland = { extraConfig = '' $mod = SUPER @@ -36,22 +35,12 @@ 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/waybar.nix b/share/cfg/waybar.nix index 7a9fb96..892850a 100644 --- a/share/cfg/waybar.nix +++ b/share/cfg/waybar.nix @@ -1,5 +1,4 @@ -{ lib, ... }: -{ +{ lib, ... }: { programs.waybar = { systemd = { enable = true; @@ -25,9 +24,7 @@ ]; # TODO: fix clock format - clock = { - format = "{:%H:%M}"; - }; + clock = { format = "{:%H:%M}"; }; "battery#capacity" = { format = lib.concatStringsSep "\n" [ "{icon}" "{capacity}%" ]; diff --git a/share/hm-modules/default.nix b/share/hm-modules/default.nix index 695f3fe..e20d424 100644 --- a/share/hm-modules/default.nix +++ b/share/hm-modules/default.nix @@ -1,6 +1 @@ -{ ... }: { - 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 eef388f..a9f2ed4 100644 --- a/share/hm-modules/hyprdesktop.nix +++ b/share/hm-modules/hyprdesktop.nix @@ -1,20 +1,8 @@ -{ 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 = { @@ -61,8 +49,7 @@ 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 @@ -120,28 +107,20 @@ 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; @@ -173,28 +152,22 @@ 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 68a98a9..022f54d 100644 --- a/share/hm-modules/wpaperd.nix +++ b/share/hm-modules/wpaperd.nix @@ -1,14 +1,9 @@ -{ 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"; @@ -49,7 +44,9 @@ 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 c4f878a..566fa42 100644 --- a/share/home/minimal.nix +++ b/share/home/minimal.nix @@ -18,7 +18,7 @@ xdg.enable = true; home.shellAliases = { - ip = ''ip --color=auto''; + ip = "ip --color=auto"; tempdir = "cd $(mktemp -d)"; }; @@ -39,7 +39,7 @@ W3M_DIR = "${dataHome}/w3m"; RENPY_PATH_TO_SAVES = "${dataHome}"; PSQL_HISTORY = "${dataHome}/psql_history"; - _JAVA_OPTIONS = ''-Djava.util.prefs.userRoot=${configHome}/java''; + _JAVA_OPTIONS = "-Djava.util.prefs.userRoot=${configHome}/java"; OMNISHARPHOME = "${configHome}/omnisharp"; DOTNET_CLI_HOME = "${dataHome}/dotnet"; # shell diff --git a/share/nixos-modules/iwd-ext.nix b/share/nixos-modules/iwd-ext.nix index ddf0494..09327a9 100644 --- a/share/nixos-modules/iwd-ext.nix +++ b/share/nixos-modules/iwd-ext.nix @@ -13,8 +13,7 @@ let }; configFile = ini.generate "main.conf" (recursiveUpdate defaults cfg.settings); -in -{ +in { options.networking.wireless.iwd-ext = { enable = mkEnableOption (lib.mdDoc "iwd"); @@ -51,12 +50,8 @@ 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 879f593..4d3c3ca 100644 --- a/share/system/client-common.nix +++ b/share/system/client-common.nix @@ -1,9 +1,6 @@ # Common configuration options for client machines (i.e. not servers) -{ pkgs, ... }: -{ - imports = [ - ./steam.nix - ]; +{ pkgs, ... }: { + imports = [ ./steam.nix ]; programs.hyprland.enable = true; boot.supportedFilesystems = [ "ntfs" "bcachefs" ]; @@ -37,9 +34,7 @@ enable = true; enableSSHSupport = true; pinentryPackage = pkgs.pinentry-gnome3; - settings = { - default-cache-ttl = 1200; - }; + settings = { default-cache-ttl = 1200; }; }; sound.enable = true; diff --git a/share/system/virt.nix b/share/system/virt.nix index 0207064..6f5a9fe 100644 --- a/share/system/virt.nix +++ b/share/system/virt.nix @@ -2,25 +2,18 @@ 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 -{ - users.users = attrSetRepeatValue - { extraGroups = [ "libvirtd" ]; } - virt-users; + 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 - { - home.packages = [ pkgs.quickemu ]; - dconf.settings."org/virt-manager/virt-manager/connections" = { - autoconnect = [ "qemu:///system" ]; - uris = [ "qemu:///system" ]; - }; - } - virt-users; + home-manager.users = attrSetRepeatValue { + home.packages = [ pkgs.quickemu ]; + dconf.settings."org/virt-manager/virt-manager/connections" = { + autoconnect = [ "qemu:///system" ]; + uris = [ "qemu:///system" ]; + }; + } virt-users; programs.virt-manager.enable = true; virtualisation.libvirtd = { |
