Skip to content

Commit

Permalink
refactor: move raspberry config from flake to hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
redyf committed Jul 7, 2024
1 parent 21cee63 commit 3f6665d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 55 deletions.
50 changes: 4 additions & 46 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,47 +44,6 @@
...
} @ 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"; ... }'.
Expand Down Expand Up @@ -122,14 +81,13 @@
disko.nixosModules.disko
];
};
# nix build '.#nixosConfigurations.selene.config.system.build.sdImage'
# nix build '.#nixosConfigurations.selene.config.system.build.sdImage' to build the image for the raspberry-pi
selene = nixosSystem {
system = "aarch64-linux";
modules = [
./hosts/selene/configuration.nix
raspberry-pi-nix.nixosModules.raspberry-pi
# basic-config
];
./hosts/selene/configuration.nix
raspberry-pi-nix.nixosModules.raspberry-pi
];
};
};
devShells = forAllSystems (system: let
Expand Down
28 changes: 19 additions & 9 deletions hosts/selene/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@
}: {
imports = [./hardware-configuration.nix];

raspberry-pi-nix.uboot.enable = true;

networking = {
enable = true;
hostName = "raspberry"; # Define your hostname.
firewall.enable = false;
wireless = {
enable = true;
};
};

services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes";
services = {
openssh = {
enable = true;
settings.PermitRootLogin = "yes";
};
};

environment.systemPackages = with pkgs; [
neovim
Expand Down Expand Up @@ -49,16 +56,19 @@
};
};

users.users.selene = {
isNormalUser = true;
description = "My RaspberryPI Host";
initialPassword = "123456";
shell = pkgs.zsh;
extraGroups = ["networkmanager" "wheel" "input" "docker" "kvm" "libvirtd"];
users.users = {
root.initialPassword = "root";
selene = {
isNormalUser = true;
description = "My RaspberryPI Host";
initialPassword = "123456";
shell = pkgs.zsh;
extraGroups = ["networkmanager" "wheel" "input" "docker" "kvm" "libvirtd"];
};
};

programs = {
zsh.enable = true;
zsh.enable = true;
};

time.timeZone = "America/Bahia";
Expand Down

0 comments on commit 3f6665d

Please sign in to comment.