rpi config attempt number 1 (one)

This commit is contained in:
krizej 2024-08-10 01:03:29 +02:00
parent 330d214d49
commit 42d81dbf56
8 changed files with 98 additions and 4 deletions

View file

@ -20,6 +20,22 @@
"type": "github" "type": "github"
} }
}, },
"nixos-hardware": {
"locked": {
"lastModified": 1723149858,
"narHash": "sha256-3u51s7jdhavmEL1ggtd8wqrTH2clTy5yaZmhLvAXTqc=",
"owner": "nixos",
"repo": "nixos-hardware",
"rev": "107bb46eef1f05e86fc485ee8af9b637e5157988",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "master",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1722062969, "lastModified": 1722062969,
@ -54,6 +70,7 @@
"root": { "root": {
"inputs": { "inputs": {
"home-manager": "home-manager", "home-manager": "home-manager",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nur": "nur" "nur": "nur"
} }

View file

@ -10,6 +10,8 @@
}; };
nur.url = "github:nix-community/NUR"; nur.url = "github:nix-community/NUR";
nixos-hardware.url = "github:nixos/nixos-hardware/master";
}; };
outputs = { ... } @ inputs: { outputs = { ... } @ inputs: {

View file

@ -14,4 +14,12 @@
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
]; ];
}; };
"rpi" = inputs.nixpkgs.lib.nixosSystem {
modules = [
./rpi
../modules
inputs.home-manager.nixosModules.home-manager
inputs.nixos-hardware.nixosModules.raspberry-pi-4
];
};
} }

57
hosts/rpi/default.nix Normal file
View file

@ -0,0 +1,57 @@
{ config, pkgs, ... }:
{
config = {
boot = {
kernelPackages = pkgs.linuxKernel.packages.linux_rpi4;
initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" ];
loader = {
grub.enable = false;
generic-extlinux-compatible.enable = true;
};
};
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
options = [ "noatime" ];
};
};
hardware.raspberry-pi."4" = {
bluetooth.enable = false;
# let me sleep
leds.eth.disable = true;
leds.act.disable = true;
leds.pwr.disable = true;
};
chuj = {
system = {
user = "krizej";
host = "rpi";
platform = "aarch64-linux";
};
# home manger on a server xd
home-manager.enable = true;
stuff = {
git.enable = true;
vim.enable = true;
ssh = {
enable = true;
authKeys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDXxtwm+YoSIXfT9OJtU3O/EHf1Lg4IwoLe0CO2/Oapl7efTNZO5qVCh7aG0T5Hy4RD5CmVpxZVei44NM1dpNf3c+5976eH1BKgMmklA4EwAVc3o259YfJoOowBvyzBqO4CZWJmuUUjZwaQ152gPh1iCVe8bcR25S7cCTRN/6qU+rGn2zsbkV/GKdtJmhS5OLic5iXMdL56B7+hqFdL5NxPcWpnaSilIPus2xhI4u29I/FrM8RcR3Uzkqyx385js5MqhkVP3SVc7V8hSKEO8LRzmBYuBKkBPW9gmCUHKyxhSxZOvcretUFB87W/P/HDw3I4tk4naQPiPnASj6NvqTRMuhErIvXd1w+3MEEsfnXLeyq7CIhO01+d3/JEl7br5HOLZO+64IjSWYY7N0a0zhMjf147yEJ+JBOwXzN6px7y2rLI9CLY6jMs+Ye63nl7ALqN9dLJiaqxOMqTxrSNdRqWEj+FnFTd6sTb5eOZH7yabF/EApwdV3TGRGEaaZGS/GE= krizej@krizej-pc"
];
};
fish = {
enable = true;
extraAliases = {
"rebuild" = "sudo nixos-rebuild switch --flake ~/nix#rpi -v";
};
};
};
};
};
}

View file

@ -12,7 +12,7 @@ in {
steam = mkEnableOption "steam"; steam = mkEnableOption "steam";
}; };
config = { config = mkIf cfg.enable {
programs.steam.enable = cfg.steam; programs.steam.enable = cfg.steam;
home-manager.users.${user}.home.packages = with pkgs; ([ home-manager.users.${user}.home.packages = with pkgs; ([

View file

@ -6,7 +6,7 @@ in {
options.chuj.stuff.git = { options.chuj.stuff.git = {
enable = mkEnableOption "git"; enable = mkEnableOption "git";
}; };
config = { config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.git ]; environment.systemPackages = [ pkgs.git ];
home-manager.users.${user}.programs.git = { home-manager.users.${user}.programs.git = {
enable = true; enable = true;

View file

@ -9,9 +9,19 @@ in {
type = lib.types.attrs; type = lib.types.attrs;
default = {}; default = {};
}; };
authKeys = mkOption {
type = lib.types.listOf lib.types.str;
default = [];
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.openssh.enable = true; services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
};
users.users.${user}.openssh.authorizedKeys.keys = cfg.authKeys;
home-manager.users.${user}.programs.ssh = { home-manager.users.${user}.programs.ssh = {
enable = true; enable = true;
matchBlocks = mapAttrs' matchBlocks = mapAttrs'

View file

@ -64,7 +64,7 @@ in {
zip zip
unzip unzip
rar # rar
unrar unrar
p7zip p7zip
p7zip-rar p7zip-rar