dotfiles

My PC Dotfiles & Website
commit 89792988ead11680b206f25921e2a84e8439a0da
parent 8911e2f4349bfe7c38837df804bd279c8c5749b5
Author: maydayv7 <maydayv7@gmail.com>
Date:   Wed, 21 Feb 2024 10:18:29 +0530

docs: Update README

+ Write about `lib.build.device`
+ Update Version
+ Fix Hyprland Greeter
+ Retry until install succeeeds in `install` script

Diffstat:

MREADME.md | 83+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
Mflake.nix | 2+-
Mmodules/gui/desktop/hyprland/default.nix | 6++----
Mmodules/user/security.nix | 4++--
Mscripts/install.nix | 8++++++--
5 files changed, 90 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md @@ -114,6 +114,7 @@ github:maydayv7/dotfiles │ ├───lua: development environment 'Lua' │ ├───python: development environment 'Python' │ ├───rust: development environment 'Rust' +│ ├───sql: development environment 'SQL' │ ├───video: development environment 'Video' │ └───website: development environment 'Website' ├───files: 'dotfiles' and program configuration @@ -229,18 +230,92 @@ In case you want to use my configuration as-is for a fresh NixOS install, you ca 5. Make new `secrets` and `passwords` in the desired directories by appending the paths to `secrets.yaml` and then using the following command (The [`nixos`](./scripts/README.md) script can be used to simplify the process): _Replace_ **_PATH_** _with the path to the `secret`_ <pre><code>sops --config <i>/path/to/<b>secrets.yaml</b></i> -i <b><i>PATH</i></b></code></pre> -6. Add device-specific configuration by creating a new file in [`devices`](./devices) (bear in mind that the name of the file must be same as the `HOSTNAME` of your device), and if required, hardware configuration using the `hardware.modules` option +6. Add device-specific configuration by creating a new file in [`devices`](./devices) (bear in mind that the name of the file must be same as the `HOSTNAME` of your device), and if required, hardware configuration using the `hardware.modules` option. Do keep in mind that the filesystems must be appropriately created and labeled as defined [here](./modules/hardware/filesystem.nix). 7. Finally, run `nixos-rebuild switch --flake /etc/nixos#HOSTNAME` (as `root`) to switch to the configuration! </details> <details> +<summary><b>Minimal Configuration</b></summary> + +The `lib.build.device` function can be used to generate the full configuration minimally +Read [this](./devices/README.md) for definition information + +Example `flake.nix`: + +```nix +{ + description = "Minimal NixOS Configuration"; + + ## System Repositories ## + inputs = { + ## Package Repositories ## + # NixOS Package Repository + nixpkgs.follows = "dotfiles/nixpkgs"; + + ## Configuration Modules ## + # My PC Dotfiles + dotfiles.url = "github:maydayv7/dotfiles"; + }; + + ## System Configuration ## + outputs = inputs: let + lib = with inputs; nixpkgs.lib // dotfiles.lib; + in { + nixosConfigurations.host = lib.build.device { + name = "HOST_NAME"; + system = "x86_64-linux"; + + imports = [ + # Generate using 'nixos-generate-config' + ./hardware-configuration.nix + + # Passwords + { + users.extraUsers = { + root.hashedPassword = "HASHED_PASSWORD"; + recovery.initialHashedPassword = "HASHED_PASSWORD"; + }; + } + ]; + + timezone = "Continent/City"; + locale = "US"; + + kernel = "zen"; + kernelModules = ["nvme"]; + + gui = {}; + hardware = { + boot = "efi"; + cores = 4; + filesystem = "simple"; + modules = [ /* Imported from 'nixos-hardware' */]; + }; + + # Default User + user = { + name = "nixos"; + description = "Default User"; + minimal = true; + password = "HASHED_PASSWORD"; # Generate using 'mkpasswd -m sha-512' + }; + }; + }; +} +``` + +</details> + +<details> <summary><b>From Scratch</b></summary> Download the latest NixOS `.iso` from the [Releases](../../releases/latest) page and burn it to a USB using a flashing utility such as [Etcher](https://www.balena.io/etcher/) -**_Important:_** In order to directly use the configuration, you must first create a clone of this repository and follow steps 2 to 6 from the above section, and preferably upload it to a hosting platform like GitHub/GitLab +> [!IMPORTANT] +> These instructions are mainly intended for personal use. +> In order to directly use the configuration, you must first create a clone of this repository and follow steps 2 to 6 from the first section, and preferably create your own install media <details> <summary><i>Additional Install Media</i></summary> @@ -419,14 +494,14 @@ You can navigate to the `README`s present in the various directories to know mor <details> <summary><b>Changelog</b></summary> -### vNEXT +### v17 - Re-expose `lib.build.device` +- Add Hyprland Configuration - Refactor GNOME `dconf` - Overhaul XFCE Configuration - Use ULauncher - Use the Picom Compositor -- Add Hyprland Configuration - Add Pantheon Desktop Configuration - Add VS Code Extensions Repository - Fix Android Virtualisation diff --git a/flake.nix b/flake.nix @@ -23,7 +23,7 @@ # Author -> V 7 <maydayv7@gmail.com> # # License -> MIT # # URL -> github:maydayv7/dotfiles # -# Version -> vNEXT # +# Version -> v17 # # --------------------------------------- # # Welcome to Ground Zero! # # The Very Heart of my 'dotfiles' # diff --git a/modules/gui/desktop/hyprland/default.nix b/modules/gui/desktop/hyprland/default.nix @@ -30,12 +30,9 @@ in { package = pkgs.hyprworld.hyprland; }; + # Login regreet = { enable = true; - package = pkgs.greetd.regreet.overrideAttrs (final: prev: { - SESSION_DIRS = "${config.services.xserver.displayManager.sessionData.desktops}/share"; - }); - settings.commands = { reboot = ["systemctl" "reboot"]; poweroff = ["systemctl" "poweroff"]; @@ -52,6 +49,7 @@ in { }; # Greeter + environment.persist.directories = ["/var/cache/regreet"]; programs.regreet.settings.GTK = with config.stylix; { application_prefer_dark_theme = true; cursor_theme_name = cursor.name; diff --git a/modules/user/security.nix b/modules/user/security.nix @@ -5,7 +5,7 @@ files, ... }: let - inherit (lib) filterAttrs mkAfter mkForce mkIf; + inherit (lib) filterAttrs mkAfter mkDefault mkForce mkIf; inherit (builtins) all attrNames attrValues hasAttr mapAttrs readFile; inherit (config.sops) secrets; inherit (config.user) settings; @@ -70,7 +70,7 @@ in { group = "users"; extraGroups = ["wheel"]; useDefaultShell = true; - initialHashedPassword = readFile (directory + "/default"); + initialHashedPassword = mkDefault (readFile (directory + "/default")); }; }; }; diff --git a/scripts/install.nix b/scripts/install.nix @@ -62,7 +62,7 @@ with files.path; let mount -t zfs fspool/system/root /mnt mkdir -p /mnt/{nix,data} mount -t zfs fspool/system/nix /mnt/nix - mkdir -p /mnt/nix/state + mkdir -p /mnt${persist} mount -t zfs fspool/data /mnt/data } @@ -150,7 +150,11 @@ in URL=${flake} fi echo "Installing System from '$URL'..." - nixos-install --no-root-passwd --root /mnt --flake "$URL"#"$HOST" + until nixos-install --no-root-passwd --root /mnt --flake "$URL"#"$HOST" + do + newline + info "Couldn't finish installation. Trying again..." + done newline unmount_all