commit ee58887bcbb6696cf99f508da7fcb0635e7f4495 Author: DOOME1M8Cover Date: Thu Jun 15 11:40:56 2023 +0100 Initial Commit diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..4fbe68b --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..67c3e6b --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# Git credentials, to move elsewhere, temporary ignore +gitcreds/ + + +# Flake Build +result/ +.direnv/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b09cd78 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3226aee --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# NixOS Setup + +## Have questions on how to do things? +Refere to the [FAQ-Guide](/faq-guide/) that has a couple Frequently Asked Questions and Guides + + +## Nix References +https://search.nixos.org/packages + + +## Setup dotfiles inspirations +https://github.com/Suyashtnt/commafiles + +https://github.com/the-argus/nixsys + + +## Reference Functions and Variables Docs (Also searching for others online often is good to keep up-to-date) +https://teu5us.github.io/nix-lib.html + + + +## Nix, Flakes, NixOS and Home Manager Beginner and Medium intros (By best order) +https://www.youtube.com/watch?v=AGVXJ-TIv3Y + +https://www.youtube.com/playlist?list=PLnlyQqQLJLnJqZzJgcsUfftdGApjdFZPV + +https://www.youtube.com/playlist?list=PL-saUBvIJzOkjAw_vOac75v-x6EzNzZq- + +https://www.youtube.com/playlist?list=PLLvdqTlFTmuKsiyAI8Q9FgHP4mY0ktPVq + + + +## Reference guides (For knowledge, their practices should not be mostly applied) +https://matthewrhone.dev/nixos-package-guide + + + +## Reference System Flakes from other people (from simple to hard complex) +https://github.com/Suyashtnt/commafiles + +https://github.com/FedericoSchonborn/nixfiles + +https://github.com/the-argus/nixsys + +https://github.com/MatthiasBenaets/nixos-config + + + +## Showcases of Nix in the wild +https://www.youtube.com/watch?v=0uixRE8xlbY + +https://www.youtube.com/watch?v=6Le0IbPRzOE&t=3s + diff --git a/faq-guide/README.md b/faq-guide/README.md new file mode 100644 index 0000000..e69de29 diff --git a/faq-guide/desktop.md b/faq-guide/desktop.md new file mode 100644 index 0000000..a5a8603 --- /dev/null +++ b/faq-guide/desktop.md @@ -0,0 +1,26 @@ +# So i want to install a OS on my machine, or update it +In good luck, there is a few notes and steps to help with it + +## Installing flake select configuration + +- Make sure the machine has a +keyboard layout we can work with, such as ES layout: `loadkeys es` + +- Install Git(system-wide is fine): `nix-env -iA git` + +- Clone the flake repo: `git clone https://github.com/oridevteam/nix-setup.git` + +- Rebuild and Switch: `nixos-rebuild switch --flake .#bunta_desktop` + + +After installed, follow roughly the steps you need in any order: + - (Disk Setup)[./disk-setup.md] + +## Keeping things updated +Firstly lets make sure that we have the channels added (for nixos and home-manager), and preferably lets use unstable, which are the latest: + - nixos: `nix-channel --add https://nixos.org/channels/nixos-unstable` + - home-manager: `nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager` + + +Secondly update the channels (should be nixos and home-manager): +`sudo nix-channel --update` diff --git a/faq-guide/disk-setup.md b/faq-guide/disk-setup.md new file mode 100644 index 0000000..07bb5fe --- /dev/null +++ b/faq-guide/disk-setup.md @@ -0,0 +1,37 @@ +# I want to install a system flake on the same disk as always +Well if the parititions have the same properties like UUID and Label +as specified in the `configuration.nix` + + +# I want to install a system flake in a different disk +Imagine we order a new disk or just want to prepare one to be compatible +with our flake configurations, we need to make sure the disk is ready + +Firstly lets say you plug it into the machine and its named /dev/sdc, +but it can be named and located anywhere else + + +## Lets prepare the disk but what if i dont want to wipe the entire disk? +Lets make sure we have two partitions, if not create them: + - NIXBOOT (/dev/sdc1, FS; EXT4 UUID: `fdea0ef2-fa72-11ed-8a6f-e39e300c6f30` Label: NIXBOOT) + - NIXROOT (/dev/sdc2, FS: FAT32 UUID: `D393-D3D1` Label: NIROOT) + +... + +## What if they already exist but the UUID are not equal? +If the partitions already exist but the UUID is not the same, it can +be changed by doing: + - First a fsck check with `e2fsck -f /dev/sdc1` + - Then change the uuid with `tune2fs /dev/sdc1 -U fdea0ef2-fa72-11ed-8a6f-e39e300c6f30` + + Do the same process but for the other partition with its respective UUID + + +# What if i forgot or don't know how disks work? +Well there is a great well paced video to follow here +https://www.youtube.com/watch?v=2Z6ouBYfZr8 + + +Also a good reference for changing UUIDs and so on +https://linuxconfig.org/how-to-retrieve-and-change-partitions-universally-unique-identifier-uuid-on-linux + diff --git a/faq-guide/home.md b/faq-guide/home.md new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/faq-guide/home.md @@ -0,0 +1 @@ + diff --git a/faq-guide/mouse-alternative-fix.md b/faq-guide/mouse-alternative-fix.md new file mode 100644 index 0000000..a6aa34c --- /dev/null +++ b/faq-guide/mouse-alternative-fix.md @@ -0,0 +1,13 @@ + # I have a broken key on my mouse, what options do i have? + A few ideas comes to mind, one would be making a configuration using xmodmap + and telling nix to put it in /home//.config/.xmodmap, so that it fixes permanently + +```nix +home.file.".config/.xmodmap".source = """ +"""; +``` + + +# Permanent fix (useful if you only use one mouse for now) + +# Toggleable fix (useful if you get a new mouse temporarily) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ef1f2ad --- /dev/null +++ b/flake.lock @@ -0,0 +1,124 @@ +{ + "nodes": { + "grub-theme": { + "flake": false, + "locked": { + "lastModified": 1672329233, + "narHash": "sha256-/bSolCta8GCZ4lP0u5NVqYQ9Y3ZooYCNdTwORNvR7M0=", + "owner": "catppuccin", + "repo": "grub", + "rev": "803c5df0e83aba61668777bb96d90ab8f6847106", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "grub", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1686715156, + "narHash": "sha256-91S5sWEDREACTu7411J9dhHVGgK9eSeGz4bGCuu/kLo=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "5db22bce05c776057fdb289da17f6c12049c4624", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-on-droid": { + "inputs": { + "home-manager": [ + "home-manager" + ], + "nix-formatter-pack": [], + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-for-bootstrap": [], + "nmd": [] + }, + "locked": { + "lastModified": 1684353543, + "narHash": "sha256-0b85kcdeM1WgGZZn0L4fke39xcVpO99hidzcpqvNOcQ=", + "owner": "t184256", + "repo": "nix-on-droid", + "rev": "064e1b280e4711ecea0d7abbe885362cbf7b717a", + "type": "github" + }, + "original": { + "owner": "t184256", + "repo": "nix-on-droid", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1686501370, + "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1686476475, + "narHash": "sha256-W9yUePvCSDghn+YUXewuodyPxt+kJl/a7zdY4Q6r4MU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "eef86b8a942913a828b9ef13722835f359deef29", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nur": { + "locked": { + "lastModified": 1686732300, + "narHash": "sha256-7wwhRQ4X5vZF8c6xCL9FuF1meGvjmjg5uSb6DMZo7nE=", + "owner": "nix-community", + "repo": "NUR", + "rev": "7ea3c0a513ce7538c139876763f5c9c87c4f1d99", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, + "root": { + "inputs": { + "grub-theme": "grub-theme", + "home-manager": "home-manager", + "nix-on-droid": "nix-on-droid", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable", + "nur": "nur" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..902dbb0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,67 @@ +{ + description = "Office Desktop and Server"; + + # Channels + inputs = { + nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-22.11"; + nixpkgs.url = "nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager"; + + # Make home manager use the nixpkgs packages instead + # due to being more updated + inputs.nixpkgs.follows = "nixpkgs"; + }; + + nur.url = "github:nix-community/NUR"; + + nix-on-droid = { + url = "github:t184256/nix-on-droid"; + inputs = { + nixpkgs.follows = "nixpkgs"; + home-manager.follows = "home-manager"; + nixpkgs-for-bootstrap.follows = ""; + nix-formatter-pack.follows = ""; + nmd.follows = ""; + }; + }; + + grub-theme = { + url = "github:catppuccin/grub"; + flake = false; + }; + + }; + outputs = { self, nixpkgs, home-manager, ... } @ inputs: + let + system = "x86_64-linux"; + stateVersion = "22.11"; + pkgs = import nixpkgs { + inherit system; + config = { allowUnfreePredicate = true; }; + }; + in { + # NixOS configurations + # nixosConfigurations = import ./hosts/nixos/bunta_desktop/test.nix + # (inputs // {inherit system stateVersion;}); + nixosConfigurations = import ./hosts/nixos (inputs // {inherit system stateVersion inputs;}); + + # Nix on Android configurations + # nixonDroidConfigurations = import ./hosts/nixdroid (inputs // {inherit stateVersion system;}); + + # Default shell configuration, for pre-installation + # availability for example, nix needs it as well + devShells.${system}.default = pkgs.mkShell { + packages = with pkgs; [ + wget + nil rnix-lsp + lazygit + ]; + }; + + # packages.${system} = with pkgs; [ nil ]; + + # defaultPackage.${system} = self.nixosConfigurations.bunta_desktop; + }; +} diff --git a/hosts/nixdroid/default.nix b/hosts/nixdroid/default.nix new file mode 100644 index 0000000..6b812bc --- /dev/null +++ b/hosts/nixdroid/default.nix @@ -0,0 +1,6 @@ +{inputs, nix-on-droid, self, system, stateVersion, ...}: +{ + # Hosts configurations, »hosts« here means phones/tablets/machines + merway = import ./merway; + # pabundroid = import ./pabundroid; +} diff --git a/hosts/nixdroid/merway/configuration.nix b/hosts/nixdroid/merway/configuration.nix new file mode 100644 index 0000000..98ec337 --- /dev/null +++ b/hosts/nixdroid/merway/configuration.nix @@ -0,0 +1,5 @@ +{}: +{ + +} + diff --git a/hosts/nixdroid/merway/default.nix b/hosts/nixdroid/merway/default.nix new file mode 100644 index 0000000..86689b5 --- /dev/null +++ b/hosts/nixdroid/merway/default.nix @@ -0,0 +1,11 @@ +{inputs, nix-on-droid, system, stateVersion}: +{ + merway = nix-on-droid.lib.nixOnDroidConfiguration { + inherit system; + + imports = [ ./configuration.nix ./hardware-configuration.nix ]; + modules = [ + # import ../core/bootloader.nix + ]; + }; +} diff --git a/hosts/nixdroid/merway/hardware-configuration.nix b/hosts/nixdroid/merway/hardware-configuration.nix new file mode 100644 index 0000000..59e0938 --- /dev/null +++ b/hosts/nixdroid/merway/hardware-configuration.nix @@ -0,0 +1,4 @@ +{}: +{ + +} diff --git a/hosts/nixos/another_desktop/default.nix b/hosts/nixos/another_desktop/default.nix new file mode 100644 index 0000000..807566c --- /dev/null +++ b/hosts/nixos/another_desktop/default.nix @@ -0,0 +1,13 @@ +{nixpkgs, system, ...}: +{ + # Host configurations + another_Desktop = nixpkgs.lib.nixosSystem { + inherit system; + + # modules = [ + # ./configuration.nix + # ./hardware-configuration.nix + # # import ../core/bootloader.nix + #]; + }; +} \ No newline at end of file diff --git a/hosts/nixos/bunta_desktop/README.md b/hosts/nixos/bunta_desktop/README.md new file mode 100644 index 0000000..0e6703d --- /dev/null +++ b/hosts/nixos/bunta_desktop/README.md @@ -0,0 +1,3 @@ +# Bunta Desktop +Office desktop configuration + diff --git a/hosts/nixos/bunta_desktop/configuration.nix b/hosts/nixos/bunta_desktop/configuration.nix new file mode 100644 index 0000000..14abdd1 --- /dev/null +++ b/hosts/nixos/bunta_desktop/configuration.nix @@ -0,0 +1,114 @@ +{pkgs, stateVersion, ...}: { + imports = [ + ./hardware-configuration.nix # Hardware scan + ]; + + # System + system.stateVersion = stateVersion; # Only touch if aware of effects, check manual + # experimental-features = "nix-command flakes"; + + # Users + users.users.nibunta = { + isNormalUser = true; description = "Nibunta NixOS"; + initialPassword = "password"; + extraGroups = [ "networkmanager" "wheel" ]; + shell = pkgs.fish; + }; + + programs.fish.enable = true; + + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + + nixpkgs.config.allowUnfree = true; + environment.systemPackages = with pkgs; [ + nix-tree nix-update nix-init + nurl nil + nano kate ventoy-bin-full + + # Libs + llvmPackages_7.clangUseLLVM + mold + python311 poetry + ]; + + # Graphical and Windowing environment + services.xserver = { + enable = true; # X11 windowing system. + + displayManager = { + sddm.enable = true; + autoLogin = { enable=true; user="nibunta"; }; + }; + + ## KDE Plasma + desktopManager.plasma5.enable = true; + }; + + + # Localization and Internationalisation + time.timeZone = "Europe/London"; + + i18n.defaultLocale = "en_GB.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_GB.UTF-8"; + LC_IDENTIFICATION = "en_GB.UTF-8"; + LC_MEASUREMENT = "en_GB.UTF-8"; + LC_MONETARY = "en_GB.UTF-8"; + LC_NAME = "en_GB.UTF-8"; + LC_NUMERIC = "en_GB.UTF-8"; + LC_PAPER = "en_GB.UTF-8"; + LC_TELEPHONE = "en_GB.UTF-8"; + LC_TIME = "en_GB.UTF-8"; + }; + + + # Networking + networking.networkmanager.enable = true; + networking.hostName = "nixos"; + # networking.wireless.enable = true; # Wireless support via wpa_supplicant + /* + networking.firewall = { + allowedTCPPorts = [ ... ]; + allowedUDPPorts = [ ... ]; + }; + */ + + # Input settings + console.keyMap = "pt-latin1"; + + # Reference: https://nixos.wiki/wiki/Keyboard_Layout_Customization + # Configure keymap in X11 + services.xserver = { layout = "pt"; xkbVariant = ""; }; + + + # Plug&Play Devices settings + services.printing.enable = true; + + sound.enable = true; # Ssound with pipewire. + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # jack.enable = true; # JACK applications + # media-session.enable = true; + }; + + # TODO: Temporarily here because i dont know how to do it in the user section + # virtualisation.virtualbox.host = { + # enable = true; # enableExtensionPack = true; + #}; + # virtualisation.virtualbox.guest = { + # enable = true; # x11 = true; + # }; + # users.extraGroups.vboxusers.members = [ "nibunta" ]; + + virtualisation.libvirtd.enable = true; + programs.dconf.enable = true; + +} + diff --git a/hosts/nixos/bunta_desktop/core/README.md b/hosts/nixos/bunta_desktop/core/README.md new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/hosts/nixos/bunta_desktop/core/README.md @@ -0,0 +1 @@ + diff --git a/hosts/nixos/bunta_desktop/core/bootloader.nix b/hosts/nixos/bunta_desktop/core/bootloader.nix new file mode 100644 index 0000000..3670a79 --- /dev/null +++ b/hosts/nixos/bunta_desktop/core/bootloader.nix @@ -0,0 +1,32 @@ +{pkgs, ...}: +let + inputs.grub-theme = { + url = "github:catppuccin/grub"; + flake = false; + }; +in { + # Bootloader + boot = { + loader = { + grub = { + enable = true; + device = "/dev/sdc"; # "nodev"; + useOSProber = true; + # efiSupport = true; + # theme = inputs.grub-theme + "/src/catppuccin-mocha-grub-theme"; + }; + /* + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot/efi"; + }; + */ + }; + + extraModprobeConfig = "options kvm_intel nested=1"; + supportedFilesystems = [ "ntfs" "btrfs" "mtpfs" ]; + + kernelModules = [ "kvm-intel" ]; + kernelPackages = pkgs.linuxPackages_latest; + }; +} diff --git a/hosts/nixos/bunta_desktop/core/default.nix b/hosts/nixos/bunta_desktop/core/default.nix new file mode 100644 index 0000000..a790555 --- /dev/null +++ b/hosts/nixos/bunta_desktop/core/default.nix @@ -0,0 +1,3 @@ +[ + ./bootloader.nix +] \ No newline at end of file diff --git a/hosts/nixos/bunta_desktop/default.nix b/hosts/nixos/bunta_desktop/default.nix new file mode 100644 index 0000000..1d7b89c --- /dev/null +++ b/hosts/nixos/bunta_desktop/default.nix @@ -0,0 +1,42 @@ +{nixpkgs, nixpkgs-stable, system, stateVersion, home-manager, self, inputs, ...}: +{ + # Host configurations + bunta_desktop = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit nixpkgs system stateVersion home-manager; + }; + + modules = [ + ./configuration.nix + ./hardware-configuration.nix + ./core/bootloader.nix + home-manager.nixosModules.home-manager { + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + extraSpecialArgs = { + inherit self; + inherit inputs; + packages = self.packages.${system}; + }; + + users.nibunta = import ./users/nibunta.nix; + }; + } + ]; + + /* + imports = [ "${nixpkgs-stable}/nixos/modules/services/virtualisation/virtualbox-host.nix" ]; + + disabledModules = [ "virtualisation/virtualbox-host.nix" ]; + nixpkgs.config = { + packageOverrides = pkgs: let + stablePkgs = import nixpkgs-stable { enableUnfree = true; }; + in { + virtualbox = stablePkgs.virtualbox; + virtualboxExtpack = stablePkgs.virtualboxExtpack; + }; + }; + */ + }; +} diff --git a/hosts/nixos/bunta_desktop/hardware-configuration.nix b/hosts/nixos/bunta_desktop/hardware-configuration.nix new file mode 100644 index 0000000..af2889a --- /dev/null +++ b/hosts/nixos/bunta_desktop/hardware-configuration.nix @@ -0,0 +1,35 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + boot.supportedFilesystems = ["ntfs"]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/fdea0ef2-fa72-11ed-8a6f-e39e300c6f30"; + # device = "/dev/disk/by-label/NIXROOT" + fsType = "ext4"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s20u12.useDHCP = lib.mkDefault true; + # networking.interfaces.enp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/nixos/bunta_desktop/modules/default.nix b/hosts/nixos/bunta_desktop/modules/default.nix new file mode 100644 index 0000000..1a03ab0 --- /dev/null +++ b/hosts/nixos/bunta_desktop/modules/default.nix @@ -0,0 +1,4 @@ +[ + ./home-manager.nix +] + diff --git a/hosts/nixos/bunta_desktop/modules/home-manager.nix b/hosts/nixos/bunta_desktop/modules/home-manager.nix new file mode 100644 index 0000000..e69de29 diff --git a/hosts/nixos/bunta_desktop/modules/home.nix b/hosts/nixos/bunta_desktop/modules/home.nix new file mode 100644 index 0000000..9faa458 --- /dev/null +++ b/hosts/nixos/bunta_desktop/modules/home.nix @@ -0,0 +1,13 @@ +/* +{pkgs, version, name, directory, ...}: +{ + programs.home-manager.enable = true; + + home.userName = name; home.homeDirectory = directory; + home.stateVersion = version; + home.packages = with pkgs; [ + htop + ]; +} + +*/ diff --git a/hosts/nixos/bunta_desktop/users/default.nix b/hosts/nixos/bunta_desktop/users/default.nix new file mode 100644 index 0000000..c723312 --- /dev/null +++ b/hosts/nixos/bunta_desktop/users/default.nix @@ -0,0 +1,2 @@ +{ nixpkgs, system, stateVersion, ... } @ inputs: +import ./nibunta.nix inputs diff --git a/hosts/nixos/bunta_desktop/users/modules/default.nix b/hosts/nixos/bunta_desktop/users/modules/default.nix new file mode 100644 index 0000000..f8f2ff0 --- /dev/null +++ b/hosts/nixos/bunta_desktop/users/modules/default.nix @@ -0,0 +1,5 @@ +[ + import ./libs + import ./programs + import ./shells +] diff --git a/hosts/nixos/bunta_desktop/users/modules/libs/default.nix b/hosts/nixos/bunta_desktop/users/modules/libs/default.nix new file mode 100644 index 0000000..de41e9e --- /dev/null +++ b/hosts/nixos/bunta_desktop/users/modules/libs/default.nix @@ -0,0 +1,3 @@ +[ + ./python.nix +] diff --git a/hosts/nixos/bunta_desktop/users/modules/libs/python.nix b/hosts/nixos/bunta_desktop/users/modules/libs/python.nix new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/hosts/nixos/bunta_desktop/users/modules/libs/python.nix @@ -0,0 +1 @@ +{} diff --git a/hosts/nixos/bunta_desktop/users/modules/programs/default.nix b/hosts/nixos/bunta_desktop/users/modules/programs/default.nix new file mode 100644 index 0000000..5478c25 --- /dev/null +++ b/hosts/nixos/bunta_desktop/users/modules/programs/default.nix @@ -0,0 +1,5 @@ +[ + ./firefox + ./librewolf + ./github-desktop +] diff --git a/hosts/nixos/bunta_desktop/users/modules/programs/firefox.nix b/hosts/nixos/bunta_desktop/users/modules/programs/firefox.nix new file mode 100644 index 0000000..36ff7db --- /dev/null +++ b/hosts/nixos/bunta_desktop/users/modules/programs/firefox.nix @@ -0,0 +1,29 @@ +{inputs, pkgs, ...}: +let nur = inputs.nur { + nurpkgs = pkgs; inherit pkgs; +}; +in { + # home.file.".mozilla/firefox/nibunta/" = {}; + + programs.firefox = { + enable = true; package = pkgs.firefox; + profiles = { + personal = { + id = 0; + + # userSchrome = import ./userChrome.nix; + extraConfig = '' + user_pref("media.ffmpeg.vaapi.enabled", true); + ''; + extensions = with nur.repos.rycee.firefox-addons; [ + augmented_steam + adnauseam + "uBlock0@raymondhill.net" "sponsorBlocker@ajay.app" + "{762f9885-5a13-4abd-9c77-433dcd38b8fd}" # Return Youtube Dislike + "{a4c4eda4-fb84-4a84-b4a1-f7c1cbf2a1ad}" # Refined Github + "{72bd91c9-3dc5-40a8-9b10-dec633c0873f}" # Enhanced Github + ]; + }; + }; + }; +} diff --git a/hosts/nixos/bunta_desktop/users/modules/programs/github-desktop.nix b/hosts/nixos/bunta_desktop/users/modules/programs/github-desktop.nix new file mode 100644 index 0000000..0db3279 --- /dev/null +++ b/hosts/nixos/bunta_desktop/users/modules/programs/github-desktop.nix @@ -0,0 +1,3 @@ +{ + +} diff --git a/hosts/nixos/bunta_desktop/users/modules/programs/librewolf/default.nix b/hosts/nixos/bunta_desktop/users/modules/programs/librewolf/default.nix new file mode 100644 index 0000000..d8328da --- /dev/null +++ b/hosts/nixos/bunta_desktop/users/modules/programs/librewolf/default.nix @@ -0,0 +1,31 @@ +{inputs, pkgs, ...}: +let nur = inputs.nur { + nurpkgs = pkgs; + inherit pkgs; +}; +in { + # home.file.".mozilla/firefox/nibunta/" = {}; + + programs.firefox = { + enable = true; + package = pkgs.firefox; + + profiles = { + personal = { + id = 0; + extraConfig = '' + user_pref("media.ffmpeg.vaapi.enabled", true); + ''; + extensions = with nur.repos.rycee.firefox-addons; [ + ublock + /* + "uBlock0@raymondhill.net" "sponsorBlocker@ajay.app" + "{762f9885-5a13-4abd-9c77-433dcd38b8fd}" # Return Youtube Dislike + "{a4c4eda4-fb84-4a84-b4a1-f7c1cbf2a1ad}" # Refined Github + "{72bd91c9-3dc5-40a8-9b10-dec633c0873f}" # Enhanced Github + */ + ]; + }; + }; + }; +} diff --git a/hosts/nixos/bunta_desktop/users/modules/programs/pycharm-pro.nix b/hosts/nixos/bunta_desktop/users/modules/programs/pycharm-pro.nix new file mode 100644 index 0000000..56a48c4 --- /dev/null +++ b/hosts/nixos/bunta_desktop/users/modules/programs/pycharm-pro.nix @@ -0,0 +1,7 @@ +{inputs, pkgs, ...}: +{ + programs.jetbrains.pycharm-professional = { + enable = true; + package = pkgs.jetbrains.pycharm-professional; + }; +} diff --git a/hosts/nixos/bunta_desktop/users/modules/programs/virtualbox.nix b/hosts/nixos/bunta_desktop/users/modules/programs/virtualbox.nix new file mode 100644 index 0000000..1571f48 --- /dev/null +++ b/hosts/nixos/bunta_desktop/users/modules/programs/virtualbox.nix @@ -0,0 +1,10 @@ +{users, pkgs, nixpkgs, ...}: +{ + virtualisation.virtualbox.host = { + enable = true; enableExtensionPack = true; + }; + virtualisation.virtualbox.guest = { + enable = true; x11 = true; + }; + # users.extraGroups.vboxusers.members = [ "nibunta" ]; +} diff --git a/hosts/nixos/bunta_desktop/users/modules/programs/vscodium.nix b/hosts/nixos/bunta_desktop/users/modules/programs/vscodium.nix new file mode 100644 index 0000000..33be245 --- /dev/null +++ b/hosts/nixos/bunta_desktop/users/modules/programs/vscodium.nix @@ -0,0 +1,40 @@ +{inputs, pkgs, ...}: +{ + programs.vscode = { + enable = true; + package = pkgs.vscodium; + extensions = with pkgs.vscode-extensions; [ + jnoortheen.nix-ide # bbenoist.Nix + arrterian.nix-env-selector + mkhl.direnv + + # Themes + # rokoroku.vscode-theme-darcula + ]; + + userSettings = { + # https://github.com/oxalica/nil/blob/main/docs/configuration.md + "workbench.colorTheme" = "Visual Studio Dark"; + # "workbench.colorTheme" = "Darcula"; + "nix.enableLanguageServer" = true; + "nix.serverPath" = "nil"; + "nix.serverSettings.nix.flake.autoEvalInputs" = true; + + }; + + /* + { + "nix.enableLanguageServer": true, + "nix.serverPath": "nil", + "nix.serverSettings": { + "nix": { + "flake": { + "autoEvalInputs": true + } + } + } + } + */ + + }; +} diff --git a/hosts/nixos/bunta_desktop/users/modules/shells/default.nix b/hosts/nixos/bunta_desktop/users/modules/shells/default.nix new file mode 100644 index 0000000..a317de9 --- /dev/null +++ b/hosts/nixos/bunta_desktop/users/modules/shells/default.nix @@ -0,0 +1,3 @@ +[ + ./zsh.nix +] diff --git a/hosts/nixos/bunta_desktop/users/modules/shells/zsh.nix b/hosts/nixos/bunta_desktop/users/modules/shells/zsh.nix new file mode 100644 index 0000000..6f76a62 --- /dev/null +++ b/hosts/nixos/bunta_desktop/users/modules/shells/zsh.nix @@ -0,0 +1,28 @@ +{pkgs, ...} : { + programs = { + zsh = { + enable = true; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + enableCompletion = true; + histSize = 100000; + + ohMyZsh = { + enable = true; plugins = ["git"]; + }; + + shellInit = '' + # Zsh theme + # Spaceship + source ${pkgs.spaceship-prompt}/share/zsh/site-functions/prompt_spaceship_setup + autoload -U promptinit; promptinit + # Hook direnv + #emulate zsh -c "$(direnv hook zsh)" + # Swag + ${pkgs.nitch}/bin/nitch + + #eval "$(direnv hook zsh)" + ''; + }; + }; +} diff --git a/hosts/nixos/bunta_desktop/users/nibunta.nix b/hosts/nixos/bunta_desktop/users/nibunta.nix new file mode 100644 index 0000000..a46ecfe --- /dev/null +++ b/hosts/nixos/bunta_desktop/users/nibunta.nix @@ -0,0 +1,107 @@ +{pkgs, lib, ...}: let + username = "nibunta"; +in +{ + # Import things like programs, shells, core configurations, etc + # imports = [./modules ]; + # imports = import ./modules; + imports = [ + ./modules/libs/python.nix + + # ./modules/programs/librewolf + # ./modules/programs/github-desktop.nix + # ./modules/programs/pycharm-pro.nix + ./modules/programs/vscodium.nix + + # ./modules/programs/virtualbox.nix + # ./modules/shells/zsh.nix + ]; + + manual.manpages.enable = true; + home = { + stateVersion = "22.11"; + + inherit username; + # homeDirectory = "/home/${username}/"; + # configuration.imports = [./home.nix]; + + packages = with pkgs; [ + # System control + btop wget + gsmartcontrol + xclip nodePackages.remod-cli + gparted fsearch + + virt-manager libvirt spice-vdagent #qemu_kvm + # linuxKernel.packages.linux_latest_libre.virtualbox + # virtualboxHardened linuxKernel.packages.linux_6_3.virtualbox + + # Web + librewolf + thunderbird + + # IDE Tools + kate + jetbrains.pycharm-professional jetbrains.clion + imhex + + # Version control + git # github-desktop gitkraken + + # Engines + nodejs rustup + + # Archiving + file unzip + + # Credentials + keepassxc + + # KDE Apps + spectacle ark okular + kooha # Recording and Editing + + # Input aidware + xorg.xev xorg.xmodmap + # input-remapper # Aidware, using xorg instead + + # Emulation and Compatibility + wine + + # Debian Packages Supports + dpkg patchelf # binutil + + # temurin-jrs-bin-17 + # Unfree packages + gitkraken + /* + { + pkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName) [ + # jetbrains-toolbox # IDE Tools + # jetbrains.pycharm-professional + ]; + } + */ + ]; + }; + + + programs = { + home-manager.enable = true; + }; + + # TODO: In case a new mouse is plugged, this setting could be + # reverted back to original, so make it with that in mind + # when figured out how to execute this command optionally + home.file.".config/.xmodmap".text = " + xmodmap -e \"pointer = 1 2 8 4 5 6 7 3 8 10\" + "; + + # Keyboard Lights Mapping, + # https://ubuntuforums.org/showthread.php?t=2257710 link for context + # home.file."./config/.xmodmap".source = " + # xmodmap -e \"add mod3 = Scroll_Lock\" + # xset -led named \"Scroll Lock\" + #"; +} + diff --git a/hosts/nixos/default.nix b/hosts/nixos/default.nix new file mode 100644 index 0000000..a645c53 --- /dev/null +++ b/hosts/nixos/default.nix @@ -0,0 +1,4 @@ +{ nixpkgs, system, stateVersion, ... } @ inputs: +# Hosts configurations, »hosts« here means computers/machines +import ./bunta_desktop inputs +// import ./another_desktop inputs