From f606ebc20f25536416f87c255c0902e30e75acb0 Mon Sep 17 00:00:00 2001 From: Redyf Date: Wed, 3 Jul 2024 22:31:14 -0300 Subject: [PATCH 1/6] feat: add git maintenance command on git config I'm cooking --- home/redyf/tools/git/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/redyf/tools/git/default.nix b/home/redyf/tools/git/default.nix index 74595e31..2f999ca4 100644 --- a/home/redyf/tools/git/default.nix +++ b/home/redyf/tools/git/default.nix @@ -7,6 +7,7 @@ init = {defaultBranch = "main";}; core.editor = "nvim"; pull.rebase = false; + maintenance.repo = "/home/redyf/opensource/nixpkgs"; }; }; home.packages = with pkgs; [ From 03052245433ba82c0b0945c1dc7316bdebb519b1 Mon Sep 17 00:00:00 2001 From: Redyf Date: Wed, 3 Jul 2024 22:31:35 -0300 Subject: [PATCH 2/6] remove: dead code --- home/redyf/tools/languages/c/default.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/home/redyf/tools/languages/c/default.nix b/home/redyf/tools/languages/c/default.nix index b0f836ed..ff6ad8a1 100644 --- a/home/redyf/tools/languages/c/default.nix +++ b/home/redyf/tools/languages/c/default.nix @@ -4,8 +4,6 @@ cmake gnumake gnupatch - # astyle - # cpplint clang-tools ]; } From 7afc8303eb4f9250125847cc16dc74a20765e556 Mon Sep 17 00:00:00 2001 From: Redyf Date: Wed, 3 Jul 2024 22:33:05 -0300 Subject: [PATCH 3/6] remove: unused fonts --- home/redyf/system/fonts/default.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/home/redyf/system/fonts/default.nix b/home/redyf/system/fonts/default.nix index add45c37..2bf7ffb9 100644 --- a/home/redyf/system/fonts/default.nix +++ b/home/redyf/system/fonts/default.nix @@ -1,17 +1,19 @@ -{pkgs, ...}: { +{ + inputs, + pkgs, + ... +}: { home = { packages = with pkgs; [ dejavu_fonts font-awesome fira-code-symbols material-design-icons - (nerdfonts.override {fonts = ["JetBrainsMono"];}) noto-fonts powerline-symbols # monolisa-script # berkeley # sf-mono-liga-bin - # geist-mono ]; }; } From cbcd6757262efcd2e2d8d10387d3c1b456e8ec7f Mon Sep 17 00:00:00 2001 From: Redyf Date: Thu, 4 Jul 2024 13:14:59 -0300 Subject: [PATCH 4/6] feat: add new aliases for nix commands --- home/redyf/system/shell/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/home/redyf/system/shell/default.nix b/home/redyf/system/shell/default.nix index 21f71a0c..adf01341 100644 --- a/home/redyf/system/shell/default.nix +++ b/home/redyf/system/shell/default.nix @@ -143,6 +143,8 @@ in { gp = "git pull"; gs = "git status"; nb = "nix-build"; + nd = "nix develop"; + nr = "nix run"; ns = "nix-shell"; }; From 476a1ba34a08c1f348710a11801e34fa597742ec Mon Sep 17 00:00:00 2001 From: Redyf Date: Sat, 6 Jul 2024 16:25:50 -0300 Subject: [PATCH 5/6] feat: add raspberry-pi flake --- flake.lock | 177 ++++++++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 75 +++++++++++++++-------- 2 files changed, 226 insertions(+), 26 deletions(-) diff --git a/flake.lock b/flake.lock index d22ada23..c4d4093e 100644 --- a/flake.lock +++ b/flake.lock @@ -439,6 +439,57 @@ "type": "github" } }, + "libcamera-apps-src": { + "flake": false, + "locked": { + "lastModified": 1713431793, + "narHash": "sha256-uoewZMGf3vsBoRDfRz8KBKl+J6st/J44SHvNRMBdaUI=", + "owner": "raspberrypi", + "repo": "libcamera-apps", + "rev": "414a7383464b98f21f5e5381a16cc73ae0350ba6", + "type": "github" + }, + "original": { + "owner": "raspberrypi", + "ref": "v1.4.4", + "repo": "libcamera-apps", + "type": "github" + } + }, + "libcamera-src": { + "flake": false, + "locked": { + "lastModified": 1713446223, + "narHash": "sha256-p0/inkHPRUkxSIsTmj7VI7sIaX7OXdqjMGZ31W7cnt4=", + "owner": "raspberrypi", + "repo": "libcamera", + "rev": "eb00c13d7c9f937732305d47af5b8ccf895e700f", + "type": "github" + }, + "original": { + "owner": "raspberrypi", + "repo": "libcamera", + "rev": "eb00c13d7c9f937732305d47af5b8ccf895e700f", + "type": "github" + } + }, + "libpisp-src": { + "flake": false, + "locked": { + "lastModified": 1713362873, + "narHash": "sha256-CHd44CH5dBcZuK+5fZtONZ8HE/lwGKwK5U0BYUK8gG4=", + "owner": "raspberrypi", + "repo": "libpisp", + "rev": "999da5acb4f40cb8e93d22ec16e28edd55ec9414", + "type": "github" + }, + "original": { + "owner": "raspberrypi", + "ref": "v1.0.5", + "repo": "libpisp", + "type": "github" + } + }, "matugen": { "inputs": { "nixpkgs": "nixpkgs_5", @@ -554,6 +605,22 @@ } }, "nixpkgs_7": { + "locked": { + "lastModified": 1715218190, + "narHash": "sha256-R98WOBHkk8wIi103JUVQF3ei3oui4HvoZcz9tYOAwlk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9a9960b98418f8c385f52de3b09a63f9c561427a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9a9960b98418f8c385f52de3b09a63f9c561427a", + "type": "github" + } + }, + "nixpkgs_8": { "locked": { "lastModified": 1714912032, "narHash": "sha256-clkcOIkg8G4xuJh+1onLG4HPMpbtzdLv4rHxFzgsH9c=", @@ -569,6 +636,32 @@ "type": "github" } }, + "raspberry-pi-nix": { + "inputs": { + "libcamera-apps-src": "libcamera-apps-src", + "libcamera-src": "libcamera-src", + "libpisp-src": "libpisp-src", + "nixpkgs": "nixpkgs_7", + "rpi-bluez-firmware-src": "rpi-bluez-firmware-src", + "rpi-firmware-nonfree-src": "rpi-firmware-nonfree-src", + "rpi-firmware-src": "rpi-firmware-src", + "rpi-linux-6_6-src": "rpi-linux-6_6-src", + "u-boot-src": "u-boot-src" + }, + "locked": { + "lastModified": 1718664987, + "narHash": "sha256-9MSY3LkvX50bVg21wdFQJRdVnoFkvORqgQRdJG990W8=", + "owner": "tstat", + "repo": "raspberry-pi-nix", + "rev": "6045de5f79ac8eb432cd75e82e1accfb48caff45", + "type": "github" + }, + "original": { + "owner": "tstat", + "repo": "raspberry-pi-nix", + "type": "github" + } + }, "root": { "inputs": { "ags": "ags", @@ -578,9 +671,78 @@ "hyprland": "hyprland", "matugen": "matugen", "nixpkgs": "nixpkgs_6", + "raspberry-pi-nix": "raspberry-pi-nix", "stylix": "stylix" } }, + "rpi-bluez-firmware-src": { + "flake": false, + "locked": { + "lastModified": 1698157837, + "narHash": "sha256-CjbZ3t3TW/iJ3+t9QKEtM9NdQU7SwcUCDYuTmFEwvhU=", + "owner": "RPi-Distro", + "repo": "bluez-firmware", + "rev": "d9d4741caba7314d6500f588b1eaa5ab387a4ff5", + "type": "github" + }, + "original": { + "owner": "RPi-Distro", + "repo": "bluez-firmware", + "rev": "d9d4741caba7314d6500f588b1eaa5ab387a4ff5", + "type": "github" + } + }, + "rpi-firmware-nonfree-src": { + "flake": false, + "locked": { + "lastModified": 1700058854, + "narHash": "sha256-Yynww79LPPkau4YDSLI6IMOjH64nMpHUdGjnCfIR2+M=", + "owner": "RPi-Distro", + "repo": "firmware-nonfree", + "rev": "88aa085bfa1a4650e1ccd88896f8343c22a24055", + "type": "github" + }, + "original": { + "owner": "RPi-Distro", + "repo": "firmware-nonfree", + "rev": "88aa085bfa1a4650e1ccd88896f8343c22a24055", + "type": "github" + } + }, + "rpi-firmware-src": { + "flake": false, + "locked": { + "lastModified": 1713970515, + "narHash": "sha256-X5OinkLh/+mx34DM8mCk4tqOGuJdYxkvygv3gA77NJI=", + "owner": "raspberrypi", + "repo": "firmware", + "rev": "969420b4121b522ab33c5001074cc4c2547dafaf", + "type": "github" + }, + "original": { + "owner": "raspberrypi", + "ref": "1.20240424", + "repo": "firmware", + "type": "github" + } + }, + "rpi-linux-6_6-src": { + "flake": false, + "locked": { + "lastModified": 1713516936, + "narHash": "sha256-mlsDuVczu0e57BlD/iq7IEEluOIgqbZ+W4Ju30E/zhw=", + "owner": "raspberrypi", + "repo": "linux", + "rev": "0c341f47adc3578cd5f817aa20ee2b7f9ae6b23e", + "type": "github" + }, + "original": { + "owner": "raspberrypi", + "ref": "stable_20240423", + "repo": "linux", + "type": "github" + } + }, "stylix": { "inputs": { "base16": "base16", @@ -593,7 +755,7 @@ "flake-compat": "flake-compat", "gnome-shell": "gnome-shell", "home-manager": "home-manager_2", - "nixpkgs": "nixpkgs_7" + "nixpkgs": "nixpkgs_8" }, "locked": { "lastModified": 1719525570, @@ -654,6 +816,19 @@ "type": "github" } }, + "u-boot-src": { + "flake": false, + "locked": { + "lastModified": 1712055538, + "narHash": "sha256-IlaDdjKq/Pq2orzcU959h93WXRZfvKBGDO/MFw9mZMg=", + "type": "tarball", + "url": "https://ftp.denx.de/pub/u-boot/u-boot-2024.04.tar.bz2" + }, + "original": { + "type": "tarball", + "url": "https://ftp.denx.de/pub/u-boot/u-boot-2024.04.tar.bz2" + } + }, "xdph": { "inputs": { "hyprland-protocols": "hyprland-protocols", diff --git a/flake.nix b/flake.nix index 657bd853..01655e94 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,8 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + raspberry-pi-nix.url = "github:tstat/raspberry-pi-nix"; + hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; disko.url = "github:nix-community/disko"; stylix.url = "github:danth/stylix"; @@ -38,8 +40,51 @@ disko, stylix, font-flake, + raspberry-pi-nix, ... } @ inputs: let + inherit (nixpkgs.lib) nixosSystem; + basic-config = { + pkgs, + lib, + ... + }: { + users.users.root.initialPassword = "root"; + networking = { + hostName = "raspberry"; + firewall.enable = false; + wireless = { + enable = true; + }; + }; + environment.systemPackages = with pkgs; [bluez bluez-tools neovim git]; + nix = { + package = pkgs.nixFlakes; + extraOptions = "experimental-features = nix-command flakes"; + }; + time.timeZone = "America/Bahia"; + console = {keyMap = "br-abnt2";}; + i18n = { + defaultLocale = "pt_BR.UTF-8"; + }; + hardware = { + bluetooth.enable = true; + raspberry-pi = { + config = { + all = { + base-dt-params = { + # enable autoprobing of bluetooth driver + # https://github.com/raspberrypi/linux/blob/c8c99191e1419062ac8b668956d19e788865912a/arch/arm/boot/dts/overlays/README#L222-L224 + krnbt = { + enable = true; + value = "on"; + }; + }; + }; + }; + }; + }; + }; supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. @@ -77,31 +122,11 @@ disko.nixosModules.disko ]; }; - # selene = nixpkgs.lib.nixosSystem { - # system = "x86_64-linux"; - # specialArgs = { - # inherit - # inputs - # hyprland - # disko - # ; - # }; - # modules = [ - # ./hosts/selene/configuration.nix - # home-manager.nixosModules.home-manager - # { - # home-manager = { - # useUserPackages = true; - # useGlobalPkgs = false; - # extraSpecialArgs = {inherit inputs disko;}; - # users.selene = ./home/selene/home.nix; - # }; - # } - # hyprland.nixosModules.default - # {programs.hyprland.enable = false;} - # disko.nixosModules.disko - # ]; - # }; + # nix build '.#nixosConfigurations.selene.config.system.build.sdImage' + selene = nixosSystem { + system = "aarch64-linux"; + modules = [raspberry-pi-nix.nixosModules.raspberry-pi basic-config]; + }; }; devShells = forAllSystems (system: let pkgs = nixpkgsFor.${system}; From 3d9713b39b312a98c82a18d42992509deac43e74 Mon Sep 17 00:00:00 2001 From: Redyf Date: Sat, 6 Jul 2024 16:26:31 -0300 Subject: [PATCH 6/6] feat: add host for raspberrypi5 Welcome selene! (I love underworld) --- hosts/selene/configuration.nix | 66 ++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 hosts/selene/configuration.nix diff --git a/hosts/selene/configuration.nix b/hosts/selene/configuration.nix new file mode 100644 index 00000000..6dd49333 --- /dev/null +++ b/hosts/selene/configuration.nix @@ -0,0 +1,66 @@ +{ + config, + lib, + pkgs, + ... +}: { + imports = [./hardware-configuration.nix]; + + networking = { + hostName = "raspberry"; # Define your hostname. + firewall.enable = false; + wireless = { + enable = true; + iwd = { + enable = true; + settings.General.EnableNetworkConfiguration = true; + }; + }; + }; + + services.openssh.enable = true; + services.openssh.settings.PermitRootLogin = "yes"; + + environment.systemPackages = with pkgs; [ + neovim + curl + git + bluez + bluez-tools + ]; + + users.users.selene = { + isNormalUser = true; + description = "My RaspberryPI Host"; + initialPassword = "123456"; + shell = pkgs.zsh; + extraGroups = ["networkmanager" "wheel" "input" "docker" "kvm" "libvirtd"]; + }; + + nix = { + package = pkgs.nixFlakes; + extraOptions = "experimental-features = nix-command flakes"; + }; + + time.timeZone = "America/Bahia"; + console = {keyMap = "br-abnt2";}; + + i18n = { + defaultLocale = "pt_BR.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "pt_BR.UTF-8"; + LC_IDENTIFICATION = "pt_BR.UTF-8"; + LC_MEASUREMENT = "pt_BR.UTF-8"; + LC_MONETARY = "pt_BR.UTF-8"; + LC_NAME = "pt_BR.UTF-8"; + LC_NUMERIC = "pt_BR.UTF-8"; + LC_PAPER = "pt_BR.UTF-8"; + LC_TELEPHONE = "pt_BR.UTF-8"; + LC_TIME = "pt_BR.UTF-8"; + }; + }; + + # just for access after install to continue provisioning + + system.stateVersion = "23.11"; +}