From 227dff7fd1835e8f0305fd5163303702a5792513 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 9 Aug 2023 21:43:47 +0100 Subject: [PATCH] fix(wsl2): use shared Home Manager configuration --- flake.nix | 3 ++- justfile | 2 +- system/wsl2/default.nix | 31 ++++++++++--------------------- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/flake.nix b/flake.nix index 89ed6ed..327aa81 100644 --- a/flake.nix +++ b/flake.nix @@ -8,10 +8,11 @@ outputs = inputs@{ flake-parts, self, ... }: let + system = "x86_64-linux"; username = "opdavies"; nixos-system = import ./system/nixos { inherit inputs username; }; - wsl-system = import ./system/wsl2 { inherit inputs username; }; + wsl-system = import ./system/wsl2 { inherit inputs system username; }; in flake-parts.lib.mkFlake { inherit inputs; } { systems = [ "x86_64-linux" ]; diff --git a/justfile b/justfile index d6cd356..9a831a3 100644 --- a/justfile +++ b/justfile @@ -8,7 +8,7 @@ nixos profile command: && clean sudo nixos-rebuild {{ command }} --flake .#{{ profile }} wsl2 command: && clean - home-manager {{ command }} -f home-manager/home.nix --flake .#wsl2 + NIXPKGS_ALLOW_UNFREE=1 home-manager {{ command }} --flake .#wsl2 --impure update: nix flake update diff --git a/system/wsl2/default.nix b/system/wsl2/default.nix index 5be1beb..7fcdc50 100644 --- a/system/wsl2/default.nix +++ b/system/wsl2/default.nix @@ -1,27 +1,16 @@ -{ inputs, username }: +{ inputs, system, username }: +let + pkgs = inputs.nixpkgs.legacyPackages."${system}"; + + shared-config = import ../shared/home-manager.nix { inherit inputs pkgs username; }; + shared-packages = import ../shared/home-manager-packages.nix { inherit inputs pkgs; }; +in inputs.home-manager.lib.homeManagerConfiguration { - extraSpecialArgs = { inherit inputs; }; + inherit pkgs; modules = [ - { - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (inputs.nixpkgs.lib.getName pkg) [ - "intelephense" - "postman" - "tabnine" - ]; - } - - { - imports = [ - ../../home-manager/modules/common.nix - ../../home-manager/modules/git.nix - ../../home-manager/modules/home-manager.nix - ../../home-manager/modules/tmux.nix - ../../home-manager/modules/zsh.nix - ]; - } + { imports = [ shared-config ]; } + { home.packages = shared-packages; } ]; - - pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; }