From e6b1129f9d3c2010fba981307c72ad7d15717d3d Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 29 Sep 2023 20:51:59 +0300 Subject: feat: rewrite tarball generation to use proper nixos-install + nixos-enter Supersedes #243. --- flake.nix | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 66397e8..f3243f4 100644 --- a/flake.nix +++ b/flake.nix @@ -26,11 +26,41 @@ }; nixosModules.default = self.nixosModules.wsl; - nixosConfigurations.mysystem = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./configuration.nix - ]; + nixosConfigurations = { + modern = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + self.nixosModules.default + { wsl.enable = true; } + ]; + }; + + legacy = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + self.nixosModules.default + { + wsl.enable = true; + wsl.nativeSystemd = false; + } + ]; + }; + + test = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + self.nixosModules.default + ({ config, ... }: { + wsl.enable = true; + wsl.nativeSystemd = false; + + system.activationScripts.create-test-entrypoint.text = '' + mkdir -p /bin + ln -sfn ${config.users.users.root.shell} /bin/syschdemd + ''; + }) + ]; + }; }; } // -- cgit v1.2.3 From f347f6c75fe861dfd8f4c277d2bafa4e343968b6 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 29 Sep 2023 23:21:23 +0300 Subject: fix: add better indirection to syschdemd proxy Fixes username-change test --- flake.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index f3243f4..931f1e9 100644 --- a/flake.nix +++ b/flake.nix @@ -50,14 +50,21 @@ system = "x86_64-linux"; modules = [ self.nixosModules.default - ({ config, ... }: { + ({ config, pkgs, ... }: { wsl.enable = true; wsl.nativeSystemd = false; - system.activationScripts.create-test-entrypoint.text = '' - mkdir -p /bin - ln -sfn ${config.users.users.root.shell} /bin/syschdemd - ''; + 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 + ''; }) ]; }; -- cgit v1.2.3