forked from Yuka/c3h-nixfiles
Compare commits
3 commits
main
...
feature/pi
Author | SHA1 | Date | |
---|---|---|---|
6bf257dbbb | |||
0fe50a9c62 | |||
|
a52133cec4 |
9 changed files with 52 additions and 63 deletions
|
@ -1,7 +1,7 @@
|
||||||
{ lib, pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
boot.kernelPackages = lib.mkOverride 2000 pkgs.linuxPackages_latest;
|
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||||
boot.kernelParams = [ "quiet" ];
|
boot.kernelParams = [ "quiet" ];
|
||||||
|
|
||||||
services.openssh.enable = true;
|
services.openssh.enable = true;
|
||||||
|
@ -49,13 +49,5 @@
|
||||||
ll = "exa -l";
|
ll = "exa -l";
|
||||||
la = "exa -la";
|
la = "exa -la";
|
||||||
tree = "exa -T";
|
tree = "exa -T";
|
||||||
apt = "echo 'please use nix-env -iA nixos.<packagename> instead to install packages.'";
|
|
||||||
};
|
|
||||||
|
|
||||||
users.mutableUsers = false;
|
|
||||||
users.users.c3h = {
|
|
||||||
isNormalUser = true;
|
|
||||||
password = "c3h";
|
|
||||||
extraGroups = [ "wheel" ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
16
deploy.sh
16
deploy.sh
|
@ -12,25 +12,15 @@ fi
|
||||||
|
|
||||||
mode="${1:-switch}"
|
mode="${1:-switch}"
|
||||||
host="${2:-nuc}"
|
host="${2:-nuc}"
|
||||||
target="${3:-c3h@$host.c3h}"
|
target="${3:-$host.c3h}"
|
||||||
|
|
||||||
if ! [ -d "hosts/$host" ]
|
|
||||||
then
|
|
||||||
echo "Host $host does not exist. Choose from:"
|
|
||||||
ls hosts
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "deploying $host to $target"
|
echo "deploying $host to $target"
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
tmp=$(mktemp -d)
|
sources=$(nix-build nix/sources-dir.nix --no-out-link)
|
||||||
trap 'rm -rf "$tmp"' EXIT
|
|
||||||
sources="$tmp/sources"
|
|
||||||
cp -r $(nix-build nix/sources-dir.nix --no-out-link) $tmp/sources
|
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
system_drv=$(nix-instantiate "<nixpkgs/nixos>" -A config.system.build.toplevel -I $sources -I "nixos-config=$PWD/hosts/$host/configuration.nix")
|
system_drv=$(nix-instantiate "<nixpkgs/nixos>" -I $sources -I "nixos-config=$PWD/hosts/$host/configuration.nix" | head -n1)
|
||||||
nix-copy-closure --to $target $system_drv
|
nix-copy-closure --to $target $system_drv
|
||||||
system=$(ssh $target "nix-store --realise $system_drv")
|
system=$(ssh $target "nix-store --realise $system_drv")
|
||||||
ssh $target "sudo nix-env -p /nix/var/nix/profiles/system -i $system && sudo /nix/var/nix/profiles/system/bin/switch-to-configuration $mode"
|
ssh $target "sudo nix-env -p /nix/var/nix/profiles/system -i $system && sudo /nix/var/nix/profiles/system/bin/switch-to-configuration $mode"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
# services
|
# services
|
||||||
../../shared-services/pulseaudio.nix
|
../../shared-services/pulseaudio.nix
|
||||||
../../shared-services/nfs-client.nix
|
#../../shared-services/nfs-server.nix
|
||||||
../../shared-services/mpd.nix
|
../../shared-services/mpd.nix
|
||||||
../../shared-services/ympd.nix
|
../../shared-services/ympd.nix
|
||||||
../../shared-services/spotifyd.nix
|
../../shared-services/spotifyd.nix
|
||||||
|
@ -16,21 +16,28 @@
|
||||||
../../shared-services/vnc.nix
|
../../shared-services/vnc.nix
|
||||||
../../shared-services/webserver.nix
|
../../shared-services/webserver.nix
|
||||||
];
|
];
|
||||||
|
users.users.c3h = {
|
||||||
# We import sd-image-aarch64.nix so we can build a config.system.build.sdImage
|
isNormalUser = true;
|
||||||
# But it imports some modules we don't want, so disable them
|
password = "c3h";
|
||||||
disabledModules = [
|
extraGroups = [ "wheel" ];
|
||||||
"profiles/base.nix"
|
packages = with pkgs; [ chromium firefox mpv youtube-dl ];
|
||||||
"profiles/all-hardware.nix"
|
};
|
||||||
];
|
|
||||||
|
|
||||||
networking.hostName = "bemmer";
|
networking.hostName = "bemmer";
|
||||||
networking.domain = "c3h";
|
networking.domain = "c3h";
|
||||||
|
|
||||||
networking.useDHCP = true;
|
networking.useDHCP = true;
|
||||||
|
|
||||||
nixpkgs.system = "aarch64-linux";
|
nixpkgs.system = "aarch64-linux";
|
||||||
hardware.raspberry-pi."4".fkms-3d.enable = true;
|
boot.initrd.availableKernelModules = lib.mkForce [ "vc4" "i2c_bcm2835" ];
|
||||||
boot.tmpOnTmpfs = true; # building stuff on sd-card is slow
|
boot.supportedFilesystems = lib.mkForce [ "ext4" "vfat" ];
|
||||||
|
boot.kernelPackages = pkgs.linuxPackages_rpi4;
|
||||||
|
documentation.enable = false;
|
||||||
|
|
||||||
|
hardware.raspberry-pi."4" = {
|
||||||
|
fkms-3d.enable = true;
|
||||||
|
#audio.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
system.stateVersion = "21.05";
|
system.stateVersion = "21.05";
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
# services
|
# services
|
||||||
../../shared-services/pulseaudio.nix
|
../../shared-services/pulseaudio.nix
|
||||||
../../shared-services/nfs-client.nix
|
../../shared-services/nfs-server.nix
|
||||||
../../shared-services/mpd.nix
|
../../shared-services/mpd.nix
|
||||||
../../shared-services/ympd.nix
|
../../shared-services/ympd.nix
|
||||||
../../shared-services/spotifyd.nix
|
../../shared-services/spotifyd.nix
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/mnt/hdd" =
|
fileSystems."/mnt" =
|
||||||
{ device = "/dev/disk/by-uuid/ff18a6f9-ee3b-452c-8671-38b74508a74c";
|
{ device = "/dev/disk/by-uuid/ff18a6f9-ee3b-452c-8671-38b74508a74c";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
users.users.c3h.packages = with pkgs; [
|
users.mutableUsers = false;
|
||||||
chromium
|
users.users.c3h = {
|
||||||
firefox
|
isNormalUser = true;
|
||||||
mpv
|
password = "c3h";
|
||||||
youtube-dl
|
extraGroups = [ "wheel" ];
|
||||||
pavucontrol
|
packages = with pkgs; [ chromium firefox mpv youtube-dl ];
|
||||||
dosbox
|
};
|
||||||
vlc
|
|
||||||
ffmpeg-full
|
|
||||||
sox
|
|
||||||
];
|
|
||||||
|
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
boot.supportedFilesystems = [ "nfs" ];
|
|
||||||
fileSystems."/mnt/Music" = {
|
|
||||||
device = "10.23.42.126:/music";
|
|
||||||
fsType = "nfs";
|
|
||||||
options = [
|
|
||||||
"nfsvers=4.1"
|
|
||||||
"noauto"
|
|
||||||
"x-systemd.automount"
|
|
||||||
"x-systemd.idle-timeout=600"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
17
shared-services/nfs-server.nix
Normal file
17
shared-services/nfs-server.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.nfs.server = {
|
||||||
|
enable = true;
|
||||||
|
exports = ''
|
||||||
|
/mnt 10.23.42.0/24(rw,fsid=0,insecure,no_subtree_check)
|
||||||
|
'';
|
||||||
|
|
||||||
|
statdPort = 4000;
|
||||||
|
lockdPort = 4001;
|
||||||
|
mountdPort = 4002;
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.interfaces.enp3s0.allowedTCPPorts = [ 2049 4000 4001 4002 111 ];
|
||||||
|
networking.firewall.interfaces.enp3s0.allowedUDPPorts = [ 2049 4000 4001 4002 111 ];
|
||||||
|
}
|
|
@ -1,10 +1,12 @@
|
||||||
{ config, ... }:
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
services.spotifyd = {
|
services.spotifyd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings.zeroconf_port = 18572;
|
config = ''
|
||||||
|
zeroconf_port = 18572
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ config.services.spotifyd.settings.zeroconf_port ];
|
networking.firewall.allowedTCPPorts = [ 18572 ];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue