summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornzbr <mail@nzbr.de>2023-10-02 11:41:50 +0200
committerGitHub <noreply@github.com>2023-10-02 11:41:50 +0200
commit337edef90c8abe35b42e95aecf510a063dad02dd (patch)
tree2c96628395596ece620fd0ac722ca941bee5fb6d
parent46d35ee9d3bd9fa3b31c3b660248db7c84d90555 (diff)
parent83d3356e5c0becc6b7ab0429b4fe6a5f3d2dbb6b (diff)
Merge pull request #303 from nix-community/welcome
feat: add welcome message
-rw-r--r--flake.nix82
-rw-r--r--modules/default.nix1
-rw-r--r--modules/welcome.nix22
3 files changed, 67 insertions, 38 deletions
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
diff --git a/modules/default.nix b/modules/default.nix
index 08a612a..c2f9a38 100644
--- a/modules/default.nix
+++ b/modules/default.nix
@@ -6,6 +6,7 @@
./recovery.nix
./systemd
./version.nix
+ ./welcome.nix
./wsl-conf.nix
./wsl-distro.nix
diff --git a/modules/welcome.nix b/modules/welcome.nix
new file mode 100644
index 0000000..30b2466
--- /dev/null
+++ b/modules/welcome.nix
@@ -0,0 +1,22 @@
+{ lib, pkgs, config, ... }:
+let
+ welcomeMessage = pkgs.writeText "nixos-wsl-welcome-message" ''
+ Welcome to your new NixOS-WSL system!
+
+ Please run `sudo nix-channel --update` and `sudo nixos-rebuild switch` now, to ensure you're running the latest NixOS and NixOS-WSL versions.
+
+ If you run into issues, please report them on our Github page at https://github.com/nix-community/NixOS-WSL or come talk to us on Matrix at #wsl:nixos.org.
+
+ ❄️ Enjoy NixOS-WSL! ❄️
+
+ Note: this message will disappear after you rebuild your system. If you want to see it again, run `nixos-wsl-welcome`.
+ '';
+ welcome = pkgs.writeShellScriptBin "nixos-wsl-welcome" ''
+ cat ${welcomeMessage}
+ '';
+in
+{
+ config = lib.mkIf config.wsl.enable {
+ environment.systemPackages = [ welcome ];
+ };
+}