diff --git a/default.nix b/default.nix index c6a8700..f70e9d3 100644 --- a/default.nix +++ b/default.nix @@ -3,45 +3,45 @@ , checked ? false }: let - types = import ./types { inherit lib rootMountPoint; }; + diskoLib = import ./lib { inherit lib rootMountPoint; }; eval = cfg: lib.evalModules { modules = lib.singleton { # _file = toString input; imports = lib.singleton { disko.devices = cfg.disko.devices; }; options = { disko.devices = lib.mkOption { - type = types.devices; + type = diskoLib.devices; }; }; }; }; in { - types = types; - create = cfg: types.diskoLib.create (eval cfg).config.disko.devices; - createScript = cfg: pkgs: (types.diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-create" '' - export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.disko.devices pkgs)}:$PATH - ${types.diskoLib.create (eval cfg).config.disko.devices} + lib = diskoLib; + create = cfg: diskoLib.create (eval cfg).config.disko.devices; + createScript = cfg: pkgs: (diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-create" '' + export PATH=${lib.makeBinPath (diskoLib.packages (eval cfg).config.disko.devices pkgs)}:$PATH + ${diskoLib.create (eval cfg).config.disko.devices} ''; - createScriptNoDeps = cfg: pkgs: (types.diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko-create" '' - ${types.diskoLib.create (eval cfg).config.disko.devices} + createScriptNoDeps = cfg: pkgs: (diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko-create" '' + ${diskoLib.create (eval cfg).config.disko.devices} ''; - mount = cfg: types.diskoLib.mount (eval cfg).config.disko.devices; - mountScript = cfg: pkgs: (types.diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-mount" '' - export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.disko.devices pkgs)}:$PATH - ${types.diskoLib.mount (eval cfg).config.disko.devices} + mount = cfg: diskoLib.mount (eval cfg).config.disko.devices; + mountScript = cfg: pkgs: (diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-mount" '' + export PATH=${lib.makeBinPath (diskoLib.packages (eval cfg).config.disko.devices pkgs)}:$PATH + ${diskoLib.mount (eval cfg).config.disko.devices} ''; - mountScriptNoDeps = cfg: pkgs: (types.diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko-mount" '' - ${types.diskoLib.mount (eval cfg).config.disko.devices} + mountScriptNoDeps = cfg: pkgs: (diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko-mount" '' + ${diskoLib.mount (eval cfg).config.disko.devices} ''; - zapCreateMount = cfg: types.diskoLib.zapCreateMount (eval cfg).config.disko.devices; - zapCreateMountScript = cfg: pkgs: (types.diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-zap-create-mount" '' - export PATH=${lib.makeBinPath (types.diskoLib.packages (eval cfg).config.disko.devices pkgs)}:$PATH - ${types.diskoLib.zapCreateMount (eval cfg).config.disko.devices} + zapCreateMount = cfg: diskoLib.zapCreateMount (eval cfg).config.disko.devices; + zapCreateMountScript = cfg: pkgs: (diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-zap-create-mount" '' + export PATH=${lib.makeBinPath (diskoLib.packages (eval cfg).config.disko.devices pkgs)}:$PATH + ${diskoLib.zapCreateMount (eval cfg).config.disko.devices} ''; - zapCreateMountScriptNoDeps = cfg: pkgs: (types.diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko-zap-create-mount" '' - ${types.diskoLib.zapCreateMount (eval cfg).config.disko.devices} + zapCreateMountScriptNoDeps = cfg: pkgs: (diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko-zap-create-mount" '' + ${diskoLib.zapCreateMount (eval cfg).config.disko.devices} ''; - config = cfg: { imports = types.diskoLib.config (eval cfg).config.disko.devices; }; - packages = cfg: types.diskoLib.packages (eval cfg).config.disko.devices; + config = cfg: { imports = diskoLib.config (eval cfg).config.disko.devices; }; + packages = cfg: diskoLib.packages (eval cfg).config.disko.devices; } diff --git a/doc.nix b/doc.nix index 67b17bd..e171058 100644 --- a/doc.nix +++ b/doc.nix @@ -1,7 +1,7 @@ { lib, nixosOptionsDoc, runCommand, fetchurl, pandoc }: let - types = import ./types { + diskoLib = import ./lib { inherit lib; rootMountPoint = "/mnt"; }; @@ -10,7 +10,7 @@ let { options.disko = { devices = lib.mkOption { - type = types.devices; + type = diskoLib.devices; default = { }; description = "The devices to set up"; }; diff --git a/types/btrfs.nix b/lib/btrfs.nix similarity index 93% rename from types/btrfs.nix rename to lib/btrfs.nix index ce212cd..92b5e6d 100644 --- a/types/btrfs.nix +++ b/lib/btrfs.nix @@ -1,4 +1,4 @@ -({ config, options, diskoLib, lib, subTypes, optionTypes, rootMountPoint, ... }: +{ config, options, diskoLib, lib, rootMountPoint, ... }: { options = { type = lib.mkOption { @@ -17,12 +17,12 @@ description = "A list of options to pass to mount."; }; subvolumes = lib.mkOption { - type = lib.types.attrsOf subTypes.btrfs_subvol; + type = lib.types.attrsOf diskoLib.types.btrfs_subvol; default = { }; description = "Subvolumes to define for BTRFS."; }; mountpoint = lib.mkOption { - type = lib.types.nullOr optionTypes.absolute-pathname; + type = lib.types.nullOr diskoLib.optionTypes.absolute-pathname; default = null; description = "A path to mount the BTRFS filesystem to."; }; @@ -83,4 +83,4 @@ description = "Packages"; }; }; -}) +} diff --git a/types/btrfs_subvol.nix b/lib/btrfs_subvol.nix similarity index 95% rename from types/btrfs_subvol.nix rename to lib/btrfs_subvol.nix index caba3fe..461f5a2 100644 --- a/types/btrfs_subvol.nix +++ b/lib/btrfs_subvol.nix @@ -1,4 +1,4 @@ -{ config, options, diskoLib, lib, optionTypes, rootMountPoint, ... }: +{ config, options, diskoLib, lib, rootMountPoint, ... }: { options = { name = lib.mkOption { @@ -23,7 +23,7 @@ description = "Options to pass to mount"; }; mountpoint = lib.mkOption { - type = lib.types.nullOr optionTypes.absolute-pathname; + type = lib.types.nullOr diskoLib.optionTypes.absolute-pathname; default = null; description = "Location to mount the subvolume to."; }; diff --git a/types/default.nix b/lib/default.nix similarity index 77% rename from types/default.nix rename to lib/default.nix index dae4ff4..a5854d0 100644 --- a/types/default.nix +++ b/lib/default.nix @@ -2,7 +2,7 @@ with lib; with builtins; -rec { +let diskoLib = { # like lib.types.oneOf but instead of a list takes an attrset @@ -17,14 +17,14 @@ rec { # option for valid contents of partitions (basically like devices, but without tables) partitionType = lib.mkOption { - type = lib.types.nullOr (diskoLib.subType { inherit (subTypes) btrfs filesystem zfs mdraid luks lvm_pv swap; }); + type = lib.types.nullOr (diskoLib.subType { inherit (diskoLib.types) btrfs filesystem zfs mdraid luks lvm_pv swap; }); default = null; description = "The type of partition"; }; # option for valid contents of devices deviceType = lib.mkOption { - type = lib.types.nullOr (diskoLib.subType { inherit (subTypes) table btrfs filesystem zfs mdraid luks lvm_pv swap; }); + type = lib.types.nullOr (diskoLib.subType { inherit (diskoLib.types) table btrfs filesystem zfs mdraid luks lvm_pv swap; }); default = null; description = "The type of device"; }; @@ -160,7 +160,7 @@ rec { postMountHook = diskoLib.mkHook "shell commands to run after mount"; }; config._module.args = { - inherit diskoLib optionTypes subTypes rootMountPoint; + inherit diskoLib rootMountPoint; }; } ]; @@ -274,87 +274,88 @@ rec { packages :: lib.types.devices -> pkgs -> [ derivation ] */ packages = devices: pkgs: unique (flatten (map (dev: dev._pkgs pkgs) (flatten (map attrValues (attrValues devices))))); - }; - optionTypes = rec { - filename = lib.mkOptionType { - name = "filename"; - check = isString; - merge = mergeOneOption; - description = "A filename"; - }; + optionTypes = rec { + filename = lib.mkOptionType { + name = "filename"; + check = isString; + merge = mergeOneOption; + description = "A filename"; + }; - absolute-pathname = lib.mkOptionType { - name = "absolute pathname"; - check = x: isString x && substring 0 1 x == "/" && pathname.check x; - merge = mergeOneOption; - description = "An absolute path"; - }; + absolute-pathname = lib.mkOptionType { + name = "absolute pathname"; + check = x: isString x && substring 0 1 x == "/" && pathname.check x; + merge = mergeOneOption; + description = "An absolute path"; + }; - pathname = lib.mkOptionType { - name = "pathname"; - check = x: - let - # The filter is used to normalize paths, i.e. to remove duplicated and - # trailing slashes. It also removes leading slashes, thus we have to - # check for "/" explicitly below. - xs = filter (s: stringLength s > 0) (splitString "/" x); - in - isString x && (x == "/" || (length xs > 0 && all filename.check xs)); - merge = mergeOneOption; - description = "A path name"; - }; - }; - - /* topLevel type of the disko config, takes attrsets of disks, mdadms, zpools, nodevs, and lvm vgs. - */ - devices = lib.types.submodule { - options = { - disk = lib.mkOption { - type = lib.types.attrsOf subTypes.disk; - default = { }; - description = "Block device"; - }; - mdadm = lib.mkOption { - type = lib.types.attrsOf subTypes.mdadm; - default = { }; - description = "mdadm device"; - }; - zpool = lib.mkOption { - type = lib.types.attrsOf subTypes.zpool; - default = { }; - description = "ZFS pool device"; - }; - lvm_vg = lib.mkOption { - type = lib.types.attrsOf subTypes.lvm_vg; - default = { }; - description = "LVM VG device"; - }; - nodev = lib.mkOption { - type = lib.types.attrsOf subTypes.nodev; - default = { }; - description = "A non-block device"; + pathname = lib.mkOptionType { + name = "pathname"; + check = x: + let + # The filter is used to normalize paths, i.e. to remove duplicated and + # trailing slashes. It also removes leading slashes, thus we have to + # check for "/" explicitly below. + xs = filter (s: stringLength s > 0) (splitString "/" x); + in + isString x && (x == "/" || (length xs > 0 && all filename.check xs)); + merge = mergeOneOption; + description = "A path name"; }; }; - }; - subTypes = lib.mapAttrs (_: diskoLib.mkSubType) { - nodev = ./nodev.nix; - btrfs = ./btrfs.nix; - btrfs_subvol = ./btrfs_subvol.nix; - filesystem = ./filesystem.nix; - table = ./table.nix; - swap = ./swap.nix; - lvm_pv = ./lvm_pv.nix; - lvm_vg = ./lvm_vg.nix; - zfs = ./zfs.nix; - zpool = ./zpool.nix; - zfs_dataset = ./zfs_dataset.nix; - zfs_fs = ./zfs_fs.nix; - zfs_volume = ./zfs_volume.nix; - mdadm = ./mdadm.nix; - mdraid = ./mdraid.nix; - luks = ./luks.nix; - disk = ./disk.nix; + /* topLevel type of the disko config, takes attrsets of disks, mdadms, zpools, nodevs, and lvm vgs. + */ + devices = lib.types.submodule { + options = { + disk = lib.mkOption { + type = lib.types.attrsOf diskoLib.types.disk; + default = { }; + description = "Block device"; + }; + mdadm = lib.mkOption { + type = lib.types.attrsOf diskoLib.types.mdadm; + default = { }; + description = "mdadm device"; + }; + zpool = lib.mkOption { + type = lib.types.attrsOf diskoLib.types.zpool; + default = { }; + description = "ZFS pool device"; + }; + lvm_vg = lib.mkOption { + type = lib.types.attrsOf diskoLib.types.lvm_vg; + default = { }; + description = "LVM VG device"; + }; + nodev = lib.mkOption { + type = lib.types.attrsOf diskoLib.types.nodev; + default = { }; + description = "A non-block device"; + }; + }; + }; + + types = lib.mapAttrs (_: diskoLib.mkSubType) { + nodev = ./nodev.nix; + btrfs = ./btrfs.nix; + btrfs_subvol = ./btrfs_subvol.nix; + filesystem = ./filesystem.nix; + table = ./table.nix; + swap = ./swap.nix; + lvm_pv = ./lvm_pv.nix; + lvm_vg = ./lvm_vg.nix; + zfs = ./zfs.nix; + zpool = ./zpool.nix; + zfs_dataset = ./zfs_dataset.nix; + zfs_fs = ./zfs_fs.nix; + zfs_volume = ./zfs_volume.nix; + mdadm = ./mdadm.nix; + mdraid = ./mdraid.nix; + luks = ./luks.nix; + disk = ./disk.nix; + }; }; -} +in +diskoLib diff --git a/types/disk.nix b/lib/disk.nix similarity index 90% rename from types/disk.nix rename to lib/disk.nix index c1261bc..06499ac 100644 --- a/types/disk.nix +++ b/lib/disk.nix @@ -1,4 +1,4 @@ -{ config, options, lib, diskoLib, optionTypes, ... }: +{ config, options, lib, diskoLib, ... }: { options = { name = lib.mkOption { @@ -13,7 +13,7 @@ description = "Type"; }; device = lib.mkOption { - type = optionTypes.absolute-pathname; # TODO check if subpath of /dev ? - No! eg: /.swapfile + type = diskoLib.optionTypes.absolute-pathname; # TODO check if subpath of /dev ? - No! eg: /.swapfile description = "Device path"; }; content = diskoLib.deviceType; diff --git a/types/filesystem.nix b/lib/filesystem.nix similarity index 95% rename from types/filesystem.nix rename to lib/filesystem.nix index cda58b8..afe0ebe 100644 --- a/types/filesystem.nix +++ b/lib/filesystem.nix @@ -1,4 +1,4 @@ -{ config, options, lib, diskoLib, optionTypes, rootMountPoint, ... }: +{ config, options, lib, diskoLib, rootMountPoint, ... }: { options = { type = lib.mkOption { @@ -17,7 +17,7 @@ description = "Options to pass to mount"; }; mountpoint = lib.mkOption { - type = lib.types.nullOr optionTypes.absolute-pathname; + type = lib.types.nullOr diskoLib.optionTypes.absolute-pathname; default = null; description = "Path to mount the filesystem to"; }; diff --git a/types/luks.nix b/lib/luks.nix similarity index 96% rename from types/luks.nix rename to lib/luks.nix index caa17fe..bd8a5fc 100644 --- a/types/luks.nix +++ b/lib/luks.nix @@ -1,4 +1,4 @@ -{ config, options, lib, diskoLib, optionTypes, ... }: +{ config, options, lib, diskoLib, ... }: { options = { type = lib.mkOption { @@ -11,7 +11,7 @@ description = "Name of the LUKS"; }; keyFile = lib.mkOption { - type = lib.types.nullOr optionTypes.absolute-pathname; + type = lib.types.nullOr diskoLib.optionTypes.absolute-pathname; default = null; description = "Path to the key for encryption"; example = "/tmp/disk.key"; diff --git a/types/lvm_pv.nix b/lib/lvm_pv.nix similarity index 100% rename from types/lvm_pv.nix rename to lib/lvm_pv.nix diff --git a/types/lvm_vg.nix b/lib/lvm_vg.nix similarity index 98% rename from types/lvm_vg.nix rename to lib/lvm_vg.nix index 6d0cedc..1a6d3e5 100644 --- a/types/lvm_vg.nix +++ b/lib/lvm_vg.nix @@ -1,4 +1,4 @@ -{ config, options, lib, diskoLib, subTypes, ... }: +{ config, options, lib, diskoLib, ... }: { options = { name = lib.mkOption { diff --git a/types/mdadm.nix b/lib/mdadm.nix similarity index 100% rename from types/mdadm.nix rename to lib/mdadm.nix diff --git a/types/mdraid.nix b/lib/mdraid.nix similarity index 100% rename from types/mdraid.nix rename to lib/mdraid.nix diff --git a/types/nodev.nix b/lib/nodev.nix similarity index 94% rename from types/nodev.nix rename to lib/nodev.nix index 9fe7b86..aa6a2ef 100644 --- a/types/nodev.nix +++ b/lib/nodev.nix @@ -1,4 +1,4 @@ -{ lib, config, options, diskoLib, optionTypes, rootMountPoint, ... }: +{ lib, config, options, diskoLib, rootMountPoint, ... }: { options = { type = lib.mkOption { @@ -17,7 +17,7 @@ description = "Device to use"; }; mountpoint = lib.mkOption { - type = lib.types.nullOr optionTypes.absolute-pathname; + type = lib.types.nullOr diskoLib.optionTypes.absolute-pathname; default = config._module.args.name; description = "Location to mount the file system at"; }; diff --git a/types/swap.nix b/lib/swap.nix similarity index 100% rename from types/swap.nix rename to lib/swap.nix diff --git a/types/table.nix b/lib/table.nix similarity index 99% rename from types/table.nix rename to lib/table.nix index eb8121a..a366685 100644 --- a/types/table.nix +++ b/lib/table.nix @@ -1,4 +1,4 @@ -{ config, options, lib, diskoLib, subTypes, ... }: +{ config, options, lib, diskoLib, ... }: { options = { type = lib.mkOption { diff --git a/types/zfs.nix b/lib/zfs.nix similarity index 100% rename from types/zfs.nix rename to lib/zfs.nix diff --git a/types/zfs_fs.nix b/lib/zfs_fs.nix similarity index 95% rename from types/zfs_fs.nix rename to lib/zfs_fs.nix index ae0bf2f..c943794 100644 --- a/types/zfs_fs.nix +++ b/lib/zfs_fs.nix @@ -1,4 +1,4 @@ -{ config, options, lib, diskoLib, optionTypes, rootMountPoint, ... }: +{ config, options, lib, diskoLib, rootMountPoint, ... }: { options = { name = lib.mkOption { @@ -24,7 +24,7 @@ }; mountpoint = lib.mkOption { - type = lib.types.nullOr optionTypes.absolute-pathname; + type = lib.types.nullOr diskoLib.optionTypes.absolute-pathname; default = null; description = "Path to mount the dataset to"; }; diff --git a/types/zfs_volume.nix b/lib/zfs_volume.nix similarity index 97% rename from types/zfs_volume.nix rename to lib/zfs_volume.nix index 2609ed6..6eb3848 100644 --- a/types/zfs_volume.nix +++ b/lib/zfs_volume.nix @@ -1,4 +1,4 @@ -{ config, options, lib, diskoLib, optionTypes, rootMountPoint, ... }: +{ config, options, lib, diskoLib, rootMountPoint, ... }: { options = { name = lib.mkOption { diff --git a/types/zpool.nix b/lib/zpool.nix similarity index 93% rename from types/zpool.nix rename to lib/zpool.nix index b3965a3..3ec59df 100644 --- a/types/zpool.nix +++ b/lib/zpool.nix @@ -1,4 +1,4 @@ -{ config, options, lib, diskoLib, optionTypes, subTypes, rootMountPoint, ... }: +{ config, options, lib, diskoLib, rootMountPoint, ... }: { options = { name = lib.mkOption { @@ -28,7 +28,7 @@ description = "Options for the root filesystem"; }; mountpoint = lib.mkOption { - type = lib.types.nullOr optionTypes.absolute-pathname; + type = lib.types.nullOr diskoLib.optionTypes.absolute-pathname; default = null; description = "The mountpoint of the pool"; }; @@ -49,8 +49,7 @@ ''; }; datasets = lib.mkOption { - type = lib.types.attrsOf (diskoLib.subType { inherit (subTypes) zfs_fs zfs_volume; }); - # type = lib.types.attrsOf subTypes.zfs_fs; + type = lib.types.attrsOf (diskoLib.subType { inherit (diskoLib.types) zfs_fs zfs_volume; }); description = "List of datasets to define"; }; _meta = lib.mkOption { diff --git a/module.nix b/module.nix index afdd315..1262841 100644 --- a/module.nix +++ b/module.nix @@ -1,6 +1,6 @@ { config, lib, pkgs, ... }: let - types = import ./types { + diskoLib = import ./lib { inherit lib; rootMountPoint = config.disko.rootMountPoint; }; @@ -10,7 +10,7 @@ in { options.disko = { devices = lib.mkOption { - type = types.devices; + type = diskoLib.devices; default = { }; description = "The devices to set up"; }; @@ -37,29 +37,29 @@ in }; }; config = lib.mkIf (cfg.devices.disk != { }) { - system.build.formatScript = (types.diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-create" '' - export PATH=${lib.makeBinPath (types.diskoLib.packages cfg.devices pkgs)}:$PATH - ${types.diskoLib.create cfg.devices} + system.build.formatScript = (diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-create" '' + export PATH=${lib.makeBinPath (diskoLib.packages cfg.devices pkgs)}:$PATH + ${diskoLib.create cfg.devices} ''; - system.build.mountScript = (types.diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-mount" '' - export PATH=${lib.makeBinPath (types.diskoLib.packages cfg.devices pkgs)}:$PATH - ${types.diskoLib.mount cfg.devices} + system.build.mountScript = (diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko-mount" '' + export PATH=${lib.makeBinPath (diskoLib.packages cfg.devices pkgs)}:$PATH + ${diskoLib.mount cfg.devices} ''; - system.build.disko = (types.diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko" '' - export PATH=${lib.makeBinPath (types.diskoLib.packages cfg.devices pkgs)}:$PATH - ${types.diskoLib.zapCreateMount cfg.devices} + system.build.disko = (diskoLib.writeCheckedBash { inherit pkgs checked; }) "disko" '' + export PATH=${lib.makeBinPath (diskoLib.packages cfg.devices pkgs)}:$PATH + ${diskoLib.zapCreateMount cfg.devices} ''; # This is useful to skip copying executables uploading a script to an in-memory installer - system.build.diskoNoDeps = (types.diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko" '' - ${types.diskoLib.zapCreateMount cfg.devices} + system.build.diskoNoDeps = (diskoLib.writeCheckedBash { inherit pkgs checked; noDeps = true; }) "disko" '' + ${diskoLib.zapCreateMount cfg.devices} ''; # Remember to add config keys here if they are added to types - fileSystems = lib.mkIf cfg.enableConfig (lib.mkMerge (lib.catAttrs "fileSystems" (types.diskoLib.config cfg.devices))); - boot = lib.mkIf cfg.enableConfig (lib.mkMerge (lib.catAttrs "boot" (types.diskoLib.config cfg.devices))); - swapDevices = lib.mkIf cfg.enableConfig (lib.mkMerge (lib.catAttrs "swapDevices" (types.diskoLib.config cfg.devices))); + fileSystems = lib.mkIf cfg.enableConfig (lib.mkMerge (lib.catAttrs "fileSystems" (diskoLib.config cfg.devices))); + boot = lib.mkIf cfg.enableConfig (lib.mkMerge (lib.catAttrs "boot" (diskoLib.config cfg.devices))); + swapDevices = lib.mkIf cfg.enableConfig (lib.mkMerge (lib.catAttrs "swapDevices" (diskoLib.config cfg.devices))); }; } diff --git a/package.nix b/package.nix index efdf98b..1021bd3 100644 --- a/package.nix +++ b/package.nix @@ -8,7 +8,7 @@ stdenvNoCC.mkDerivation rec { ]; installPhase = '' mkdir -p $out/bin $out/share/disko - cp -r cli.nix default.nix disk-deactivate types $out/share/disko + cp -r cli.nix default.nix disk-deactivate lib $out/share/disko sed \ -e "s|libexec_dir=\".*\"|libexec_dir=\"$out/share/disko\"|" \ -e "s|#!/usr/bin/env.*|#!/usr/bin/env bash|" \