diff options
73 files changed, 531 insertions, 1993 deletions
@@ -36,17 +36,14 @@ }, "flake-parts": { "inputs": { - "nixpkgs-lib": [ - "neovim-nightly-overlay", - "nixpkgs" - ] + "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1765835352, - "narHash": "sha256-XswHlK/Qtjasvhd1nOa1e8MgZ8GS//jBoTqWtrS1Giw=", + "lastModified": 1767609335, + "narHash": "sha256-feveD98mQpptwrAEggBQKJTYbvwwglSbOv53uCfH9PY=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "a34fae9c08a15ad73f295041fec82323541400a9", + "rev": "250481aafeb741edfe23d29195671c19b36b6dca", "type": "github" }, "original": { @@ -57,7 +54,7 @@ }, "flake-parts_2": { "inputs": { - "nixpkgs-lib": "nixpkgs-lib" + "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { "lastModified": 1765835352, @@ -111,39 +108,18 @@ "type": "github" } }, - "neovim-nightly-overlay": { - "inputs": { - "flake-parts": "flake-parts", - "neovim-src": "neovim-src", - "nixpkgs": "nixpkgs_2" - }, + "import-tree": { "locked": { - "lastModified": 1767485114, - "narHash": "sha256-Y3Y+cTyUtlKNUAEw1v/g9K67Go/Hb6pRHJJ0CLs7r4w=", - "owner": "nix-community", - "repo": "neovim-nightly-overlay", - "rev": "f731eee3e59ad17361587898b55054644c18bd81", + "lastModified": 1763762820, + "narHash": "sha256-ZvYKbFib3AEwiNMLsejb/CWs/OL/srFQ8AogkebEPF0=", + "owner": "vic", + "repo": "import-tree", + "rev": "3c23749d8013ec6daa1d7255057590e9ca726646", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "neovim-nightly-overlay", - "type": "github" - } - }, - "neovim-src": { - "flake": false, - "locked": { - "lastModified": 1767483975, - "narHash": "sha256-kufXcgn8ZbShHKCvgHgxZq85yCWrOJYgcY40k+JBno8=", - "owner": "neovim", - "repo": "neovim", - "rev": "715015d3b231a5d640f9bb109caf4d817c7f2bd6", - "type": "github" - }, - "original": { - "owner": "neovim", - "repo": "neovim", + "owner": "vic", + "repo": "import-tree", "type": "github" } }, @@ -171,7 +147,7 @@ "inputs": { "flake-compat": "flake-compat", "flake-parts": "flake-parts_2", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1767451989, @@ -218,23 +194,22 @@ "type": "github" } }, - "nixpkgs_2": { + "nixpkgs-lib_2": { "locked": { - "lastModified": 1767364772, - "narHash": "sha256-fFUnEYMla8b7UKjijLnMe+oVFOz6HjijGGNS1l7dYaQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "16c7794d0a28b5a37904d55bcca36003b9109aaa", + "lastModified": 1765674936, + "narHash": "sha256-k00uTP4JNfmejrCLJOwdObYC9jHRrr/5M/a/8L2EIdo=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "2075416fcb47225d9b68ac469a5c4801a9c4dd85", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", + "owner": "nix-community", + "repo": "nixpkgs.lib", "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_2": { "locked": { "lastModified": 1766885793, "narHash": "sha256-P6RVkrM9JLCW6xBjSwHfgTOQ1JwBUma5xe5LI8xAPC0=", @@ -250,7 +225,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_3": { "locked": { "lastModified": 1767364772, "narHash": "sha256-fFUnEYMla8b7UKjijLnMe+oVFOz6HjijGGNS1l7dYaQ=", @@ -266,7 +241,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_4": { "locked": { "lastModified": 1759381078, "narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=", @@ -282,7 +257,7 @@ "type": "github" } }, - "nixpkgs_6": { + "nixpkgs_5": { "locked": { "lastModified": 1766651565, "narHash": "sha256-QEhk0eXgyIqTpJ/ehZKg9IKS7EtlWxF3N7DXy42zPfU=", @@ -301,11 +276,12 @@ "root": { "inputs": { "firefox-addons": "firefox-addons", + "flake-parts": "flake-parts", "home-manager": "home-manager", - "neovim-nightly-overlay": "neovim-nightly-overlay", + "import-tree": "import-tree", "nix-darwin": "nix-darwin", "nixcord": "nixcord", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_3", "site": "site", "spicetify-nix": "spicetify-nix" } @@ -313,7 +289,7 @@ "site": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_4" }, "locked": { "lastModified": 1766967002, @@ -331,7 +307,7 @@ }, "spicetify-nix": { "inputs": { - "nixpkgs": "nixpkgs_6", + "nixpkgs": "nixpkgs_5", "systems": "systems_2" }, "locked": { @@ -4,6 +4,9 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + import-tree.url = "github:vic/import-tree"; + nix-darwin.url = "github:nix-darwin/nix-darwin"; nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; @@ -12,8 +15,6 @@ site.url = "github:schererleander/site"; - neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; - spicetify-nix.url = "github:Gerg-L/spicetify-nix"; nixcord.url = "github:kaylorben/nixcord"; @@ -21,43 +22,6 @@ firefox-addons.url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; }; - outputs = - { ... }@inputs: - let - linux-system = "x86_64-linux"; - darwin-system = "aarch64-darwin"; - username = "schererleander"; - overlays = [ ]; - lib = import ./lib { inherit inputs; }; - in - { - nixosConfigurations = { - adam = lib.mkSystem { - host = "adam"; - username = "schererleander"; - system = linux-system; - overlays = overlays; - extraHomeModules = [ - inputs.nixcord.homeModules.nixcord - inputs.spicetify-nix.homeManagerModules.spicetify - ]; - }; - sachiel = lib.mkSystem { - host = "sachiel"; - username = "administrator"; - system = linux-system; - useHomeManager = false; - }; - }; - darwinConfigurations.lilith = lib.mkSystem { - host = "lilith"; - username = username; - system = darwin-system; - overlays = overlays; - extraHomeModules = [ - inputs.nixcord.homeModules.nixcord - inputs.spicetify-nix.homeManagerModules.spicetify - ]; - }; - }; + outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } + (inputs.import-tree ./modules/flake); } diff --git a/home/schererleander.nix b/home/schererleander.nix new file mode 100644 index 0000000..83e59e8 --- /dev/null +++ b/home/schererleander.nix @@ -0,0 +1,78 @@ +{ + pkgs, + lib, + ... +}: + +let + inherit (lib) optionals optionalAttrs; + isDarwin = pkgs.stdenv.isDarwin; +in +{ + home.stateVersion = "25.11"; + + home.packages = + with pkgs; + [ + htop + ffmpeg + wget + zoxide + zathura + jetbrains.idea-community + anki + obsidian + typst + nerd-fonts.symbols-only + nextcloud-client + ] + ++ optionals isDarwin [ + iterm2 + rectangle + bambu-studio + arduino-ide + ] + ++ optionals (!isDarwin) [ + mpv + firefox + arduino-ide + ]; + + home.sessionVariables = optionalAttrs isDarwin { + PATH = "/opt/homebrew/opt/openjdk@21/bin:$PATH"; + }; + + home.shellAliases = optionalAttrs (!isDarwin) { + open = "xdg-open"; + }; + + programs.home-manager.enable = true; + + nx = { + shells.zsh.enable = true; + + editors.neovim = { + enable = true; + langs = { + python = true; + go = true; + latex = true; + nix = true; + lua = true; + typst = true; + }; + }; + + programs.git.enable = true; + cli.opencode.enable = true; + + media = { + spicetify.enable = true; + nixcord.enable = true; + }; + + productivity = { + latex.enable = true; + }; + }; +} diff --git a/hosts/adam/configuration.nix b/hosts/adam/configuration.nix index 0abfeac..18f3d4f 100644 --- a/hosts/adam/configuration.nix +++ b/hosts/adam/configuration.nix @@ -1,9 +1,11 @@ { pkgs, - username, ... }: +let + username = "schererleander"; +in { imports = [ ./hardware-configuration.nix @@ -11,33 +13,13 @@ boot = { kernelPackages = pkgs.linuxPackages_latest; - kernelParams = [ - "amd_pstate=active" - "quiet" - "splash" - "boot.shell_on_fail" - "udev.log_priority=3" - "rd.systemd.show_status=auto" - ]; - initrd = { - luks.devices."luks-803851e9-7fa8-4367-a927-0bb76d0fe830".device = - "/dev/disk/by-uuid/803851e9-7fa8-4367-a927-0bb76d0fe830"; - }; - consoleLogLevel = 3; + kernelParams = [ "amd_pstate=active" ]; + initrd.luks.devices."luks-803851e9-7fa8-4367-a927-0bb76d0fe830".device = + "/dev/disk/by-uuid/803851e9-7fa8-4367-a927-0bb76d0fe830"; loader = { timeout = 0; systemd-boot.enable = true; efi.canTouchEfiVariables = true; - systemd-boot.consoleMode = "max"; - }; - plymouth = { - enable = true; - theme = "lone"; - themePackages = with pkgs; [ - (adi1090x-plymouth-themes.override { - selected_themes = [ "lone" ]; - }) - ]; }; }; @@ -47,20 +29,6 @@ enable32Bit = true; }; - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - settings = { - General = { - Experimental = true; - FastConnectable = true; - }; - Policy = { - AutoEnable = true; - }; - }; - }; - networking.networkmanager.enable = true; # Localisation @@ -84,48 +52,31 @@ programs.dconf.enable = true; nx = { + plymouth.enable = true; desktop.kde.enable = true; - dns.enable = true; - - user.${username} = { - stateVersion = "25.11"; - packages = with pkgs; [ - imv - mpv - firefox - zoxide - ]; - shellAliases = { - open = "xdg-open"; - }; + steam.enable = true; + dns.enable = true; + hardware.bluetooth.enable = true; + }; - nx = { - terminal.defaultShell = "zsh"; + # User configuration + users.users.${username} = { + isNormalUser = true; + home = "/home/${username}"; + shell = pkgs.zsh; + ignoreShellProgramCheck = true; + extraGroups = [ + "wheel" + "networkmanager" + "video" + "input" + ]; + }; - editors.neovim = { - enable = true; - langs = { - python = true; - go = true; - latex = true; - nix = true; - lua = true; - }; - }; - git.enable = true; - cli.opencode.enable = true; - media = { - spicetify.enable = true; - nixcord.enable = true; - }; - productivity = { - nextcloud-client.enable = true; - obsidian.enable = true; - latex.enable = true; - anki.enable = true; - }; - }; - }; + home-manager.users.${username} = { + imports = [ ../../home/schererleander.nix ]; + home.username = username; + home.homeDirectory = "/home/${username}"; }; system.stateVersion = "25.11"; diff --git a/hosts/lilith/configuration.nix b/hosts/lilith/configuration.nix index 2a35c74..e631b51 100644 --- a/hosts/lilith/configuration.nix +++ b/hosts/lilith/configuration.nix @@ -1,57 +1,21 @@ { - pkgs, host, - username, ... }: +let + username = "schererleander"; +in { networking.hostName = host; - nx.user.${username} = { - stateVersion = "25.11"; - packages = with pkgs; [ - htop - ffmpeg - wget + # User configuration + users.users.${username}.home = "/Users/${username}"; - zathura - gemini-cli - iterm2 - rectangle - slack - podman - jetbrains.idea-community - - nerd-fonts.symbols-only - ]; - sessionVariables = { - PATH = "/opt/homebrew/opt/openjdk@21/bin:$PATH"; - }; - - nx = { - terminal.defaultShell = "zsh"; - - editors.neovim = { - enable = true; - langs = { - python = true; - go = true; - java = true; - latex = true; - }; - }; - git.enable = true; - cli.opencode.enable = true; - media = { - spicetify.enable = true; - nixcord.enable = true; - }; - productivity = { - obsidian.enable = true; - latex.enable = true; - }; - }; + home-manager.users.${username} = { + imports = [ ../../home/schererleander.nix ]; + home.username = username; + home.homeDirectory = "/Users/${username}"; }; system.primaryUser = username; @@ -63,8 +27,6 @@ }; WindowManager.EnableStandardClickToShowDesktop = false; finder = { - #ShowPathbar = true; - #ShowStatusBar = true; _FXShowPosixPathInTitle = true; _FXSortFoldersFirst = true; }; @@ -82,11 +44,7 @@ "openjdk@21" ]; casks = [ - "nextcloud" "mullvad-vpn" - "bambu-studio" - "arduino-ide" - "anki" ]; onActivation.cleanup = "zap"; onActivation.autoUpdate = true; diff --git a/hosts/sachiel/configuration.nix b/hosts/sachiel/configuration.nix index 3944006..207447d 100644 --- a/hosts/sachiel/configuration.nix +++ b/hosts/sachiel/configuration.nix @@ -1,10 +1,12 @@ { pkgs, host, - username, ... }: +let + username = "administrator"; +in { imports = [ ./hardware-configuration.nix @@ -65,10 +67,16 @@ }; nx.server = { - openssh.enable = true; + openssh = { + enable = true; + allowedUsers = [ username ]; + }; fail2ban.enable = true; nginx.enable = true; - nextcloud.enable = true; + nextcloud = { + enable = true; + user = username; + }; site.enable = true; }; diff --git a/images/pf.jpg b/images/pf.jpg Binary files differdeleted file mode 100644 index e7b8fb5..0000000 --- a/images/pf.jpg +++ /dev/null diff --git a/images/pond.jpg b/images/pond.jpg Binary files differdeleted file mode 100644 index 520a8a7..0000000 --- a/images/pond.jpg +++ /dev/null diff --git a/images/tokyo tower.jpg b/images/tokyo tower.jpg Binary files differdeleted file mode 100644 index e6e9c84..0000000 --- a/images/tokyo tower.jpg +++ /dev/null diff --git a/lib/default.nix b/lib/default.nix deleted file mode 100644 index 5424801..0000000 --- a/lib/default.nix +++ /dev/null @@ -1,203 +0,0 @@ -{ inputs, ... }: - -let - lib = inputs.nixpkgs.lib; - isDarwin = s: lib.strings.hasSuffix "-darwin" s; -in -{ - mkUser = - { - username, - homeDirectory ? null, - useHomeManager ? true, - extraHomeModules ? [ ], - }: - { - config, - pkgs, - lib, - system, - inputs, - ... - }: - let - inherit (lib) - mkOption - types - mkIf - mkMerge - optional - optionals - ; - - darwinHost = isDarwin system; - defaultHome = if darwinHost then "/Users/${username}" else "/home/${username}"; - home = if homeDirectory != null then homeDirectory else defaultHome; - - anyDesktopEnabled = - (config.nx.desktop.kde.enable or false) - || (config.nx.desktop.hyprland.enable or false) - || (config.nx.desktop.gnome.enable or false) - || (config.nx.desktop.cinnamon.enable or false) - || (config.nx.desktop.sway.enable or false) - || (config.nx.desktop.labwc.enable or false); - - cfg = config.nx.user.${username}; - - shellPkg = if (cfg.nx.terminal.defaultShell or "bash") == "zsh" then pkgs.zsh else pkgs.bash; - in - { - options.nx.user.${username} = mkOption { - description = "User configuration for ${username}"; - type = types.submodule { - freeformType = types.attrsOf types.anything; - options = { - stateVersion = mkOption { - type = types.str; - description = "home.stateVersion for this user"; - }; - - packages = mkOption { - type = types.listOf types.package; - default = [ ]; - description = "Extra packages for this user"; - }; - - shellAliases = mkOption { - type = types.attrsOf types.str; - default = { }; - description = "Shell aliases"; - }; - - sessionVariables = mkOption { - type = types.attrsOf types.str; - default = { }; - description = "Session environment variables"; - }; - - nx = mkOption { - type = types.attrsOf types.anything; - default = { }; - description = "User module options (proxied to home-manager's nx.*)"; - }; - }; - }; - default = { }; - }; - - config = mkMerge [ - (mkIf (!darwinHost) { - users.users.${username} = { - isNormalUser = true; - home = home; - shell = shellPkg; - ignoreShellProgramCheck = true; - extraGroups = - [ - "wheel" - ] - ++ optional (config.networking.networkmanager.enable or false) "networkmanager" - ++ optionals anyDesktopEnabled [ - "video" - "input" - ] - ++ optional (config.nx.services.audio.enable or false) "audio" - ++ optional (config.nx.printer.enable or false) "lp"; - }; - }) - - (mkIf darwinHost { - users.users.${username}.home = home; - }) - - (mkIf useHomeManager { - home-manager.extraSpecialArgs = { inherit inputs; }; - - home-manager.users.${username} = { - home.username = username; - home.homeDirectory = home; - home.stateVersion = cfg.stateVersion; - home.packages = cfg.packages; - home.sessionVariables = cfg.sessionVariables; - - programs.home-manager.enable = true; - - programs.zsh.shellAliases = mkIf (cfg.nx.terminal.defaultShell == "zsh") cfg.shellAliases; - programs.bash.shellAliases = mkIf (cfg.nx.terminal.defaultShell == "bash") cfg.shellAliases; - - imports = [ ../modules/users ] ++ extraHomeModules; - - nx = cfg.nx; - }; - }) - ]; - }; - - mkSystem = - { - host, - username, - system, - overlays ? [ ], - extraModules ? [ ], - extraSpecialArgs ? { }, - useHomeManager ? true, - extraHomeModules ? [ ], - }: - let - darwinHost = isDarwin system; - builder = - if darwinHost then inputs.nix-darwin.lib.darwinSystem else inputs.nixpkgs.lib.nixosSystem; - hostDir = ../hosts/${host}; - hostCfg = hostDir + /configuration.nix; - - self = import ./. { inherit inputs; }; - - nixpkgsModule = { - nixpkgs.overlays = overlays; - nixpkgs.config.allowUnfree = true; - - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; - }; - - modules = - [ - hostCfg - nixpkgsModule - ] - ++ (lib.optional (!darwinHost) ../modules/hosts) - ++ (lib.optional useHomeManager ( - if darwinHost then - inputs.home-manager.darwinModules.home-manager - else - inputs.home-manager.nixosModules.home-manager - )) - ++ (lib.optional useHomeManager (self.mkUser { - inherit - username - useHomeManager - extraHomeModules - ; - })) - ++ extraModules; - in - builder { - system = system; - specialArgs = ( - { - inherit - inputs - system - host - username - useHomeManager - ; - } - // extraSpecialArgs - ); - modules = modules; - }; -} diff --git a/modules/flake/darwin.nix b/modules/flake/darwin.nix new file mode 100644 index 0000000..84eb74d --- /dev/null +++ b/modules/flake/darwin.nix @@ -0,0 +1,22 @@ +{ inputs, config, self, ... }: + +{ + flake.darwinConfigurations = { + lilith = inputs.nix-darwin.lib.darwinSystem { + system = "aarch64-darwin"; + specialArgs = { inherit inputs; host = "lilith"; }; + modules = [ + inputs.home-manager.darwinModules.home-manager + { + home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.sharedModules = [ config.flake.homeModules.default ]; + } + (self + /hosts/lilith/configuration.nix) + { + nixpkgs.config.allowUnfree = true; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + } + ]; + }; + }; +} diff --git a/modules/flake/home.nix b/modules/flake/home.nix new file mode 100644 index 0000000..288b558 --- /dev/null +++ b/modules/flake/home.nix @@ -0,0 +1,22 @@ +{ inputs, self, ... }: + +let + inherit (inputs.nixpkgs) lib; + import-tree = inputs.import-tree.withLib lib; + + homeModuleFiles = import-tree.leafs (self + /modules/home); +in +{ + imports = [ + inputs.home-manager.flakeModules.home-manager + ]; + + flake.homeModules = { + default = { + imports = homeModuleFiles ++ [ + inputs.nixcord.homeModules.nixcord + inputs.spicetify-nix.homeManagerModules.spicetify + ]; + }; + }; +} diff --git a/modules/flake/nixos.nix b/modules/flake/nixos.nix new file mode 100644 index 0000000..efc6d15 --- /dev/null +++ b/modules/flake/nixos.nix @@ -0,0 +1,45 @@ +{ inputs, config, self, ... }: + +let + inherit (inputs.nixpkgs) lib; + import-tree = inputs.import-tree.withLib lib; + + # Use import-tree.leafs to get list of NixOS module paths + nixosModuleFiles = import-tree.leafs (self + /modules/nixos); + + # Common NixOS modules for all hosts + commonNixosModules = nixosModuleFiles ++ [ + { + nixpkgs.config.allowUnfree = true; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + } + ]; + + # Home-manager modules for hosts that use it + homeManagerModules = [ + inputs.home-manager.nixosModules.home-manager + { + home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.sharedModules = [ config.flake.homeModules.default ]; + } + ]; +in +{ + flake.nixosConfigurations = { + adam = lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; host = "adam"; }; + modules = commonNixosModules ++ homeManagerModules ++ [ + (self + /hosts/adam/configuration.nix) + ]; + }; + + sachiel = lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; host = "sachiel"; }; + modules = commonNixosModules ++ [ + (self + /hosts/sachiel/configuration.nix) + ]; + }; + }; +} diff --git a/modules/flake/systems.nix b/modules/flake/systems.nix new file mode 100644 index 0000000..e66e2e1 --- /dev/null +++ b/modules/flake/systems.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + # Define systems for perSystem (even if we don't use it much) + systems = [ + "x86_64-linux" + "aarch64-darwin" + ]; +} diff --git a/modules/users/browsers/firefox/default.nix b/modules/home/browsers/firefox/default.nix index b5212a2..2cb0656 100644 --- a/modules/users/browsers/firefox/default.nix +++ b/modules/home/browsers/firefox/default.nix @@ -9,6 +9,7 @@ let cfg = config.nx.browsers.firefox; inherit (lib) + mkEnableOption mkOption types mkIf @@ -19,11 +20,7 @@ in { options.nx.browsers.firefox = { - enable = mkOption { - description = "mozilla firefox"; - type = types.bool; - default = false; - }; + enable = mkEnableOption "mozilla firefox"; blockGoogle = mkOption { description = "blocks google banner and other"; type = types.bool; @@ -56,7 +53,7 @@ in enable = true; profiles.default = { extensions = { - packages = with inputs.firefox-addons.packages.${pkgs.system}; [ + packages = with inputs.firefox-addons.packages.${pkgs.stdenv.hostPlatform.system}; [ ublock-origin istilldontcareaboutcookies sponsorblock diff --git a/modules/users/cli/opencode/default.nix b/modules/home/cli/opencode/default.nix index 8c1071d..48be861 100644 --- a/modules/users/cli/opencode/default.nix +++ b/modules/home/cli/opencode/default.nix @@ -5,16 +5,12 @@ }: let cfg = config.nx.cli.opencode; - inherit (lib) mkOption types mkIf; + inherit (lib) mkEnableOption mkIf; in { options.nx.cli.opencode = { - enable = mkOption { - description = "opencode open source ai coding agent"; - type = types.bool; - default = false; - }; + enable = mkEnableOption "opencode open source ai coding agent"; }; config = mkIf cfg.enable { diff --git a/modules/users/cli/tmux/default.nix b/modules/home/cli/tmux/default.nix index 9259c0b..989851c 100644 --- a/modules/users/cli/tmux/default.nix +++ b/modules/home/cli/tmux/default.nix @@ -5,24 +5,19 @@ ... }: let - inherit (lib) mkOption types mkIf; - cfg = config.nx.tmux; + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.cli.tmux; in { - options.nx.tmux = { - enable = mkOption { - description = "tmux"; - type = types.bool; - default = config.nx.terminal.multiplexer == "tmux"; - }; + options.nx.cli.tmux = { + enable = mkEnableOption "tmux"; }; config = mkIf cfg.enable { programs.tmux = { enable = true; keyMode = "vi"; secureSocket = true; - shell = "${pkgs.${config.nx.terminal.defaultShell}}/bin/${config.nx.terminal.defaultShell}"; terminal = "xterm-256color"; extraConfig = '' unbind C-b diff --git a/modules/users/editors/neovim/default.nix b/modules/home/editors/neovim/default.nix index d6c8218..c9d30db 100644 --- a/modules/users/editors/neovim/default.nix +++ b/modules/home/editors/neovim/default.nix @@ -1,6 +1,5 @@ { config, - username, lib, pkgs, ... @@ -54,6 +53,11 @@ in type = types.bool; default = false; }; + typst = mkOption { + description = "enable typst integration"; + type = types.bool; + default = false; + }; }; }; @@ -79,7 +83,8 @@ in pkgs.nixfmt ]) ++ (optionals cfg.langs.lua [ pkgs.lua-language-server ]) - ++ (optionals cfg.langs.latex [ pkgs.texlab ]); + ++ (optionals cfg.langs.latex [ pkgs.texlab ]) + ++ (optionals cfg.langs.typst [ pkgs.tinymist ]); plugins = with pkgs.vimPlugins; [ gruvbox-nvim diff --git a/modules/users/editors/neovim/init.lua b/modules/home/editors/neovim/init.lua index efd021f..141eb3c 100644 --- a/modules/users/editors/neovim/init.lua +++ b/modules/home/editors/neovim/init.lua @@ -126,6 +126,20 @@ vim.api.nvim_create_autocmd('LspAttach', { end, }) +-- Format on save for all languages with LSP support +vim.api.nvim_create_autocmd('BufWritePre', { + group = vim.api.nvim_create_augroup('FormatOnSave', {}), + callback = function() + local clients = vim.lsp.get_clients({ bufnr = 0 }) + for _, client in ipairs(clients) do + if client.supports_method('textDocument/formatting') then + vim.lsp.buf.format({ async = false }) + return + end + end + end, +}) + -- Native LSP setup (Neovim v0.11+) vim.lsp.config('nixd', { cmd = { 'nixd' }, diff --git a/modules/users/editors/vscode/default.nix b/modules/home/editors/vscode/default.nix index fe2c444..9762d92 100644 --- a/modules/users/editors/vscode/default.nix +++ b/modules/home/editors/vscode/default.nix @@ -7,6 +7,7 @@ let inherit (lib) + mkEnableOption mkOption types mkIf @@ -16,11 +17,7 @@ let in { options.nx.editors.vscode = { - enable = mkOption { - description = "vscode editor"; - type = types.bool; - default = false; - }; + enable = mkEnableOption "vscode editor"; useVSCodium = mkOption { description = "Use vscodium instead of vscode"; diff --git a/modules/users/editors/zed/default.nix b/modules/home/editors/zed/default.nix index 5ff0714..431560c 100644 --- a/modules/users/editors/zed/default.nix +++ b/modules/home/editors/zed/default.nix @@ -6,6 +6,7 @@ let inherit (lib) + mkEnableOption mkOption types mkIf @@ -15,11 +16,7 @@ let in { options.nx.editors.zed-editor = { - enable = mkOption { - description = "Enable and setup zed editor"; - type = types.bool; - default = false; - }; + enable = mkEnableOption "zed editor"; langs = { nix = mkOption { diff --git a/modules/users/git/default.nix b/modules/home/git/default.nix index f1f555e..a2563d5 100644 --- a/modules/users/git/default.nix +++ b/modules/home/git/default.nix @@ -4,16 +4,12 @@ ... }: let - cfg = config.nx.git; - inherit (lib) mkOption mkIf types; + cfg = config.nx.programs.git; + inherit (lib) mkEnableOption mkOption mkIf types; in { - options.nx.git = { - enable = mkOption { - description = "Enable git"; - type = types.bool; - default = false; - }; + options.nx.programs.git = { + enable = mkEnableOption "git"; userName = mkOption { description = "Git username"; diff --git a/modules/users/gpg/default.nix b/modules/home/gpg/default.nix index d5714b0..af08ae3 100644 --- a/modules/users/gpg/default.nix +++ b/modules/home/gpg/default.nix @@ -11,15 +11,15 @@ let types mkIf ; - cfg = config.nx.gpg; + cfg = config.nx.programs.gpg; in { - options.nx.gpg = { + options.nx.programs.gpg = { enable = mkOption { description = "GNU Privacy Guard"; type = types.bool; - default = config.nx.git.enable; + default = config.nx.programs.git.enable; }; gpgKey = mkOption { diff --git a/modules/users/media/nixcord/default.nix b/modules/home/media/nixcord/default.nix index d421abf..8f3b665 100644 --- a/modules/users/media/nixcord/default.nix +++ b/modules/home/media/nixcord/default.nix @@ -5,15 +5,11 @@ }: let cfg = config.nx.media.nixcord; - inherit (lib) mkOption types mkIf; + inherit (lib) mkEnableOption mkOption types mkIf; in { options.nx.media.nixcord = { - enable = lib.mkOption { - description = "Enable nixcord and setup"; - type = types.bool; - default = false; - }; + enable = mkEnableOption "nixcord and setup"; frameless = mkOption { description = "Make discord frameless"; type = types.bool; diff --git a/modules/users/media/spicetify/default.nix b/modules/home/media/spicetify/default.nix index e78b779..06c619b 100644 --- a/modules/users/media/spicetify/default.nix +++ b/modules/home/media/spicetify/default.nix @@ -9,15 +9,11 @@ let spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.stdenv.system}; cfg = config.nx.media.spicetify; - inherit (lib) mkOption types mkIf; + inherit (lib) mkEnableOption mkIf; in { options.nx.media.spicetify = { - enable = mkOption { - description = "Command-line tool to customize the official Spotify client"; - type = types.bool; - default = false; - }; + enable = mkEnableOption "Command-line tool to customize the official Spotify client"; }; config = mkIf cfg.enable { diff --git a/modules/users/productivity/anki/default.nix b/modules/home/productivity/anki/default.nix index 58d8f49..84b1655 100644 --- a/modules/users/productivity/anki/default.nix +++ b/modules/home/productivity/anki/default.nix @@ -5,15 +5,11 @@ }: let cfg = config.nx.productivity.anki; - inherit (lib) mkOption types mkIf; + inherit (lib) mkEnableOption mkIf; in { options.nx.productivity.anki = { - enable = mkOption { - description = "Anki free and open-source flashcard program"; - type = types.bool; - default = false; - }; + enable = mkEnableOption "Anki free and open-source flashcard program"; }; config = mkIf cfg.enable { programs.anki = { diff --git a/modules/users/productivity/latex/default.nix b/modules/home/productivity/latex/default.nix index 0720664..6f37138 100644 --- a/modules/users/productivity/latex/default.nix +++ b/modules/home/productivity/latex/default.nix @@ -7,15 +7,11 @@ }: let cfg = config.nx.productivity.latex; - inherit (lib) mkOption types mkIf; + inherit (lib) mkEnableOption mkIf; in { options.nx.productivity.latex = { - enable = mkOption { - description = "LaTeX typesetting system"; - type = types.bool; - default = false; - }; + enable = mkEnableOption "LaTeX typesetting system"; }; config = mkIf cfg.enable { diff --git a/modules/users/shells/bash/default.nix b/modules/home/shells/bash/default.nix index d17ffc5..d224442 100644 --- a/modules/users/shells/bash/default.nix +++ b/modules/home/shells/bash/default.nix @@ -6,15 +6,12 @@ }: let - inherit (lib) mkOption mkIf types; + inherit (lib) mkEnableOption mkIf; cfg = config.nx.shells.bash; in { options.nx.shells.bash = { - enable = mkOption { - type = types.bool; - default = config.nx.terminal.defaultShell == "bash"; - }; + enable = mkEnableOption "bash shell"; }; config = mkIf cfg.enable { diff --git a/modules/users/shells/zsh/default.nix b/modules/home/shells/zsh/default.nix index 0b94c3d..72d3f9a 100644 --- a/modules/users/shells/zsh/default.nix +++ b/modules/home/shells/zsh/default.nix @@ -6,15 +6,12 @@ }: let - inherit (lib) mkOption mkIf types; + inherit (lib) mkEnableOption mkIf; cfg = config.nx.shells.zsh; in { options.nx.shells.zsh = { - enable = mkOption { - type = types.bool; - default = config.nx.terminal.defaultShell == "zsh"; - }; + enable = mkEnableOption "zsh shell"; }; config = mkIf cfg.enable { diff --git a/modules/users/terminal/kitty.nix b/modules/home/terminal/kitty.nix index 02789cd..35d5648 100644 --- a/modules/users/terminal/kitty.nix +++ b/modules/home/terminal/kitty.nix @@ -5,8 +5,8 @@ }: { - options.nx.programs.kitty.enable = lib.mkEnableOption "Enable kitty"; - config = lib.mkIf config.nx.programs.kitty.enable { + options.nx.terminal.kitty.enable = lib.mkEnableOption "Enable kitty"; + config = lib.mkIf config.nx.terminal.kitty.enable { programs.kitty = { enable = true; shellIntegration.enableFishIntegration = true; diff --git a/modules/users/zathura/default.nix b/modules/home/zathura/default.nix index f07707c..2334fc7 100644 --- a/modules/users/zathura/default.nix +++ b/modules/home/zathura/default.nix @@ -5,15 +5,11 @@ }: let cfg = config.nx.programs.zathura; - inherit (lib) mkOption mkIf types; + inherit (lib) mkEnableOption mkIf; in { options.nx.programs.zathura = { - enable = mkOption { - default = false; - description = "zathura document viewer"; - type = types.bool; - }; + enable = mkEnableOption "zathura document viewer"; }; config = mkIf cfg.enable { diff --git a/modules/hosts/default.nix b/modules/hosts/default.nix deleted file mode 100644 index d8a8927..0000000 --- a/modules/hosts/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ ... }: - -{ - imports = [ - ./audio - ./desktop - ./dns - ./openssh - ./printer - ./server - ./wooting - ./steam - ./mullvad-vpn - ]; -} diff --git a/modules/hosts/desktop/cinnamon/default.nix b/modules/hosts/desktop/cinnamon/default.nix deleted file mode 100644 index 5233ad1..0000000 --- a/modules/hosts/desktop/cinnamon/default.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: - -let - inherit (lib) mkEnableOption mkIf mkForce; - cfg = config.nx.desktop.cinnamon; -in -{ - options.nx.desktop.cinnamon.enable = mkEnableOption "Enable Cinnamon desktop environment"; - - config = mkIf cfg.enable { - services.xserver.enable = true; - services.xserver.displayManager.lightdm.enable = true; - services.xserver.desktopManager.cinnamon.enable = true; - - services.speechd.enable = mkForce false; - services.orca.enable = mkForce false; - - environment.systemPackages = with pkgs; [ - nemo-preview - ]; - }; -} diff --git a/modules/hosts/desktop/default.nix b/modules/hosts/desktop/default.nix deleted file mode 100644 index 7d7f3ae..0000000 --- a/modules/hosts/desktop/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ useHomeManager ? true, ... }: - -{ - imports = [ - # NixOS-only modules (no home-manager) - ./cinnamon - ./gnome - ./kde - ] ++ (if useHomeManager then [ - # Modules that require home-manager - ./hyprland - ./labwc - ./sway - ./dunst.nix - ./waybar.nix - ] else [ ]); -} diff --git a/modules/hosts/desktop/dunst.nix b/modules/hosts/desktop/dunst.nix deleted file mode 100644 index 4c5f74e..0000000 --- a/modules/hosts/desktop/dunst.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ - config, - lib, - pkgs, - username, - ... -}: - -let - inherit (lib) mkEnableOption mkIf; - cfg = config.nx.desktop.dunst; -in -{ - options.nx.desktop.dunst.enable = mkEnableOption "Enable dunst notification"; - config = mkIf cfg.enable { - home-manager.users.${username} = { - home.packages = with pkgs; [ - libnotify - ]; - - services.dunst = { - enable = true; - settings = { - global = { - font = "monospace 10"; - offset = "(15, 15)"; - frame_width = 0; - }; - urgency_low = { - foreground = "#FFFFFF"; - background = "#000000E6"; - }; - - urgency_normal = { - foreground = "#FFFFFF"; - background = "#000000E6"; - }; - - urgency_critical = { - foreground = "#FFFFFF"; - background = "#000000E6"; - }; - }; - }; - }; - }; -} diff --git a/modules/hosts/desktop/hyprland/default.nix b/modules/hosts/desktop/hyprland/default.nix deleted file mode 100644 index 1750a59..0000000 --- a/modules/hosts/desktop/hyprland/default.nix +++ /dev/null @@ -1,283 +0,0 @@ -{ - config, - username, - lib, - pkgs, - ... -}: - -let - inherit (lib) mkEnableOption mkOption mkIf types optionals; - cfg = config.nx.desktop.hyprland; -in -{ - options.nx.desktop.hyprland = { - enable = mkEnableOption "Enable hyprland"; - monitors = mkOption { - type = types.listOf types.str; - default = [ ]; - description = "Monitor configuration strings for Hyprland"; - example = [ "DP-1,highrr,0x0,auto" ]; - }; - lockscreen = { - background = mkOption { - type = types.nullOr types.path; - default = null; - description = "Background image for hyprlock"; - }; - profileImage = mkOption { - type = types.nullOr types.path; - default = null; - description = "Profile image for hyprlock"; - }; - }; - }; - - config = mkIf cfg.enable { - programs.hyprlock.enable = true; - - home-manager.users.${username} = { - home.packages = with pkgs; [ - hyprshot - hyprpicker - ]; - - programs.hyprlock = { - enable = true; - settings = { - general = { - immediate_render = true; - }; - - background = [ - ({ - monitor = ""; - color = "rgba(0, 0, 0, 1.0)"; - } // (if cfg.lockscreen.background != null then { path = "${cfg.lockscreen.background}"; } else { })) - ]; - - input-field = [ - { - monitor = ""; - size = "300, 30"; - outline_thickness = 0; - dots_size = 0.25; - dots_spacing = 0.55; - dots_center = true; - dots_rounding = -1; - outer_color = "rgba(242, 243, 244, 0)"; - inner_color = "rgba(242, 243, 244, 0)"; - font_color = "rgba(242, 243, 244, 0.75)"; - fade_on_empty = false; - placeholder_text = ""; - hide_input = false; - check_color = "rgba(204, 136, 34, 0)"; - fail_color = "rgba(204, 34, 34, 0)"; - fail_text = "$FAIL <b>($ATTEMPTS)</b>"; - fail_transition = 300; - capslock_color = -1; - numlock_color = -1; - bothlock_color = -1; - invert_numlock = false; - swap_font_color = false; - position = "0, -468"; - halign = "center"; - valign = "center"; - } - ]; - - label = [ - { - monitor = ""; - text = ''cmd[update:1000] echo "$(date +"%A, %B %d")"''; - color = "rgba(242, 243, 244, 0.75)"; - font_size = 20; - position = "0, 405"; - halign = "center"; - valign = "center"; - } - { - monitor = ""; - text = ''cmd[update:1000] echo "$(date +"%k:%M")"''; - color = "rgba(242, 243, 244, 0.75)"; - font_size = 93; - position = "0, 310"; - halign = "center"; - valign = "center"; - } - ] ++ optionals (cfg.lockscreen.profileImage != null) [ - { - monitor = ""; - text = "${username}"; - color = "rgba(242, 243, 244, 0.75)"; - font_size = 12; - position = "0, -407"; - halign = "center"; - valign = "center"; - } - { - monitor = ""; - text = "Enter Password"; - color = "rgba(242, 243, 244, 0.75)"; - font_size = 10; - position = "0, -438"; - halign = "center"; - valign = "center"; - } - ]; - - image = optionals (cfg.lockscreen.profileImage != null) [ - { - monitor = ""; - path = "${cfg.lockscreen.profileImage}"; - border_color = "0xffdddddd"; - border_size = 0; - size = 73; - rounding = -1; - rotate = 0; - reload_time = -1; - reload_cmd = ""; - position = "0, -353"; - halign = "center"; - valign = "center"; - } - ]; - }; - }; - - wayland.windowManager.hyprland = { - enable = true; - systemd.enable = true; - xwayland.enable = true; - settings = { - monitor = if cfg.monitors != [ ] then cfg.monitors else [ ",preferred,auto,auto" ]; - - "$background" = "rgba(000000FF)"; - "$accent" = "rgba(FFFFFFFF)"; - - env = [ - "XCURSOR_SIZE,24" - ]; - - input = { - kb_layout = config.console.keyMap; - follow_mouse = 1; - touchpad = { - natural_scroll = true; - }; - }; - - general = { - gaps_in = 5; - gaps_out = 10; - border_size = 2; - "col.active_border" = "$accent"; - "col.inactive_border" = "$background"; - layout = "dwindle"; - }; - - decoration = { - rounding = 5; - active_opacity = 0.8; - inactive_opacity = 0.7; - - blur = { - enabled = true; - size = 4; - passes = 4; - ignore_opacity = true; - contrast = 1.1; - brightness = 1.0; - }; - }; - - animations = { - enabled = true; - bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; - animation = [ - "windows, 1, 7, myBezier" - "windowsOut, 1, 7, default, popin 80%" - "border, 1, 10, default" - "fade, 1, 7, default" - "workspaces, 1, 6, default" - ]; - }; - - misc = { - disable_hyprland_logo = true; - vrr = 1; - }; - - dwindle = { - pseudotile = true; - preserve_split = true; - }; - - xwayland = { - force_zero_scaling = true; - }; - - "$mod" = "SUPER"; - - bind = [ - "$mod, l, exec, hyprlock" - "$mod, s, exec, hyprshot --mode region" - "$mod, r, exec, wofi --show run" - "$mod, d, exec, wofi --show drun" - "$mod, c, exec, hyprpicker -r -a" - "$mod, return, exec, kitty" - "$mod, q, killactive," - "$mod, m, exit," - "$mod, f, fullscreen" - "$mod, v, togglefloating," - "$mod, P, pseudo," - - ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+" - ", XF86AudioLowerVolume, exec, wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%-" - ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - - ", XF86AudioPlay, exec, playerctl play-pause" - ", XF86AudioNext, exec, playerctl next" - ", XF86AudioPrev, exec, playerctl previous" - ", XF86Audiostop, exec, playerctl stop" - - "$mod, left, movefocus, l" - "$mod, right, movefocus, r" - "$mod, up, movefocus, u" - "$mod, down, movefocus, d" - - "$mod, 1, workspace, 1" - "$mod, 2, workspace, 2" - "$mod, 3, workspace, 3" - "$mod, 4, workspace, 4" - "$mod, 5, workspace, 5" - "$mod, 6, workspace, 6" - "$mod, 7, workspace, 7" - "$mod, 8, workspace, 8" - "$mod, 9, workspace, 9" - "$mod, 0, workspace, 10" - - "$mod SHIFT, 1, movetoworkspace, 1" - "$mod SHIFT, 2, movetoworkspace, 2" - "$mod SHIFT, 3, movetoworkspace, 3" - "$mod SHIFT, 4, movetoworkspace, 4" - "$mod SHIFT, 5, movetoworkspace, 5" - "$mod SHIFT, 6, movetoworkspace, 6" - "$mod SHIFT, 7, movetoworkspace, 7" - "$mod SHIFT, 8, movetoworkspace, 8" - "$mod SHIFT, 9, movetoworkspace, 9" - "$mod SHIFT, 0, movetoworkspace, 10" - - "$mod, mouse_down, workspace, e+1" - "$mod, mouse_up, workspace, e-1" - ]; - - bindm = [ - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizewindow" - ]; - }; - }; - }; - }; -} diff --git a/modules/hosts/desktop/labwc/default.nix b/modules/hosts/desktop/labwc/default.nix deleted file mode 100644 index b62dbbe..0000000 --- a/modules/hosts/desktop/labwc/default.nix +++ /dev/null @@ -1,296 +0,0 @@ -{ - config, - username, - pkgs, - lib, - ... -}: - -let - inherit (lib) mkEnableOption mkOption mkIf types optional; - cfg = config.nx.desktop.labwc; - - gruvbox-openbox = pkgs.stdenv.mkDerivation { - pname = "gruvbox-openbox"; - version = "0-unstable-2024-02-14"; - - src = pkgs.fetchFromGitHub { - owner = "nathanielevan"; - repo = "gruvbox-openbox"; - rev = "master"; - hash = "sha256-61BsD/DK6OOJLKwdY03HL1pCG1DJcIE9bsFPAVFfcIY="; - }; - - installPhase = '' - mkdir -p $out/share/themes - cp -r gruvbox-dark $out/share/themes/ - cp -r gruvbox-material-dark $out/share/themes/ - cp -r gruvbox-material-dark-blocks $out/share/themes/ - ''; - }; -in -{ - options.nx.desktop.labwc = { - enable = mkEnableOption "Enable labwc"; - monitors = mkOption { - type = types.attrsOf (types.submodule { - options = { - mode = mkOption { - type = types.str; - description = "Monitor resolution and refresh rate"; - example = "1920x1080@240"; - }; - position = mkOption { - type = types.str; - default = "0,0"; - description = "Monitor position"; - example = "1920,0"; - }; - }; - }); - default = { }; - description = "Monitor configuration for kanshi"; - }; - wallpaper = mkOption { - type = types.nullOr types.path; - default = null; - description = "Wallpaper image path"; - }; - theme = { - gtk = mkOption { - type = types.str; - default = "Gruvbox-Material-Dark"; - description = "GTK theme name"; - }; - icons = mkOption { - type = types.str; - default = "Gruvbox-Dark"; - description = "Icon theme name"; - }; - cursor = mkOption { - type = types.str; - default = "Adwaita"; - description = "Cursor theme name"; - }; - openbox = mkOption { - type = types.str; - default = "gruvbox-material-dark-blocks"; - description = "Openbox/LabWC theme name"; - }; - }; - }; - - config = mkIf cfg.enable { - home-manager.users.${username} = { - home.packages = with pkgs; [ - labwc-tweaks - labwc-gtktheme - gruvbox-material-gtk-theme - gruvbox-dark-icons-gtk - wl-clipboard - sfwbar - gtk-layer-shell - ] ++ optional (cfg.wallpaper != null) swaybg - ++ [ gruvbox-openbox ]; - - services.cliphist.enable = true; - - gtk = { - enable = true; - theme = { - name = cfg.theme.gtk; - package = pkgs.gruvbox-material-gtk-theme; - }; - iconTheme = { - name = cfg.theme.icons; - package = pkgs.gruvbox-dark-icons-gtk; - }; - cursorTheme = { - name = cfg.theme.cursor; - package = pkgs.adwaita-icon-theme; - }; - gtk3.extraConfig = { - gtk-application-prefer-dark-theme = 1; - }; - gtk4.extraConfig = { - gtk-application-prefer-dark-theme = 1; - }; - }; - - services.kanshi = mkIf (cfg.monitors != { }) { - enable = true; - profiles = { - default = { - outputs = lib.mapAttrsToList (name: monitor: { - criteria = name; - mode = monitor.mode; - position = monitor.position; - }) cfg.monitors; - }; - }; - }; - - wayland.windowManager.labwc = { - enable = true; - autostart = [ - "${pkgs.sfwbar}/bin/sfwbar" - ] ++ optional (cfg.wallpaper != null) "${pkgs.swaybg}/bin/swaybg -m fill -i ${cfg.wallpaper} & disown"; - environment = [ - "XKB_DEFAULT_LAYOUT=${config.console.keyMap}" - "XCURSOR_SIZE=24" - "XDG_CURRENT_DESKTOP=wlroots" - ]; - - rc = { - core = { - decoration = "server"; - gap = 5; - }; - - theme = { - name = cfg.theme.openbox; - }; - - keyboard = { - default = true; - keybind = [ - { - "@key" = "W-Return"; - action = { - "@name" = "Execute"; - "@command" = "kitty"; - }; - } - { - "@key" = "W-F4"; - action = { - "@name" = "None"; - }; - } - ]; - }; - - mouse = { - default = true; - context = { - "@name" = "Root"; - mousebind = { - "@button" = "Right"; - "@action" = "Press"; - action = { - "@name" = "ShowMenu"; - "@menu" = "root-menu"; - }; - }; - }; - }; - }; - }; - - # sfwbar configuration - xdg.configFile."sfwbar/sfwbar.config".text = '' - # Term setup - Set Term = "foot" - Set ThicknessHint = "20px" - - # Actions - TriggerAction "SIGRTMIN+1", SwitcherEvent "forward" - TriggerAction "SIGRTMIN+2", SwitcherEvent "back" - - # Initialization - Function("SfwbarInit") { - SetLayer "top" - SetMirror "*" - SetExclusiveZone "auto" - } - - # Placer (Window positioning) - placer { - xorigin = 5 - yorigin = 5 - xstep = 5 - ystep = 5 - children = true - } - - # Task Switcher - switcher { - interval = 700 - icons = true - labels = false - cols = 5 - } - - # Load Standard Library Winops - include("${pkgs.sfwbar}/share/sfwbar/winops.widget") - - # Main Layout - layout { - - # Start Menu - include("${pkgs.sfwbar}/share/sfwbar/startmenu.widget") - - # Show Desktop - include("${pkgs.sfwbar}/share/sfwbar/showdesktop.widget") - - # Taskbar - taskbar { - rows = 1 - icons = true - labels = false - sort = false - action[3] = Menu "winops" - action[Drag] = Focus - } - - # Spacer - label { - value = "" - style = "spacer" - } - - # Pager - pager { - rows = 1 - pins = "1","2","3","4" - preview = true - action[Drag] = WorkspaceActivate - } - - # Tray - tray { - rows = 1 - } - - # Modules - include("${pkgs.sfwbar}/share/sfwbar/volume.widget") - - # Clock - grid { - style = "clock_grid" - label { - value = Time("%H:%M") - tooltip = Time("%H:%M\n%x") - } - } - } - - #CSS - #spacer { - -GtkWidget-hexpand: true; - } - - button#taskbar_item { - padding: 5px; - border-radius: 0px; - border-width: 0px; - -GtkWidget-hexpand: false; - } - - button#taskbar_item:hover { - background-color: rgba(255, 255, 255, 0.1); - } - ''; - }; - }; -} diff --git a/modules/hosts/desktop/sway/default.nix b/modules/hosts/desktop/sway/default.nix deleted file mode 100644 index b9cec12..0000000 --- a/modules/hosts/desktop/sway/default.nix +++ /dev/null @@ -1,181 +0,0 @@ -{ - config, - username, - lib, - pkgs, - ... -}: - -let - inherit (lib) mkEnableOption mkOption mkIf mkOptionDefault types; - cfg = config.nx.desktop.sway; - mod = "Mod4"; -in -{ - options.nx.desktop.sway = { - enable = mkEnableOption "Enable sway"; - monitors = mkOption { - type = types.attrsOf (types.submodule { - options = { - resolution = mkOption { - type = types.str; - description = "Monitor resolution and refresh rate"; - example = "1920x1080@240Hz"; - }; - position = mkOption { - type = types.str; - default = "0 0"; - description = "Monitor position"; - example = "1920 0"; - }; - }; - }); - default = { }; - description = "Monitor configuration"; - }; - wallpaper = mkOption { - type = types.nullOr types.path; - default = null; - description = "Wallpaper image path"; - }; - }; - - config = mkIf cfg.enable { - home-manager.users.${username} = { - home.packages = with pkgs; [ - wmenu - swaybg - sway-contrib.grimshot - wl-clipboard - xdg-utils - ]; - - wayland.windowManager.sway = { - enable = true; - systemd = { - enable = true; - xdgAutostart = true; - }; - config = { - input = { - "*" = { - xkb_layout = config.console.keyMap; - }; - }; - - output = lib.mapAttrs (name: monitor: { - resolution = monitor.resolution; - position = monitor.position; - } // (if cfg.wallpaper != null then { bg = "${cfg.wallpaper} fill"; } else { })) cfg.monitors; - - gaps = { - inner = 15; - }; - - window = { - titlebar = false; - border = 0; - }; - - modifier = mod; - - keybindings = mkOptionDefault { - "${mod}+q" = "kill"; - "${mod}+Shift+s" = "exec grimshot savecopy area"; - "XF86AudioPlay" = "exec playerctl play-pause"; - "XF86AudioPrev" = "exec playerctl previous"; - "XF86AudioNext" = "exec playerctl next"; - "XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_DEVICE@ +5%"; - "XF86AudioLowerVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_DEVICE@ -5%"; - "XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_DEVICE@ toggle"; - }; - - menu = "${pkgs.wmenu}/bin/wmenu-run -b -N 000000E6"; - terminal = "${pkgs.foot}/bin/foot"; - defaultWorkspace = "workspace number 1"; - - bars = [ - { - command = "${pkgs.waybar}/bin/waybar"; - } - ]; - }; - checkConfig = false; - wrapperFeatures.base = true; - wrapperFeatures.gtk = true; - }; - - home.sessionVariables = { - XDG_CURRENT_DESKTOP = "sway"; - XDG_SCREENSHOTS_DIR = "~/Pictures/Screenshots/"; - }; - - gtk = { - enable = true; - theme = { - name = "Adwaita-dark"; - package = pkgs.gnome-themes-extra; - }; - gtk3.extraConfig = { - Settings = '' - gtk-application-prefer-dark-theme=1 - ''; - }; - gtk4.extraConfig = { - Settings = '' - gtk-application-prefer-dark-theme=1 - ''; - }; - }; - - home.pointerCursor = { - gtk.enable = true; - name = "Adwaita"; - package = pkgs.adwaita-icon-theme; - size = 24; - }; - - # swaylock - programs.swaylock = { - enable = true; - settings = { - font = "monospace 12"; - color = "00000000"; - ring-color = "ffffffff"; - key-hl-color = "ff0000ff"; - bs-hl-color = "ff0000ff"; - }; - }; - - # swayidle - services.swayidle = { - enable = true; - timeouts = [ - { - timeout = 300; - command = "${pkgs.swaylock}/bin/swaylock -f -c 000000"; - } - { - timeout = 600; - command = "${pkgs.sway}/bin/swaymsg 'output * dpms off'"; - resumeCommand = "${pkgs.sway}/bin/swaymsg output * dpms on"; - } - { - timeout = 900; - command = "${pkgs.systemd}/bin/systemctl suspend"; - } - ]; - events = [ - { - event = "after-resume"; - command = "${pkgs.sway}/bin/swaymsg output * dpms on"; - } - { - event = "before-sleep"; - command = "${pkgs.swaylock}/bin/swaylock -f -c 000000"; - } - ]; - }; - }; - }; -} diff --git a/modules/hosts/desktop/waybar.nix b/modules/hosts/desktop/waybar.nix deleted file mode 100644 index aebc0f7..0000000 --- a/modules/hosts/desktop/waybar.nix +++ /dev/null @@ -1,119 +0,0 @@ -{ - config, - lib, - username, - ... -}: - -let - inherit (lib) mkEnableOption mkIf; - cfg = config.nx.desktop.waybar; -in -{ - options.nx.desktop.waybar.enable = mkEnableOption "Enable and configure Waybar"; - - config = mkIf cfg.enable { - home-manager.users.${username} = { - programs.waybar = { - enable = true; - settings = { - mainBar = { - height = 32; - layer = "top"; - position = "bottom"; - modules-center = [ "mpris" ]; - modules-left = [ "wlr/workspaces" ]; - modules-right = [ - "privacy" - "tray" - "battery" - "pulseaudio" - "network" - "bluetooth" - "clock" - ]; - - mpris = { - format = "{title}"; - tooltip-format = "{artist} - {album}"; - }; - - tray = { - spacing = 10; - }; - - privacy = { - icon-size = 16; - }; - - network = { - format-disconnect = ""; - format-ethernet = ""; - format-wifi = "{icon}"; - format-icons = [ - "" - "" - "" - "" - ]; - tooltip-format-wifi = "{essid} | {signalStrength}%"; - tooltip-format-ethernet = "{ifname}"; - }; - - bluetooth = { - format = " {status}"; - format-disabled = ""; - format-no-controller = ""; - format-connected = " {device_alias}"; - }; - - clock = { - format-alt = "{:%Y-%m-%d}"; - tooltip-format = "{:%Y-%m-%d | %H:%M}"; - }; - - pulseaudio = { - format = "{icon}"; - format-icons = { - default = [ - "" - "" - "" - ]; - }; - tooltip-format = "{desc} | {volume}%"; - }; - }; - }; - - style = '' - * { - border: none; - border-radius: 0; - font-family: monospace; - font-size: 12px; - background: none; - } - - window#waybar { - background: rgba(0, 0, 0, 0.9); - } - - #workspaces button { - padding-left: 5px; - padding-right: 5px; - } - - #workspaces button.focused { - font-weight: bold; - } - - #clock, #pulseaudio, #tray, #network, #battery, #bluetooth { - padding-left: 10px; - padding-right: 10px; - } - ''; - }; - }; - }; -} diff --git a/modules/hosts/openssh/default.nix b/modules/hosts/openssh/default.nix deleted file mode 100644 index 49c0527..0000000 --- a/modules/hosts/openssh/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - config, - username, - lib, - ... -}: -let - inherit (lib) mkOption types mkIf; - cfg = config.nx.services.openssh; -in -{ - options.nx.services.openssh.enable = mkOption { - description = "Setup openssh server"; - type = types.bool; - default = false; - }; - config = mkIf cfg.enable { - services.openssh = { - enable = true; - settings = { - AllowUsers = [ username ]; - }; - }; - }; -} diff --git a/modules/hosts/printer/default.nix b/modules/hosts/printer/default.nix deleted file mode 100644 index d094c21..0000000 --- a/modules/hosts/printer/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: -let - inherit (lib) mkOption types mkIf; - cfg = config.nx.printer; -in -{ - - options.nx.printer = { - enable = mkOption { - description = "Setup printer service"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - services.printing = { - enable = true; - drivers = [ pkgs.brlaser ]; - }; - # printer autodiscovery - services.avahi = { - enable = true; - nssmdns4 = true; - openFirewall = true; - }; - }; -} diff --git a/modules/hosts/server/default.nix b/modules/hosts/server/default.nix deleted file mode 100644 index ca3ca4f..0000000 --- a/modules/hosts/server/default.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - lib, - ... -}: -let - inherit (lib) mkOption types; -in -{ - options.nx.server = { - enable = mkOption { - description = "Set this host as server"; - type = types.bool; - default = false; - }; - timeZone = mkOption { - description = "Time Zone of the server"; - type = types.str; - default = "Europe/Berlin"; - }; - }; - - imports = [ - ./openssh - ./nginx - ./fail2ban - ./nextcloud - ./site - ]; -} diff --git a/modules/hosts/steam/default.nix b/modules/hosts/steam/default.nix deleted file mode 100644 index 05a3703..0000000 --- a/modules/hosts/steam/default.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: -let - cfg = config.nx.steam; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.steam = { - enable = mkOption { - description = "Digital distribution platfrom from vavle"; - type = types.bool; - default = false; - }; - useProtontricks = mkOption { - description = "Whether to enable protontricks"; - type = types.bool; - default = true; - }; - useGamescope = mkOption { - description = "SteamOS session compositing window manager"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - programs.steam = { - enable = true; - protontricks.enable = cfg.useProtontricks; - gamescopeSession.enable = cfg.useGamescope; - extraCompatPackages = with pkgs; [ - proton-ge-bin - ]; - }; - }; -} diff --git a/modules/hosts/wooting/default.nix b/modules/hosts/wooting/default.nix deleted file mode 100644 index b2b78c0..0000000 --- a/modules/hosts/wooting/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -let - inherit (lib) mkOption types mkIf; - cfg = config.nx.wooting; -in -{ - options.nx.wooting = { - enable = mkOption { - description = "Setup wootility, udev rules to discover keyboards"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - services.udev.packages = [ pkgs.wooting-udev-rules ]; - environment.systemPackages = with pkgs; [ - wootility - ]; - }; -} diff --git a/modules/nixos/desktop/cinnamon/default.nix b/modules/nixos/desktop/cinnamon/default.nix new file mode 100644 index 0000000..2561bdb --- /dev/null +++ b/modules/nixos/desktop/cinnamon/default.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf mkForce; + cfg = config.nx.desktop.cinnamon; +in +{ + options.nx.desktop.cinnamon.enable = mkEnableOption "Cinnamon desktop"; + + config = mkIf cfg.enable { + services.xserver = { + enable = true; + displayManager.lightdm.enable = true; + desktopManager.cinnamon.enable = true; + }; + services.speechd.enable = mkForce false; + services.orca.enable = mkForce false; + environment.systemPackages = [ pkgs.nemo-preview ]; + }; +} diff --git a/modules/hosts/desktop/gnome/default.nix b/modules/nixos/desktop/gnome/default.nix index 268fdc7..9ffd353 100644 --- a/modules/hosts/desktop/gnome/default.nix +++ b/modules/nixos/desktop/gnome/default.nix @@ -1,16 +1,10 @@ -{ - config, - pkgs, - lib, - ... -}: - +{ config, lib, pkgs, ... }: let inherit (lib) mkEnableOption mkIf; cfg = config.nx.desktop.gnome; in { - options.nx.desktop.gnome.enable = mkEnableOption "Enable GNOME desktop environment"; + options.nx.desktop.gnome.enable = mkEnableOption "GNOME desktop"; config = mkIf cfg.enable { services.displayManager.gdm.enable = true; @@ -19,15 +13,10 @@ in services.gnome.games.enable = false; environment.gnome.excludePackages = with pkgs; [ - gnome-tour - gnome-user-docs - epiphany + gnome-tour gnome-user-docs epiphany ]; - environment.systemPackages = with pkgs; [ - gnomeExtensions.pop-shell - gnomeExtensions.blur-my-shell - gnome-tweaks + gnomeExtensions.pop-shell gnomeExtensions.blur-my-shell gnome-tweaks ]; }; } diff --git a/modules/hosts/desktop/kde/default.nix b/modules/nixos/desktop/kde/default.nix index d53e1c8..5a24f0d 100644 --- a/modules/hosts/desktop/kde/default.nix +++ b/modules/nixos/desktop/kde/default.nix @@ -1,26 +1,18 @@ -{ - config, - lib, - pkgs, - ... -}: - +{ config, lib, pkgs, ... }: let inherit (lib) mkEnableOption mkIf; cfg = config.nx.desktop.kde; in { + options.nx.desktop.kde.enable = mkEnableOption "KDE Plasma 6 desktop"; - options.nx.desktop.kde.enable = mkEnableOption "Enable kde"; config = mkIf cfg.enable { - services.displayManager.sddm.enable = true; - services.displayManager.sddm.wayland.enable = true; + services.displayManager.sddm = { + enable = true; + wayland.enable = true; + }; services.desktopManager.plasma6.enable = true; security.pam.services.sddm.enableKwallet = true; - - environment.plasma6.excludePackages = with pkgs.kdePackages; [ - elisa - kate - ]; + environment.plasma6.excludePackages = with pkgs.kdePackages; [ elisa kate ]; }; } diff --git a/modules/hosts/dns/default.nix b/modules/nixos/dns/default.nix index 8463367..0b8cf90 100644 --- a/modules/hosts/dns/default.nix +++ b/modules/nixos/dns/default.nix @@ -1,22 +1,12 @@ -{ - config, - lib, - ... -}: - +{ config, lib, ... }: let - inherit (lib) mkOption types mkIf; + inherit (lib) mkEnableOption mkOption types mkIf concatStringsSep; cfg = config.nx.dns; in { options.nx.dns = { - enable = mkOption { - description = "enable DNS-over-TLS using systemd-resolved"; - type = types.bool; - default = false; - }; + enable = mkEnableOption "DNS-over-TLS via systemd-resolved"; servers = mkOption { - description = "list of DNS-over-TLS servers to use"; type = types.listOf types.str; default = [ "1.1.1.1#cloudflare-dns.com" @@ -26,12 +16,8 @@ in ]; }; fallbackServers = mkOption { - description = "fallback DNS servers"; type = types.listOf types.str; - default = [ - "8.8.8.8#dns.google" - "8.8.4.4#dns.google" - ]; + default = [ "8.8.8.8#dns.google" "8.8.4.4#dns.google" ]; }; }; @@ -46,15 +32,13 @@ in Cache=yes ''; }; - networking = { nameservers = cfg.servers; networkmanager.dns = lib.mkDefault "systemd-resolved"; }; - systemd.services.systemd-resolved.environment = { - DNS = lib.concatStringsSep " " cfg.servers; - FallbackDNS = lib.concatStringsSep " " cfg.fallbackServers; + DNS = concatStringsSep " " cfg.servers; + FallbackDNS = concatStringsSep " " cfg.fallbackServers; }; }; } diff --git a/modules/hosts/audio/default.nix b/modules/nixos/hardware/audio/default.nix index 3cd06e4..66c9606 100644 --- a/modules/hosts/audio/default.nix +++ b/modules/nixos/hardware/audio/default.nix @@ -1,21 +1,11 @@ -{ - config, - lib, - ... -}: - +{ config, lib, ... }: let - inherit (lib) mkOption types mkIf; - cfg = config.nx.services.audio; + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.hardware.audio; in { - options.nx.services.audio = { - enable = mkOption { - description = "enable sound"; - type = types.bool; - default = false; - }; - }; + options.nx.hardware.audio.enable = mkEnableOption "PipeWire audio"; + config = mkIf cfg.enable { security.rtkit.enable = true; services.pipewire = { diff --git a/modules/nixos/hardware/bluetooth/default.nix b/modules/nixos/hardware/bluetooth/default.nix new file mode 100644 index 0000000..1bb9014 --- /dev/null +++ b/modules/nixos/hardware/bluetooth/default.nix @@ -0,0 +1,24 @@ +{ config, lib, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.hardware.bluetooth; +in +{ + options.nx.hardware.bluetooth.enable = mkEnableOption "Bluetooth support"; + + config = mkIf cfg.enable { + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + settings = { + General = { + Experimental = true; + FastConnectable = true; + }; + Policy = { + AutoEnable = true; + }; + }; + }; + }; +} diff --git a/modules/nixos/hardware/printer/default.nix b/modules/nixos/hardware/printer/default.nix new file mode 100644 index 0000000..749c766 --- /dev/null +++ b/modules/nixos/hardware/printer/default.nix @@ -0,0 +1,20 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.hardware.printer; +in +{ + options.nx.hardware.printer.enable = mkEnableOption "printer support"; + + config = mkIf cfg.enable { + services.printing = { + enable = true; + drivers = [ pkgs.brlaser ]; + }; + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + }; +} diff --git a/modules/nixos/hardware/wooting/default.nix b/modules/nixos/hardware/wooting/default.nix new file mode 100644 index 0000000..62a4b78 --- /dev/null +++ b/modules/nixos/hardware/wooting/default.nix @@ -0,0 +1,13 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.hardware.wooting; +in +{ + options.nx.hardware.wooting.enable = mkEnableOption "Wooting keyboard support"; + + config = mkIf cfg.enable { + services.udev.packages = [ pkgs.wooting-udev-rules ]; + environment.systemPackages = [ pkgs.wootility ]; + }; +} diff --git a/modules/hosts/mullvad-vpn/default.nix b/modules/nixos/mullvad-vpn/default.nix index 80451a5..d2c18b1 100644 --- a/modules/hosts/mullvad-vpn/default.nix +++ b/modules/nixos/mullvad-vpn/default.nix @@ -1,16 +1,11 @@ { config, lib, pkgs, ... }: let + inherit (lib) mkEnableOption mkIf; cfg = config.nx.mullvad-vpn; - inherit (lib) mkOption types mkIf; in { - options.nx.mullvad-vpn = { - enable = mkOption { - description = "Privacy focues vpn"; - type = types.bool; - default = false; - }; - }; + options.nx.mullvad-vpn.enable = mkEnableOption "Mullvad VPN"; + config = mkIf cfg.enable { services.mullvad-vpn.enable = true; environment.systemPackages = [ pkgs.mullvad-vpn ]; diff --git a/modules/nixos/openssh/default.nix b/modules/nixos/openssh/default.nix new file mode 100644 index 0000000..22f7df5 --- /dev/null +++ b/modules/nixos/openssh/default.nix @@ -0,0 +1,21 @@ +{ config, lib, ... }: +let + inherit (lib) mkEnableOption mkOption types mkIf; + cfg = config.nx.services.openssh; +in +{ + options.nx.services.openssh = { + enable = mkEnableOption "OpenSSH server"; + allowedUsers = mkOption { + type = types.listOf types.str; + default = [ ]; + }; + }; + + config = mkIf cfg.enable { + services.openssh = { + enable = true; + settings.AllowUsers = cfg.allowedUsers; + }; + }; +} diff --git a/modules/nixos/plymouth/default.nix b/modules/nixos/plymouth/default.nix new file mode 100644 index 0000000..f89777e --- /dev/null +++ b/modules/nixos/plymouth/default.nix @@ -0,0 +1,36 @@ +{ + config, + lib, + pkgs, + ... +}: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.plymouth; +in +{ + options.nx.plymouth.enable = mkEnableOption "Plymouth"; + + config = mkIf cfg.enable { + boot = { + kernelParams = [ + "quiet" + "splash" + "boot.shell_on_fail" + "udev.log_priority=3" + "rd.systemd.show_status=auto" + ]; + consoleLogLevel = 3; + loader.systemd-boot.consoleMode = "max"; + plymouth = { + enable = true; + theme = "lone"; + themePackages = with pkgs; [ + (adi1090x-plymouth-themes.override { + selected_themes = [ "lone" ]; + }) + ]; + }; + }; + }; +} diff --git a/modules/hosts/server/fail2ban/default.nix b/modules/nixos/server/fail2ban/default.nix index 09fcdf2..21020b5 100644 --- a/modules/hosts/server/fail2ban/default.nix +++ b/modules/nixos/server/fail2ban/default.nix @@ -1,21 +1,15 @@ { config, - pkgs, - options, lib, ... }: let + inherit (lib) mkEnableOption mkOption types mkIf; cfg = config.nx.server.fail2ban; - inherit (lib) mkOption types mkIf; in { options.nx.server.fail2ban = { - enable = mkOption { - description = "Setup fail2ban service"; - type = types.bool; - default = false; - }; + enable = mkEnableOption "fail2ban service"; bantime = mkOption { description = "default bantime"; type = types.str; diff --git a/modules/hosts/server/nextcloud/default.nix b/modules/nixos/server/nextcloud/default.nix index a527de2..7325c92 100644 --- a/modules/hosts/server/nextcloud/default.nix +++ b/modules/nixos/server/nextcloud/default.nix @@ -1,21 +1,19 @@ { pkgs, config, - username, - options, lib, ... }: let + inherit (lib) mkEnableOption mkOption types mkIf; cfg = config.nx.server.nextcloud; - inherit (lib) mkOption types mkIf; in { options.nx.server.nextcloud = { - enable = mkOption { - description = "Setup nextcloud server"; - type = types.bool; - default = false; + enable = mkEnableOption "Nextcloud server"; + user = mkOption { + description = "System user for paths like SSH keys"; + type = types.str; }; adminUser = mkOption { description = "Admin user"; @@ -37,6 +35,11 @@ in type = types.bool; default = true; }; + backupSshKeyPath = mkOption { + description = "SSH key path for borgbase backup"; + type = types.str; + default = "/home/${cfg.user}/.ssh/borgbase-nextcloud"; + }; jail = mkOption { description = "setup fail2ban jail"; type = types.bool; @@ -62,7 +65,7 @@ in default_phone_region = "de"; overwriteProtocol = "https"; trusted_domains = [ cfg.hostName ]; - logtimezone = config.nx.server.timeZone; + logtimezone = config.time.timeZone; log_type = "file"; }; phpOptions."opcache.interned_strings_buffer" = "64"; @@ -84,7 +87,7 @@ in repo = "h8xn8qvo@h8xn8qvo.repo.borgbase.com:repo"; encryption.mode = "none"; environment = { - BORG_RSH = "ssh -i /home/${username}/.ssh/borgbase-nextcloud -o StrictHostKeyChecking=accept-new"; + BORG_RSH = "ssh -i ${cfg.backupSshKeyPath} -o StrictHostKeyChecking=accept-new"; TMPDIR = "/var/tmp"; }; compression = "auto,lzma"; @@ -97,7 +100,7 @@ in set -euo pipefail INSTALL="${pkgs.coreutils}/bin/install" FIND="${pkgs.findutils}/bin/find" - MYSQLDUMP="${pkgs.mariadb.client}/bin/mysql-dump" + MYSQLDUMP="${pkgs.mariadb.client}/bin/mariadb-dump" GZIP="${pkgs.gzip}/bin/gzip" OCC="${lib.getExe config.services.nextcloud.occ}" diff --git a/modules/hosts/server/nginx/default.nix b/modules/nixos/server/nginx/default.nix index 438ab49..2bdaba1 100644 --- a/modules/hosts/server/nginx/default.nix +++ b/modules/nixos/server/nginx/default.nix @@ -4,14 +4,12 @@ ... }: let + inherit (lib) mkEnableOption mkOption types mkIf; cfg = config.nx.server.nginx; - inherit (lib) mkOption types mkIf; in { options.nx.server.nginx = { - enable = mkOption { - description = "Setup nginx reverse proxy"; - type = types.bool; + enable = mkEnableOption "nginx reverse proxy" // { default = true; }; hostName = mkOption { diff --git a/modules/hosts/server/openssh/default.nix b/modules/nixos/server/openssh/default.nix index fbb15db..675ceaf 100644 --- a/modules/hosts/server/openssh/default.nix +++ b/modules/nixos/server/openssh/default.nix @@ -1,25 +1,26 @@ { config, - username, lib, ... }: + let + inherit (lib) mkEnableOption mkOption types mkIf; cfg = config.nx.server.openssh; - inherit (lib) mkOption types mkIf; in { options.nx.server.openssh = { - enable = mkOption { - description = "Setup openssh for server"; - type = types.bool; - default = false; - }; + enable = mkEnableOption "OpenSSH server"; port = mkOption { description = "Port for openssh"; type = types.port; default = 8693; }; + allowedUsers = mkOption { + description = "Users allowed to SSH"; + type = types.listOf types.str; + default = [ ]; + }; }; config = mkIf cfg.enable { @@ -28,7 +29,7 @@ in ports = [ cfg.port ]; settings = { PasswordAuthentication = false; - AllowUsers = [ username ]; + AllowUsers = cfg.allowedUsers; X11Forwarding = false; PermitRootLogin = "yes"; }; diff --git a/modules/hosts/server/site/default.nix b/modules/nixos/server/site/default.nix index 24807d3..be603c6 100644 --- a/modules/hosts/server/site/default.nix +++ b/modules/nixos/server/site/default.nix @@ -5,8 +5,8 @@ ... }: let + inherit (lib) mkEnableOption mkIf; cfg = config.nx.server.site; - inherit (lib) mkOption types mkIf; in { imports = [ @@ -14,11 +14,7 @@ in ]; options.nx.server.site = { - enable = mkOption { - description = "Setup personal website"; - type = types.bool; - default = false; - }; + enable = mkEnableOption "personal website"; }; config = mkIf cfg.enable { diff --git a/modules/nixos/steam/default.nix b/modules/nixos/steam/default.nix new file mode 100644 index 0000000..d708139 --- /dev/null +++ b/modules/nixos/steam/default.nix @@ -0,0 +1,28 @@ +{ + config, + lib, + pkgs, + ... +}: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.steam; +in +{ + options.nx.steam = { + enable = mkEnableOption "Steam gaming platform"; + protontricks = mkEnableOption "protontricks" // { + default = true; + }; + gamescope = mkEnableOption "gamescope session compositor"; + }; + + config = mkIf cfg.enable { + programs.steam = { + enable = true; + protontricks.enable = cfg.protontricks; + gamescopeSession.enable = cfg.gamescope; + extraCompatPackages = [ pkgs.proton-ge-bin ]; + }; + }; +} diff --git a/modules/users/browsers/default.nix b/modules/users/browsers/default.nix deleted file mode 100644 index 70a8be5..0000000 --- a/modules/users/browsers/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ ... }: -{ - imports = [ - ./firefox - ]; -} diff --git a/modules/users/cli/default.nix b/modules/users/cli/default.nix deleted file mode 100644 index 98fe1fb..0000000 --- a/modules/users/cli/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: -{ - imports = [ - ./tmux - ./opencode - ]; -} diff --git a/modules/users/default.nix b/modules/users/default.nix deleted file mode 100644 index 06999d5..0000000 --- a/modules/users/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ ... }: - -{ - imports = [ - ./browsers - ./cli - ./editors - ./git - ./gpg - ./media - ./productivity - ./shells - ./terminal - ./zathura - ]; -} diff --git a/modules/users/editors/default.nix b/modules/users/editors/default.nix deleted file mode 100644 index 76f3b96..0000000 --- a/modules/users/editors/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ ... }: -{ - imports = [ - ./neovim - ./vscode - ./zed - ]; -} diff --git a/modules/users/media/default.nix b/modules/users/media/default.nix deleted file mode 100644 index 89daaba..0000000 --- a/modules/users/media/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: -{ - imports = [ - ./nixcord - ./spicetify - ]; -} diff --git a/modules/users/productivity/default.nix b/modules/users/productivity/default.nix deleted file mode 100644 index 9e05dde..0000000 --- a/modules/users/productivity/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ ... }: -{ - imports = [ - ./anki - ./latex - ./obsidian - ./typst - ./nextcloud-client - ]; -} diff --git a/modules/users/productivity/nextcloud-client/default.nix b/modules/users/productivity/nextcloud-client/default.nix deleted file mode 100644 index 1b92bb0..0000000 --- a/modules/users/productivity/nextcloud-client/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - lib, - pkgs, - username, - ... -}: - -let - inherit (lib) mkOption types mkIf; - cfg = config.nx.productivity.nextcloud-client; -in -{ - options.nx.productivity.nextcloud-client = { - enable = mkOption { - description = "Client for nextcloud"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - #home.packages = with pkgs; [ nextcloud-client ]; - services.nextcloud-client = { - enable = true; - startInBackground = true; - }; - }; -} diff --git a/modules/users/productivity/obsidian/default.nix b/modules/users/productivity/obsidian/default.nix deleted file mode 100644 index 21b3f34..0000000 --- a/modules/users/productivity/obsidian/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ - config, - lib, - ... -}: -let - cfg = config.nx.productivity.obsidian; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.productivity.obsidian = { - enable = mkOption { - description = "Obsidian note-taking application"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - programs.obsidian = { - enable = true; - }; - }; -} diff --git a/modules/users/productivity/typst/default.nix b/modules/users/productivity/typst/default.nix deleted file mode 100644 index f3e1981..0000000 --- a/modules/users/productivity/typst/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: -let - cfg = config.nx.productivity.typst; - inherit (lib) mkOption types mkIf; -in -{ - options.nx.productivity.typst = { - enable = mkOption { - description = "Typst markup-based typesetting system"; - type = types.bool; - default = false; - }; - }; - config = mkIf cfg.enable { - home.packages = with pkgs; [ - typst - typst-fmt - ]; - }; -} diff --git a/modules/users/shells/default.nix b/modules/users/shells/default.nix deleted file mode 100644 index 9abd804..0000000 --- a/modules/users/shells/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ ... }: -{ - imports = [ - ./zsh - ./bash - ]; -} diff --git a/modules/users/terminal/default.nix b/modules/users/terminal/default.nix deleted file mode 100644 index 937c086..0000000 --- a/modules/users/terminal/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: -let - inherit (lib) mkOption types; - cfg = config.nx.terminal; -in -{ - imports = [ - ./foot.nix - ./kitty.nix - ]; - options.nx.terminal = { - font = mkOption { - description = "default font"; - default = "Victor Mono"; - }; - - multiplexer = mkOption { - type = types.enum [ "tmux" ]; - default = "tmux"; - }; - - defaultShell = mkOption { - description = "default shell"; - type = types.enum [ - "bash" - "zsh" - ]; - default = "bash"; - }; - }; -} diff --git a/modules/users/terminal/foot.nix b/modules/users/terminal/foot.nix deleted file mode 100644 index fbaba8f..0000000 --- a/modules/users/terminal/foot.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -{ - options.nx.terminal.foot.enable = lib.mkEnableOption "Enable foot terminal"; - config = lib.mkIf config.nx.terminal.foot.enable { - home.packages = with pkgs; [ - nerd-fonts.space-mono - ]; - - programs.foot = { - enable = true; - settings = { - main = { - pad = "10x10"; - font = "SpaceMono Nerd Font Mono:size=10"; - line-height = 12; - }; - - cursor = { - style = "underline"; - unfocused-style = "unchanged"; - blink = true; - }; - - colors = { - alpha = 0.9; - # Gruvbox Theme - background = "000000"; - foreground = "ebdbb2"; - - regular0 = "282828"; - regular1 = "cc241d"; - regular2 = "98971a"; - regular3 = "d79921"; - regular4 = "458588"; - regular5 = "b16286"; - regular6 = "689d6a"; - regular7 = "a89984"; - - bright0 = "928374"; - bright1 = "fb4934"; - bright2 = "b8bb26"; - bright3 = "fabd2f"; - bright4 = "83a598"; - bright5 = "d3869b"; - bright6 = "8ec07c"; - bright7 = "ebdbb2"; - }; - }; - }; - }; -} |
