From 5cbe8fbb483f10d717e26c608524ce442802cb37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 15 Nov 2022 19:28:28 +0100 Subject: simplify deviceNumbering function --- types.nix | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/types.nix b/types.nix index 228052f..c26cf0b 100644 --- a/types.nix +++ b/types.nix @@ -51,21 +51,14 @@ rec { => "/dev/disk/by-id/xxx-part2" */ deviceNumbering = dev: index: - let - schemas = { - dev__da = dev + toString index; # /dev/{s,v}da style - dev_disk = "${dev}-part${toString index}"; # /dev/disk/by-id/xxx style - dev_nvme = "${dev}p${toString index}"; # /dev/nvme0n1p1 style - dev_md = "${dev}p${toString index}"; # /dev/nvme0n1p1 style - }; - detectSchema = - if match "/dev/[vs]d.*" dev != null then "dev__da" else - if match "/dev/disk/.*" dev != null then "dev_disk" else - if match "/dev/nvme.*" dev != null then "dev_nvme" else - if match "/dev/md/.*" dev != null then "dev_md" else - if match "/dev/mmcblk.*" dev != null then "dev_nvme" else - abort "${dev} seems not to be a supported disk format"; - in schemas.${detectSchema}; + if match "/dev/[vs]d.*" dev != null then + dev + toString index # /dev/{s,v}da style + else if match "/dev/disk/.*" dev != null then + "${dev}-part${toString index}" # /dev/disk/by-id/xxx style + else if match "/dev/(nvme|md/|mmcblk).*" dev != null then + "${dev}p${toString index}" # /dev/nvme0n1p1 style + else + abort "${dev} seems not to be a supported disk format"; /* A nix option type representing a json datastructure, vendored from nixpkgs to avoid dependency on pkgs */ jsonType = let -- cgit v1.2.3 From d0fd785c93e69adbf28c271cfce1e6a36eae9ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 15 Nov 2022 19:30:09 +0100 Subject: make device matching regexes a bit stricter --- types.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types.nix b/types.nix index c26cf0b..fe04e9c 100644 --- a/types.nix +++ b/types.nix @@ -51,11 +51,11 @@ rec { => "/dev/disk/by-id/xxx-part2" */ deviceNumbering = dev: index: - if match "/dev/[vs]d.*" dev != null then + if match "/dev/[vs]d.+" dev != null then dev + toString index # /dev/{s,v}da style - else if match "/dev/disk/.*" dev != null then + else if match "/dev/disk/.+" dev != null then "${dev}-part${toString index}" # /dev/disk/by-id/xxx style - else if match "/dev/(nvme|md/|mmcblk).*" dev != null then + else if match "/dev/(nvme|md/|mmcblk).+" dev != null then "${dev}p${toString index}" # /dev/nvme0n1p1 style else abort "${dev} seems not to be a supported disk format"; -- cgit v1.2.3 From 107b0ed59f61bfe789a60fc339360da88b6e8164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 15 Nov 2022 19:33:15 +0100 Subject: make flake the current installation recommendation --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 20dea6f..c6f0e99 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ TODO: output of the cli --help You can use the NixOS module in one of the following ways: -### Flakes +### Flakes (Current recommendation) If you use nix flakes support: @@ -71,7 +71,7 @@ If you use nix flakes support: } ``` -### [niv](https://github.com/nmattia/niv) (Current recommendation) +### [niv](https://github.com/nmattia/niv) First add it to niv: ```console -- cgit v1.2.3 From a3bef46beb9c497582ae44efb06671c9df6c74c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 15 Nov 2022 19:36:56 +0100 Subject: README: fold installation methods --- README.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c6f0e99..333f2a6 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,8 @@ TODO: output of the cli --help You can use the NixOS module in one of the following ways: -### Flakes (Current recommendation) +
+ Flakes (Current recommendation) If you use nix flakes support: @@ -70,9 +71,11 @@ If you use nix flakes support: }; } ``` - -### [niv](https://github.com/nmattia/niv) - First add it to niv: +
+
+ niv + + First add it to [niv](https://github.com/nmattia/niv): ```console $ niv add nix-community/disko @@ -85,8 +88,9 @@ $ niv add nix-community/disko imports = [ "${(import ./nix/sources.nix).disko}/modules/disko.nix" ]; } ``` - -### nix-channel +
+
+ nix-channel As root run: @@ -102,8 +106,9 @@ $ nix-channel --update imports = [ ]; } ``` - -### fetchTarball +
+
+ fetchTarball Add the following to your configuration.nix: @@ -129,6 +134,7 @@ $ nix-channel --update ]; } ``` +
## Using the NixOS module -- cgit v1.2.3