diff --git a/common/default.nix b/common/default.nix index b5a1f7f..f68c534 100644 --- a/common/default.nix +++ b/common/default.nix @@ -1,7 +1,7 @@ { lib, pkgs, ... }: { - boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + boot.kernelPackages = lib.mkOverride 2000 pkgs.linuxPackages_latest; boot.kernelParams = [ "quiet" ]; services.openssh.enable = true; @@ -38,6 +38,11 @@ vim wget jq + pavucontrol + dosbox + vlc + ffmpeg-full + sox ]; programs.bash.shellAliases = { @@ -49,6 +54,13 @@ ll = "exa -l"; la = "exa -la"; tree = "exa -T"; - apt = "echo 'please use nix-env -iA instead to install packages.'"; + apt = "echo 'please use nix-env -iA nixos. instead to install packages.'"; + }; + + users.mutableUsers = false; + users.users.c3h = { + isNormalUser = true; + password = "c3h"; + extraGroups = [ "wheel" ]; }; } diff --git a/deploy.sh b/deploy.sh index f425fce..065eb2b 100755 --- a/deploy.sh +++ b/deploy.sh @@ -12,15 +12,25 @@ fi mode="${1:-switch}" host="${2:-nuc}" -target="${3:-$host.c3h}" +target="${3:-c3h@$host.c3h}" + +if ! [ -d "hosts/$host" ] +then + echo "Host $host does not exist. Choose from:" + ls hosts + exit +fi echo "deploying $host to $target" sleep 1 -sources=$(nix-build nix/sources-dir.nix --no-out-link) +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT +sources="$tmp/sources" +cp -r $(nix-build nix/sources-dir.nix --no-out-link) $tmp/sources set -x -system_drv=$(nix-instantiate "" -I $sources -I "nixos-config=$PWD/hosts/$host/configuration.nix" | head -n1) +system_drv=$(nix-instantiate "" -A config.system.build.toplevel -I $sources -I "nixos-config=$PWD/hosts/$host/configuration.nix") nix-copy-closure --to $target $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" diff --git a/hosts/bemmer/configuration.nix b/hosts/bemmer/configuration.nix index 62b02f7..e7d0951 100644 --- a/hosts/bemmer/configuration.nix +++ b/hosts/bemmer/configuration.nix @@ -8,7 +8,7 @@ # services ../../shared-services/pulseaudio.nix - #../../shared-services/nfs-server.nix + ../../shared-services/nfs-client.nix ../../shared-services/mpd.nix ../../shared-services/ympd.nix ../../shared-services/spotifyd.nix @@ -16,28 +16,21 @@ ../../shared-services/vnc.nix ../../shared-services/webserver.nix ]; - users.users.c3h = { - isNormalUser = true; - password = "c3h"; - extraGroups = [ "wheel" ]; - packages = with pkgs; [ chromium firefox mpv youtube-dl ]; - }; + + # We import sd-image-aarch64.nix so we can build a config.system.build.sdImage + # But it imports some modules we don't want, so disable them + disabledModules = [ + "profiles/base.nix" + "profiles/all-hardware.nix" + ]; networking.hostName = "bemmer"; networking.domain = "c3h"; - networking.useDHCP = true; nixpkgs.system = "aarch64-linux"; - boot.initrd.availableKernelModules = lib.mkForce [ "vc4" "i2c_bcm2835" ]; - 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; - }; + hardware.raspberry-pi."4".fkms-3d.enable = true; + boot.tmpOnTmpfs = true; # building stuff on sd-card is slow system.stateVersion = "21.05"; } diff --git a/hosts/nuc/configuration.nix b/hosts/nuc/configuration.nix index 47fc3ef..56cea2e 100644 --- a/hosts/nuc/configuration.nix +++ b/hosts/nuc/configuration.nix @@ -8,7 +8,7 @@ # services ../../shared-services/pulseaudio.nix - ../../shared-services/nfs-server.nix + ../../shared-services/nfs-client.nix ../../shared-services/mpd.nix ../../shared-services/ympd.nix ../../shared-services/spotifyd.nix diff --git a/hosts/nuc/hardware-configuration.nix b/hosts/nuc/hardware-configuration.nix index ef0e54b..4355e9e 100644 --- a/hosts/nuc/hardware-configuration.nix +++ b/hosts/nuc/hardware-configuration.nix @@ -23,7 +23,7 @@ fsType = "vfat"; }; - fileSystems."/mnt" = + fileSystems."/mnt/hdd" = { device = "/dev/disk/by-uuid/ff18a6f9-ee3b-452c-8671-38b74508a74c"; fsType = "btrfs"; }; diff --git a/shared-services/desktop.nix b/shared-services/desktop.nix index f11fb04..dffae62 100644 --- a/shared-services/desktop.nix +++ b/shared-services/desktop.nix @@ -1,13 +1,7 @@ { pkgs, ... }: { - users.mutableUsers = false; - users.users.c3h = { - isNormalUser = true; - password = "c3h"; - extraGroups = [ "wheel" ]; - packages = with pkgs; [ chromium firefox mpv youtube-dl ]; - }; + users.users.c3h.packages = with pkgs; [ chromium firefox mpv youtube-dl ]; services.xserver = { enable = true; diff --git a/shared-services/nfs-client.nix b/shared-services/nfs-client.nix new file mode 100644 index 0000000..1659449 --- /dev/null +++ b/shared-services/nfs-client.nix @@ -0,0 +1,15 @@ +{ ... }: + +{ + 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" + ]; + }; +} diff --git a/shared-services/nfs-server.nix b/shared-services/nfs-server.nix deleted file mode 100644 index 8a6f8ca..0000000 --- a/shared-services/nfs-server.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ ... }: - -{ - 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 ]; -} diff --git a/shared-services/spotifyd.nix b/shared-services/spotifyd.nix index 7cf79ce..1988632 100644 --- a/shared-services/spotifyd.nix +++ b/shared-services/spotifyd.nix @@ -1,12 +1,10 @@ -{ ... }: +{ config, ... }: { services.spotifyd = { enable = true; - config = '' - zeroconf_port = 18572 - ''; + settings.zeroconf_port = 18572; }; - networking.firewall.allowedTCPPorts = [ 18572 ]; + networking.firewall.allowedTCPPorts = [ config.services.spotifyd.settings.zeroconf_port ]; }