From 73810b20460d12cd4766e26b772efa382296ba48 Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Mon, 14 Aug 2023 17:03:13 -0400 Subject: [PATCH] feat: modernize work config --- flake.lock | 57 ++++++++++++++++++++++++++++++++- flake.nix | 19 +++++++---- machines/work/configuration.nix | 26 +++++++-------- modules/containers.nix | 2 +- modules/vscode-server.nix | 10 ------ user/environments/wsl/home.nix | 5 ++- user/modules/dev.nix | 2 +- 7 files changed, 83 insertions(+), 38 deletions(-) delete mode 100644 modules/vscode-server.nix diff --git a/flake.lock b/flake.lock index de79b7e..861eef9 100644 --- a/flake.lock +++ b/flake.lock @@ -73,6 +73,24 @@ "type": "github" } }, + "flake-utils_3": { + "inputs": { + "systems": "systems_4" + }, + "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": [ @@ -171,7 +189,8 @@ "nur": "nur", "rust-overlay": "rust-overlay", "unstable": "unstable", - "utils": "utils" + "utils": "utils", + "vscode-server": "vscode-server" } }, "rust-overlay": { @@ -238,6 +257,21 @@ "type": "github" } }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "unstable": { "locked": { "lastModified": 1688590700, @@ -270,6 +304,27 @@ "repo": "flake-utils", "type": "github" } + }, + "vscode-server": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1684517665, + "narHash": "sha256-SaAr66uCQ8CF75jIr23FZjk1+9Kfwm5sQnwV25206Gs=", + "owner": "nix-community", + "repo": "nixos-vscode-server", + "rev": "1e1358493df6529d4c7bc4cc3066f76fd16d4ae6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-vscode-server", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 0bb7d43..beb4a88 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,10 @@ nixpkgs.follows = "nixpkgs"; }; }; + vscode-server = { + url = "github:nix-community/nixos-vscode-server"; + inputs.nixpkgs.follows = "nixpkgs"; + }; darwin = { url = "github:lnl7/nix-darwin/master"; @@ -29,7 +33,7 @@ }; }; - outputs = { self, nixpkgs, unstable, nur, utils, rust-overlay, nixos-wsl, darwin, home-manager, ... }@inputs: { + outputs = { self, nixpkgs, unstable, nur, utils, rust-overlay, nixos-wsl, vscode-server, darwin, home-manager, ... }@inputs: { # This repo's overlay plus any other overlays you use # If you want to use packages from flakes that are not nixpkgs (such as NUR), add their overlays here.\ @@ -82,14 +86,15 @@ modules = [ self.overlaysModule home-manager.nixosModules.home-manager - { - nixpkgs.overlays = [ - (import ./overlays/iptables) - ]; - } + vscode-server.nixosModules.default + # { + # nixpkgs.overlays = [ + # (import ./overlays/iptables) + # ]; + # } ./modules/containers.nix ./modules/nix.nix - ./modules/vscode-server.nix + # ./modules/vscode-server.nix ./machines/work/configuration.nix ]; diff --git a/machines/work/configuration.nix b/machines/work/configuration.nix index 031b317..dbf9c82 100644 --- a/machines/work/configuration.nix +++ b/machines/work/configuration.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, config, modulesPath, inputs, ... }: +{ lib, pkgs, modulesPath, inputs, ... }: with lib; let @@ -13,7 +13,10 @@ in wsl = { enable = true; - automountPath = "/mnt"; + wslConf = { + automount.root = "/mnt"; + interop.appendWindowsPath = false; + }; defaultUser = defaultUser; startMenuLaunchers = true; @@ -34,25 +37,18 @@ in }; environment.systemPackages = with pkgs; [ - wget + wget ]; - # Proxychains - programs.proxychains = { - enable = true; - proxies.main = { - enable = true; - type = "http"; - host = "172.21.32.1"; - port = 1080; - }; - }; + services.vscode-server.enable = true; + + programs.zsh.enable = true; users.users.${defaultUser} = { - uid = pkgs.lib.mkForce 1001; + uid = pkgs.lib.mkForce 1001; extraGroups = [ "wheel" "docker" "podman" ]; shell = pkgs.zsh; }; - system.stateVersion = "21.11"; + system.stateVersion = "22.05"; } diff --git a/modules/containers.nix b/modules/containers.nix index 9cb3218..6a26de7 100644 --- a/modules/containers.nix +++ b/modules/containers.nix @@ -4,7 +4,7 @@ virtualisation.podman = { enable = true; dockerSocket.enable = true; - defaultNetwork.dnsname.enable = true; + defaultNetwork.settings.dns_enabled = true; }; environment.systemPackages = with pkgs; [ diff --git a/modules/vscode-server.nix b/modules/vscode-server.nix deleted file mode 100644 index a924157..0000000 --- a/modules/vscode-server.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - imports = [ - (fetchTarball { - url = "https://github.com/msteen/nixos-vscode-server/tarball/d2343b5eb47b811856085f3eff4d899a32b2c136"; - sha256 = "sha256:1cszfjwshj6imkwip270ln4l1j328aw2zh9vm26wv3asnqlhdrak"; - }) - ]; - - services.vscode-server.enable = true; -} \ No newline at end of file diff --git a/user/environments/wsl/home.nix b/user/environments/wsl/home.nix index db17ab0..f4ded73 100644 --- a/user/environments/wsl/home.nix +++ b/user/environments/wsl/home.nix @@ -18,8 +18,7 @@ shellAliases = { code = "/mnt/c/Program\\ Files/Microsoft\\ VS\\ Code/Code.exe"; }; - profileExtra = '' - source $HOME/.profile - ''; }; + + home.stateVersion = "22.05"; } diff --git a/user/modules/dev.nix b/user/modules/dev.nix index 9d4ad6e..1e5f5a9 100644 --- a/user/modules/dev.nix +++ b/user/modules/dev.nix @@ -16,7 +16,7 @@ kubectl kubernetes-helm # Nix - rnix-lsp + nil nixpkgs-fmt # Rust (rust-bin.stable.latest.default.override {