diff --git a/flake.lock b/flake.lock index 1b7bcb6..c13849d 100755 --- a/flake.lock +++ b/flake.lock @@ -145,6 +145,24 @@ "type": "github" } }, + "flake-utils_4": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -288,6 +306,20 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1682134069, + "narHash": "sha256-TnI/ZXSmRxQDt2sjRYK/8j8iha4B4zP2cnQCZZ3vp7k=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fd901ef4bf93499374c5af385b2943f5801c0833", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, "plasma-manager": { "inputs": { "home-manager": [ @@ -322,7 +354,8 @@ "nixpkgs-24-11": "nixpkgs-24-11", "plasma-manager": "plasma-manager", "sddm-sugar-candy-nix": "sddm-sugar-candy-nix", - "vscode-extensions": "vscode-extensions" + "vscode-extensions": "vscode-extensions", + "vscode-server": "vscode-server" } }, "sddm-sugar-candy-nix": { @@ -375,6 +408,21 @@ "type": "github" } }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "vscode-extensions": { "inputs": { "flake-compat": "flake-compat_2", @@ -396,6 +444,25 @@ "repo": "nix-vscode-extensions", "type": "github" } + }, + "vscode-server": { + "inputs": { + "flake-utils": "flake-utils_4", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1729422940, + "narHash": "sha256-DlvJv33ml5UTKgu4b0HauOfFIoDx6QXtbqUF3vWeRCY=", + "owner": "nix-community", + "repo": "nixos-vscode-server", + "rev": "8b6db451de46ecf9b4ab3d01ef76e59957ff549f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-vscode-server", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 2146bb9..2afda3e 100755 --- a/flake.nix +++ b/flake.nix @@ -48,9 +48,11 @@ url = "github:nix-community/nix-vscode-extensions"; inputs.nixpkgs.follows = "nixpkgs"; }; + # VSCode server support + vscode-server.url = "github:nix-community/nixos-vscode-server"; }; - outputs = inputs@{ nixpkgs, home-manager, plasma-manager, nix-index-database, ... }: let + outputs = inputs@{ nixpkgs, home-manager, plasma-manager, nix-index-database, vscode-server, ... }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; secrets = import ./secrets.nix; @@ -108,6 +110,10 @@ vscode.enable = false; }; } + + # VSCode server support + vscode-server.nixosModules.default + ({ pkgs, ... }: { services.vscode-server = { enable = true; nodejsPackage = pkgs.nodejs-18_x; installPath = "$HOME/.vscodium-server"; }; }) ]; specialArgs = { @@ -115,4 +121,4 @@ }; }; }; -} \ No newline at end of file +} diff --git a/hosts/laptop-server/default.nix b/hosts/laptop-server/default.nix index 3fb21a3..3daba20 100644 --- a/hosts/laptop-server/default.nix +++ b/hosts/laptop-server/default.nix @@ -10,6 +10,7 @@ imports = [ ./hardware-configuration.nix ./modules + ./services ]; system.stateVersion = "24.11"; diff --git a/hosts/laptop-server/modules/networking.nix b/hosts/laptop-server/modules/networking.nix index b99611a..9545ef3 100644 --- a/hosts/laptop-server/modules/networking.nix +++ b/hosts/laptop-server/modules/networking.nix @@ -3,7 +3,10 @@ networking.hostName = "ty-laptop-server"; # Enable firewall - networking.firewall.enable = true; + networking = { + firewall.enable = true; + trustedInterfaces = [ "lo" "ve-*" ]; + }; # Enable NetworkManager networking.networkmanager.enable = true; diff --git a/hosts/laptop-server/services/default.nix b/hosts/laptop-server/services/default.nix new file mode 100644 index 0000000..3f1e220 --- /dev/null +++ b/hosts/laptop-server/services/default.nix @@ -0,0 +1,15 @@ +{ ... }: +{ + imports = [ + ./jellyfin.nix + ]; + + networking = { + nat = { + enable = true; + internalInterfaces = ["ve-*"]; + externalInterface = "wlp2s0"; + }; + networkmanager.unmanaged = [ "interface-name:ve-*" ]; + }; +} \ No newline at end of file diff --git a/hosts/laptop-server/services/jellyfin.nix b/hosts/laptop-server/services/jellyfin.nix new file mode 100644 index 0000000..7b24fb0 --- /dev/null +++ b/hosts/laptop-server/services/jellyfin.nix @@ -0,0 +1,17 @@ +{ config, ... }: +{ + containers.jellyfin = { + config = { pkgs, ...}: { + system.stateVersion = "25.05"; + + services.jellyfin = { + enable = true; + package = pkgs.jellyfin; + }; + }; + autoStart = true; + privateNetwork = true; + hostAddress = "172.30.0.2"; # TODO define in config option + localAddress = "172.30.0.2"; + }; +} \ No newline at end of file