rpi4: add new device
This commit is contained in:
parent
c0e2e3b8b9
commit
9dd2c42726
3 changed files with 81 additions and 1 deletions
17
flake.lock
17
flake.lock
|
@ -95,6 +95,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1680876084,
|
||||
"narHash": "sha256-eP9yxP0wc7XuVaODugh+ajgbFGaile2O1ihxiLxOuvU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "3006d2860a6ed5e01b0c3e7ffb730e9b293116e2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "master",
|
||||
"repo": "nixos-hardware",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1681303793,
|
||||
|
@ -200,6 +216,7 @@
|
|||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nixos-cn": "nixos-cn",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-stable": "nixpkgs-stable",
|
||||
"nur": "nur",
|
||||
|
|
27
flake.nix
27
flake.nix
|
@ -15,6 +15,8 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
||||
|
||||
nixos-cn = {
|
||||
url = "github:nixos-cn/flakes";
|
||||
# Use the same nixpkgs
|
||||
|
@ -25,7 +27,8 @@
|
|||
};
|
||||
|
||||
|
||||
outputs = { self, nixpkgs, nur, home-manager, sops-nix, nixos-cn, ... }@inputs:
|
||||
outputs = { self, ... }@inputs:
|
||||
with inputs;
|
||||
let
|
||||
mkHome = user: host: home-manager.nixosModules.home-manager {
|
||||
extraSpecialArgs = { inherit inputs; };
|
||||
|
@ -45,5 +48,27 @@
|
|||
];
|
||||
specialArgs = inputs;
|
||||
};
|
||||
nixosConfigurations.rpi4 = nixpkgs.lib.nixosSystem {
|
||||
system = "aarch64-linux";
|
||||
modules = [
|
||||
machines/rpi4/configuration.nix
|
||||
nixos-hardware.nixosModules.raspberry-pi-4
|
||||
];
|
||||
};
|
||||
|
||||
images.rpi4 = (nixpkgs.lib.nixosSystem {
|
||||
system = "aarch64-linux";
|
||||
modules = [
|
||||
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
|
||||
machines/rpi4/configuration.nix
|
||||
nixos-hardware.nixosModules.raspberry-pi-4
|
||||
{
|
||||
nixpkgs.config.allowUnsupportedSystem = true;
|
||||
nixpkgs.hostPlatform.system = "aarch64-linux";
|
||||
nixpkgs.buildPlatform.system = "x86_64-linux";
|
||||
# ... extra configs as above
|
||||
}
|
||||
];
|
||||
}).config.system.build.sdImage;
|
||||
};
|
||||
}
|
||||
|
|
38
machines/rpi4/configuration.nix
Normal file
38
machines/rpi4/configuration.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{ config, libs, pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
];
|
||||
nixpkgs.overlays = [
|
||||
# Workaround https://github.com/NixOS/nixpkgs/issues/126755#issuecomment-869149243
|
||||
(final: super: {
|
||||
makeModulesClosure = x:
|
||||
super.makeModulesClosure (x // { allowMissing = true; });
|
||||
})
|
||||
];
|
||||
|
||||
imports = [ ];
|
||||
|
||||
system.stateVersion = "22.11";
|
||||
|
||||
networking = {
|
||||
hostName = "pi-wh";
|
||||
useDHCP = false;
|
||||
interfaces.eth0.useDHCP = true;
|
||||
};
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
systemd.services.sshd.wantedBy = pkgs.lib.mkForce [ "multi-user.target" ];
|
||||
|
||||
users.users.pi = {
|
||||
isNormalUser = true;
|
||||
home = "/home/pi";
|
||||
extraGroups = [ "wheel" "networkmanager" ];
|
||||
openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIInPn+7cMbH7zCEPJArU/Ot6oq8NHo8a2rYaCfTp7zgd xin@nixos" ];
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue