Compare commits
2 Commits
0cb82a43fb
...
06847c6f6f
Author | SHA1 | Date | |
---|---|---|---|
06847c6f6f | |||
88b92f49b9 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
result
|
@ -1,8 +1,6 @@
|
||||
{ stable, config, pkgs, lib, ... }:
|
||||
{ hardware, stable, config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
SSID = "mywifi";
|
||||
SSIDpassword = "mypassword";
|
||||
interface = "wlan0";
|
||||
hostname = "nixpi";
|
||||
in {
|
||||
@ -23,6 +21,47 @@ in {
|
||||
LC_TIME = "de_DE.UTF-8";
|
||||
};
|
||||
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
# displayManager.lightdm.enable = true;
|
||||
# desktopManager.gnome.enable = true;
|
||||
videoDrivers = [ "fbdev" ];
|
||||
};
|
||||
|
||||
sound.enable = true;
|
||||
hardware.pulseaudio.enable = true;
|
||||
|
||||
# Create gpio group
|
||||
users.groups.gpio = {};
|
||||
|
||||
# Change permissions gpio devices
|
||||
services.udev.extraRules = ''
|
||||
SUBSYSTEM=="bcm2835-gpiomem", KERNEL=="gpiomem", GROUP="gpio",MODE="0660"
|
||||
SUBSYSTEM=="gpio", KERNEL=="gpiochip*", ACTION=="add", RUN+="${pkgs.bash}/bin/bash -c 'chown root:gpio /sys/class/gpio/export /sys/class/gpio/unexport ; chmod 220 /sys/class/gpio/export /sys/class/gpio/unexport'"
|
||||
SUBSYSTEM=="gpio", KERNEL=="gpio*", ACTION=="add",RUN+="${pkgs.bash}/bin/bash -c 'chown root:gpio /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value ; chmod 660 /sys%p/active_low /sys%p/direction /sys%p/edge /sys%p/value'"
|
||||
SUBSYSTEM=="spidev", KERNEL=="spidev0.0", GROUP="spi", MODE="0660"
|
||||
'';
|
||||
|
||||
hardware = {
|
||||
raspberry-pi."4" = {
|
||||
# audio.enable = true;
|
||||
apply-overlays-dtmerge.enable = true;
|
||||
};
|
||||
deviceTree = {
|
||||
enable = true;
|
||||
filter = "*rpi-4-*.dtb";
|
||||
overlays = [
|
||||
{
|
||||
name = "spi";
|
||||
dtboFile = ./spi0-0cs.dtbo;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
users.groups.spi = {};
|
||||
|
||||
console.keyMap = "de";
|
||||
|
||||
services.xserver = {
|
||||
@ -52,13 +91,12 @@ in {
|
||||
hostName = hostname;
|
||||
wireless = {
|
||||
enable = true;
|
||||
networks."${SSID}".psk = SSIDpassword;
|
||||
userControlled.enable = false;
|
||||
networks = (import ./networks.nix);
|
||||
interfaces = [ interface ];
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [ vim ];
|
||||
|
||||
services.openssh.enable = true;
|
||||
|
||||
programs.xonsh.enable = true;
|
||||
@ -68,7 +106,8 @@ in {
|
||||
shell = pkgs.xonsh;
|
||||
isNormalUser = true;
|
||||
hashedPassword = "$y$j9T$ODBtPwWjIx50Bjhctw9kW/$jhfsHaAyh8zOXBV7cCK9l2M0yWyE3VLiL0h55XXV5J2";
|
||||
extraGroups = [ "wheel" ];
|
||||
extraGroups = [ "wheel" "gpio" "spi" "dialout" ];
|
||||
openssh.authorizedKeys.keys = (import ./authorizedKeys.nix);
|
||||
};
|
||||
};
|
||||
|
||||
@ -85,7 +124,9 @@ in {
|
||||
git-lfs
|
||||
lm_sensors
|
||||
file
|
||||
(writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@")
|
||||
raspberrypi-eeprom
|
||||
libraspberrypi
|
||||
];
|
||||
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
17
flake.lock
17
flake.lock
@ -64,6 +64,22 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1706182238,
|
||||
"narHash": "sha256-Ti7CerGydU7xyrP/ow85lHsOpf+XMx98kQnPoQCSi1g=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "f84eaffc35d1a655e84749228cde19922fcf55f1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "master",
|
||||
"repo": "nixos-hardware",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1703013332,
|
||||
@ -115,6 +131,7 @@
|
||||
"root": {
|
||||
"inputs": {
|
||||
"agenix": "agenix",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
# /etc/nixos/flake.nix
|
||||
{
|
||||
description = "flake for a remote display on a raspi";
|
||||
|
||||
@ -6,9 +5,10 @@
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixpkgs-unstable";
|
||||
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
agenix.url = "github:ryantm/agenix";
|
||||
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
||||
};
|
||||
|
||||
outputs = {nixpkgs, nixpkgs-stable, agenix, ...} @ inputs: let
|
||||
outputs = {nixpkgs, nixpkgs-stable, agenix, nixos-hardware, ...} @ inputs: let
|
||||
system = "aarch64-linux";
|
||||
stable = import nixpkgs-stable { inherit system; config.allowUnfree = true; };
|
||||
in {
|
||||
@ -17,6 +17,7 @@
|
||||
specialArgs = { inherit inputs stable; };
|
||||
modules = [
|
||||
./configuration.nix
|
||||
nixos-hardware.nixosModules.raspberry-pi-4
|
||||
agenix.nixosModules.default
|
||||
];
|
||||
};
|
||||
|
BIN
spi0-0cs.dtbo
Normal file
BIN
spi0-0cs.dtbo
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user