dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
commit fd577cc1340620a865d23b4ca7a1303a5b463485 parent d65a8e013e855d0166c0635a5280870774059dbe Author: maydayv7 <maydayv7@gmail.com> Date: Sat, 9 Dec 2023 21:19:42 +0530 fix: Add boot recovery settings Also fix package calling
Diffstat:
| M | README.md | | | 3 | --- |
| M | modules/hardware/README.md | | | 2 | ++ |
| M | modules/hardware/boot.nix | | | 8 | ++++++++ |
| M | modules/hardware/filesystem.nix | | | 27 | +++++++++++++++++++-------- |
| M | packages/flake.nix | | | 18 | +++++++++++------- |
5 files changed, 40 insertions(+), 18 deletions(-)
diff --git a/README.md b/README.md @@ -86,12 +86,9 @@ github:maydayv7/dotfiles ├───devShells │ └───x86_64-linux │ ├───cc: development environment 'C' -│ ├───commit: development environment 'nix-shell' │ ├───default: development environment 'devShell' │ ├───format: development environment 'Formatter' -│ ├───go: development environment 'Go' │ ├───java: development environment 'Java' -│ ├───lisp: development environment 'Lisp' │ ├───lua: development environment 'Lua' │ ├───python: development environment 'Python' │ ├───rust: development environment 'Rust' diff --git a/modules/hardware/README.md b/modules/hardware/README.md @@ -2,6 +2,8 @@ To boot into a different build generation, hold down the Spacebar (for `efi`) or the `Shift`/`Esc` key (for `mbr`) upon startup to access the boot menu +To access recovery settings, open the boot menu and select the `recovery` Specialisation + #### Secure Boot To configure Secure Boot, first install the system by using the `efi` loader, then follow [these](https://github.com/nix-community/lanzaboote/blob/v0.3.0/docs/QUICK_START.md) instructions and set `hardware.boot.loader` to `secure` diff --git a/modules/hardware/boot.nix b/modules/hardware/boot.nix @@ -56,6 +56,14 @@ in { systemd-boot.enable = mkDefault false; }; }; + + # Debug + specialisation.recovery.configuration = { + boot = { + initrd.verbose = mkForce true; + plymouth.enable = mkForce false; + }; + }; } ## GRUB MBR Boot Loader ## diff --git a/modules/hardware/filesystem.nix b/modules/hardware/filesystem.nix @@ -12,7 +12,9 @@ (lib) filterAttrs hasPrefix + mkAfter mkAliasOptionModule + mkForce mkIf mkMerge mkOption @@ -90,8 +92,12 @@ in { }; }) - ## Advanced File System Configuration using BTRFS ## - (mkIf (filesystem == "advanced") { + ## Advanced File System Configuration using ZFS ## + (mkIf (filesystem == "advanced") (let + rollback = '' + zfs rollback -r fspool/system/root@blank && echo "Rollback Complete!" + ''; + in { fileSystems = { # ROOT Partition @@ -128,7 +134,6 @@ in { devNodes = "/dev/disk/by-partlabel/System"; }; - # Opt-In State initrd.systemd = { enable = true; services.rollback = { @@ -139,13 +144,19 @@ in { path = [pkgs.zfs]; unitConfig.DefaultDependencies = "no"; serviceConfig.Type = "oneshot"; - script = '' - zfs rollback -r fspool/system/root@blank && echo "Rollback Complete!" - ''; + script = rollback; }; }; }; + # Debug + specialisation.recovery.configuration = { + boot.initrd = { + systemd.enable = mkForce false; + postDeviceCommands = mkAfter rollback; + }; + }; + # Persisted Files system.activationScripts.dotfiles = let dir = with files; "${persist}/${path.system}"; @@ -169,7 +180,7 @@ in { "/data" = { hideMounts = true; users = - mapAttrs (name: _: { + mapAttrs (_: _: { inherit (config.user.persist) files; directories = [ @@ -205,6 +216,6 @@ in { monthly = 1; }; }; - }) + })) ]); } diff --git a/packages/flake.nix b/packages/flake.nix @@ -16,11 +16,15 @@ in { ... }: (let # Package Calling Function - call = name: - pkgs.callPackage name { - inherit lib util inputs pkgs; - inherit (inputs.self) files; - }; + call = rec { + __functor = _: name: pkg name {}; + pkg = name: args: pkgs.callPackage name ({inherit lib util pkgs;} // args); + script = name: + pkg name { + inherit inputs; + inherit (inputs.self) files; + }; + }; in rec { # Default Package Channel _module.args.pkgs = legacyPackages; @@ -55,11 +59,11 @@ in { # Custom Packages apps = - map.modules ../scripts (name: inputs.utils.lib.mkApp {drv = call name;}) + map.modules ../scripts (name: inputs.utils.lib.mkApp {drv = call.script name;}) // {default = self'.apps.nixos;}; packages = map.modules ./. call - // map.modules ../scripts call + // map.modules ../scripts call.script // inputs'.proprietary.packages; });