From 83d3356e5c0becc6b7ab0429b4fe6a5f3d2dbb6b Mon Sep 17 00:00:00 2001 From: K900 Date: Mon, 2 Oct 2023 09:10:45 +0300 Subject: feat: add welcome message Direct people to upgrade their systems first and link to support channels just in case. --- flake.nix | 82 ++++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 44 insertions(+), 38 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 931f1e9..8e08f47 100644 --- a/flake.nix +++ b/flake.nix @@ -26,49 +26,55 @@ }; nixosModules.default = self.nixosModules.wsl; - nixosConfigurations = { - modern = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - self.nixosModules.default - { wsl.enable = true; } - ]; - }; + nixosConfigurations = + let + initialConfig = { + wsl.enable = true; - legacy = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - self.nixosModules.default - { - wsl.enable = true; - wsl.nativeSystemd = false; - } - ]; - }; + programs.bash.loginShellInit = "nixos-wsl-welcome"; + }; + in + { + modern = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + self.nixosModules.default + initialConfig + ]; + }; + + legacy = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + self.nixosModules.default + initialConfig + { wsl.nativeSystemd = false; } + ]; + }; - test = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - self.nixosModules.default - ({ config, pkgs, ... }: { - wsl.enable = true; - wsl.nativeSystemd = false; + test = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + self.nixosModules.default + ({ config, pkgs, ... }: { + wsl.enable = true; + wsl.nativeSystemd = false; - system.activationScripts.create-test-entrypoint.text = - let - syschdemdProxy = pkgs.writeShellScript "syschdemd-proxy" '' - shell=$(${pkgs.glibc.bin}/bin/getent passwd root | ${pkgs.coreutils}/bin/cut -d: -f7) - exec $shell $@ + system.activationScripts.create-test-entrypoint.text = + let + syschdemdProxy = pkgs.writeShellScript "syschdemd-proxy" '' + shell=$(${pkgs.glibc.bin}/bin/getent passwd root | ${pkgs.coreutils}/bin/cut -d: -f7) + exec $shell $@ + ''; + in + '' + mkdir -p /bin + ln -sfn ${syschdemdProxy} /bin/syschdemd ''; - in - '' - mkdir -p /bin - ln -sfn ${syschdemdProxy} /bin/syschdemd - ''; - }) - ]; + }) + ]; + }; }; - }; } // flake-utils.lib.eachSystem -- cgit v1.2.3