mirror of
https://github.com/TECHNOFAB11/disko.git
synced 2025-12-11 23:50:05 +01:00
style: Apply nixpkgs-fmt and fix
Apply standard formatting and some statix conventions using; ```sh nixpkgs-fmt **.nix && statix fix . ``` With the intent of making contribution a bit easier and reducing mental load in hand formatting (in the same vein as [black]). [black]: https://github.com/psf/black#the-uncompromising-code-formatter
This commit is contained in:
parent
b1a4ecb8ca
commit
08435eec4b
23 changed files with 171 additions and 158 deletions
52
cli.nix
52
cli.nix
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs ? import <nixpkgs> {}
|
||||
{ pkgs ? import <nixpkgs> { }
|
||||
, lib ? pkgs.lib
|
||||
, mode ? "mount"
|
||||
, flake ? null
|
||||
|
|
@ -6,35 +6,39 @@
|
|||
, diskoFile ? null
|
||||
, rootMountPoint ? "/mnt"
|
||||
, noDeps ? false
|
||||
, ... }@args:
|
||||
, ...
|
||||
}@args:
|
||||
let
|
||||
disko = import ./. {
|
||||
inherit rootMountPoint;
|
||||
inherit lib;
|
||||
};
|
||||
|
||||
diskFormat = if flake != null then
|
||||
(pkgs.lib.attrByPath [ "diskoConfigurations" flakeAttr ] (builtins.abort "${flakeAttr} does not exist") (builtins.getFlake flake)) args
|
||||
else
|
||||
import diskoFile ({ inherit lib; } // args);
|
||||
diskFormat =
|
||||
if flake != null then
|
||||
(pkgs.lib.attrByPath [ "diskoConfigurations" flakeAttr ] (builtins.abort "${flakeAttr} does not exist") (builtins.getFlake flake)) args
|
||||
else
|
||||
import diskoFile ({ inherit lib; } // args);
|
||||
|
||||
diskoEval = if noDeps then
|
||||
if (mode == "create") then
|
||||
disko.createScriptNoDeps diskFormat pkgs
|
||||
else if (mode == "mount") then
|
||||
disko.mountScriptNoDeps diskFormat pkgs
|
||||
else if (mode == "zap_create_mount") then
|
||||
disko.zapCreateMountScriptNoDeps diskFormat pkgs
|
||||
diskoEval =
|
||||
if noDeps then
|
||||
if (mode == "create") then
|
||||
disko.createScriptNoDeps diskFormat pkgs
|
||||
else if (mode == "mount") then
|
||||
disko.mountScriptNoDeps diskFormat pkgs
|
||||
else if (mode == "zap_create_mount") then
|
||||
disko.zapCreateMountScriptNoDeps diskFormat pkgs
|
||||
else
|
||||
builtins.abort "invalid mode"
|
||||
else
|
||||
builtins.abort "invalid mode"
|
||||
else
|
||||
if (mode == "create") then
|
||||
disko.createScript diskFormat pkgs
|
||||
else if (mode == "mount") then
|
||||
disko.mountScript diskFormat pkgs
|
||||
else if (mode == "zap_create_mount") then
|
||||
disko.zapCreateMountScript diskFormat pkgs
|
||||
else
|
||||
builtins.abort "invalid mode"
|
||||
if (mode == "create") then
|
||||
disko.createScript diskFormat pkgs
|
||||
else if (mode == "mount") then
|
||||
disko.mountScript diskFormat pkgs
|
||||
else if (mode == "zap_create_mount") then
|
||||
disko.zapCreateMountScript diskFormat pkgs
|
||||
else
|
||||
builtins.abort "invalid mode"
|
||||
;
|
||||
in diskoEval
|
||||
in
|
||||
diskoEval
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue