diff --git a/flake.nix b/flake.nix index 002c0cc..69a2585 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { description = "tux's nix configurations"; - outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules); + outputs = inputs: inputs.flake-parts.lib.mkFlake {inherit inputs;} (inputs.import-tree ./modules); inputs = { flake-parts = { diff --git a/modules/droid/core/hm.nix b/modules/droid/core/hm.nix index 694b152..2753b66 100644 --- a/modules/droid/core/hm.nix +++ b/modules/droid/core/hm.nix @@ -1,32 +1,33 @@ -{ inputs, config, ... }: { - flake.modules.nixOnDroid.core = - { - hostName, - userName, - userEmail, - ... - }: - { - home-manager = { - backupFileExtension = "bak"; - useGlobalPkgs = true; - useUserPackages = true; - extraSpecialArgs = { - inherit - inputs - hostName - userName - userEmail - ; - }; + inputs, + config, + ... +}: { + flake.modules.nixOnDroid.core = { + hostName, + userName, + userEmail, + ... + }: { + home-manager = { + backupFileExtension = "bak"; + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit + inputs + hostName + userName + userEmail + ; + }; - config = { - imports = [ - config.flake.modules.homeManager.shell - config.flake.modules.homeManager.${hostName} - ]; - }; + config = { + imports = [ + config.flake.modules.homeManager.shell + config.flake.modules.homeManager.${hostName} + ]; }; }; + }; } diff --git a/modules/droid/networking/ssh.nix b/modules/droid/networking/ssh.nix index 5c399be..99a00f7 100644 --- a/modules/droid/networking/ssh.nix +++ b/modules/droid/networking/ssh.nix @@ -1,109 +1,106 @@ { - flake.modules.nixOnDroid.networking = - { - config, - lib, - pkgs, - ... - }: - let - # utility functions - concatLines = list: builtins.concatStringsSep "\n" list; + flake.modules.nixOnDroid.networking = { + config, + lib, + pkgs, + ... + }: let + # utility functions + concatLines = list: builtins.concatStringsSep "\n" list; - prefixLines = mapper: list: concatLines (map mapper list); + prefixLines = mapper: list: concatLines (map mapper list); - # could be put in the config - configPath = "ssh/sshd_config"; + # could be put in the config + configPath = "ssh/sshd_config"; - keysFolder = "/etc/ssh"; + keysFolder = "/etc/ssh"; - authorizedKeysFolder = "/etc/ssh/authorized_keys.d"; + authorizedKeysFolder = "/etc/ssh/authorized_keys.d"; - supportedKeysTypes = [ - "rsa" - "ed25519" - ]; + supportedKeysTypes = [ + "rsa" + "ed25519" + ]; - sshd-start-bin = "sshd-start"; + sshd-start-bin = "sshd-start"; - # real config - cfg = config.tnix.networking.openssh; + # real config + cfg = config.tnix.networking.openssh; - pathOfKeyOf = type: "${keysFolder}/ssh_host_${type}_key"; + pathOfKeyOf = type: "${keysFolder}/ssh_host_${type}_key"; - generateKeyOf = type: '' - ${lib.getExe' pkgs.openssh "ssh-keygen"} \ - -t "${type}" \ - -f "${pathOfKeyOf type}" \ - -N "" + generateKeyOf = type: '' + ${lib.getExe' pkgs.openssh "ssh-keygen"} \ + -t "${type}" \ + -f "${pathOfKeyOf type}" \ + -N "" + ''; + + generateKeyWhenNeededOf = type: '' + if [ ! -f ${pathOfKeyOf type} ]; then + mkdir --parents ${keysFolder} + ${generateKeyOf type} + fi + ''; + + sshd-start = pkgs.writeScriptBin sshd-start-bin '' + #!${pkgs.runtimeShell} + ${prefixLines generateKeyWhenNeededOf supportedKeysTypes} + + mkdir --parents "${authorizedKeysFolder}" + echo "${lib.concatStringsSep "\n" cfg.authorizedKeys}" > ${authorizedKeysFolder}/${config.user.userName} + + echo "Starting sshd in non-daemonized way on port ${lib.concatMapStrings toString cfg.ports}" + ${lib.getExe' pkgs.openssh "sshd"} \ + -f "/etc/${configPath}" \ + -D # don't detach into a daemon process + ''; + in { + options.tnix.networking.openssh = { + enable = lib.mkEnableOption '' + Whether to enable the OpenSSH secure shell daemon, which + allows secure remote logins. ''; - generateKeyWhenNeededOf = type: '' - if [ ! -f ${pathOfKeyOf type} ]; then - mkdir --parents ${keysFolder} - ${generateKeyOf type} - fi - ''; - - sshd-start = pkgs.writeScriptBin sshd-start-bin '' - #!${pkgs.runtimeShell} - ${prefixLines generateKeyWhenNeededOf supportedKeysTypes} - - mkdir --parents "${authorizedKeysFolder}" - echo "${lib.concatStringsSep "\n" cfg.authorizedKeys}" > ${authorizedKeysFolder}/${config.user.userName} - - echo "Starting sshd in non-daemonized way on port ${lib.concatMapStrings toString cfg.ports}" - ${lib.getExe' pkgs.openssh "sshd"} \ - -f "/etc/${configPath}" \ - -D # don't detach into a daemon process - ''; - in - { - options.tnix.networking.openssh = { - enable = lib.mkEnableOption '' - Whether to enable the OpenSSH secure shell daemon, which - allows secure remote logins. + ports = lib.mkOption { + type = lib.types.listOf lib.types.port; + default = [22]; + description = '' + Specifies on which ports the SSH daemon listens. ''; - - ports = lib.mkOption { - type = lib.types.listOf lib.types.port; - default = [ 22 ]; - description = '' - Specifies on which ports the SSH daemon listens. - ''; - }; - - authorizedKeys = lib.mkOption { - type = lib.types.listOf lib.types.str; - default = [ ]; - description = '' - Specify a list of public keys to be added to the authorized_keys file. - ''; - }; }; - config = lib.mkIf cfg.enable { - environment.etc = { - "${configPath}".text = '' - ${prefixLines (port: "Port ${toString port}") cfg.ports} - - AuthorizedKeysFile ${authorizedKeysFolder}/%u - - LogLevel VERBOSE - ''; - }; - - environment.packages = [ - sshd-start - pkgs.openssh - ]; - - build.activationAfter.sshd = '' - SERVER_PID=$(${lib.getExe' pkgs.procps "ps"} -a | ${lib.getExe' pkgs.toybox "grep"} sshd || true) - if [ -z "$SERVER_PID" ]; then - $DRY_RUN_CMD ${lib.getExe sshd-start} - fi + authorizedKeys = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = []; + description = '' + Specify a list of public keys to be added to the authorized_keys file. ''; }; }; + + config = lib.mkIf cfg.enable { + environment.etc = { + "${configPath}".text = '' + ${prefixLines (port: "Port ${toString port}") cfg.ports} + + AuthorizedKeysFile ${authorizedKeysFolder}/%u + + LogLevel VERBOSE + ''; + }; + + environment.packages = [ + sshd-start + pkgs.openssh + ]; + + build.activationAfter.sshd = '' + SERVER_PID=$(${lib.getExe' pkgs.procps "ps"} -a | ${lib.getExe' pkgs.toybox "grep"} sshd || true) + if [ -z "$SERVER_PID" ]; then + $DRY_RUN_CMD ${lib.getExe sshd-start} + fi + ''; + }; + }; } diff --git a/modules/flake/flake-parts.nix b/modules/flake/flake-parts.nix index 1c75663..24fc4cb 100644 --- a/modules/flake/flake-parts.nix +++ b/modules/flake/flake-parts.nix @@ -1,4 +1,3 @@ -{ inputs, ... }: -{ - imports = [ inputs.flake-parts.flakeModules.modules ]; +{inputs, ...}: { + imports = [inputs.flake-parts.flakeModules.modules]; } diff --git a/modules/flake/hosts.nix b/modules/flake/hosts.nix index 3dbe199..37e8587 100644 --- a/modules/flake/hosts.nix +++ b/modules/flake/hosts.nix @@ -3,19 +3,18 @@ inputs, config, ... -}: -let - mkNixOSHost = - hostName: - { - userName ? "tux", - userEmail ? "t@tux.rs", - system ? "x86_64-linux", - unstable ? true, - }: - let - nixpkgs = if unstable then inputs.nixpkgs else inputs.nixpkgs-stable; - in +}: let + mkNixOSHost = hostName: { + userName ? "tux", + userEmail ? "t@tux.rs", + system ? "x86_64-linux", + unstable ? true, + }: let + nixpkgs = + if unstable + then inputs.nixpkgs + else inputs.nixpkgs-stable; + in nixpkgs.lib.nixosSystem { inherit system; specialArgs = { @@ -32,17 +31,17 @@ let ]; }; - mkDroidHost = - hostName: - { - userName ? "nix-on-droid", - userEmail ? "t@tux.rs", - system ? "aarch64-linux", - unstable ? true, - }: - let - nixpkgs = if unstable then inputs.nixpkgs else inputs.nixpkgs-stable; - in + mkDroidHost = hostName: { + userName ? "nix-on-droid", + userEmail ? "t@tux.rs", + system ? "aarch64-linux", + unstable ? true, + }: let + nixpkgs = + if unstable + then inputs.nixpkgs + else inputs.nixpkgs-stable; + in inputs.nix-on-droid.lib.nixOnDroidConfiguration { pkgs = import nixpkgs { inherit system; @@ -65,66 +64,55 @@ let ]; }; - mkNixOSNode = - hostName: - { - system ? "x86_64-linux", - }: - { - hostname = hostName; - profiles.system = { - user = "root"; - path = inputs.deploy-rs.lib.${system}.activate.nixos self.nixosConfigurations.${hostName}; - }; + mkNixOSNode = hostName: {system ? "x86_64-linux"}: { + hostname = hostName; + profiles.system = { + user = "root"; + path = inputs.deploy-rs.lib.${system}.activate.nixos self.nixosConfigurations.${hostName}; }; + }; - activateNixOnDroid = - system: configuration: + activateNixOnDroid = system: configuration: inputs.deploy-rs.lib.${system}.activate.custom configuration.activationPackage - "${configuration.activationPackage}/activate"; + "${configuration.activationPackage}/activate"; - mkDroidNode = - hostName: - { - system ? "aarch64-linux", - }: - { - hostname = hostName; - profiles.system = { - sshUser = "nix-on-droid"; - user = "nix-on-droid"; - magicRollback = true; - sshOpts = [ - "-p" - "8033" - ]; - path = activateNixOnDroid system self.nixOnDroidConfigurations.${hostName}; - }; + mkDroidNode = hostName: {system ? "aarch64-linux"}: { + hostname = hostName; + profiles.system = { + sshUser = "nix-on-droid"; + user = "nix-on-droid"; + magicRollback = true; + sshOpts = [ + "-p" + "8033" + ]; + path = activateNixOnDroid system self.nixOnDroidConfigurations.${hostName}; }; - -in -{ + }; +in { flake = { nixosConfigurations = builtins.mapAttrs mkNixOSHost { - sirius = { }; - canopus = { }; - arcturus = { }; - alpha = { }; - vps = { }; + sirius = {}; + canopus = {}; + arcturus = {}; + alpha = {}; + vps = {}; }; nixOnDroidConfigurations = builtins.mapAttrs mkDroidHost { - vega = { }; + vega = {}; }; deploy.nodes = - builtins.mapAttrs (hostName: _: mkNixOSNode hostName { }) self.nixosConfigurations - // builtins.mapAttrs (hostName: _: mkDroidNode hostName { }) self.nixOnDroidConfigurations; + builtins.mapAttrs (hostName: _: mkNixOSNode hostName {}) self.nixosConfigurations + // builtins.mapAttrs (hostName: _: mkDroidNode hostName {}) self.nixOnDroidConfigurations; }; perSystem = { - checks = builtins.mapAttrs ( - _: hostConfig: hostConfig.config.system.build.toplevel - ) self.nixosConfigurations; + checks = + builtins.mapAttrs ( + _: hostConfig: hostConfig.config.system.build.toplevel + ) + self.nixosConfigurations; }; } diff --git a/modules/flake/overlays.nix b/modules/flake/overlays.nix index 184a81f..9678956 100644 --- a/modules/flake/overlays.nix +++ b/modules/flake/overlays.nix @@ -1,8 +1,4 @@ -{ - inputs, - ... -}: -{ +{inputs, ...}: { flake.overlays = { modifications = final: prev: { tnvim = inputs.tnvim.packages.${prev.stdenv.hostPlatform.system}.default; @@ -31,12 +27,10 @@ copyparty = inputs.copyparty.overlays.default; }; - perSystem = - { system, ... }: - { - _module.args.pkgs = import inputs.nixpkgs { - inherit system; - overlays = builtins.attrValues inputs.self.overlays; - }; + perSystem = {system, ...}: { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + overlays = builtins.attrValues inputs.self.overlays; }; + }; } diff --git a/modules/flake/treefmt.nix b/modules/flake/treefmt.nix index 6aadd98..4681e86 100644 --- a/modules/flake/treefmt.nix +++ b/modules/flake/treefmt.nix @@ -1,5 +1,4 @@ -{ inputs, ... }: -{ +{inputs, ...}: { imports = [ inputs.treefmt-nix.flakeModule ]; @@ -9,7 +8,7 @@ projectRootFile = "flake.nix"; flakeCheck = true; programs = { - nixfmt.enable = true; + alejandra.enable = true; }; }; }; diff --git a/modules/hm/core/hm.nix b/modules/hm/core/hm.nix index 5fced0c..59ee604 100644 --- a/modules/hm/core/hm.nix +++ b/modules/hm/core/hm.nix @@ -1,13 +1,11 @@ { - flake.modules.homeManager.core = - { userName, ... }: - { - programs.home-manager.enable = true; - systemd.user.startServices = "sd-switch"; + flake.modules.homeManager.core = {userName, ...}: { + programs.home-manager.enable = true; + systemd.user.startServices = "sd-switch"; - home = { - username = "${userName}"; - homeDirectory = "/home/${userName}"; - }; + home = { + username = "${userName}"; + homeDirectory = "/home/${userName}"; }; + }; } diff --git a/modules/hm/core/nixpkgs.nix b/modules/hm/core/nixpkgs.nix index b6ca2f5..129a8a3 100644 --- a/modules/hm/core/nixpkgs.nix +++ b/modules/hm/core/nixpkgs.nix @@ -1,18 +1,15 @@ -{ inputs, ... }: -{ - flake.modules.homeManager.core = - { - lib, - osConfig ? { }, - ... - }: - { - nixpkgs = lib.mkIf (!(osConfig.home-manager.useGlobalPkgs or false)) { - config = { - allowUnfree = true; - joypixels.acceptLicense = true; - }; - overlays = builtins.attrValues inputs.self.overlays; +{inputs, ...}: { + flake.modules.homeManager.core = { + lib, + osConfig ? {}, + ... + }: { + nixpkgs = lib.mkIf (!(osConfig.home-manager.useGlobalPkgs or false)) { + config = { + allowUnfree = true; + joypixels.acceptLicense = true; }; + overlays = builtins.attrValues inputs.self.overlays; }; + }; } diff --git a/modules/hm/desktop/brave.nix b/modules/hm/desktop/brave.nix index 9f68ad3..668d0ad 100644 --- a/modules/hm/desktop/brave.nix +++ b/modules/hm/desktop/brave.nix @@ -1,38 +1,35 @@ { - flake.modules.homeManager.desktop = - { - pkgs, - config, - ... - }: - let - configDir = "${config.xdg.configHome}/BraveSoftware/Brave-Browser"; + flake.modules.homeManager.desktop = { + pkgs, + config, + ... + }: let + configDir = "${config.xdg.configHome}/BraveSoftware/Brave-Browser"; - extensionJson = ext: { - name = "${configDir}/External Extensions/${ext.id}.json"; - value.text = builtins.toJSON { - external_update_url = "https://clients2.google.com/service/update2/crx"; - }; + extensionJson = ext: { + name = "${configDir}/External Extensions/${ext.id}.json"; + value.text = builtins.toJSON { + external_update_url = "https://clients2.google.com/service/update2/crx"; }; - - extensions = [ - { id = "nkbihfbeogaeaoehlefnkodbefgpgknn"; } # Metamask - { id = "gppongmhjkpfnbhagpmjfkannfbllamg"; } # Wappalyzer - { id = "nngceckbapebfimnlniiiahkandclblb"; } # Bitwarden - { id = "bfnaelmomeimhlpmgjnjophhpkkoljpa"; } # Phantom - { id = "eimadpbcbfnmbkopoojfekhnkhdbieeh"; } # DarkReader - ]; - in - { - programs.chromium = { - enable = true; - package = pkgs.brave; - commandLineArgs = [ - "--disable-features=WebRtcAllowInputVolumeAdjustment" - "--force-device-scale-factor=1.0" - ]; - }; - - home.file = builtins.listToAttrs (map extensionJson extensions); }; + + extensions = [ + {id = "nkbihfbeogaeaoehlefnkodbefgpgknn";} # Metamask + {id = "gppongmhjkpfnbhagpmjfkannfbllamg";} # Wappalyzer + {id = "nngceckbapebfimnlniiiahkandclblb";} # Bitwarden + {id = "bfnaelmomeimhlpmgjnjophhpkkoljpa";} # Phantom + {id = "eimadpbcbfnmbkopoojfekhnkhdbieeh";} # DarkReader + ]; + in { + programs.chromium = { + enable = true; + package = pkgs.brave; + commandLineArgs = [ + "--disable-features=WebRtcAllowInputVolumeAdjustment" + "--force-device-scale-factor=1.0" + ]; + }; + + home.file = builtins.listToAttrs (map extensionJson extensions); + }; } diff --git a/modules/hm/desktop/discord.nix b/modules/hm/desktop/discord.nix index fb0ff36..0a95e51 100644 --- a/modules/hm/desktop/discord.nix +++ b/modules/hm/desktop/discord.nix @@ -1,56 +1,58 @@ { - flake.modules.homeManager.desktop = - { inputs, userName, ... }: - { - imports = [ - inputs.nixcord.homeModules.nixcord - ]; + flake.modules.homeManager.desktop = { + inputs, + userName, + ... + }: { + imports = [ + inputs.nixcord.homeModules.nixcord + ]; - programs.nixcord = { - enable = true; - user = userName; - discord.enable = false; - vesktop.enable = true; - config = { - themeLinks = [ - "https://raw.githubusercontent.com/refact0r/system24/refs/heads/main/archive/flavors/spotify-text.theme.css" - ]; - frameless = true; - plugins = { - hideMedia.enable = true; - anonymiseFileNames.enable = true; - copyFileContents.enable = true; - noTypingAnimation.enable = true; - readAllNotificationsButton.enable = true; - silentTyping.enable = true; - validUser.enable = true; - biggerStreamPreview.enable = true; - ignoreActivities = { - enable = true; - ignorePlaying = true; - ignoreWatching = true; - }; - sortFriendRequests = { - enable = true; - showDates = true; - }; + programs.nixcord = { + enable = true; + user = userName; + discord.enable = false; + vesktop.enable = true; + config = { + themeLinks = [ + "https://raw.githubusercontent.com/refact0r/system24/refs/heads/main/archive/flavors/spotify-text.theme.css" + ]; + frameless = true; + plugins = { + hideMedia.enable = true; + anonymiseFileNames.enable = true; + copyFileContents.enable = true; + noTypingAnimation.enable = true; + readAllNotificationsButton.enable = true; + silentTyping.enable = true; + validUser.enable = true; + biggerStreamPreview.enable = true; + ignoreActivities = { + enable = true; + ignorePlaying = true; + ignoreWatching = true; + }; + sortFriendRequests = { + enable = true; + showDates = true; }; }; - dorion = { - theme = "dark"; - zoom = "1.1"; - blur = "acrylic"; - sysTray = true; - openOnStartup = true; - autoClearCache = true; - disableHardwareAccel = false; - rpcServer = true; - rpcProcessScanner = true; - pushToTalk = true; - pushToTalkKeys = [ "RControl" ]; - desktopNotifications = true; - unreadBadge = true; - }; + }; + dorion = { + theme = "dark"; + zoom = "1.1"; + blur = "acrylic"; + sysTray = true; + openOnStartup = true; + autoClearCache = true; + disableHardwareAccel = false; + rpcServer = true; + rpcProcessScanner = true; + pushToTalk = true; + pushToTalkKeys = ["RControl"]; + desktopNotifications = true; + unreadBadge = true; }; }; + }; } diff --git a/modules/hm/desktop/firefox.nix b/modules/hm/desktop/firefox.nix index 56f3ade..00f511e 100644 --- a/modules/hm/desktop/firefox.nix +++ b/modules/hm/desktop/firefox.nix @@ -1,75 +1,73 @@ { - flake.modules.homeManager.desktop = - { - pkgs, - userName, - ... - }: - { - programs.firefox = { - enable = true; + flake.modules.homeManager.desktop = { + pkgs, + userName, + ... + }: { + programs.firefox = { + enable = true; - package = pkgs.firefox.override { - extraPolicies = { - CaptivePortal = false; - DisableFirefoxStudies = true; - DisablePocket = true; - DisableTelemetry = true; - DisableFirefoxAccounts = false; - NoDefaultBookmarks = true; - OfferToSaveLogins = false; - OfferToSaveLoginsDefault = false; - PasswordManagerEnabled = false; - FirefoxHome = { - Search = true; - Pocket = false; - Snippets = false; - TopSites = false; - Highlights = false; - }; - UserMessaging = { - ExtensionRecommendations = false; - SkipOnboarding = true; - }; + package = pkgs.firefox.override { + extraPolicies = { + CaptivePortal = false; + DisableFirefoxStudies = true; + DisablePocket = true; + DisableTelemetry = true; + DisableFirefoxAccounts = false; + NoDefaultBookmarks = true; + OfferToSaveLogins = false; + OfferToSaveLoginsDefault = false; + PasswordManagerEnabled = false; + FirefoxHome = { + Search = true; + Pocket = false; + Snippets = false; + TopSites = false; + Highlights = false; }; - }; - - profiles = { - ${userName} = { - id = 0; - name = "tux"; - search = { - force = true; - default = "google"; - }; - settings = { - "general.smoothScroll" = true; - "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; - "layout.css.prefers-color-scheme.content-override" = 0; - "browser.compactmode.show" = true; - "browser.tabs.firefox-view" = false; - "browser.bookmarks.addedImportButton" = false; - "extensions.pocket.enabled" = false; - "browser.fullscreen.autohide" = false; - }; - extraConfig = '' - user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true); - user_pref("full-screen-api.ignore-widgets", true); - user_pref("media.ffmpeg.vaapi.enabled", true); - user_pref("media.rdd-vpx.enabled", true); - ''; - - extensions.packages = with pkgs.nur.repos.rycee.firefox-addons; [ - ublock-origin - facebook-container - metamask - darkreader - bitwarden - wappalyzer - clearurls - ]; + UserMessaging = { + ExtensionRecommendations = false; + SkipOnboarding = true; }; }; }; + + profiles = { + ${userName} = { + id = 0; + name = "tux"; + search = { + force = true; + default = "google"; + }; + settings = { + "general.smoothScroll" = true; + "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; + "layout.css.prefers-color-scheme.content-override" = 0; + "browser.compactmode.show" = true; + "browser.tabs.firefox-view" = false; + "browser.bookmarks.addedImportButton" = false; + "extensions.pocket.enabled" = false; + "browser.fullscreen.autohide" = false; + }; + extraConfig = '' + user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true); + user_pref("full-screen-api.ignore-widgets", true); + user_pref("media.ffmpeg.vaapi.enabled", true); + user_pref("media.rdd-vpx.enabled", true); + ''; + + extensions.packages = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + facebook-container + metamask + darkreader + bitwarden + wappalyzer + clearurls + ]; + }; + }; }; + }; } diff --git a/modules/hm/desktop/hyprland.nix b/modules/hm/desktop/hyprland.nix index a39dcf0..4ba4cf0 100644 --- a/modules/hm/desktop/hyprland.nix +++ b/modules/hm/desktop/hyprland.nix @@ -1,40 +1,42 @@ { - flake.modules.homeManager.desktop = - { config, pkgs, ... }: - { - # TODO: Hyprland 0.55 switched to Lua-based configuration. - # HM module is updated but I'm too lazy at this point so we symlink our config instead. - wayland.windowManager.hyprland = { - enable = true; - package = null; - portalPackage = null; - xwayland.enable = true; - configType = "hyprlang"; - systemd.variables = [ "--all" ]; - }; - - home.file = { - ".config/hypr/config".source = - config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/Projects/hypr/config"; - ".config/hypr/hyprland.lua".source = - config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/Projects/hypr/hyprland.lua"; - }; - - home.packages = with pkgs; [ - ags - awww - grim - slurp - hyprshot - wl-clipboard - wl-screenrec - (writeShellScriptBin "hypr-screenshot" '' - hyprshot -m region -r ppm - | satty --filename - - '') - - (writeShellScriptBin "hypr-screenrecord" '' - wl-screenrec -g "$(slurp)" - '') - ]; + flake.modules.homeManager.desktop = { + config, + pkgs, + ... + }: { + # TODO: Hyprland 0.55 switched to Lua-based configuration. + # HM module is updated but I'm too lazy at this point so we symlink our config instead. + wayland.windowManager.hyprland = { + enable = true; + package = null; + portalPackage = null; + xwayland.enable = true; + configType = "hyprlang"; + systemd.variables = ["--all"]; }; + + home.file = { + ".config/hypr/config".source = + config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/Projects/hypr/config"; + ".config/hypr/hyprland.lua".source = + config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/Projects/hypr/hyprland.lua"; + }; + + home.packages = with pkgs; [ + ags + awww + grim + slurp + hyprshot + wl-clipboard + wl-screenrec + (writeShellScriptBin "hypr-screenshot" '' + hyprshot -m region -r ppm - | satty --filename - + '') + + (writeShellScriptBin "hypr-screenrecord" '' + wl-screenrec -g "$(slurp)" + '') + ]; + }; } diff --git a/modules/hm/desktop/lan-mouse.nix b/modules/hm/desktop/lan-mouse.nix index ab17ca9..67afb1b 100644 --- a/modules/hm/desktop/lan-mouse.nix +++ b/modules/hm/desktop/lan-mouse.nix @@ -1,25 +1,21 @@ -{ inputs, ... }: -{ - flake.modules.homeManager.desktop = - { - config, - pkgs, - lib, - ... - }: - with lib; - let +{inputs, ...}: { + flake.modules.homeManager.desktop = { + config, + pkgs, + lib, + ... + }: + with lib; let cfg = config.tnix.services.lan-mouse; - in - { - imports = [ inputs.lan-mouse.homeManagerModules.default ]; + in { + imports = [inputs.lan-mouse.homeManagerModules.default]; options.tnix.services.lan-mouse = { enable = mkEnableOption "Enable Lan-Mouse"; settings = mkOption { - type = (pkgs.formats.toml { }).type; - default = { }; + type = (pkgs.formats.toml {}).type; + default = {}; description = '' TOML configuration for lan-mouse. See for available options. @@ -28,7 +24,6 @@ }; config = mkIf cfg.enable { - programs.lan-mouse = { enable = true; systemd = true; diff --git a/modules/hm/desktop/mango.nix b/modules/hm/desktop/mango.nix index a5d2c87..abbdf75 100644 --- a/modules/hm/desktop/mango.nix +++ b/modules/hm/desktop/mango.nix @@ -1,17 +1,13 @@ -{ inputs, ... }: -{ - flake.modules.homeManager.desktop = - { - config, - pkgs, - lib, - ... - }: - with lib; - let +{inputs, ...}: { + flake.modules.homeManager.desktop = { + config, + pkgs, + lib, + ... + }: + with lib; let cfg = config.tnix.desktop.mangowm; - in - { + in { imports = [ inputs.mango.hmModules.mango ]; @@ -21,12 +17,12 @@ monitorRule = mkOption { type = with types; listOf str; - default = [ ]; + default = []; }; tagRule = mkOption { type = with types; listOf str; - default = [ ]; + default = []; }; }; diff --git a/modules/hm/desktop/mpv.nix b/modules/hm/desktop/mpv.nix index dd199e2..300e47f 100644 --- a/modules/hm/desktop/mpv.nix +++ b/modules/hm/desktop/mpv.nix @@ -1,24 +1,21 @@ { - flake.modules.homeManager.desktop = - { pkgs, ... }: - { - programs.mpv = { - enable = true; + flake.modules.homeManager.desktop = {pkgs, ...}: { + programs.mpv = { + enable = true; - scripts = ( - with pkgs.mpvScripts; - [ - modernz - thumbfast - mpris - mpv-image-viewer.image-positioning - ] - ); + scripts = ( + with pkgs.mpvScripts; [ + modernz + thumbfast + mpris + mpv-image-viewer.image-positioning + ] + ); - config = { - osc = "no"; - border = "no"; - }; + config = { + osc = "no"; + border = "no"; }; }; + }; } diff --git a/modules/hm/desktop/theme.nix b/modules/hm/desktop/theme.nix index edf4475..bba1cf5 100644 --- a/modules/hm/desktop/theme.nix +++ b/modules/hm/desktop/theme.nix @@ -1,32 +1,30 @@ { - flake.modules.homeManager.desktop = - { pkgs, ... }: - { - home.pointerCursor = { - enable = true; - package = pkgs.bibata-cursors; - name = "Bibata-Modern-Ice"; - size = 28; - }; - - qt = { - enable = true; - style.name = "adwaita-dark"; - }; - - gtk = { - enable = true; - theme = { - name = "adw-gtk3-dark"; - package = pkgs.adw-gtk3; - }; - iconTheme = { - package = pkgs.tela-icon-theme; - name = "Tela-black"; - }; - }; - - # Make GTK4/libadwaita apps prefer dark too (they ignore gtk.theme). - dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark"; + flake.modules.homeManager.desktop = {pkgs, ...}: { + home.pointerCursor = { + enable = true; + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Ice"; + size = 28; }; + + qt = { + enable = true; + style.name = "adwaita-dark"; + }; + + gtk = { + enable = true; + theme = { + name = "adw-gtk3-dark"; + package = pkgs.adw-gtk3; + }; + iconTheme = { + package = pkgs.tela-icon-theme; + name = "Tela-black"; + }; + }; + + # Make GTK4/libadwaita apps prefer dark too (they ignore gtk.theme). + dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark"; + }; } diff --git a/modules/hm/desktop/vicinae.nix b/modules/hm/desktop/vicinae.nix index 82da2d3..2058135 100644 --- a/modules/hm/desktop/vicinae.nix +++ b/modules/hm/desktop/vicinae.nix @@ -1,69 +1,64 @@ { - flake.modules.homeManager.desktop = - { - pkgs, - ... - }: - { - programs.vicinae = { + flake.modules.homeManager.desktop = {pkgs, ...}: { + programs.vicinae = { + enable = true; + systemd = { enable = true; - systemd = { - enable = true; - autoStart = true; + autoStart = true; + }; + useLayerShell = true; + + extensions = with pkgs.vicinae-extensions; [ + # @TODO broken in upstream repo + # bluetooth + nix + ssh + awww-switcher + process-manager + pulseaudio + wifi-commander + port-killer + silverbullet + ]; + + settings = { + close_on_focus_loss = true; + consider_preedit = true; + pop_to_root_on_close = true; + favicon_service = "twenty"; + search_files_in_root = true; + font = { + normal = { + size = 10; + family = "JetBrainsMono Nerd Font"; + }; }; - useLayerShell = true; - - extensions = with pkgs.vicinae-extensions; [ - # @TODO broken in upstream repo - # bluetooth - nix - ssh - awww-switcher - process-manager - pulseaudio - wifi-commander - port-killer - silverbullet - ]; - - settings = { - close_on_focus_loss = true; - consider_preedit = true; - pop_to_root_on_close = true; - favicon_service = "twenty"; - search_files_in_root = true; - font = { - normal = { - size = 10; - family = "JetBrainsMono Nerd Font"; - }; + theme = { + light = { + name = "vicinae-light"; + icon_theme = "default"; }; - theme = { - light = { - name = "vicinae-light"; - icon_theme = "default"; - }; - dark = { - name = "vicinae-dark"; - icon_theme = "default"; - }; - }; - launcher_window = { - opacity = 0.98; + dark = { + name = "vicinae-dark"; + icon_theme = "default"; }; + }; + launcher_window = { + opacity = 0.98; + }; - imports = [ "/run/secrets/vicinae.json" ]; + imports = ["/run/secrets/vicinae.json"]; - providers = { - "@sovereign/vicinae-extension-awww-switcher-0" = { - "preferences" = { - "transitionDuration" = "1"; - "transitionType" = "center"; - "wallpaperPath" = "/home/tux/Wallpapers/"; - }; + providers = { + "@sovereign/vicinae-extension-awww-switcher-0" = { + "preferences" = { + "transitionDuration" = "1"; + "transitionType" = "center"; + "wallpaperPath" = "/home/tux/Wallpapers/"; }; }; }; }; }; + }; } diff --git a/modules/hm/desktop/voxtype.nix b/modules/hm/desktop/voxtype.nix index df024a4..75111ed 100644 --- a/modules/hm/desktop/voxtype.nix +++ b/modules/hm/desktop/voxtype.nix @@ -1,5 +1,5 @@ -{ inputs, ... }: { - flake.modules.homeManager.desktop = { pkgs, ... }: { +{inputs, ...}: { + flake.modules.homeManager.desktop = {pkgs, ...}: { imports = [ inputs.voxtype.homeManagerModules.default ]; diff --git a/modules/hm/desktop/wezterm.nix b/modules/hm/desktop/wezterm.nix index 4275b35..68bdb4f 100644 --- a/modules/hm/desktop/wezterm.nix +++ b/modules/hm/desktop/wezterm.nix @@ -1,33 +1,31 @@ { - flake.modules.homeManager.desktop = - { pkgs, ... }: - { - programs.wezterm = { - enable = true; - package = pkgs.wezterm-git; - enableZshIntegration = false; + flake.modules.homeManager.desktop = {pkgs, ...}: { + programs.wezterm = { + enable = true; + package = pkgs.wezterm-git; + enableZshIntegration = false; - extraConfig = '' - local wezterm = require 'wezterm' - local config = {} + extraConfig = '' + local wezterm = require 'wezterm' + local config = {} - config.check_for_updates = false + config.check_for_updates = false - config.window_close_confirmation = 'NeverPrompt' - config.color_scheme = 'Poimandres' - config.colors = { - background = "#0f0f0f" - } - config.enable_tab_bar = false - config.font = wezterm.font_with_fallback { - 'JetBrainsMono Nerd Font', - } - config.font_size = 12.0 - config.window_background_opacity = 1 - config.audible_bell = "Disabled" + config.window_close_confirmation = 'NeverPrompt' + config.color_scheme = 'Poimandres' + config.colors = { + background = "#0f0f0f" + } + config.enable_tab_bar = false + config.font = wezterm.font_with_fallback { + 'JetBrainsMono Nerd Font', + } + config.font_size = 12.0 + config.window_background_opacity = 1 + config.audible_bell = "Disabled" - return config - ''; - }; + return config + ''; }; + }; } diff --git a/modules/hm/gaming/lutris.nix b/modules/hm/gaming/lutris.nix index ba36180..25af490 100644 --- a/modules/hm/gaming/lutris.nix +++ b/modules/hm/gaming/lutris.nix @@ -1,5 +1,5 @@ { - flake.modules.homeManager.desktop = { osConfig, ... }: { + flake.modules.homeManager.desktop = {osConfig, ...}: { programs.lutris = { enable = true; steamPackage = osConfig.programs.steam.package; diff --git a/modules/hm/shell/git.nix b/modules/hm/shell/git.nix index 20264f1..6198988 100644 --- a/modules/hm/shell/git.nix +++ b/modules/hm/shell/git.nix @@ -1,27 +1,25 @@ { - flake.modules.homeManager.shell = - { - userName, - userEmail, - ... - }: - { - programs.git = { - enable = true; - signing = { - key = "~/.ssh/id_ed25519.pub"; - signByDefault = true; - }; - lfs.enable = true; - settings = { - user = { - name = "${userName}"; - email = "${userEmail}"; - }; - init.defaultBranch = "main"; - commit.gpgSign = true; - gpg.format = "ssh"; + flake.modules.homeManager.shell = { + userName, + userEmail, + ... + }: { + programs.git = { + enable = true; + signing = { + key = "~/.ssh/id_ed25519.pub"; + signByDefault = true; + }; + lfs.enable = true; + settings = { + user = { + name = "${userName}"; + email = "${userEmail}"; }; + init.defaultBranch = "main"; + commit.gpgSign = true; + gpg.format = "ssh"; }; }; + }; } diff --git a/modules/hm/shell/misc.nix b/modules/hm/shell/misc.nix index ca35bf1..13bc45f 100644 --- a/modules/hm/shell/misc.nix +++ b/modules/hm/shell/misc.nix @@ -1,17 +1,15 @@ { - flake.modules.homeManager.shell = - { pkgs, ... }: - { - home.packages = with pkgs; [ - systemctl-tui - zip - unzip - pciutils - usbutils - jq - dig - lsof - trok - ]; - }; + flake.modules.homeManager.shell = {pkgs, ...}: { + home.packages = with pkgs; [ + systemctl-tui + zip + unzip + pciutils + usbutils + jq + dig + lsof + trok + ]; + }; } diff --git a/modules/hm/shell/neovim.nix b/modules/hm/shell/neovim.nix index 48508bb..3b2f8ed 100644 --- a/modules/hm/shell/neovim.nix +++ b/modules/hm/shell/neovim.nix @@ -1,40 +1,38 @@ { - flake.modules.homeManager.shell = - { pkgs, ... }: - { - home.file = { - ".config/nvim" = { - recursive = true; - source = "${pkgs.tnvim}"; - }; - }; - - programs = { - neovim = { - enable = true; - defaultEditor = true; - }; - }; - - home = { - packages = with pkgs; [ - python3 - nodejs - bun - pnpm - go - rustup - typescript - neovide - nil - statix - deadnix - alejandra - luarocks - gdu - gcc - wakatime-cli - ]; + flake.modules.homeManager.shell = {pkgs, ...}: { + home.file = { + ".config/nvim" = { + recursive = true; + source = "${pkgs.tnvim}"; }; }; + + programs = { + neovim = { + enable = true; + defaultEditor = true; + }; + }; + + home = { + packages = with pkgs; [ + python3 + nodejs + bun + pnpm + go + rustup + typescript + neovide + nil + statix + deadnix + alejandra + luarocks + gdu + gcc + wakatime-cli + ]; + }; + }; } diff --git a/modules/hm/shell/opencode.nix b/modules/hm/shell/opencode.nix index 3c6bf9b..df0a096 100644 --- a/modules/hm/shell/opencode.nix +++ b/modules/hm/shell/opencode.nix @@ -1,5 +1,5 @@ { - flake.modules.homeManager.shell = { pkgs, ... }: { + flake.modules.homeManager.shell = {pkgs, ...}: { programs.opencode = { enable = true; package = pkgs.opencode-git; @@ -25,7 +25,7 @@ }; }; }; - plugin = [ "@dietrichgebert/ponytail" ]; + plugin = ["@dietrichgebert/ponytail"]; }; }; }; diff --git a/modules/hm/shell/tmux.nix b/modules/hm/shell/tmux.nix index 4593cdd..0235581 100644 --- a/modules/hm/shell/tmux.nix +++ b/modules/hm/shell/tmux.nix @@ -1,155 +1,138 @@ { - flake.modules.homeManager.shell = - { pkgs, ... }: - let - bg = "default"; - fg = "default"; - bg2 = "brightblack"; - fg2 = "white"; - color = c: "#{@${c}}"; + flake.modules.homeManager.shell = {pkgs, ...}: let + bg = "default"; + fg = "default"; + bg2 = "brightblack"; + fg2 = "white"; + color = c: "#{@${c}}"; - indicator = - let - accent = color "indicator_color"; - content = "  "; - in - "#[reverse,fg=${accent}]#{?client_prefix,${content},}"; + indicator = let + accent = color "indicator_color"; + content = "  "; + in "#[reverse,fg=${accent}]#{?client_prefix,${content},}"; - current_window = - let - accent = color "main_accent"; - index = "#[reverse,fg=${accent},bg=${fg}] #I "; - name = "#[fg=${bg2},bg=${fg2}] #W "; - # flags = "#{?window_flags,#{window_flags}, }"; - in - "${index}${name}"; + current_window = let + accent = color "main_accent"; + index = "#[reverse,fg=${accent},bg=${fg}] #I "; + name = "#[fg=${bg2},bg=${fg2}] #W "; + # flags = "#{?window_flags,#{window_flags}, }"; + in "${index}${name}"; - window_status = - let - accent = color "window_color"; - index = "#[reverse,fg=${accent},bg=${fg}] #I "; - name = "#[fg=${bg2},bg=${fg2}] #W "; - # flags = "#{?window_flags,#{window_flags}, }"; - in - "${index}${name}"; + window_status = let + accent = color "window_color"; + index = "#[reverse,fg=${accent},bg=${fg}] #I "; + name = "#[fg=${bg2},bg=${fg2}] #W "; + # flags = "#{?window_flags,#{window_flags}, }"; + in "${index}${name}"; - battery = - let - percentage = pkgs.writeShellScript "percentage" ( - if pkgs.stdenv.isDarwin then - '' - echo $(pmset -g batt | grep -o "[0-9]\+%" | tr '%' ' ') - '' - else - '' - path="/org/freedesktop/UPower/devices/DisplayDevice" - echo $(${pkgs.upower}/bin/upower -i $path | grep -o "[0-9]\+%" | tr '%' ' ') - '' - ); - state = pkgs.writeShellScript "state" ( - if pkgs.stdenv.isDarwin then - '' - echo $(pmset -g batt | awk '{print $4}') - '' - else - '' - path="/org/freedesktop/UPower/devices/DisplayDevice" - echo $(${pkgs.upower}/bin/upower -i $path | grep state | awk '{print $2}') - '' - ); - icon = pkgs.writeShellScript "icon" '' - percentage=$(${percentage}) - state=$(${state}) - if [ "$state" == "charging" ] || [ "$state" == "fully-charged" ]; then echo "󰂄" - elif [ $percentage -ge 75 ]; then echo "󱊣" - elif [ $percentage -ge 50 ]; then echo "󱊢" - elif [ $percentage -ge 25 ]; then echo "󱊡" - elif [ $percentage -ge 0 ]; then echo "󰂎" - fi - ''; - color = pkgs.writeShellScript "color" '' - percentage=$(${percentage}) - state=$(${state}) - if [ "$state" == "charging" ] || [ "$state" == "fully-charged" ]; then echo "green" - elif [ $percentage -ge 75 ]; then echo "green" - elif [ $percentage -ge 50 ]; then echo "${fg2}" - elif [ $percentage -ge 30 ]; then echo "yellow" - elif [ $percentage -ge 0 ]; then echo "red" - fi - ''; - in - "#[fg=#(${color})]#(${icon}) #[fg=${fg}]#(${percentage})%"; + battery = let + percentage = pkgs.writeShellScript "percentage" ( + if pkgs.stdenv.isDarwin + then '' + echo $(pmset -g batt | grep -o "[0-9]\+%" | tr '%' ' ') + '' + else '' + path="/org/freedesktop/UPower/devices/DisplayDevice" + echo $(${pkgs.upower}/bin/upower -i $path | grep -o "[0-9]\+%" | tr '%' ' ') + '' + ); + state = pkgs.writeShellScript "state" ( + if pkgs.stdenv.isDarwin + then '' + echo $(pmset -g batt | awk '{print $4}') + '' + else '' + path="/org/freedesktop/UPower/devices/DisplayDevice" + echo $(${pkgs.upower}/bin/upower -i $path | grep state | awk '{print $2}') + '' + ); + icon = pkgs.writeShellScript "icon" '' + percentage=$(${percentage}) + state=$(${state}) + if [ "$state" == "charging" ] || [ "$state" == "fully-charged" ]; then echo "󰂄" + elif [ $percentage -ge 75 ]; then echo "󱊣" + elif [ $percentage -ge 50 ]; then echo "󱊢" + elif [ $percentage -ge 25 ]; then echo "󱊡" + elif [ $percentage -ge 0 ]; then echo "󰂎" + fi + ''; + color = pkgs.writeShellScript "color" '' + percentage=$(${percentage}) + state=$(${state}) + if [ "$state" == "charging" ] || [ "$state" == "fully-charged" ]; then echo "green" + elif [ $percentage -ge 75 ]; then echo "green" + elif [ $percentage -ge 50 ]; then echo "${fg2}" + elif [ $percentage -ge 30 ]; then echo "yellow" + elif [ $percentage -ge 0 ]; then echo "red" + fi + ''; + in "#[fg=#(${color})]#(${icon}) #[fg=${fg}]#(${percentage})%"; - pwd = - let - accent = color "main_accent"; - icon = "#[fg=${accent}] "; - format = "#[fg=${fg}]#{b:pane_current_path}"; - in - "${icon}${format}"; + pwd = let + accent = color "main_accent"; + icon = "#[fg=${accent}] "; + format = "#[fg=${fg}]#{b:pane_current_path}"; + in "${icon}${format}"; - git = - let - icon = pkgs.writeShellScript "branch" '' - git -C "$1" branch && echo " " - ''; - branch = pkgs.writeShellScript "branch" '' - git -C "$1" rev-parse --abbrev-ref HEAD - ''; - in - "#[fg=magenta]#(${icon} #{pane_current_path})#(${branch} #{pane_current_path})"; + git = let + icon = pkgs.writeShellScript "branch" '' + git -C "$1" branch && echo " " + ''; + branch = pkgs.writeShellScript "branch" '' + git -C "$1" rev-parse --abbrev-ref HEAD + ''; + in "#[fg=magenta]#(${icon} #{pane_current_path})#(${branch} #{pane_current_path})"; - separator = "#[fg=${fg}]|"; - in - { - programs.tmux = { - enable = true; - baseIndex = 1; - escapeTime = 0; - mouse = true; - extraConfig = '' - set-option -sa terminal-overrides ",xterm*:Tc" - set-option -g status-position top - unbind r - bind r source-file ~/.config/tmux/tmux.conf + separator = "#[fg=${fg}]|"; + in { + programs.tmux = { + enable = true; + baseIndex = 1; + escapeTime = 0; + mouse = true; + extraConfig = '' + set-option -sa terminal-overrides ",xterm*:Tc" + set-option -g status-position top + unbind r + bind r source-file ~/.config/tmux/tmux.conf - # remap prefix from C-b to C-Space - # unbind C-b - # set -g prefix C-Space - # bind C-Space send-prefix + # remap prefix from C-b to C-Space + # unbind C-b + # set -g prefix C-Space + # bind C-Space send-prefix - # split panes using | and - - unbind '"' - unbind % - bind | split-window -h - bind - split-window -v + # split panes using | and - + unbind '"' + unbind % + bind | split-window -h + bind - split-window -v - # Start windows and panes at 1, not 0 - set -g base-index 1 - set -g pane-base-index 1 - set-window-option -g pane-base-index 1 - set-option -g renumber-windows on + # Start windows and panes at 1, not 0 + set -g base-index 1 + set -g pane-base-index 1 + set-window-option -g pane-base-index 1 + set-option -g renumber-windows on - # switch panes using Alt-arrow without prefix - bind -n M-Left select-pane -L - bind -n M-Right select-pane -R - bind -n M-Up select-pane -U - bind -n M-Down select-pane -D + # switch panes using Alt-arrow without prefix + bind -n M-Left select-pane -L + bind -n M-Right select-pane -R + bind -n M-Up select-pane -U + bind -n M-Down select-pane -D - set-option -g default-terminal "screen-256color" - set-option -g status-right-length 100 - set-option -g @indicator_color "yellow" - set-option -g @window_color "magenta" - set-option -g @main_accent "blue" - set-option -g pane-active-border fg=black - set-option -g pane-border-style fg=black - set-option -g status-style "bg=${bg} fg=${fg}" - set-option -g status-left "${indicator}" - set-option -g status-right "${git} ${pwd} ${separator} ${battery}" - set-option -g window-status-current-format "${current_window}" - set-option -g window-status-format "${window_status}" - set-option -g window-status-separator "" - ''; - }; + set-option -g default-terminal "screen-256color" + set-option -g status-right-length 100 + set-option -g @indicator_color "yellow" + set-option -g @window_color "magenta" + set-option -g @main_accent "blue" + set-option -g pane-active-border fg=black + set-option -g pane-border-style fg=black + set-option -g status-style "bg=${bg} fg=${fg}" + set-option -g status-left "${indicator}" + set-option -g status-right "${git} ${pwd} ${separator} ${battery}" + set-option -g window-status-current-format "${current_window}" + set-option -g window-status-format "${window_status}" + set-option -g window-status-separator "" + ''; }; + }; } diff --git a/modules/hm/shell/zoxide.nix b/modules/hm/shell/zoxide.nix index 42df138..1155894 100644 --- a/modules/hm/shell/zoxide.nix +++ b/modules/hm/shell/zoxide.nix @@ -2,7 +2,7 @@ flake.modules.homeManager.shell = { programs.zoxide = { enable = true; - options = [ "--cmd cd" ]; + options = ["--cmd cd"]; enableZshIntegration = true; }; }; diff --git a/modules/hm/shell/zsh.nix b/modules/hm/shell/zsh.nix index 56172e9..dd5fb0a 100644 --- a/modules/hm/shell/zsh.nix +++ b/modules/hm/shell/zsh.nix @@ -1,31 +1,28 @@ -{ lib, ... }: -{ - flake.modules.homeManager.shell = - { pkgs, ... }: - { - programs.zsh = { - enable = true; - history = { - append = true; - share = true; - expireDuplicatesFirst = true; - ignoreDups = true; - size = 1000000; - save = 1000000; - path = "$HOME/.local/share/zsh/.zsh_history"; - }; - fastSyntaxHighlighting.enable = true; - autosuggestion.enable = true; - initContent = '' - ${lib.getExe pkgs.fastfetch} - bindkey "^A" vi-beginning-of-line - bindkey "^E" vi-end-of-line - bindkey '^R' fzf-history-widget - - PATH=$PATH:~/.cargo/bin:~/.local/bin - alias stui='systemctl-tui' - alias vim='nvim --clean' - ''; +{lib, ...}: { + flake.modules.homeManager.shell = {pkgs, ...}: { + programs.zsh = { + enable = true; + history = { + append = true; + share = true; + expireDuplicatesFirst = true; + ignoreDups = true; + size = 1000000; + save = 1000000; + path = "$HOME/.local/share/zsh/.zsh_history"; }; + fastSyntaxHighlighting.enable = true; + autosuggestion.enable = true; + initContent = '' + ${lib.getExe pkgs.fastfetch} + bindkey "^A" vi-beginning-of-line + bindkey "^E" vi-end-of-line + bindkey '^R' fzf-history-widget + + PATH=$PATH:~/.cargo/bin:~/.local/bin + alias stui='systemctl-tui' + alias vim='nvim --clean' + ''; }; + }; } diff --git a/modules/hosts/alpha/config.nix b/modules/hosts/alpha/config.nix index 4be5f17..2268a7f 100644 --- a/modules/hosts/alpha/config.nix +++ b/modules/hosts/alpha/config.nix @@ -1,138 +1,138 @@ -{ inputs, config, ... }: { - flake.modules.nixos.alpha = - { - hostName, - userName, - ... - }@innerArgs: - { - imports = - with config.flake.modules.nixos; - [ - boot - networking - virtualisation - services - ] - ++ [ - inputs.trok.nixosModules.default - inputs.tfolio.nixosModules.default - ]; + inputs, + config, + ... +}: { + flake.modules.nixos.alpha = { + hostName, + userName, + ... + } @ innerArgs: { + imports = with config.flake.modules.nixos; + [ + boot + networking + virtualisation + services + ] + ++ [ + inputs.trok.nixosModules.default + inputs.tfolio.nixosModules.default + ]; - tnix = { - boot = { - legacy.enable = true; + tnix = { + boot = { + legacy.enable = true; - impermanence = { - enable = true; + impermanence = { + enable = true; - home = { - directories = [ - ".local/share/nvim" - ".local/share/zsh" - ".local/share/zoxide" - ".local/state/lazygit" - ".local/share/opencode" - ]; - }; - }; - }; - - networking = { - openssh = { - enable = true; - ports = [ - 23 + home = { + directories = [ + ".local/share/nvim" + ".local/share/zsh" + ".local/share/zoxide" + ".local/state/lazygit" + ".local/share/opencode" ]; }; - netbird-client.enable = true; - }; - - services = { - pangolin = { - enable = true; - domain = "pangolin.lab.tux.rs"; - baseDomain = "lab.tux.rs"; - environmentFile = innerArgs.config.sops.secrets."pangolin".path; - }; - - uptime-kuma = { - enable = true; - domain = "status.lab.tux.rs"; - }; - - mediaflow-proxy = { - enable = true; - environmentFile = innerArgs.config.sops.secrets."mediaflow-proxy".path; - }; - - trok = { - enable = true; - }; - }; - - virtualisation = { - docker.enable = true; }; }; - sops.secrets = { - tux-password = { - sopsFile = ./secrets.yaml; - neededForUsers = true; + networking = { + openssh = { + enable = true; + ports = [ + 23 + ]; + }; + netbird-client.enable = true; + }; + + services = { + pangolin = { + enable = true; + domain = "pangolin.lab.tux.rs"; + baseDomain = "lab.tux.rs"; + environmentFile = innerArgs.config.sops.secrets."pangolin".path; }; - gemini-api-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - openrouter-api-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - opencode-go-api-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - netbird-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - "cloudflare-credentials/email" = { - sopsFile = ./secrets.yaml; - }; - - "cloudflare-credentials/dns-api-token" = { - sopsFile = ./secrets.yaml; - }; - - aiostreams = { - sopsFile = ./secrets.yaml; + uptime-kuma = { + enable = true; + domain = "status.lab.tux.rs"; }; mediaflow-proxy = { - sopsFile = ./secrets.yaml; + enable = true; + environmentFile = innerArgs.config.sops.secrets."mediaflow-proxy".path; }; - pangolin = { - sopsFile = ./secrets.yaml; + trok = { + enable = true; }; }; - # --- Networking --- - networking = { - hostName = hostName; - networkmanager.enable = true; - firewall.enable = false; + virtualisation = { + docker.enable = true; }; - - services.tfolio.enable = true; - - system.stateVersion = "26.05"; }; + + sops.secrets = { + tux-password = { + sopsFile = ./secrets.yaml; + neededForUsers = true; + }; + + gemini-api-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + openrouter-api-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + opencode-go-api-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + netbird-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + "cloudflare-credentials/email" = { + sopsFile = ./secrets.yaml; + }; + + "cloudflare-credentials/dns-api-token" = { + sopsFile = ./secrets.yaml; + }; + + aiostreams = { + sopsFile = ./secrets.yaml; + }; + + mediaflow-proxy = { + sopsFile = ./secrets.yaml; + }; + + pangolin = { + sopsFile = ./secrets.yaml; + }; + }; + + # --- Networking --- + networking = { + hostName = hostName; + networkmanager.enable = true; + firewall.enable = false; + }; + + services.tfolio.enable = true; + + system.stateVersion = "26.05"; + }; } diff --git a/modules/hosts/alpha/disko.nix b/modules/hosts/alpha/disko.nix index 3cc0c26..930c62c 100644 --- a/modules/hosts/alpha/disko.nix +++ b/modules/hosts/alpha/disko.nix @@ -1,22 +1,23 @@ -{ inputs, ... }: -{ - flake.modules.nixos.alpha = - { config, lib, ... }: - let - hasOptinPersistence = config.tnix.boot.impermanence.enable; - isLegacy = config.tnix.boot.legacy.enable; - in - { - imports = [ - inputs.disko.nixosModules.disko - ]; +{inputs, ...}: { + flake.modules.nixos.alpha = { + config, + lib, + ... + }: let + hasOptinPersistence = config.tnix.boot.impermanence.enable; + isLegacy = config.tnix.boot.legacy.enable; + in { + imports = [ + inputs.disko.nixosModules.disko + ]; - disko.devices.disk.primary = { - device = "/dev/sda"; - type = "disk"; - content = { - type = "gpt"; - partitions = { + disko.devices.disk.primary = { + device = "/dev/sda"; + type = "disk"; + content = { + type = "gpt"; + partitions = + { ESP = { size = "1G"; type = "EF00"; @@ -36,36 +37,37 @@ content = { type = "btrfs"; # Base subvolumes that always exist - subvolumes = { - "/root" = { - mountOptions = [ - "compress=zstd" - "noatime" - "space_cache=v2" - ]; - mountpoint = "/"; + subvolumes = + { + "/root" = { + mountOptions = [ + "compress=zstd" + "noatime" + "space_cache=v2" + ]; + mountpoint = "/"; + }; + "/nix" = { + mountOptions = [ + "compress=zstd" + "noatime" + "noacl" + "space_cache=v2" + ]; + mountpoint = "/nix"; + }; + } + # Conditionally merge /persist only when impermanence is enabled + // lib.optionalAttrs hasOptinPersistence { + "/persist" = { + mountOptions = [ + "compress=zstd" + "noatime" + "space_cache=v2" + ]; + mountpoint = "/persist"; + }; }; - "/nix" = { - mountOptions = [ - "compress=zstd" - "noatime" - "noacl" - "space_cache=v2" - ]; - mountpoint = "/nix"; - }; - } - # Conditionally merge /persist only when impermanence is enabled - // lib.optionalAttrs hasOptinPersistence { - "/persist" = { - mountOptions = [ - "compress=zstd" - "noatime" - "space_cache=v2" - ]; - mountpoint = "/persist"; - }; - }; }; }; } @@ -76,7 +78,7 @@ type = "EF02"; }; }; - }; }; }; + }; } diff --git a/modules/hosts/alpha/hardware.nix b/modules/hosts/alpha/hardware.nix index 297cffe..1eb14c9 100644 --- a/modules/hosts/alpha/hardware.nix +++ b/modules/hosts/alpha/hardware.nix @@ -1,17 +1,15 @@ { - flake.modules.nixos.alpha = - { - lib, - modulesPath, - system, - ... - }: - { - imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + flake.modules.nixos.alpha = { + lib, + modulesPath, + system, + ... + }: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - networking.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault system; - }; + networking.useDHCP = lib.mkDefault true; + nixpkgs.hostPlatform = lib.mkDefault system; + }; } diff --git a/modules/hosts/arcturus/config.nix b/modules/hosts/arcturus/config.nix index 8629ac4..43054a6 100644 --- a/modules/hosts/arcturus/config.nix +++ b/modules/hosts/arcturus/config.nix @@ -1,165 +1,163 @@ -{ config, ... }: { - flake.modules.nixos.arcturus = - { - pkgs, - hostName, - userName, - ... - }@innerArgs: - { - imports = with config.flake.modules.nixos; [ - boot - networking - virtualisation - services - ]; +{config, ...}: { + flake.modules.nixos.arcturus = { + pkgs, + hostName, + userName, + ... + } @ innerArgs: { + imports = with config.flake.modules.nixos; [ + boot + networking + virtualisation + services + ]; - tnix = { - boot = { - secure-boot.enable = true; + tnix = { + boot = { + secure-boot.enable = true; - impermanence = { - enable = true; + impermanence = { + enable = true; - home = { - directories = [ - "Distrobox" - ".bun" - ".rustup" - ".config/sops" - ".local/share/nvim" - ".local/share/opencode" - ".local/share/zsh" - ".local/share/zoxide" - ".local/state/lazygit" - ]; + home = { + directories = [ + "Distrobox" + ".bun" + ".rustup" + ".config/sops" + ".local/share/nvim" + ".local/share/opencode" + ".local/share/zsh" + ".local/share/zoxide" + ".local/state/lazygit" + ]; - files = [ - ".wakatime.cfg" - ]; - }; + files = [ + ".wakatime.cfg" + ]; }; }; - - networking = { - openssh.enable = true; - netbird-client.enable = true; - newt = { - enable = true; - environmentFile = innerArgs.config.sops.secrets.newt.path; - }; - }; - - services = { - hermes-agent = { - enable = true; - environmentFiles = [ innerArgs.config.sops.secrets.hermes.path ]; - }; - - cyber-tux = { - enable = true; - environmentFile = innerArgs.config.sops.secrets.discord-token.path; - }; - - vaultwarden = { - enable = true; - domain = "bw.lab.tux.rs"; - configurePangolin = true; - }; - - copyparty = { - enable = true; - domain = "files.lab.tux.rs"; - accounts.${userName}.passwordFile = innerArgs.config.sops.secrets.copyparty.path; - volumes = { - "/" = { - path = "/var/lib/copyparty/data"; - access = { - r = "*"; - rwmdgGha = [ userName ]; - }; - }; - }; - configurePangolin = true; - }; - }; - - virtualisation = { - docker.enable = true; - distrobox.enable = true; - }; }; - sops.secrets = { - tux-password = { - sopsFile = ./secrets.yaml; - neededForUsers = true; - }; - - discord-token = { - sopsFile = ./secrets.yaml; - }; - - gemini-api-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - openrouter-api-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - opencode-go-api-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - netbird-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - + networking = { + openssh.enable = true; + netbird-client.enable = true; newt = { - sopsFile = ./secrets.yaml; - owner = userName; + enable = true; + environmentFile = innerArgs.config.sops.secrets.newt.path; + }; + }; + + services = { + hermes-agent = { + enable = true; + environmentFiles = [innerArgs.config.sops.secrets.hermes.path]; + }; + + cyber-tux = { + enable = true; + environmentFile = innerArgs.config.sops.secrets.discord-token.path; + }; + + vaultwarden = { + enable = true; + domain = "bw.lab.tux.rs"; + configurePangolin = true; }; copyparty = { - sopsFile = ./secrets.yaml; - owner = innerArgs.config.services.copyparty.user; - }; - - hermes = { - sopsFile = ./secrets.yaml; - }; - }; - - # --- Networking --- - networking = { - hostName = hostName; - networkmanager = { enable = true; - wifi.backend = "iwd"; - }; - wireless.iwd = { - enable = true; - settings = { - Network = { - EnableIPv6 = true; - }; - Settings = { - AutoConnect = true; + domain = "files.lab.tux.rs"; + accounts.${userName}.passwordFile = innerArgs.config.sops.secrets.copyparty.path; + volumes = { + "/" = { + path = "/var/lib/copyparty/data"; + access = { + r = "*"; + rwmdgGha = [userName]; + }; }; }; + configurePangolin = true; }; - firewall.enable = false; }; - environment.systemPackages = with pkgs; [ - impala - ]; - - system.stateVersion = "26.05"; + virtualisation = { + docker.enable = true; + distrobox.enable = true; + }; }; + + sops.secrets = { + tux-password = { + sopsFile = ./secrets.yaml; + neededForUsers = true; + }; + + discord-token = { + sopsFile = ./secrets.yaml; + }; + + gemini-api-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + openrouter-api-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + opencode-go-api-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + netbird-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + newt = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + copyparty = { + sopsFile = ./secrets.yaml; + owner = innerArgs.config.services.copyparty.user; + }; + + hermes = { + sopsFile = ./secrets.yaml; + }; + }; + + # --- Networking --- + networking = { + hostName = hostName; + networkmanager = { + enable = true; + wifi.backend = "iwd"; + }; + wireless.iwd = { + enable = true; + settings = { + Network = { + EnableIPv6 = true; + }; + Settings = { + AutoConnect = true; + }; + }; + }; + firewall.enable = false; + }; + + environment.systemPackages = with pkgs; [ + impala + ]; + + system.stateVersion = "26.05"; + }; } diff --git a/modules/hosts/arcturus/disko.nix b/modules/hosts/arcturus/disko.nix index a426148..c2cf10b 100644 --- a/modules/hosts/arcturus/disko.nix +++ b/modules/hosts/arcturus/disko.nix @@ -1,41 +1,42 @@ -{ inputs, ... }: -{ - flake.modules.nixos.arcturus = - { config, lib, ... }: - let - hasOptinPersistence = config.tnix.boot.impermanence.enable; - in - { - imports = [ - inputs.disko.nixosModules.disko - ]; +{inputs, ...}: { + flake.modules.nixos.arcturus = { + config, + lib, + ... + }: let + hasOptinPersistence = config.tnix.boot.impermanence.enable; + in { + imports = [ + inputs.disko.nixosModules.disko + ]; - disko.devices.disk.primary = { - device = "/dev/nvme0n1"; - type = "disk"; - content = { - type = "gpt"; - partitions = { - ESP = { - size = "1G"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ - "defaults" - "umask=0077" - ]; - }; + disko.devices.disk.primary = { + device = "/dev/nvme0n1"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "1G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "defaults" + "umask=0077" + ]; }; - root = { - size = "100%"; - type = "8300"; - content = { - type = "btrfs"; - # Base subvolumes that always exist - subvolumes = { + }; + root = { + size = "100%"; + type = "8300"; + content = { + type = "btrfs"; + # Base subvolumes that always exist + subvolumes = + { "/root" = { mountOptions = [ "compress=zstd" @@ -65,10 +66,10 @@ mountpoint = "/persist"; }; }; - }; }; }; }; }; }; + }; } diff --git a/modules/hosts/arcturus/hardware.nix b/modules/hosts/arcturus/hardware.nix index 8648393..a1069d2 100644 --- a/modules/hosts/arcturus/hardware.nix +++ b/modules/hosts/arcturus/hardware.nix @@ -1,36 +1,33 @@ -{ config, ... }: -{ - flake.modules.nixos.arcturus = - { - lib, - pkgs, - system, - ... - }@innerArgs: - { - imports = with config.flake.modules.nixos; [ - hardware - ]; +{config, ...}: { + flake.modules.nixos.arcturus = { + lib, + pkgs, + system, + ... + } @ innerArgs: { + imports = with config.flake.modules.nixos; [ + hardware + ]; - boot.initrd.availableKernelModules = [ - "nvme" - "xhci_pci" - "ahci" - "usbhid" - "usb_storage" - "sd_mod" - ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usbhid" + "usb_storage" + "sd_mod" + ]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; - hardware.cpu.amd.updateMicrocode = lib.mkDefault innerArgs.config.hardware.enableRedistributableFirmware; + hardware.cpu.amd.updateMicrocode = lib.mkDefault innerArgs.config.hardware.enableRedistributableFirmware; - networking.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault system; + networking.useDHCP = lib.mkDefault true; + nixpkgs.hostPlatform = lib.mkDefault system; - environment.systemPackages = with pkgs; [ - nvtopPackages.amd - ]; - }; + environment.systemPackages = with pkgs; [ + nvtopPackages.amd + ]; + }; } diff --git a/modules/hosts/canopus/config.nix b/modules/hosts/canopus/config.nix index 55e7e4b..dc2f795 100644 --- a/modules/hosts/canopus/config.nix +++ b/modules/hosts/canopus/config.nix @@ -1,141 +1,139 @@ -{ config, ... }: { - flake.modules.nixos.canopus = - { - pkgs, - hostName, - userName, - ... - }: - { - imports = with config.flake.modules.nixos; [ - boot - networking - desktop - gaming - virtualisation - ]; +{config, ...}: { + flake.modules.nixos.canopus = { + pkgs, + hostName, + userName, + ... + }: { + imports = with config.flake.modules.nixos; [ + boot + networking + desktop + gaming + virtualisation + ]; - tnix = { - boot = { - secure-boot.enable = true; + tnix = { + boot = { + secure-boot.enable = true; - impermanence = { - enable = true; + impermanence = { + enable = true; - home = { - directories = [ - "Distrobox" - ".steam" - ".bun" - ".rustup" - ".cache/awww" - ".config/BraveSoftware" - ".config/zed" - ".config/Vencord" - ".config/vesktop" - ".config/sops" - ".config/obs-studio" - ".config/easyeffects" - ".config/DankMaterialShell" - ".local/share/Steam" - ".local/share/lutris" - ".local/share/net.lutris.Lutris" - ".local/share/nvim" - ".local/share/opencode" - ".local/share/zsh" - ".local/share/zoxide" - ".local/share/voxtype" - ".local/state/lazygit" - ".local/share/vicinae" - ".local/share/TelegramDesktop" - ".local/share/GalaxyBudsClient" - ".local/state/serpantinum" - ".local/share/zed" - ]; + home = { + directories = [ + "Distrobox" + ".steam" + ".bun" + ".rustup" + ".cache/awww" + ".config/BraveSoftware" + ".config/zed" + ".config/Vencord" + ".config/vesktop" + ".config/sops" + ".config/obs-studio" + ".config/easyeffects" + ".config/DankMaterialShell" + ".local/share/Steam" + ".local/share/lutris" + ".local/share/net.lutris.Lutris" + ".local/share/nvim" + ".local/share/opencode" + ".local/share/zsh" + ".local/share/zoxide" + ".local/share/voxtype" + ".local/state/lazygit" + ".local/share/vicinae" + ".local/share/TelegramDesktop" + ".local/share/GalaxyBudsClient" + ".local/state/serpantinum" + ".local/share/zed" + ]; - files = [ - ".wakatime.cfg" - ]; - }; + files = [ + ".wakatime.cfg" + ]; }; }; - - networking = { - openssh.enable = true; - netbird-client.enable = true; - }; - - virtualisation = { - docker.enable = true; - docker.nvidia.enable = false; - qemu.enable = true; - waydroid.enable = true; - distrobox.enable = true; - }; }; - sops.secrets = { - tux-password = { - sopsFile = ./secrets.yaml; - neededForUsers = true; - }; - - gemini-api-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - openrouter-api-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - opencode-go-api-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - netbird-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - vicinae-json = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - }; - - # --- Networking --- networking = { - hostName = hostName; - networkmanager = { - enable = true; - wifi.backend = "iwd"; - }; - wireless.iwd = { - enable = true; - settings = { - Network = { - EnableIPv6 = true; - }; - Settings = { - AutoConnect = true; - }; - }; - }; - firewall.enable = false; + openssh.enable = true; + netbird-client.enable = true; }; - environment.systemPackages = with pkgs; [ - davinci-resolve - telegram-desktop - galaxy-buds-client - impala - ]; - - # !!! DO NOT CHANGE THIS !!! - # This should match the version used at initial install. - system.stateVersion = "26.05"; + virtualisation = { + docker.enable = true; + docker.nvidia.enable = false; + qemu.enable = true; + waydroid.enable = true; + distrobox.enable = true; + }; }; + + sops.secrets = { + tux-password = { + sopsFile = ./secrets.yaml; + neededForUsers = true; + }; + + gemini-api-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + openrouter-api-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + opencode-go-api-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + netbird-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + vicinae-json = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + }; + + # --- Networking --- + networking = { + hostName = hostName; + networkmanager = { + enable = true; + wifi.backend = "iwd"; + }; + wireless.iwd = { + enable = true; + settings = { + Network = { + EnableIPv6 = true; + }; + Settings = { + AutoConnect = true; + }; + }; + }; + firewall.enable = false; + }; + + environment.systemPackages = with pkgs; [ + davinci-resolve + telegram-desktop + galaxy-buds-client + impala + ]; + + # !!! DO NOT CHANGE THIS !!! + # This should match the version used at initial install. + system.stateVersion = "26.05"; + }; } diff --git a/modules/hosts/canopus/disko.nix b/modules/hosts/canopus/disko.nix index ea9e61b..795d5b6 100644 --- a/modules/hosts/canopus/disko.nix +++ b/modules/hosts/canopus/disko.nix @@ -1,49 +1,50 @@ -{ inputs, ... }: -{ - flake.modules.nixos.canopus = - { config, lib, ... }: - let - hasOptinPersistence = config.tnix.boot.impermanence.enable; - in - { - imports = [ - inputs.disko.nixosModules.disko - ]; +{inputs, ...}: { + flake.modules.nixos.canopus = { + config, + lib, + ... + }: let + hasOptinPersistence = config.tnix.boot.impermanence.enable; + in { + imports = [ + inputs.disko.nixosModules.disko + ]; - disko.devices.disk.primary = { - device = "/dev/nvme0n1"; - type = "disk"; - content = { - type = "gpt"; - partitions = { - ESP = { - size = "1G"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ - "defaults" - "umask=0077" - ]; - }; + disko.devices.disk.primary = { + device = "/dev/nvme0n1"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "1G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "defaults" + "umask=0077" + ]; }; - swap = { - size = "32G"; - content = { - type = "swap"; - discardPolicy = "both"; - resumeDevice = true; - }; + }; + swap = { + size = "32G"; + content = { + type = "swap"; + discardPolicy = "both"; + resumeDevice = true; }; - root = { - size = "100%"; - type = "8300"; - content = { - type = "btrfs"; - # Base subvolumes that always exist - subvolumes = { + }; + root = { + size = "100%"; + type = "8300"; + content = { + type = "btrfs"; + # Base subvolumes that always exist + subvolumes = + { "/root" = { mountOptions = [ "compress=zstd" @@ -73,10 +74,10 @@ mountpoint = "/persist"; }; }; - }; }; }; }; }; }; + }; } diff --git a/modules/hosts/canopus/hardware.nix b/modules/hosts/canopus/hardware.nix index 422e375..958e8c1 100644 --- a/modules/hosts/canopus/hardware.nix +++ b/modules/hosts/canopus/hardware.nix @@ -1,150 +1,150 @@ -{ inputs, config, ... }: { - flake.modules.nixos.canopus = - { - lib, - pkgs, - system, - ... - }@innerArgs: - { - imports = - with config.flake.modules.nixos; - [ - hardware - ] - ++ [ - inputs.nixos-hardware.nixosModules.asus-zephyrus-ga503 - inputs.cardwire.nixosModules.default - ]; - - boot.kernelParams = [ "nvidia-drm.modeset=1" ]; - boot.initrd.availableKernelModules = [ - "nvme" - "xhci_pci" - "ahci" - "usbhid" - "usb_storage" - "sd_mod" + inputs, + config, + ... +}: { + flake.modules.nixos.canopus = { + lib, + pkgs, + system, + ... + } @ innerArgs: { + imports = with config.flake.modules.nixos; + [ + hardware + ] + ++ [ + inputs.nixos-hardware.nixosModules.asus-zephyrus-ga503 + inputs.cardwire.nixosModules.default ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - hardware = { - nvidia = { - modesetting.enable = true; - open = false; - nvidiaSettings = true; - }; + boot.kernelParams = ["nvidia-drm.modeset=1"]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usbhid" + "usb_storage" + "sd_mod" + ]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; - cpu.amd.updateMicrocode = lib.mkDefault innerArgs.config.hardware.enableRedistributableFirmware; + hardware = { + nvidia = { + modesetting.enable = true; + open = false; + nvidiaSettings = true; }; - services = { - xserver.videoDrivers = [ "nvidia" ]; - power-profiles-daemon.enable = true; - upower.enable = true; - - cardwire = { - enable = true; - settings = { - auto_apply_gpu_state = true; - experimental_nvidia_block = true; - battery_auto_switch = true; - battery_auto_switch_mode = "hybrid"; - }; - }; - - asusd = { - enable = true; - asusdConfig.text = '' - ( - charge_control_end_threshold: 80, - disable_nvidia_powerd_on_battery: true, - ac_command: "", - bat_command: "", - - platform_profile_linked_epp: true, - platform_profile_on_battery: Quiet, - platform_profile_on_ac: Performance, - - change_platform_profile_on_battery: true, - change_platform_profile_on_ac: true, - - profile_quiet_epp: Power, - profile_balanced_epp: BalancePower, - profile_custom_epp: Performance, - profile_performance_epp: Performance, - - ac_profile_tunings: {}, - dc_profile_tunings: {}, - armoury_settings: {}, - ) - ''; - profileConfig.text = '' - ( - active_profile: Quiet, - ) - ''; - fanCurvesConfig.text = '' - ( - profiles: ( - balanced: [ - ( - fan: CPU, - pwm: (20, 40, 60, 85, 110, 140, 170, 200), - temp: (45, 55, 62, 68, 74, 80, 86, 92), - enabled: true, - ), - ( - fan: GPU, - pwm: (20, 40, 60, 85, 110, 140, 170, 200), - temp: (45, 55, 62, 68, 74, 80, 86, 92), - enabled: true, - ), - ], - performance: [ - ( - fan: CPU, - pwm: (35, 60, 90, 120, 150, 180, 220, 255), - temp: (45, 55, 62, 68, 74, 80, 86, 92), - enabled: true, - ), - ( - fan: GPU, - pwm: (35, 60, 90, 120, 150, 180, 220, 255), - temp: (45, 55, 62, 68, 74, 80, 86, 92), - enabled: true, - ), - ], - quiet: [ - ( - fan: CPU, - pwm: (0, 10, 20, 35, 55, 80, 110, 140), - temp: (45, 55, 62, 68, 74, 80, 86, 92), - enabled: true, - ), - ( - fan: GPU, - pwm: (0, 10, 20, 35, 55, 80, 110, 140), - temp: (45, 55, 62, 68, 74, 80, 86, 92), - enabled: true, - ), - ], - custom: [], - ), - ) - ''; - }; - }; - - networking.useDHCP = lib.mkDefault true; - nixpkgs.config.cudaSupport = true; - nixpkgs.hostPlatform = lib.mkDefault system; - - environment.systemPackages = with pkgs; [ - nvtopPackages.full - ]; + cpu.amd.updateMicrocode = lib.mkDefault innerArgs.config.hardware.enableRedistributableFirmware; }; + + services = { + xserver.videoDrivers = ["nvidia"]; + power-profiles-daemon.enable = true; + upower.enable = true; + + cardwire = { + enable = true; + settings = { + auto_apply_gpu_state = true; + experimental_nvidia_block = true; + battery_auto_switch = true; + battery_auto_switch_mode = "hybrid"; + }; + }; + + asusd = { + enable = true; + asusdConfig.text = '' + ( + charge_control_end_threshold: 80, + disable_nvidia_powerd_on_battery: true, + ac_command: "", + bat_command: "", + + platform_profile_linked_epp: true, + platform_profile_on_battery: Quiet, + platform_profile_on_ac: Performance, + + change_platform_profile_on_battery: true, + change_platform_profile_on_ac: true, + + profile_quiet_epp: Power, + profile_balanced_epp: BalancePower, + profile_custom_epp: Performance, + profile_performance_epp: Performance, + + ac_profile_tunings: {}, + dc_profile_tunings: {}, + armoury_settings: {}, + ) + ''; + profileConfig.text = '' + ( + active_profile: Quiet, + ) + ''; + fanCurvesConfig.text = '' + ( + profiles: ( + balanced: [ + ( + fan: CPU, + pwm: (20, 40, 60, 85, 110, 140, 170, 200), + temp: (45, 55, 62, 68, 74, 80, 86, 92), + enabled: true, + ), + ( + fan: GPU, + pwm: (20, 40, 60, 85, 110, 140, 170, 200), + temp: (45, 55, 62, 68, 74, 80, 86, 92), + enabled: true, + ), + ], + performance: [ + ( + fan: CPU, + pwm: (35, 60, 90, 120, 150, 180, 220, 255), + temp: (45, 55, 62, 68, 74, 80, 86, 92), + enabled: true, + ), + ( + fan: GPU, + pwm: (35, 60, 90, 120, 150, 180, 220, 255), + temp: (45, 55, 62, 68, 74, 80, 86, 92), + enabled: true, + ), + ], + quiet: [ + ( + fan: CPU, + pwm: (0, 10, 20, 35, 55, 80, 110, 140), + temp: (45, 55, 62, 68, 74, 80, 86, 92), + enabled: true, + ), + ( + fan: GPU, + pwm: (0, 10, 20, 35, 55, 80, 110, 140), + temp: (45, 55, 62, 68, 74, 80, 86, 92), + enabled: true, + ), + ], + custom: [], + ), + ) + ''; + }; + }; + + networking.useDHCP = lib.mkDefault true; + nixpkgs.config.cudaSupport = true; + nixpkgs.hostPlatform = lib.mkDefault system; + + environment.systemPackages = with pkgs; [ + nvtopPackages.full + ]; + }; } diff --git a/modules/hosts/canopus/home.nix b/modules/hosts/canopus/home.nix index c9bd1dc..faca549 100644 --- a/modules/hosts/canopus/home.nix +++ b/modules/hosts/canopus/home.nix @@ -1,6 +1,5 @@ -{ config, ... }: -{ - flake.modules.homeManager.canopus = { pkgs, ... }: { +{config, ...}: { + flake.modules.homeManager.canopus = {pkgs, ...}: { imports = with config.flake.modules.homeManager; [ desktop ]; @@ -27,8 +26,7 @@ enable = true; settings = { authorized_fingerprints = { - "f4:4b:17:61:f7:01:a4:a2:e1:c7:8c:1c:7a:f3:8b:87:14:3d:05:3d:a0:8b:cc:e7:88:d8:d8:d2:a4:c2:75:8b" = - "sirius"; + "f4:4b:17:61:f7:01:a4:a2:e1:c7:8c:1c:7a:f3:8b:87:14:3d:05:3d:a0:8b:cc:e7:88:d8:d8:d2:a4:c2:75:8b" = "sirius"; }; }; }; @@ -42,7 +40,7 @@ position = "0x0", scale = "1", disabled = false - })' && + })' && hyprctl eval 'hl.monitor({ output = "HDMI-A-1", mode = "preferred", @@ -58,7 +56,7 @@ position = "0x0", scale = "1", disabled = false - })' && + })' && hyprctl eval 'hl.monitor({ output = "HDMI-A-1", mode = "preferred", @@ -71,7 +69,7 @@ hyprctl eval 'hl.monitor({ output = "eDP-1", disabled = true - })' && + })' && hyprctl eval 'hl.monitor({ output = "HDMI-A-1", mode = "preferred", diff --git a/modules/hosts/sirius/config.nix b/modules/hosts/sirius/config.nix index 2372d1f..0f038ce 100644 --- a/modules/hosts/sirius/config.nix +++ b/modules/hosts/sirius/config.nix @@ -1,140 +1,138 @@ -{ config, ... }: { - flake.modules.nixos.sirius = - { - pkgs, - hostName, - userName, - ... - }: - { - imports = with config.flake.modules.nixos; [ - boot - networking - desktop - gaming - virtualisation - ]; +{config, ...}: { + flake.modules.nixos.sirius = { + pkgs, + hostName, + userName, + ... + }: { + imports = with config.flake.modules.nixos; [ + boot + networking + desktop + gaming + virtualisation + ]; - tnix = { - boot = { - secure-boot.enable = true; + tnix = { + boot = { + secure-boot.enable = true; - impermanence = { - enable = true; + impermanence = { + enable = true; - home = { - directories = [ - "Distrobox" - ".bun" - ".rustup" - ".steam" - ".cache/awww" - ".config/BraveSoftware" - ".config/zed" - ".config/Vencord" - ".config/vesktop" - ".config/sops" - ".config/obs-studio" - ".config/easyeffects" - ".config/DankMaterialShell" - ".local/share/Steam" - ".local/share/lutris" - ".local/share/net.lutris.Lutris" - ".local/share/nvim" - ".local/share/opencode" - ".local/share/zsh" - ".local/share/zoxide" - ".local/share/voxtype" - ".local/state/lazygit" - ".local/share/vicinae" - ".local/share/TelegramDesktop" - ".local/state/serpantinum" - ".local/share/zed" - ]; + home = { + directories = [ + "Distrobox" + ".bun" + ".rustup" + ".steam" + ".cache/awww" + ".config/BraveSoftware" + ".config/zed" + ".config/Vencord" + ".config/vesktop" + ".config/sops" + ".config/obs-studio" + ".config/easyeffects" + ".config/DankMaterialShell" + ".local/share/Steam" + ".local/share/lutris" + ".local/share/net.lutris.Lutris" + ".local/share/nvim" + ".local/share/opencode" + ".local/share/zsh" + ".local/share/zoxide" + ".local/share/voxtype" + ".local/state/lazygit" + ".local/share/vicinae" + ".local/share/TelegramDesktop" + ".local/state/serpantinum" + ".local/share/zed" + ]; - files = [ - ".wakatime.cfg" - ".config/lan-mouse/lan-mouse.pem" - ]; - }; + files = [ + ".wakatime.cfg" + ".config/lan-mouse/lan-mouse.pem" + ]; }; }; - - networking = { - openssh.enable = true; - netbird-client.enable = true; - }; - - virtualisation = { - docker.enable = true; - docker.nvidia.enable = true; - qemu.enable = true; - waydroid.enable = true; - distrobox.enable = true; - }; }; - sops.secrets = { - tux-password = { - sopsFile = ./secrets.yaml; - neededForUsers = true; - }; - - gemini-api-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - openrouter-api-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - opencode-go-api-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - netbird-key = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - - vicinae-json = { - sopsFile = ./secrets.yaml; - owner = userName; - }; - }; - - # --- Networking --- networking = { - hostName = hostName; - networkmanager = { - enable = true; - wifi.backend = "iwd"; - }; - wireless.iwd = { - enable = true; - settings = { - Network = { - EnableIPv6 = true; - }; - Settings = { - AutoConnect = true; - }; - }; - }; - firewall.enable = false; + openssh.enable = true; + netbird-client.enable = true; }; - environment.systemPackages = with pkgs; [ - davinci-resolve - telegram-desktop - impala - ]; - - # !!! DO NOT CHANGE THIS !!! - # This should match the version used at initial install. - system.stateVersion = "26.05"; + virtualisation = { + docker.enable = true; + docker.nvidia.enable = true; + qemu.enable = true; + waydroid.enable = true; + distrobox.enable = true; + }; }; + + sops.secrets = { + tux-password = { + sopsFile = ./secrets.yaml; + neededForUsers = true; + }; + + gemini-api-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + openrouter-api-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + opencode-go-api-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + netbird-key = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + + vicinae-json = { + sopsFile = ./secrets.yaml; + owner = userName; + }; + }; + + # --- Networking --- + networking = { + hostName = hostName; + networkmanager = { + enable = true; + wifi.backend = "iwd"; + }; + wireless.iwd = { + enable = true; + settings = { + Network = { + EnableIPv6 = true; + }; + Settings = { + AutoConnect = true; + }; + }; + }; + firewall.enable = false; + }; + + environment.systemPackages = with pkgs; [ + davinci-resolve + telegram-desktop + impala + ]; + + # !!! DO NOT CHANGE THIS !!! + # This should match the version used at initial install. + system.stateVersion = "26.05"; + }; } diff --git a/modules/hosts/sirius/disko.nix b/modules/hosts/sirius/disko.nix index 7704fb5..41ef73d 100644 --- a/modules/hosts/sirius/disko.nix +++ b/modules/hosts/sirius/disko.nix @@ -1,49 +1,50 @@ -{ inputs, ... }: -{ - flake.modules.nixos.sirius = - { config, lib, ... }: - let - hasOptinPersistence = config.tnix.boot.impermanence.enable; - in - { - imports = [ - inputs.disko.nixosModules.disko - ]; +{inputs, ...}: { + flake.modules.nixos.sirius = { + config, + lib, + ... + }: let + hasOptinPersistence = config.tnix.boot.impermanence.enable; + in { + imports = [ + inputs.disko.nixosModules.disko + ]; - disko.devices.disk.primary = { - device = "/dev/nvme1n1"; - type = "disk"; - content = { - type = "gpt"; - partitions = { - ESP = { - size = "1G"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ - "defaults" - "umask=0077" - ]; - }; + disko.devices.disk.primary = { + device = "/dev/nvme1n1"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "1G"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ + "defaults" + "umask=0077" + ]; }; - swap = { - size = "70G"; - content = { - type = "swap"; - discardPolicy = "both"; - resumeDevice = true; - }; + }; + swap = { + size = "70G"; + content = { + type = "swap"; + discardPolicy = "both"; + resumeDevice = true; }; - root = { - size = "100%"; - type = "8300"; - content = { - type = "btrfs"; - # Base subvolumes that always exist - subvolumes = { + }; + root = { + size = "100%"; + type = "8300"; + content = { + type = "btrfs"; + # Base subvolumes that always exist + subvolumes = + { "/root" = { mountOptions = [ "compress=zstd" @@ -73,10 +74,10 @@ mountpoint = "/persist"; }; }; - }; }; }; }; }; }; + }; } diff --git a/modules/hosts/sirius/hardware.nix b/modules/hosts/sirius/hardware.nix index 313e615..c8da5b8 100644 --- a/modules/hosts/sirius/hardware.nix +++ b/modules/hosts/sirius/hardware.nix @@ -1,61 +1,61 @@ -{ inputs, config, ... }: { - flake.modules.nixos.sirius = - { - lib, - pkgs, - system, - ... - }@innerArgs: - { - imports = - with config.flake.modules.nixos; - [ - hardware - ] - ++ [ - inputs.cardwire.nixosModules.default - ]; - - boot.kernelParams = [ "nvidia-drm.modeset=1" ]; - boot.initrd.availableKernelModules = [ - "nvme" - "xhci_pci" - "ahci" - "usbhid" - "usb_storage" - "sd_mod" + inputs, + config, + ... +}: { + flake.modules.nixos.sirius = { + lib, + pkgs, + system, + ... + } @ innerArgs: { + imports = with config.flake.modules.nixos; + [ + hardware + ] + ++ [ + inputs.cardwire.nixosModules.default ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - hardware = { - nvidia = { - modesetting.enable = true; - open = false; - nvidiaSettings = true; - }; + boot.kernelParams = ["nvidia-drm.modeset=1"]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usbhid" + "usb_storage" + "sd_mod" + ]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; - cpu.amd.updateMicrocode = lib.mkDefault innerArgs.config.hardware.enableRedistributableFirmware; + hardware = { + nvidia = { + modesetting.enable = true; + open = false; + nvidiaSettings = true; }; - services = { - xserver.videoDrivers = [ "nvidia" ]; - power-profiles-daemon.enable = true; - - cardwire = { - enable = true; - settings.auto_apply_gpu_state = true; - }; - }; - - networking.useDHCP = lib.mkDefault true; - nixpkgs.config.cudaSupport = true; - nixpkgs.hostPlatform = lib.mkDefault system; - - environment.systemPackages = with pkgs; [ - nvtopPackages.full - ]; + cpu.amd.updateMicrocode = lib.mkDefault innerArgs.config.hardware.enableRedistributableFirmware; }; + + services = { + xserver.videoDrivers = ["nvidia"]; + power-profiles-daemon.enable = true; + + cardwire = { + enable = true; + settings.auto_apply_gpu_state = true; + }; + }; + + networking.useDHCP = lib.mkDefault true; + nixpkgs.config.cudaSupport = true; + nixpkgs.hostPlatform = lib.mkDefault system; + + environment.systemPackages = with pkgs; [ + nvtopPackages.full + ]; + }; } diff --git a/modules/hosts/sirius/home.nix b/modules/hosts/sirius/home.nix index 143d2f0..ac8fdf8 100644 --- a/modules/hosts/sirius/home.nix +++ b/modules/hosts/sirius/home.nix @@ -1,5 +1,4 @@ -{ config, ... }: -{ +{config, ...}: { flake.modules.homeManager.sirius = { imports = with config.flake.modules.homeManager; [ desktop @@ -45,7 +44,7 @@ position = "bottom"; hostname = "canopus"; activate_on_startup = true; - ips = [ "192.168.8.2" ]; + ips = ["192.168.8.2"]; } ]; }; diff --git a/modules/hosts/vega/config.nix b/modules/hosts/vega/config.nix index d115df5..fde28c5 100644 --- a/modules/hosts/vega/config.nix +++ b/modules/hosts/vega/config.nix @@ -1,56 +1,51 @@ -{ config, ... }: -{ - flake.modules.nixOnDroid.vega = - { - pkgs, - userEmail, - ... - }: - { - imports = with config.flake.modules.nixOnDroid; [ - networking +{config, ...}: { + flake.modules.nixOnDroid.vega = { + pkgs, + userEmail, + ... + }: { + imports = with config.flake.modules.nixOnDroid; [ + networking + ]; + + # @TODO: Broken currently + # android-integration.am.enable = true; + # android-integration.termux-open-url.enable = true; + # android-integration.xdg-open.enable = true; + # android-integration.termux-setup-storage.enable = true; + # android-integration.termux-reload-settings.enable = true; + + terminal.font = let + firacode = pkgs.nerd-fonts.fira-code; + fontPath = "share/fonts/truetype/NerdFonts/FiraCode/FiraCodeNerdFont-Regular.ttf"; + in "${firacode}/${fontPath}"; + + time.timeZone = "Asia/Kolkata"; + + tnix.networking.openssh = { + enable = true; + ports = [8033]; + authorizedKeys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+OzPUe2ECPC929DqpkM39tl/vdNAXfsRnmrGfR+X3D ${userEmail}" ]; - - # @TODO: Broken currently - # android-integration.am.enable = true; - # android-integration.termux-open-url.enable = true; - # android-integration.xdg-open.enable = true; - # android-integration.termux-setup-storage.enable = true; - # android-integration.termux-reload-settings.enable = true; - - terminal.font = - let - firacode = pkgs.nerd-fonts.fira-code; - fontPath = "share/fonts/truetype/NerdFonts/FiraCode/FiraCodeNerdFont-Regular.ttf"; - in - "${firacode}/${fontPath}"; - - time.timeZone = "Asia/Kolkata"; - - tnix.networking.openssh = { - enable = true; - ports = [ 8033 ]; - authorizedKeys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+OzPUe2ECPC929DqpkM39tl/vdNAXfsRnmrGfR+X3D ${userEmail}" - ]; - }; - - user = { - uid = 10481; - gid = 10481; - shell = "${pkgs.zsh}/bin/zsh"; - }; - - environment.etcBackupExtension = ".backup"; - environment.motd = ""; - environment.packages = with pkgs; [ - ncurses - procps - util-linux - rsync - gnutar - ]; - - system.stateVersion = "24.05"; }; + + user = { + uid = 10481; + gid = 10481; + shell = "${pkgs.zsh}/bin/zsh"; + }; + + environment.etcBackupExtension = ".backup"; + environment.motd = ""; + environment.packages = with pkgs; [ + ncurses + procps + util-linux + rsync + gnutar + ]; + + system.stateVersion = "24.05"; + }; } diff --git a/modules/hosts/vega/home.nix b/modules/hosts/vega/home.nix index 8d219c1..a944742 100644 --- a/modules/hosts/vega/home.nix +++ b/modules/hosts/vega/home.nix @@ -1,5 +1,4 @@ -{ lib, ... }: -{ +{lib, ...}: { flake.modules.homeManager.vega = { # @TODO: Broken currently - By default it's enabled by neovim module programs.vim.enable = lib.mkForce false; diff --git a/modules/hosts/vps/config.nix b/modules/hosts/vps/config.nix index ac29c61..0784686 100644 --- a/modules/hosts/vps/config.nix +++ b/modules/hosts/vps/config.nix @@ -1,50 +1,44 @@ -{ config, ... }: -{ - flake.modules.nixos.vps = - { - hostName, - ... - }: - { - imports = with config.flake.modules.nixos; [ - boot - networking - virtualisation - services - ]; +{config, ...}: { + flake.modules.nixos.vps = {hostName, ...}: { + imports = with config.flake.modules.nixos; [ + boot + networking + virtualisation + services + ]; - tnix = { - boot = { - legacy.enable = true; + tnix = { + boot = { + legacy.enable = true; - impermanence = { - enable = true; + impermanence = { + enable = true; - home = { - directories = [ - ".local/share/nvim" - ".local/share/zsh" - ".local/share/zoxide" - ".local/state/lazygit" - ]; - }; + home = { + directories = [ + ".local/share/nvim" + ".local/share/zsh" + ".local/share/zoxide" + ".local/state/lazygit" + ]; }; }; - - networking.openssh.enable = true; - - virtualisation = { - docker.enable = true; - }; }; - # --- Networking --- - networking = { - hostName = hostName; - networkmanager.enable = true; - firewall.enable = false; - }; + networking.openssh.enable = true; - system.stateVersion = "26.05"; + virtualisation = { + docker.enable = true; + }; }; + + # --- Networking --- + networking = { + hostName = hostName; + networkmanager.enable = true; + firewall.enable = false; + }; + + system.stateVersion = "26.05"; + }; } diff --git a/modules/hosts/vps/disko.nix b/modules/hosts/vps/disko.nix index f6dccaa..5dd2369 100644 --- a/modules/hosts/vps/disko.nix +++ b/modules/hosts/vps/disko.nix @@ -1,22 +1,23 @@ -{ inputs, ... }: -{ - flake.modules.nixos.vps = - { config, lib, ... }: - let - hasOptinPersistence = config.tnix.boot.impermanence.enable; - isLegacy = config.tnix.boot.legacy.enable; - in - { - imports = [ - inputs.disko.nixosModules.disko - ]; +{inputs, ...}: { + flake.modules.nixos.vps = { + config, + lib, + ... + }: let + hasOptinPersistence = config.tnix.boot.impermanence.enable; + isLegacy = config.tnix.boot.legacy.enable; + in { + imports = [ + inputs.disko.nixosModules.disko + ]; - disko.devices.disk.primary = { - device = "/dev/sda"; - type = "disk"; - content = { - type = "gpt"; - partitions = { + disko.devices.disk.primary = { + device = "/dev/sda"; + type = "disk"; + content = { + type = "gpt"; + partitions = + { ESP = { size = "1G"; type = "EF00"; @@ -36,36 +37,37 @@ content = { type = "btrfs"; # Base subvolumes that always exist - subvolumes = { - "/root" = { - mountOptions = [ - "compress=zstd" - "noatime" - "space_cache=v2" - ]; - mountpoint = "/"; + subvolumes = + { + "/root" = { + mountOptions = [ + "compress=zstd" + "noatime" + "space_cache=v2" + ]; + mountpoint = "/"; + }; + "/nix" = { + mountOptions = [ + "compress=zstd" + "noatime" + "noacl" + "space_cache=v2" + ]; + mountpoint = "/nix"; + }; + } + # Conditionally merge /persist only when impermanence is enabled + // lib.optionalAttrs hasOptinPersistence { + "/persist" = { + mountOptions = [ + "compress=zstd" + "noatime" + "space_cache=v2" + ]; + mountpoint = "/persist"; + }; }; - "/nix" = { - mountOptions = [ - "compress=zstd" - "noatime" - "noacl" - "space_cache=v2" - ]; - mountpoint = "/nix"; - }; - } - # Conditionally merge /persist only when impermanence is enabled - // lib.optionalAttrs hasOptinPersistence { - "/persist" = { - mountOptions = [ - "compress=zstd" - "noatime" - "space_cache=v2" - ]; - mountpoint = "/persist"; - }; - }; }; }; } @@ -76,7 +78,7 @@ type = "EF02"; }; }; - }; }; }; + }; } diff --git a/modules/hosts/vps/hardware.nix b/modules/hosts/vps/hardware.nix index 0dbbb22..b82e30c 100644 --- a/modules/hosts/vps/hardware.nix +++ b/modules/hosts/vps/hardware.nix @@ -1,17 +1,15 @@ { - flake.modules.nixos.vps = - { - lib, - modulesPath, - system, - ... - }: - { - imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + flake.modules.nixos.vps = { + lib, + modulesPath, + system, + ... + }: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - networking.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault system; - }; + networking.useDHCP = lib.mkDefault true; + nixpkgs.hostPlatform = lib.mkDefault system; + }; } diff --git a/modules/nixos/boot/impermanence.nix b/modules/nixos/boot/impermanence.nix index 46c97e1..ddc6af3 100644 --- a/modules/nixos/boot/impermanence.nix +++ b/modules/nixos/boot/impermanence.nix @@ -1,59 +1,57 @@ -{ inputs, ... }: -{ - flake.modules.nixos.boot = - { - config, - lib, - userName, - ... - }: - let - cfg = config.tnix.boot; - in - { - imports = [ - inputs.impermanence.nixosModules.impermanence - ]; +{inputs, ...}: { + flake.modules.nixos.boot = { + config, + lib, + userName, + ... + }: let + cfg = config.tnix.boot; + in { + imports = [ + inputs.impermanence.nixosModules.impermanence + ]; - options.tnix.boot.impermanence = { - enable = lib.mkEnableOption "Enable impermanence"; + options.tnix.boot.impermanence = { + enable = lib.mkEnableOption "Enable impermanence"; - directories = lib.mkOption { - type = lib.types.listOf lib.types.str; - default = [ ]; - }; - - files = lib.mkOption { - type = lib.types.listOf lib.types.str; - default = [ ]; - }; + directories = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = []; }; - options.tnix.boot.impermanence.home = { - directories = lib.mkOption { - type = lib.types.listOf lib.types.str; - default = [ ]; - }; + files = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = []; + }; + }; - files = lib.mkOption { - type = lib.types.listOf lib.types.str; - default = [ ]; - }; + options.tnix.boot.impermanence.home = { + directories = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = []; }; - config = lib.mkIf cfg.impermanence.enable { - programs.fuse.userAllowOther = true; - fileSystems."/persist".neededForBoot = true; - environment.persistence."/persist" = { - hideMounts = true; - directories = [ + files = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = []; + }; + }; + + config = lib.mkIf cfg.impermanence.enable { + programs.fuse.userAllowOther = true; + fileSystems."/persist".neededForBoot = true; + environment.persistence."/persist" = { + hideMounts = true; + directories = + [ "/var/log" "/var/lib" "/etc/NetworkManager/system-connections" ] ++ cfg.impermanence.directories; - files = [ + files = + [ "/etc/machine-id" "/etc/ssh/ssh_host_ed25519_key" "/etc/ssh/ssh_host_ed25519_key.pub" @@ -61,11 +59,12 @@ "/etc/ssh/ssh_host_rsa_key.pub" ] ++ cfg.impermanence.files; - }; + }; - home-manager.users.${userName} = { - home.persistence."/persist" = { - directories = [ + home-manager.users.${userName} = { + home.persistence."/persist" = { + directories = + [ "Downloads" "Music" "Wallpapers" @@ -77,46 +76,46 @@ ] ++ cfg.impermanence.home.directories; - files = cfg.impermanence.home.files; - }; + files = cfg.impermanence.home.files; }; + }; - boot.initrd.systemd = { - enable = true; + boot.initrd.systemd = { + enable = true; - services.wipe-my-fs = { - wantedBy = [ "initrd.target" ]; - after = [ "initrd-root-device.target" ]; - before = [ "sysroot.mount" ]; - unitConfig.DefaultDependencies = "no"; - serviceConfig.Type = "oneshot"; - script = '' - mkdir /btrfs_tmp - mount /dev/disk/by-partlabel/disk-primary-root /btrfs_tmp + services.wipe-my-fs = { + wantedBy = ["initrd.target"]; + after = ["initrd-root-device.target"]; + before = ["sysroot.mount"]; + unitConfig.DefaultDependencies = "no"; + serviceConfig.Type = "oneshot"; + script = '' + mkdir /btrfs_tmp + mount /dev/disk/by-partlabel/disk-primary-root /btrfs_tmp - if [[ -e /btrfs_tmp/root ]]; then - mkdir -p /btrfs_tmp/old_roots - timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S") - mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp" - fi + if [[ -e /btrfs_tmp/root ]]; then + mkdir -p /btrfs_tmp/old_roots + timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S") + mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp" + fi - delete_subvolume_recursively() { - IFS=$'\n' - for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do - delete_subvolume_recursively "/btrfs_tmp/$i" - done - btrfs subvolume delete "$1" - } + delete_subvolume_recursively() { + IFS=$'\n' + for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do + delete_subvolume_recursively "/btrfs_tmp/$i" + done + btrfs subvolume delete "$1" + } - for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do - delete_subvolume_recursively "$i" - done + for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do + delete_subvolume_recursively "$i" + done - btrfs subvolume create /btrfs_tmp/root - umount /btrfs_tmp - ''; - }; + btrfs subvolume create /btrfs_tmp/root + umount /btrfs_tmp + ''; }; }; }; + }; } diff --git a/modules/nixos/boot/loader.nix b/modules/nixos/boot/loader.nix index 37081e7..33b6a68 100644 --- a/modules/nixos/boot/loader.nix +++ b/modules/nixos/boot/loader.nix @@ -1,31 +1,32 @@ { - flake.modules.nixos.boot = - { config, lib, ... }: - let - cfg = config.tnix.boot; - in - { - options.tnix.boot.legacy = { - enable = lib.mkEnableOption "legacy boot (GRUB) instead of systemd-boot"; - }; - - config = lib.mkMerge [ - { - boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; - - boot.loader = { - timeout = 1; - efi.canTouchEfiVariables = true; - }; - } - - (lib.mkIf (!cfg.legacy.enable && !cfg.secure-boot.enable) { - boot.loader.systemd-boot.enable = true; - }) - - (lib.mkIf cfg.legacy.enable { - boot.loader.grub.enable = true; - }) - ]; + flake.modules.nixos.boot = { + config, + lib, + ... + }: let + cfg = config.tnix.boot; + in { + options.tnix.boot.legacy = { + enable = lib.mkEnableOption "legacy boot (GRUB) instead of systemd-boot"; }; + + config = lib.mkMerge [ + { + boot.binfmt.emulatedSystems = ["aarch64-linux"]; + + boot.loader = { + timeout = 1; + efi.canTouchEfiVariables = true; + }; + } + + (lib.mkIf (!cfg.legacy.enable && !cfg.secure-boot.enable) { + boot.loader.systemd-boot.enable = true; + }) + + (lib.mkIf cfg.legacy.enable { + boot.loader.grub.enable = true; + }) + ]; + }; } diff --git a/modules/nixos/boot/misc.nix b/modules/nixos/boot/misc.nix index bec171b..7571293 100644 --- a/modules/nixos/boot/misc.nix +++ b/modules/nixos/boot/misc.nix @@ -1,12 +1,10 @@ { - flake.modules.nixos.boot = - { pkgs, ... }: - { - boot = { - consoleLogLevel = 0; - initrd.verbose = false; - kernelPackages = pkgs.linuxPackages_zen; - supportedFilesystems = [ "ntfs" ]; - }; + flake.modules.nixos.boot = {pkgs, ...}: { + boot = { + consoleLogLevel = 0; + initrd.verbose = false; + kernelPackages = pkgs.linuxPackages_zen; + supportedFilesystems = ["ntfs"]; }; + }; } diff --git a/modules/nixos/boot/secure-boot.nix b/modules/nixos/boot/secure-boot.nix index 49065e7..9390b64 100644 --- a/modules/nixos/boot/secure-boot.nix +++ b/modules/nixos/boot/secure-boot.nix @@ -1,43 +1,39 @@ -{ inputs, ... }: -{ - flake.modules.nixos.boot = - { - config, - lib, - pkgs, - ... - }: - let - cfg = config.tnix.boot; - in - { - imports = [ inputs.lanzaboote.nixosModules.lanzaboote ]; +{inputs, ...}: { + flake.modules.nixos.boot = { + config, + lib, + pkgs, + ... + }: let + cfg = config.tnix.boot; + in { + imports = [inputs.lanzaboote.nixosModules.lanzaboote]; - options.tnix.boot.secure-boot = { - enable = lib.mkEnableOption "Enable secure-boot"; - }; + options.tnix.boot.secure-boot = { + enable = lib.mkEnableOption "Enable secure-boot"; + }; - config = lib.mkIf cfg.secure-boot.enable { - assertions = [ - { - assertion = !cfg.legacy.enable; - message = "secure-boot and legacy boot (GRUB) cannot be enabled at the same time"; - } - ]; + config = lib.mkIf cfg.secure-boot.enable { + assertions = [ + { + assertion = !cfg.legacy.enable; + message = "secure-boot and legacy boot (GRUB) cannot be enabled at the same time"; + } + ]; - environment.systemPackages = [ pkgs.sbctl ]; + environment.systemPackages = [pkgs.sbctl]; - # Lanzaboote replaces systemd-boot, so force it off - boot.loader.systemd-boot.enable = lib.mkForce false; + # Lanzaboote replaces systemd-boot, so force it off + boot.loader.systemd-boot.enable = lib.mkForce false; - boot.lanzaboote = { - enable = true; - autoGenerateKeys.enable = true; - autoEnrollKeys.enable = true; + boot.lanzaboote = { + enable = true; + autoGenerateKeys.enable = true; + autoEnrollKeys.enable = true; - configurationLimit = 10; - pkiBundle = "/var/lib/sbctl"; - }; + configurationLimit = 10; + pkiBundle = "/var/lib/sbctl"; }; }; + }; } diff --git a/modules/nixos/core/hm.nix b/modules/nixos/core/hm.nix index 1f58bc1..90f2b31 100644 --- a/modules/nixos/core/hm.nix +++ b/modules/nixos/core/hm.nix @@ -1,37 +1,38 @@ -{ inputs, config, ... }: { - flake.modules.nixos.core = - { - hostName, - userName, - userEmail, - ... - }: - { - imports = [ - inputs.home-manager.nixosModules.home-manager - ]; + inputs, + config, + ... +}: { + flake.modules.nixos.core = { + hostName, + userName, + userEmail, + ... + }: { + imports = [ + inputs.home-manager.nixosModules.home-manager + ]; - home-manager = { - backupFileExtension = "bak"; - useGlobalPkgs = true; - useUserPackages = true; - extraSpecialArgs = { - inherit - inputs - hostName - userName - userEmail - ; - }; + home-manager = { + backupFileExtension = "bak"; + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit + inputs + hostName + userName + userEmail + ; + }; - users.${userName} = { - imports = [ - config.flake.modules.homeManager.core - config.flake.modules.homeManager.shell - config.flake.modules.homeManager.${hostName} - ]; - }; + users.${userName} = { + imports = [ + config.flake.modules.homeManager.core + config.flake.modules.homeManager.shell + config.flake.modules.homeManager.${hostName} + ]; }; }; + }; } diff --git a/modules/nixos/core/nh.nix b/modules/nixos/core/nh.nix index 5205e6d..d001809 100644 --- a/modules/nixos/core/nh.nix +++ b/modules/nixos/core/nh.nix @@ -1,20 +1,18 @@ { - flake.modules.nixos.core = - { - config, - userName, - ... - }: - { - programs.nh = { - enable = true; + flake.modules.nixos.core = { + config, + userName, + ... + }: { + programs.nh = { + enable = true; - clean = { - enable = !config.nix.gc.automatic; - dates = "weekly"; - }; - - flake = "/home/${userName}/Projects/nixos-config"; + clean = { + enable = !config.nix.gc.automatic; + dates = "weekly"; }; + + flake = "/home/${userName}/Projects/nixos-config"; }; + }; } diff --git a/modules/nixos/core/nix-index.nix b/modules/nixos/core/nix-index.nix index 3c42155..5924db9 100644 --- a/modules/nixos/core/nix-index.nix +++ b/modules/nixos/core/nix-index.nix @@ -1,6 +1,5 @@ -{ inputs, ... }: -{ - flake.modules.nixos.core = { pkgs, ... }: { +{inputs, ...}: { + flake.modules.nixos.core = {pkgs, ...}: { imports = [ inputs.nix-index-database.nixosModules.default ]; diff --git a/modules/nixos/core/nix.nix b/modules/nixos/core/nix.nix index 465c37c..1bb3649 100644 --- a/modules/nixos/core/nix.nix +++ b/modules/nixos/core/nix.nix @@ -1,88 +1,86 @@ { - flake.modules.nixos.core = - { userName, ... }: - { - nix = { - channel.enable = false; + flake.modules.nixos.core = {userName, ...}: { + nix = { + channel.enable = false; - gc = { - automatic = true; - options = "--delete-older-than 7d"; - dates = "weekly"; - persistent = true; - }; + gc = { + automatic = true; + options = "--delete-older-than 7d"; + dates = "weekly"; + persistent = true; + }; - optimise.automatic = true; + optimise.automatic = true; - settings = { - extra-platforms = [ - "aarch64-linux" - "arm-linux" - ]; + settings = { + extra-platforms = [ + "aarch64-linux" + "arm-linux" + ]; - experimental-features = [ - "nix-command" - "flakes" - ]; + experimental-features = [ + "nix-command" + "flakes" + ]; - max-jobs = "auto"; + max-jobs = "auto"; - # Make legacy nix commands use the XDG base directories instead of creating directories in $HOME. - use-xdg-base-directories = true; + # Make legacy nix commands use the XDG base directories instead of creating directories in $HOME. + use-xdg-base-directories = true; - # The maximum number of parallel TCP connections used to fetch files from binary caches and by other downloads. - # It defaults to 25. 0 means no limit. - http-connections = 128; + # The maximum number of parallel TCP connections used to fetch files from binary caches and by other downloads. + # It defaults to 25. 0 means no limit. + http-connections = 128; - # This option defines the maximum number of substitution jobs that Nix will try to run in - # parallel. The default is 16. The minimum value one can choose is 1 and lower values will be - # interpreted as 1. - max-substitution-jobs = 128; + # This option defines the maximum number of substitution jobs that Nix will try to run in + # parallel. The default is 16. The minimum value one can choose is 1 and lower values will be + # interpreted as 1. + max-substitution-jobs = 128; - # The number of lines of the tail of the log to show if a build fails. - log-lines = 25; + # The number of lines of the tail of the log to show if a build fails. + log-lines = 25; - # When free disk space in /nix/store drops below min-free during a build, Nix performs a - # garbage-collection until max-free bytes are available or there is no more garbage. - # A value of 0 (the default) disables this feature. - min-free = 128000000; # 128 MB - max-free = 1000000000; # 1 GB + # When free disk space in /nix/store drops below min-free during a build, Nix performs a + # garbage-collection until max-free bytes are available or there is no more garbage. + # A value of 0 (the default) disables this feature. + min-free = 128000000; # 128 MB + max-free = 1000000000; # 1 GB - # Prevent garbage collection from altering nix-shells managed by nix-direnv - # https://github.com/nix-community/nix-direnv#installation - keep-outputs = true; - keep-derivations = true; + # Prevent garbage collection from altering nix-shells managed by nix-direnv + # https://github.com/nix-community/nix-direnv#installation + keep-outputs = true; + keep-derivations = true; - # If set to true, Nix will keep building derivations even if some fail. The default is false. - keep-going = true; + # If set to true, Nix will keep building derivations even if some fail. The default is false. + keep-going = true; - # Automatically detect files in the store that have identical contents, and replaces - # them with hard links to a single copy. This saves disk space. - auto-optimise-store = true; + # Automatically detect files in the store that have identical contents, and replaces + # them with hard links to a single copy. This saves disk space. + auto-optimise-store = true; - # Whether to warn about dirty Git/Mercurial trees. - warn-dirty = false; + # Whether to warn about dirty Git/Mercurial trees. + warn-dirty = false; - # The timeout (in seconds) for establishing connections in the binary cache substituter. - # It corresponds to curl’s –connect-timeout option. A value of 0 means no limit. - connect-timeout = 5; + # The timeout (in seconds) for establishing connections in the binary cache substituter. + # It corresponds to curl’s –connect-timeout option. A value of 0 means no limit. + connect-timeout = 5; - # Allow the use of cachix - trusted-users = [ - "root" - "${userName}" - ]; - allowed-users = [ - "root" - "${userName}" - ]; + # Allow the use of cachix + trusted-users = [ + "root" + "${userName}" + ]; + allowed-users = [ + "root" + "${userName}" + ]; - builders-use-substitutes = true; + builders-use-substitutes = true; - # If set to true, Nix will fall back to building from source if a binary substitute - # fails. This is equivalent to the –fallback flag. The default is false. - fallback = true; - }; + # If set to true, Nix will fall back to building from source if a binary substitute + # fails. This is equivalent to the –fallback flag. The default is false. + fallback = true; }; }; + }; } diff --git a/modules/nixos/core/nixpkgs.nix b/modules/nixos/core/nixpkgs.nix index ba594b6..aaa1d5a 100644 --- a/modules/nixos/core/nixpkgs.nix +++ b/modules/nixos/core/nixpkgs.nix @@ -1,5 +1,4 @@ -{ inputs, ... }: -{ +{inputs, ...}: { flake.modules.nixos.core = { nixpkgs = { config = { diff --git a/modules/nixos/core/sops.nix b/modules/nixos/core/sops.nix index a3cb3f8..5d78ee6 100644 --- a/modules/nixos/core/sops.nix +++ b/modules/nixos/core/sops.nix @@ -1,25 +1,21 @@ -{ inputs, ... }: -{ - flake.modules.nixos.core = - { - config, - pkgs, - ... - }: - let - isEd25519 = k: k.type == "ed25519"; - getKeyPath = k: k.path; - keys = builtins.filter isEd25519 config.services.openssh.hostKeys; - in - { - imports = [ inputs.sops-nix.nixosModules.sops ]; +{inputs, ...}: { + flake.modules.nixos.core = { + config, + pkgs, + ... + }: let + isEd25519 = k: k.type == "ed25519"; + getKeyPath = k: k.path; + keys = builtins.filter isEd25519 config.services.openssh.hostKeys; + in { + imports = [inputs.sops-nix.nixosModules.sops]; - sops.age = { - sshKeyPaths = map getKeyPath keys; - keyFile = "/var/lib/sops-nix/key.txt"; - generateKey = true; - }; - - environment.systemPackages = with pkgs; [ sops ]; + sops.age = { + sshKeyPaths = map getKeyPath keys; + keyFile = "/var/lib/sops-nix/key.txt"; + generateKey = true; }; + + environment.systemPackages = with pkgs; [sops]; + }; } diff --git a/modules/nixos/core/users.nix b/modules/nixos/core/users.nix index 92719d7..3706cc1 100644 --- a/modules/nixos/core/users.nix +++ b/modules/nixos/core/users.nix @@ -1,51 +1,48 @@ { - flake.modules.nixos.core = - { - pkgs, - lib, - config, - userName, - userEmail, - ... - }: - let - hasPasswordSecret = lib.hasAttrByPath [ "sops" "secrets" "tux-password" ] config; - in - { - programs.zsh.enable = true; + flake.modules.nixos.core = { + pkgs, + lib, + config, + userName, + userEmail, + ... + }: let + hasPasswordSecret = lib.hasAttrByPath ["sops" "secrets" "tux-password"] config; + in { + programs.zsh.enable = true; - time.timeZone = "Asia/Kolkata"; - i18n = { - defaultLocale = "en_US.UTF-8"; - extraLocaleSettings = lib.genAttrs [ - "LC_ADDRESS" - "LC_IDENTIFICATION" - "LC_MEASUREMENT" - "LC_MONETARY" - "LC_NAME" - "LC_NUMERIC" - "LC_PAPER" - "LC_TELEPHONE" - "LC_TIME" - ] (_: "en_IN"); - }; + time.timeZone = "Asia/Kolkata"; + i18n = { + defaultLocale = "en_US.UTF-8"; + extraLocaleSettings = lib.genAttrs [ + "LC_ADDRESS" + "LC_IDENTIFICATION" + "LC_MEASUREMENT" + "LC_MONETARY" + "LC_NAME" + "LC_NUMERIC" + "LC_PAPER" + "LC_TELEPHONE" + "LC_TIME" + ] (_: "en_IN"); + }; - users = { - mutableUsers = false; - defaultUserShell = pkgs.zsh; - users.${userName} = { - hashedPasswordFile = lib.mkIf hasPasswordSecret config.sops.secrets.tux-password.path; - initialPassword = lib.mkIf (!hasPasswordSecret) userName; - isNormalUser = true; - extraGroups = [ - "networkmanager" - "wheel" - "storage" - ]; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+OzPUe2ECPC929DqpkM39tl/vdNAXfsRnmrGfR+X3D ${userEmail}" - ]; - }; + users = { + mutableUsers = false; + defaultUserShell = pkgs.zsh; + users.${userName} = { + hashedPasswordFile = lib.mkIf hasPasswordSecret config.sops.secrets.tux-password.path; + initialPassword = lib.mkIf (!hasPasswordSecret) userName; + isNormalUser = true; + extraGroups = [ + "networkmanager" + "wheel" + "storage" + ]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+OzPUe2ECPC929DqpkM39tl/vdNAXfsRnmrGfR+X3D ${userEmail}" + ]; }; }; + }; } diff --git a/modules/nixos/desktop/font.nix b/modules/nixos/desktop/font.nix index 05a42f0..d466a1d 100644 --- a/modules/nixos/desktop/font.nix +++ b/modules/nixos/desktop/font.nix @@ -1,11 +1,9 @@ { - flake.modules.nixos.desktop = - { pkgs, ... }: - { - fonts.packages = with pkgs.nerd-fonts; [ - fira-code - jetbrains-mono - bigblue-terminal - ]; - }; + flake.modules.nixos.desktop = {pkgs, ...}: { + fonts.packages = with pkgs.nerd-fonts; [ + fira-code + jetbrains-mono + bigblue-terminal + ]; + }; } diff --git a/modules/nixos/desktop/gpu-screen-recorder.nix b/modules/nixos/desktop/gpu-screen-recorder.nix index 5289b79..6ee4334 100644 --- a/modules/nixos/desktop/gpu-screen-recorder.nix +++ b/modules/nixos/desktop/gpu-screen-recorder.nix @@ -1,13 +1,11 @@ { - flake.modules.nixos.desktop = - { pkgs, ... }: - { - programs.gpu-screen-recorder = { - enable = true; - }; - - environment.systemPackages = with pkgs; [ - gpu-screen-recorder-gtk - ]; + flake.modules.nixos.desktop = {pkgs, ...}: { + programs.gpu-screen-recorder = { + enable = true; }; + + environment.systemPackages = with pkgs; [ + gpu-screen-recorder-gtk + ]; + }; } diff --git a/modules/nixos/desktop/hyprland.nix b/modules/nixos/desktop/hyprland.nix index e07c0e8..e558630 100644 --- a/modules/nixos/desktop/hyprland.nix +++ b/modules/nixos/desktop/hyprland.nix @@ -1,11 +1,9 @@ { - flake.modules.nixos.desktop = - { pkgs, ... }: - { - programs.hyprland = { - enable = true; - package = pkgs.hyprland-git.hyprland; - portalPackage = pkgs.hyprland-git.xdg-desktop-portal-hyprland; - }; + flake.modules.nixos.desktop = {pkgs, ...}: { + programs.hyprland = { + enable = true; + package = pkgs.hyprland-git.hyprland; + portalPackage = pkgs.hyprland-git.xdg-desktop-portal-hyprland; }; + }; } diff --git a/modules/nixos/desktop/mango.nix b/modules/nixos/desktop/mango.nix index 4e6fc4d..50761fe 100644 --- a/modules/nixos/desktop/mango.nix +++ b/modules/nixos/desktop/mango.nix @@ -1,36 +1,30 @@ -{ - inputs, - ... -}: -{ - flake.modules.nixos.desktop = - { - pkgs, - lib, - ... - }: - { - imports = [ - inputs.mango.nixosModules.mango +{inputs, ...}: { + flake.modules.nixos.desktop = { + pkgs, + lib, + ... + }: { + imports = [ + inputs.mango.nixosModules.mango + ]; + + programs.mango.enable = true; + + xdg.portal = { + enable = lib.mkDefault true; + extraPortals = with pkgs; [ + hyprland-git.xdg-desktop-portal-hyprland + xdg-desktop-portal-wlr + xdg-desktop-portal-gtk ]; - - programs.mango.enable = true; - - xdg.portal = { - enable = lib.mkDefault true; - extraPortals = with pkgs; [ - hyprland-git.xdg-desktop-portal-hyprland - xdg-desktop-portal-wlr - xdg-desktop-portal-gtk + config.mango = { + default = lib.mkForce [ + "hyprland" + "gtk" ]; - config.mango = { - default = lib.mkForce [ - "hyprland" - "gtk" - ]; - "org.freedesktop.impl.portal.ScreenCast" = lib.mkForce [ "hyprland" ]; - "org.freedesktop.impl.portal.ScreenShot" = lib.mkForce [ "hyprland" ]; - }; + "org.freedesktop.impl.portal.ScreenCast" = lib.mkForce ["hyprland"]; + "org.freedesktop.impl.portal.ScreenShot" = lib.mkForce ["hyprland"]; }; }; + }; } diff --git a/modules/nixos/desktop/misc.nix b/modules/nixos/desktop/misc.nix index c0787e1..1d98e3c 100644 --- a/modules/nixos/desktop/misc.nix +++ b/modules/nixos/desktop/misc.nix @@ -1,7 +1,5 @@ { - flake.modules.nixos.desktop = - { pkgs, ... }: - { - environment.systemPackages = with pkgs; [ brightnessctl ]; - }; + flake.modules.nixos.desktop = {pkgs, ...}: { + environment.systemPackages = with pkgs; [brightnessctl]; + }; } diff --git a/modules/nixos/desktop/obs-studio.nix b/modules/nixos/desktop/obs-studio.nix index 1eef51f..4d9d9b2 100644 --- a/modules/nixos/desktop/obs-studio.nix +++ b/modules/nixos/desktop/obs-studio.nix @@ -1,15 +1,13 @@ { - flake.modules.nixos.desktop = - { pkgs, ... }: - { - programs.obs-studio = { - enable = true; - enableVirtualCamera = true; - plugins = with pkgs.obs-studio-plugins; [ - obs-vaapi - wlrobs - obs-source-record - ]; - }; + flake.modules.nixos.desktop = {pkgs, ...}: { + programs.obs-studio = { + enable = true; + enableVirtualCamera = true; + plugins = with pkgs.obs-studio-plugins; [ + obs-vaapi + wlrobs + obs-source-record + ]; }; + }; } diff --git a/modules/nixos/desktop/thunar.nix b/modules/nixos/desktop/thunar.nix index 91615ff..b76167e 100644 --- a/modules/nixos/desktop/thunar.nix +++ b/modules/nixos/desktop/thunar.nix @@ -1,18 +1,16 @@ { - flake.modules.nixos.desktop = - { pkgs, ... }: - { - services = { - gvfs.enable = true; - tumbler.enable = true; - }; - - programs.thunar = { - enable = true; - plugins = with pkgs; [ - thunar-archive-plugin - thunar-volman - ]; - }; + flake.modules.nixos.desktop = {pkgs, ...}: { + services = { + gvfs.enable = true; + tumbler.enable = true; }; + + programs.thunar = { + enable = true; + plugins = with pkgs; [ + thunar-archive-plugin + thunar-volman + ]; + }; + }; } diff --git a/modules/nixos/desktop/tshell.nix b/modules/nixos/desktop/tshell.nix index 83b65ac..ab85b56 100644 --- a/modules/nixos/desktop/tshell.nix +++ b/modules/nixos/desktop/tshell.nix @@ -1,7 +1,5 @@ { - flake.modules.nixos.desktop = - { pkgs, ... }: - { - environment.systemPackages = with pkgs; [ tshell ]; - }; + flake.modules.nixos.desktop = {pkgs, ...}: { + environment.systemPackages = with pkgs; [tshell]; + }; } diff --git a/modules/nixos/gaming/steam.nix b/modules/nixos/gaming/steam.nix index bce53b3..3a19e8d 100644 --- a/modules/nixos/gaming/steam.nix +++ b/modules/nixos/gaming/steam.nix @@ -1,11 +1,9 @@ { - flake.modules.nixos.gaming = - { pkgs, ... }: - { - programs.steam = { - enable = true; - protontricks.enable = true; - extraCompatPackages = with pkgs; [ proton-ge-bin ]; - }; + flake.modules.nixos.gaming = {pkgs, ...}: { + programs.steam = { + enable = true; + protontricks.enable = true; + extraCompatPackages = with pkgs; [proton-ge-bin]; }; + }; } diff --git a/modules/nixos/hardware/audio.nix b/modules/nixos/hardware/audio.nix index 13bb453..79990ab 100644 --- a/modules/nixos/hardware/audio.nix +++ b/modules/nixos/hardware/audio.nix @@ -1,5 +1,5 @@ { - flake.modules.nixos.hardware = { pkgs, ... }: { + flake.modules.nixos.hardware = {pkgs, ...}: { security.rtkit.enable = true; services.pipewire = { diff --git a/modules/nixos/hardware/bluetooth.nix b/modules/nixos/hardware/bluetooth.nix index 1f58530..cf1b3a1 100644 --- a/modules/nixos/hardware/bluetooth.nix +++ b/modules/nixos/hardware/bluetooth.nix @@ -1,5 +1,5 @@ { - flake.modules.nixos.hardware = { pkgs, ... }: { + flake.modules.nixos.hardware = {pkgs, ...}: { hardware.bluetooth = { enable = true; }; diff --git a/modules/nixos/networking/netbird-client.nix b/modules/nixos/networking/netbird-client.nix index ed3e480..33c696f 100644 --- a/modules/nixos/networking/netbird-client.nix +++ b/modules/nixos/networking/netbird-client.nix @@ -1,16 +1,13 @@ { - flake.modules.nixos.networking = - { - config, - lib, - hostName, - ... - }: - with lib; - let + flake.modules.nixos.networking = { + config, + lib, + hostName, + ... + }: + with lib; let cfg = config.tnix.networking.netbird-client; - in - { + in { options.tnix.networking.netbird-client = { enable = mkEnableOption "Enable netbird client"; }; diff --git a/modules/nixos/networking/newt.nix b/modules/nixos/networking/newt.nix index 82fa749..47da2c7 100644 --- a/modules/nixos/networking/newt.nix +++ b/modules/nixos/networking/newt.nix @@ -1,15 +1,12 @@ { - flake.modules.nixos.networking = - { - config, - lib, - ... - }: - with lib; - let + flake.modules.nixos.networking = { + config, + lib, + ... + }: + with lib; let cfg = config.tnix.networking.newt; - in - { + in { options.tnix.networking.newt = { enable = mkEnableOption "Newt"; diff --git a/modules/nixos/networking/ssh.nix b/modules/nixos/networking/ssh.nix index 27240a5..aaa2240 100644 --- a/modules/nixos/networking/ssh.nix +++ b/modules/nixos/networking/ssh.nix @@ -1,25 +1,22 @@ { - flake.modules.nixos.networking = - { - config, - lib, - ... - }: - with lib; - let + flake.modules.nixos.networking = { + config, + lib, + ... + }: + with lib; let cfg = config.tnix.networking.openssh; # Sops needs acess to the keys before the persist dirs are even mounted; so # just persisting the keys won't work, we must point at /persist hasOptinPersistence = config.tnix.boot.impermanence.enable; - in - { + in { options.tnix.networking.openssh = { enable = mkEnableOption "Enable OpenSSH server"; ports = mkOption { type = types.listOf types.port; - default = [ 22 ]; + default = [22]; description = '' Specifies on which ports the SSH daemon listens. ''; diff --git a/modules/nixos/services/aiostreams.nix b/modules/nixos/services/aiostreams.nix index 64b60df..d0b776d 100644 --- a/modules/nixos/services/aiostreams.nix +++ b/modules/nixos/services/aiostreams.nix @@ -1,17 +1,14 @@ { - flake.modules.nixos.services = - { - config, - lib, - ... - }: - with lib; - let + flake.modules.nixos.services = { + config, + lib, + ... + }: + with lib; let cfg = config.tnix.services.aiostreams; port = toString cfg.port; acmeHost = config.tnix.services.nginx.domain; - in - { + in { options.tnix.services.aiostreams = { enable = mkEnableOption "AIOStreams"; diff --git a/modules/nixos/services/copyparty.nix b/modules/nixos/services/copyparty.nix index 0ec9631..3e03d01 100644 --- a/modules/nixos/services/copyparty.nix +++ b/modules/nixos/services/copyparty.nix @@ -1,19 +1,16 @@ -{ inputs, ... }: { - flake.modules.nixos.services = - { - config, - lib, - pkgs, - options, - ... - }: - with lib; - let +{inputs, ...}: { + flake.modules.nixos.services = { + config, + lib, + pkgs, + options, + ... + }: + with lib; let cfg = config.tnix.services.copyparty; port = toString cfg.port; acmeHost = config.tnix.services.nginx.domain; - in - { + in { imports = [ inputs.copyparty.nixosModules.default ]; @@ -75,7 +72,7 @@ accounts = cfg.accounts; volumes = cfg.volumes; package = pkgs.copyparty.override { - extraPackages = [ pkgs.exiftool ]; + extraPackages = [pkgs.exiftool]; }; }; diff --git a/modules/nixos/services/cyber-tux.nix b/modules/nixos/services/cyber-tux.nix index 7614854..267b7ef 100644 --- a/modules/nixos/services/cyber-tux.nix +++ b/modules/nixos/services/cyber-tux.nix @@ -1,16 +1,13 @@ { - flake.modules.nixos.services = - { - config, - lib, - pkgs, - ... - }: - with lib; - let + flake.modules.nixos.services = { + config, + lib, + pkgs, + ... + }: + with lib; let cfg = config.tnix.services.cyber-tux; - in - { + in { options.tnix.services.cyber-tux = { enable = mkEnableOption "CyberTux Discord bot"; @@ -41,9 +38,9 @@ config = mkIf cfg.enable { systemd.services.cyber-tux = { description = "CyberTux Discord bot"; - after = [ "network-online.target" ]; - wants = [ "network-online.target" ]; - wantedBy = [ "multi-user.target" ]; + after = ["network-online.target"]; + wants = ["network-online.target"]; + wantedBy = ["multi-user.target"]; serviceConfig = { Type = "simple"; @@ -83,7 +80,7 @@ RestrictRealtime = true; RestrictSUIDSGID = true; SystemCallArchitectures = "native"; - SystemCallFilter = [ "@system-service" ]; + SystemCallFilter = ["@system-service"]; UMask = "0077"; }; }; @@ -99,7 +96,7 @@ }; users.groups = mkIf (cfg.group == "cyber-tux") { - ${cfg.group} = { }; + ${cfg.group} = {}; }; }; }; diff --git a/modules/nixos/services/gitea.nix b/modules/nixos/services/gitea.nix index 743159a..e927f97 100644 --- a/modules/nixos/services/gitea.nix +++ b/modules/nixos/services/gitea.nix @@ -1,17 +1,14 @@ { - flake.modules.nixos.services = - { - config, - lib, - ... - }: - with lib; - let + flake.modules.nixos.services = { + config, + lib, + ... + }: + with lib; let cfg = config.tnix.services.gitea; port = toString cfg.port; acmeHost = config.tnix.services.nginx.domain; - in - { + in { options.tnix.services.gitea = { enable = mkEnableOption "Gitea"; @@ -109,7 +106,7 @@ postgresql = { enable = true; - ensureDatabases = [ "gitea" ]; + ensureDatabases = ["gitea"]; ensureUsers = [ { name = "gitea"; diff --git a/modules/nixos/services/hermes-agent.nix b/modules/nixos/services/hermes-agent.nix index 5f0da1d..8790500 100644 --- a/modules/nixos/services/hermes-agent.nix +++ b/modules/nixos/services/hermes-agent.nix @@ -1,18 +1,15 @@ -{ inputs, ... }: { - flake.modules.nixos.services = - { - config, - lib, - pkgs, - options, - userName, - ... - }: - with lib; - let +{inputs, ...}: { + flake.modules.nixos.services = { + config, + lib, + pkgs, + options, + userName, + ... + }: + with lib; let cfg = config.tnix.services.hermes-agent; - in - { + in { imports = [ inputs.hermes-agent.nixosModules.default ]; @@ -42,7 +39,7 @@ ]; }; - users.users.${userName}.extraGroups = [ "hermes" ]; + users.users.${userName}.extraGroups = ["hermes"]; }; }; } diff --git a/modules/nixos/services/mediaflow-proxy.nix b/modules/nixos/services/mediaflow-proxy.nix index ba5cac3..8a55464 100644 --- a/modules/nixos/services/mediaflow-proxy.nix +++ b/modules/nixos/services/mediaflow-proxy.nix @@ -1,17 +1,14 @@ { - flake.modules.nixos.services = - { - config, - lib, - ... - }: - with lib; - let + flake.modules.nixos.services = { + config, + lib, + ... + }: + with lib; let cfg = config.tnix.services.mediaflow-proxy; port = toString cfg.port; acmeHost = config.tnix.services.nginx.domain; - in - { + in { options.tnix.services.mediaflow-proxy = { enable = mkEnableOption "MediaFlow Proxy"; diff --git a/modules/nixos/services/nginx.nix b/modules/nixos/services/nginx.nix index 30c6b4a..b71aad4 100644 --- a/modules/nixos/services/nginx.nix +++ b/modules/nixos/services/nginx.nix @@ -1,16 +1,13 @@ { - flake.modules.nixos.services = - { - config, - lib, - userEmail, - ... - }: - with lib; - let + flake.modules.nixos.services = { + config, + lib, + userEmail, + ... + }: + with lib; let cfg = config.tnix.services.nginx; - in - { + in { options.tnix.services.nginx = { enable = mkEnableOption "Nginx"; @@ -30,7 +27,7 @@ "${cfg.domain}" = { group = "nginx"; domain = "*.${cfg.domain}"; - extraDomainNames = [ "${cfg.domain}" ]; + extraDomainNames = ["${cfg.domain}"]; dnsProvider = "cloudflare"; credentialFiles = { CLOUDFLARE_EMAIL_FILE = config.sops.secrets."cloudflare-credentials/email".path; @@ -41,7 +38,7 @@ }; }; - users.users.nginx.extraGroups = [ "acme" ]; + users.users.nginx.extraGroups = ["acme"]; services.nginx = { enable = true; diff --git a/modules/nixos/services/pangolin.nix b/modules/nixos/services/pangolin.nix index ed2253a..369577d 100644 --- a/modules/nixos/services/pangolin.nix +++ b/modules/nixos/services/pangolin.nix @@ -1,17 +1,14 @@ { - flake.modules.nixos.services = - { - config, - lib, - userEmail, - pkgs, - ... - }: - with lib; - let + flake.modules.nixos.services = { + config, + lib, + userEmail, + pkgs, + ... + }: + with lib; let cfg = config.tnix.services.pangolin; - in - { + in { options.tnix.services.pangolin = { enable = mkEnableOption "Pangolin"; @@ -77,7 +74,7 @@ postgresql = { enable = true; - ensureDatabases = [ "pangolin" ]; + ensureDatabases = ["pangolin"]; ensureUsers = [ { name = "pangolin"; diff --git a/modules/nixos/services/trok.nix b/modules/nixos/services/trok.nix index 7c0a732..bdf7186 100644 --- a/modules/nixos/services/trok.nix +++ b/modules/nixos/services/trok.nix @@ -1,15 +1,12 @@ -{ inputs, ... }: { - flake.modules.nixos.services = - { - config, - lib, - ... - }: - with lib; - let +{inputs, ...}: { + flake.modules.nixos.services = { + config, + lib, + ... + }: + with lib; let cfg = config.tnix.services.trok; - in - { + in { imports = [ inputs.trok.nixosModules.default ]; diff --git a/modules/nixos/services/uptime-kuma.nix b/modules/nixos/services/uptime-kuma.nix index 52fc8c3..d981153 100644 --- a/modules/nixos/services/uptime-kuma.nix +++ b/modules/nixos/services/uptime-kuma.nix @@ -1,17 +1,14 @@ { - flake.modules.nixos.services = - { - config, - lib, - ... - }: - with lib; - let + flake.modules.nixos.services = { + config, + lib, + ... + }: + with lib; let cfg = config.tnix.services.uptime-kuma; port = toString cfg.port; acmeHost = config.tnix.services.nginx.domain; - in - { + in { options.tnix.services.uptime-kuma = { enable = mkEnableOption "Uptime Kuma"; diff --git a/modules/nixos/services/vaultwarden.nix b/modules/nixos/services/vaultwarden.nix index e2ac87b..9b8c0ed 100644 --- a/modules/nixos/services/vaultwarden.nix +++ b/modules/nixos/services/vaultwarden.nix @@ -1,17 +1,14 @@ { - flake.modules.nixos.services = - { - config, - lib, - ... - }: - with lib; - let + flake.modules.nixos.services = { + config, + lib, + ... + }: + with lib; let cfg = config.tnix.services.vaultwarden; port = toString cfg.port; acmeHost = config.tnix.services.nginx.domain; - in - { + in { options.tnix.services.vaultwarden = { enable = mkEnableOption "Vaultwarden"; @@ -106,7 +103,7 @@ postgresql = { enable = true; - ensureDatabases = [ "vaultwarden" ]; + ensureDatabases = ["vaultwarden"]; ensureUsers = [ { name = "vaultwarden"; diff --git a/modules/nixos/virtualisation/distrobox.nix b/modules/nixos/virtualisation/distrobox.nix index aa22cf6..1bee7db 100644 --- a/modules/nixos/virtualisation/distrobox.nix +++ b/modules/nixos/virtualisation/distrobox.nix @@ -1,118 +1,115 @@ { - flake.modules.nixos.virtualisation = - { - config, - lib, - pkgs, - ... - }: - let - cfg = config.tnix.virtualisation; - in - { - options.tnix.virtualisation.distrobox = { - enable = lib.mkEnableOption "Enable DistroBox"; - }; - - config = lib.mkIf cfg.distrobox.enable { - virtualisation.waydroid.enable = true; - - environment.systemPackages = with pkgs; [ - distrobox - - (writeShellScriptBin "dbox-create" '' - #!/usr/bin/env bash - - # 1. Initialize variables - IMAGE="" - NAME="" - - # Array to hold optional arguments (like volumes) - declare -a EXTRA_ARGS - - # 2. Parse arguments - while [[ $# -gt 0 ]]; do - case $1 in - -i|--image) - IMAGE="$2" - shift 2 - ;; - -n|--name) - NAME="$2" - shift 2 - ;; - -p|--profile) - echo ":: Profile mode enabled: Mounting Nix store and user profiles (Read-Only)" - # Add volume flags to the array - EXTRA_ARGS+=( "--volume" "/nix/store:/nix/store:ro" ) - EXTRA_ARGS+=( "--volume" "/etc/profiles/per-user:/etc/profiles/per-user:ro" ) - EXTRA_ARGS+=( "--volume" "/etc/static/profiles/per-user:/etc/static/profiles/per-user:ro" ) - shift 1 - ;; - *) - echo "Unknown option $1" - exit 1 - ;; - esac - done - - if [ -z "$IMAGE" ] || [ -z "$NAME" ]; then - echo "Usage: dbox-create -i -n [-p]" - exit 1 - fi - - # 3. Define the custom home path - CUSTOM_HOME="$HOME/Distrobox/$NAME" - - echo "------------------------------------------------" - echo "Creating Distrobox: $NAME" - echo "Location: $CUSTOM_HOME" - echo "------------------------------------------------" - - # 4. Run Distrobox Create - # We expand "''${EXTRA_ARGS[@]}" to properly pass the volume arguments - ${pkgs.distrobox}/bin/distrobox create \ - --image "$IMAGE" \ - --name "$NAME" \ - --home "$CUSTOM_HOME" \ - "''${EXTRA_ARGS[@]}" - - # Check exit code - if [ $? -ne 0 ]; then - echo "Error: Distrobox creation failed." - exit 1 - fi - - # 5. Post-Creation: Symlink Config Files - echo "--> Linking configurations to $NAME..." - - # Helper function to symlink - link_config() { - SRC="$1" - DEST="$2" - DEST_DIR=$(dirname "$DEST") - - # Create parent directory if it doesn't exist - mkdir -p "$DEST_DIR" - - if [ -e "$SRC" ]; then - # ln -sf: symbolic link, force overwrite - ln -sf "$SRC" "$DEST" - echo " [LINK] $DEST -> $SRC" - else - echo " [SKIP] $SRC not found on host" - fi - } - - # Create Symlinks - link_config "$HOME/.zshrc" "$CUSTOM_HOME/.zshrc" - link_config "$HOME/.zshenv" "$CUSTOM_HOME/.zshenv" - link_config "$HOME/.config/fastfetch" "$CUSTOM_HOME/.config/fastfetch" - link_config "$HOME/.config/starship.toml" "$CUSTOM_HOME/.config/starship.toml" - - echo "--> Done! Enter via: distrobox enter $NAME" - '') - ]; - }; + flake.modules.nixos.virtualisation = { + config, + lib, + pkgs, + ... + }: let + cfg = config.tnix.virtualisation; + in { + options.tnix.virtualisation.distrobox = { + enable = lib.mkEnableOption "Enable DistroBox"; }; + + config = lib.mkIf cfg.distrobox.enable { + virtualisation.waydroid.enable = true; + + environment.systemPackages = with pkgs; [ + distrobox + + (writeShellScriptBin "dbox-create" '' + #!/usr/bin/env bash + + # 1. Initialize variables + IMAGE="" + NAME="" + + # Array to hold optional arguments (like volumes) + declare -a EXTRA_ARGS + + # 2. Parse arguments + while [[ $# -gt 0 ]]; do + case $1 in + -i|--image) + IMAGE="$2" + shift 2 + ;; + -n|--name) + NAME="$2" + shift 2 + ;; + -p|--profile) + echo ":: Profile mode enabled: Mounting Nix store and user profiles (Read-Only)" + # Add volume flags to the array + EXTRA_ARGS+=( "--volume" "/nix/store:/nix/store:ro" ) + EXTRA_ARGS+=( "--volume" "/etc/profiles/per-user:/etc/profiles/per-user:ro" ) + EXTRA_ARGS+=( "--volume" "/etc/static/profiles/per-user:/etc/static/profiles/per-user:ro" ) + shift 1 + ;; + *) + echo "Unknown option $1" + exit 1 + ;; + esac + done + + if [ -z "$IMAGE" ] || [ -z "$NAME" ]; then + echo "Usage: dbox-create -i -n [-p]" + exit 1 + fi + + # 3. Define the custom home path + CUSTOM_HOME="$HOME/Distrobox/$NAME" + + echo "------------------------------------------------" + echo "Creating Distrobox: $NAME" + echo "Location: $CUSTOM_HOME" + echo "------------------------------------------------" + + # 4. Run Distrobox Create + # We expand "''${EXTRA_ARGS[@]}" to properly pass the volume arguments + ${pkgs.distrobox}/bin/distrobox create \ + --image "$IMAGE" \ + --name "$NAME" \ + --home "$CUSTOM_HOME" \ + "''${EXTRA_ARGS[@]}" + + # Check exit code + if [ $? -ne 0 ]; then + echo "Error: Distrobox creation failed." + exit 1 + fi + + # 5. Post-Creation: Symlink Config Files + echo "--> Linking configurations to $NAME..." + + # Helper function to symlink + link_config() { + SRC="$1" + DEST="$2" + DEST_DIR=$(dirname "$DEST") + + # Create parent directory if it doesn't exist + mkdir -p "$DEST_DIR" + + if [ -e "$SRC" ]; then + # ln -sf: symbolic link, force overwrite + ln -sf "$SRC" "$DEST" + echo " [LINK] $DEST -> $SRC" + else + echo " [SKIP] $SRC not found on host" + fi + } + + # Create Symlinks + link_config "$HOME/.zshrc" "$CUSTOM_HOME/.zshrc" + link_config "$HOME/.zshenv" "$CUSTOM_HOME/.zshenv" + link_config "$HOME/.config/fastfetch" "$CUSTOM_HOME/.config/fastfetch" + link_config "$HOME/.config/starship.toml" "$CUSTOM_HOME/.config/starship.toml" + + echo "--> Done! Enter via: distrobox enter $NAME" + '') + ]; + }; + }; } diff --git a/modules/nixos/virtualisation/docker.nix b/modules/nixos/virtualisation/docker.nix index dfcdb6e..79a3538 100644 --- a/modules/nixos/virtualisation/docker.nix +++ b/modules/nixos/virtualisation/docker.nix @@ -1,32 +1,29 @@ { - flake.modules.nixos.virtualisation = - { - config, - lib, - pkgs, - userName, - ... - }: - let - cfg = config.tnix.virtualisation; - in - { - options.tnix.virtualisation.docker = { - enable = lib.mkEnableOption "Docker container runtime"; - nvidia = { - enable = lib.mkEnableOption "NVIDIA Container Toolkit for Docker"; - }; - }; - - config = lib.mkIf cfg.docker.enable { - virtualisation = { - oci-containers.backend = "docker"; - docker.enable = true; - }; - - hardware.nvidia-container-toolkit.enable = lib.mkIf cfg.docker.nvidia.enable true; - environment.systemPackages = with pkgs; [ lazydocker ]; - users.users.${userName}.extraGroups = [ "docker" ]; + flake.modules.nixos.virtualisation = { + config, + lib, + pkgs, + userName, + ... + }: let + cfg = config.tnix.virtualisation; + in { + options.tnix.virtualisation.docker = { + enable = lib.mkEnableOption "Docker container runtime"; + nvidia = { + enable = lib.mkEnableOption "NVIDIA Container Toolkit for Docker"; }; }; + + config = lib.mkIf cfg.docker.enable { + virtualisation = { + oci-containers.backend = "docker"; + docker.enable = true; + }; + + hardware.nvidia-container-toolkit.enable = lib.mkIf cfg.docker.nvidia.enable true; + environment.systemPackages = with pkgs; [lazydocker]; + users.users.${userName}.extraGroups = ["docker"]; + }; + }; } diff --git a/modules/nixos/virtualisation/qemu.nix b/modules/nixos/virtualisation/qemu.nix index 793c2b0..d071e6b 100644 --- a/modules/nixos/virtualisation/qemu.nix +++ b/modules/nixos/virtualisation/qemu.nix @@ -1,38 +1,34 @@ { - flake.modules.nixos.virtualisation = - { - config, - lib, - pkgs, - userName, - ... - }: - let - cfg = config.tnix.virtualisation; - in - { - options.tnix.virtualisation.qemu = { - enable = lib.mkEnableOption "QEMU/KVM virtualization with libvirtd"; - }; - - config = lib.mkIf cfg.qemu.enable { - virtualisation = { - libvirtd = { - enable = true; - qemu = { - swtpm.enable = true; - }; - }; - spiceUSBRedirection.enable = true; - }; - - users.users.${userName}.extraGroups = [ "libvirtd" ]; - - environment.systemPackages = with pkgs; [ - virt-manager - virt-viewer - ]; - }; + flake.modules.nixos.virtualisation = { + config, + lib, + pkgs, + userName, + ... + }: let + cfg = config.tnix.virtualisation; + in { + options.tnix.virtualisation.qemu = { + enable = lib.mkEnableOption "QEMU/KVM virtualization with libvirtd"; }; + config = lib.mkIf cfg.qemu.enable { + virtualisation = { + libvirtd = { + enable = true; + qemu = { + swtpm.enable = true; + }; + }; + spiceUSBRedirection.enable = true; + }; + + users.users.${userName}.extraGroups = ["libvirtd"]; + + environment.systemPackages = with pkgs; [ + virt-manager + virt-viewer + ]; + }; + }; } diff --git a/modules/nixos/virtualisation/waydroid.nix b/modules/nixos/virtualisation/waydroid.nix index 933e2d2..d103556 100644 --- a/modules/nixos/virtualisation/waydroid.nix +++ b/modules/nixos/virtualisation/waydroid.nix @@ -1,20 +1,17 @@ { - flake.modules.nixos.virtualisation = - { - config, - lib, - ... - }: - let - cfg = config.tnix.virtualisation; - in - { - options.tnix.virtualisation.waydroid = { - enable = lib.mkEnableOption "Waydroid Android container"; - }; - - config = lib.mkIf cfg.waydroid.enable { - virtualisation.waydroid.enable = true; - }; + flake.modules.nixos.virtualisation = { + config, + lib, + ... + }: let + cfg = config.tnix.virtualisation; + in { + options.tnix.virtualisation.waydroid = { + enable = lib.mkEnableOption "Waydroid Android container"; }; + + config = lib.mkIf cfg.waydroid.enable { + virtualisation.waydroid.enable = true; + }; + }; }