summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2023-09-29 20:51:59 +0300
committerK900 <me@0upti.me>2023-09-29 21:53:26 +0300
commit5f0eb2075bb1ae00496be4deca0c9e5bb848763e (patch)
tree1454fe1e7b5c624bdb166d9b7d605428887a7e2e /modules
parente6b1129f9d3c2010fba981307c72ad7d15717d3d (diff)
cleanup: remove the old installer, now unused
Diffstat (limited to 'modules')
-rw-r--r--modules/installer.nix72
1 files changed, 0 insertions, 72 deletions
diff --git a/modules/installer.nix b/modules/installer.nix
deleted file mode 100644
index 74cd7b2..0000000
--- a/modules/installer.nix
+++ /dev/null
@@ -1,72 +0,0 @@
-{ config, lib, pkgs, ... }:
-with builtins; with lib; {
-
- config = mkIf config.wsl.enable (
- let
- mkTarball = pkgs.callPackage "${lib.cleanSource pkgs.path}/nixos/lib/make-system-tarball.nix";
-
- pkgs2storeContents = map (x: { object = x; symlink = "none"; });
-
- rootfs = let tarball = config.system.build.tarball; in "${tarball}/tarball/${tarball.fileName}.tar${tarball.extension}";
-
- installer = pkgs.writeScript "installer.sh" ''
- #!${pkgs.busybox}/bin/sh
- BASEPATH=$PATH
- export PATH=$BASEPATH:${pkgs.busybox}/bin # Add busybox to path
-
- set -e
- cd /
-
- echo "Unpacking root file system..."
- ${pkgs.pv}/bin/pv ${rootfs} | tar xz
-
- echo "Activating nix configuration..."
- LANG="C.UTF-8" /nix/var/nix/profiles/system/activate
- PATH=$BASEPATH:/run/current-system/sw/bin # Use packages from target system
-
- echo "Cleaning up installer files..."
- nix-collect-garbage
- rm /nix-path-registration
-
- echo "Optimizing store..."
- nix-store --optimize
-
- # Don't package the shell here, it's contained in the rootfs
- exec ${builtins.unsafeDiscardStringContext config.users.users.root.shell} "$@"
- '';
-
- # Set installer.sh as the root shell
- passwd = pkgs.writeText "passwd" ''
- root:x:0:0:System administrator:/root:${installer}
- '';
- in
- {
-
- system.build.installer = mkTarball {
- fileName = "nixos-wsl-installer";
- compressCommand = "gzip";
- compressionExtension = ".gz";
- extraArgs = "--hard-dereference";
-
- storeContents = pkgs2storeContents [ installer ];
-
- contents = [
- { source = config.environment.etc."wsl.conf".source; target = "/etc/wsl.conf"; }
- { source = config.environment.etc."fstab".source; target = "/etc/fstab"; }
- { source = passwd; target = "/etc/passwd"; }
- { source = "${pkgs.busybox}/bin/busybox"; target = "/bin/sh"; }
- { source = "${pkgs.busybox}/bin/busybox"; target = "/bin/mount"; }
- { source = "${installer}"; target = "/nix/nixos-wsl/entrypoint"; }
- ];
-
- extraCommands = pkgs.writeShellScript "prepare" ''
- export PATH=$PATH:${pkgs.coreutils}/bin
- mkdir -p bin
- ln -s /init bin/wslpath
- '';
- };
-
- }
- );
-
-}