diff --git a/flake.nix b/flake.nix index f6f5908..53d871b 100644 --- a/flake.nix +++ b/flake.nix @@ -34,7 +34,9 @@ }; # declarative homebrew management - nix-homebrew = { url = "github:zhaofengli/nix-homebrew"; }; + nix-homebrew = { + url = "github:zhaofengli/nix-homebrew"; + }; # declarative Neovim nixvim = { @@ -67,61 +69,92 @@ }; }; - outputs = { self, nixpkgs, home-manager, darwin, nix-homebrew, nixvim - , hyprland, sops-nix, ... }@inputs: + outputs = + { + self, + nixpkgs, + home-manager, + darwin, + nix-homebrew, + nixvim, + hyprland, + sops-nix, + ... + }@inputs: let primaryUser = "phil"; + mkSystem = + { + hostName, + system, + isDarwin ? false, + isServer ? false, + }: + let + systemFunc = if isDarwin then darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem; + platformModuleSet = if isDarwin then "darwinModules" else "nixosModules"; - mkNixos = hostName: - nixpkgs.lib.nixosSystem { - modules = [ - { - nixpkgs.hostPlatform = "x86_64-linux"; - networking.hostName = hostName; - } - ./nixos - ./hosts/cyper-desktop/configuration.nix - inputs.home-manager.nixosModules.home-manager - { - home-manager.extraSpecialArgs = { - inherit inputs primaryUser self; - isDarwin = false; - }; - home-manager.users.${primaryUser} = import ./home; - } - inputs.sops-nix.nixosModules.sops - ]; - specialArgs = { - inherit inputs primaryUser self hostName; - isDarwin = false; + sharedSpecialArgs = { + inherit + inputs + primaryUser + self + hostName + isDarwin + isServer + ; }; - }; - mkDarwin = hostName: - darwin.lib.darwinSystem { - system = "x86_64-darwin"; - modules = [ - ./darwin - ./hosts/cyper-mac/configuration.nix + sharedModules = [ { networking.hostName = hostName; } - inputs.nix-homebrew.darwinModules.nix-homebrew - inputs.home-manager.darwinModules.home-manager + ./hosts/${hostName}/configuration.nix + inputs.sops-nix.${platformModuleSet}.sops + inputs.home-manager.${platformModuleSet}.home-manager { - home-manager.extraSpecialArgs = { - inherit inputs primaryUser self; - isDarwin = true; - }; + home-manager.extraSpecialArgs = sharedSpecialArgs; home-manager.users.${primaryUser} = import ./home; } - inputs.sops-nix.darwinModules.sops ]; - specialArgs = { - inherit inputs primaryUser self hostName; - isDarwin = true; - }; + + platformModules = + let + nixosBase = [ + { nixpkgs.hostPlatform = system; } + ./nixos + ]; + in + if isDarwin then + [ + ./darwin + inputs.nix-homebrew.darwinModules.nix-homebrew + ] + else + nixosBase ++ (if isServer then [ ./nixos/server ] else [ ]); + in + systemFunc { + inherit system; + modules = sharedModules ++ platformModules; + specialArgs = sharedSpecialArgs; }; - in { - nixosConfigurations."cyper-desktop" = mkNixos "cyper-desktop"; - darwinConfigurations."cyper-mac" = mkDarwin "cyper-mac"; + in + { + nixosConfigurations = { + "cyper-desktop" = mkSystem { + hostName = "cyper-desktop"; + system = "x86_64-linux"; + }; + + "cyper-node-1" = mkSystem { + hostName = "cyper-node-1"; + system = "x86_64-linux"; + isServer = true; + }; + }; + + darwinConfigurations."cyper-mac" = mkSystem { + hostName = "cyper-mac"; + system = "x86_64-darwin"; + isDarwin = true; + }; }; } diff --git a/home/desktop/default.nix b/home/desktop/default.nix index 4322638..043e39e 100644 --- a/home/desktop/default.nix +++ b/home/desktop/default.nix @@ -1,4 +1,5 @@ -{ pkgs, inputs, ... }: { +{ pkgs, inputs, ... }: +{ imports = [ inputs.catppuccin.homeModules.catppuccin ./hyprland @@ -10,7 +11,11 @@ _module.args.compositor = "hyprland"; - home.packages = with pkgs; [ waypaper awww ]; + home.packages = with pkgs; [ + waypaper + awww + onlyoffice-desktopeditors + ]; home.file.".config/waypaper/config.ini".source = ./waypaper.ini; programs = { @@ -31,5 +36,14 @@ }; }; mpv.enable = true; + onlyoffice = { + enable = true; + settings = { + UITheme = "theme-night"; + appdata = "@ByteArray(eyJ1c2VybmFtZSI6InBoaWwiLCJkb2NvcGVubW9kZSI6ImVkaXQiLCJyZXN0YXJ0Ijp0cnVlLCJsYW5naWQiOiJlbi1VUyIsInVpc2NhbGluZyI6IjAiLCJ1aXRoZW1lIjoidGhlbWUtbmlnaHQiLCJlZGl0b3J3aW5kb3dtb2RlIjpmYWxzZSwic3BlbGxjaGVja2RldGVjdCI6ImF1dG8iLCJ1c2VncHUiOnRydWV9)"; + editorWindowMode = false; + titlebar = "custom"; + }; + }; }; } diff --git a/home/desktop/waybar/common.nix b/home/desktop/waybar/common.nix index fb5a64f..d26c5cd 100644 --- a/home/desktop/waybar/common.nix +++ b/home/desktop/waybar/common.nix @@ -169,7 +169,7 @@ "custom/wallpaper" = { format = "【{} 】"; - exec = "basename $(swww query | grep -oP 'image: \\K.*')"; + exec = "basename $(awww query | grep -oP 'image: \\K.*')"; interval = 5; on-click = "waypaper"; tooltip = true; diff --git a/home/ssh.nix b/home/ssh.nix index edff1f4..8ad6abe 100644 --- a/home/ssh.nix +++ b/home/ssh.nix @@ -2,8 +2,11 @@ { programs.ssh = { enable = true; - addKeysToAgent = "yes"; + enableDefaultConfig = false; matchBlocks = { + "*" = { + addKeysToAgent = "yes"; + }; "*.cyperpunk.de" = { identityFile = if isDarwin then "/Users/${primaryUser}/.ssh/ssh" else "/home/${primaryUser}/.ssh/ssh"; diff --git a/nixos/default.nix b/nixos/default.nix index 64bc7c2..f7b52f4 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -46,6 +46,8 @@ ]; max-jobs = "auto"; cores = 0; + http-connections = 4; + download-buffer-size = 268435456; substituters = [ "https://cache.nixos.org" "https://hyprland.cachix.org"