From c16463dd65fc6a99e3d6879ce03ab14e5c342e2d Mon Sep 17 00:00:00 2001 From: Cameron Reed Date: Mon, 15 Jan 2024 19:25:58 -0700 Subject: [PATCH] Configure tailscale --- flake.lock | 21 +++++++++++++++++++++ flake.nix | 23 +++++++++++++++-------- hosts/nixos/configuration.nix | 13 ++++++++++--- hosts/nixserver/configuration.nix | 8 ++++++++ 4 files changed, 54 insertions(+), 11 deletions(-) diff --git a/flake.lock b/flake.lock index 8de3ec2..ffa14f2 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs-unstable" + ] + }, + "locked": { + "lastModified": 1705335923, + "narHash": "sha256-jRyp+a89Y7Cb2V/NyIJpgu5gsND419bY16omCZWy+jc=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "b989db5900df4bd1a786f8afd8063dae09d89a8c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1705183652, @@ -32,6 +52,7 @@ }, "root": { "inputs": { + "home-manager": "home-manager", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" } diff --git a/flake.nix b/flake.nix index a1e8fa9..c6d8b4b 100644 --- a/flake.nix +++ b/flake.nix @@ -3,30 +3,37 @@ inputs = { + # Stable nixpkgs.url = "nixpkgs/nixos-23.11"; + + # Unstable nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs-unstable"; }; - outputs = { self, nixpkgs, nixpkgs-unstable }: { + outputs = { self, nixpkgs, nixpkgs-unstable, home-manager }: + let common_dir = ./common; + in { nixosConfigurations = { nixos = nixpkgs-unstable.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { - inherit self; - nixpkgs = nixpkgs-unstable; - }; + specialArgs = { inherit common_dir; }; modules = [ ./hosts/nixos/configuration.nix + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + # home-manager.users.cameron = import ./hosts/nixos/home-manager/cameron.nix; + } ]; }; nixserver = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { - inherit self nixpkgs; - }; + specialArgs = { inherit common_dir; }; modules = [ ./hosts/nixserver/configuration.nix ]; diff --git a/hosts/nixos/configuration.nix b/hosts/nixos/configuration.nix index 7b0aa68..1f80631 100644 --- a/hosts/nixos/configuration.nix +++ b/hosts/nixos/configuration.nix @@ -1,7 +1,6 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, common_dir, ... }: -let common_dir=../../common; -in { +{ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix @@ -134,6 +133,14 @@ in { nssmdns4 = true; }; + services.tailscale = { + enable = true; + openFirewall = true; + extraUpFlags = [ + "--login-server=https://scale.cam123.dev:443" + ]; + }; + # Time Configuration diff --git a/hosts/nixserver/configuration.nix b/hosts/nixserver/configuration.nix index 15112ae..88d9512 100755 --- a/hosts/nixserver/configuration.nix +++ b/hosts/nixserver/configuration.nix @@ -34,6 +34,14 @@ in { networking.hostName = "nixserver"; networking.networkmanager.enable = true; + services.tailscale = { + enable = true; + openFirewall = true; + extraUpFlags = [ + "--login-server=https://scale.cam123.dev:443" + ]; + }; + # Set your time zone. time.timeZone = "America/Denver";