diff --git a/flake.lock b/flake.lock index ebd7e8a..55ae5f8 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,26 @@ { "nodes": { + "agenix": { + "inputs": { + "darwin": "darwin", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "systems": "systems" + }, + "locked": { + "lastModified": 1715290355, + "narHash": "sha256-2T7CHTqBXJJ3ZC6R/4TXTcKoXWHcvubKNj9SfomURnw=", + "owner": "ryantm", + "repo": "agenix", + "rev": "8d37c5bdeade12b6479c85acd133063ab53187a0", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, "base16-schemes": { "flake": false, "locked": { @@ -16,9 +37,31 @@ "type": "github" } }, + "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, "flake-utils": { "inputs": { - "systems": "systems" + "systems": "systems_2" }, "locked": { "lastModified": 1705309234, @@ -35,6 +78,27 @@ } }, "home-manager": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703113217, + "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { "inputs": { "nixpkgs": [ "nixpkgs" @@ -76,15 +140,15 @@ }, "nixpkgs": { "locked": { - "lastModified": 1714076141, - "narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=", - "owner": "nixos", + "lastModified": 1703013332, + "narHash": "sha256-+tFNwMvlXLbJZXiMHqYq77z/RfmpfpiI3yjL6o/Zo9M=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856", + "rev": "54aac082a4d9bb5bbc5c4e899603abfb76a3f6d6", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" @@ -122,6 +186,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1714076141, + "narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1707268954, "narHash": "sha256-2en1kvde3cJVc3ZnTy8QeD2oKcseLFjYPLKhIGDanQ0=", @@ -139,9 +219,10 @@ }, "root": { "inputs": { - "home-manager": "home-manager", + "agenix": "agenix", + "home-manager": "home-manager_2", "nix-colors": "nix-colors", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable", "ros": "ros" } @@ -149,7 +230,7 @@ "ros": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1713569614, @@ -179,6 +260,21 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 9d685f6..f11c3bf 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,7 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; ros.url = "github:lopsided98/nix-ros-overlay"; + agenix.url = "github:ryantm/agenix"; # Shameless plug: looking for a way to nixify your themes and make # everything match nicely? Try nix-colors! @@ -24,6 +25,8 @@ self, nixpkgs, home-manager, + ros, + agenix, ... } @ inputs: let inherit (self) outputs; @@ -83,6 +86,17 @@ ./nixos/zerotier.nix ]; }; + hearth = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs outputs; + hostname = "hearth"; + }; + modules = [ + ./nixos/configuration.nix + ./nixos/home-assistant.nix + #./nixos/zerotier.nix + ]; + }; }; # Standalone home-manager configuration entrypoint diff --git a/nixos/hardware/hearth.nix b/nixos/hardware/hearth.nix new file mode 100644 index 0000000..a1e1dd3 --- /dev/null +++ b/nixos/hardware/hearth.nix @@ -0,0 +1,39 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/50ac51e9-5ac3-4f11-ae92-f3d43b5b602e"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/F953-8DA5"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/067ac10e-d118-4e8c-bbe8-01ac99065024"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nixos/home-assistant.nix b/nixos/home-assistant.nix new file mode 100644 index 0000000..e5edab0 --- /dev/null +++ b/nixos/home-assistant.nix @@ -0,0 +1,75 @@ +{ config, pkgs, lib, ... }: + +{ + + services.home-assistant = { + enable = true; + extraComponents = [ + "default_config" + "tplink" + "met" + "esphome" + "etherscan" + "recorder" + "history" + "history_stats" + "zha" + "system_health" + "ibeacon" + "govee_ble" + "systemmonitor" + "dialogflow" + "automation" + "device_automation" + "androidtv" + "rhasspy" + "scene" + "script" + "openweathermap" + ]; + configWritable = true; + config = { + homeassistant = { + name = "${specialArgs.hostname}"; + unit_system = "metric"; + time_zone = "America/Halifax"; + auth_providers = [ + { + type = "trusted_networks"; + trusted_networks = [ + "192.168.0.0/24" + "127.0.0.1" + ]; + allow_bypass_login = true; + } + { + type = "homeassistant"; + } + ]; + }; + automation = "!include automations.yaml"; + scene = "!include scenes.yaml"; + frontend = { + themes = "!include_dir_merge_named themes"; + }; + http = {}; + history = {}; + }; + }; + #Break touchscreen support + #${pkgs.wlr-randr}/bin/wlr-randr --output eDP-1 --transform 90 # Adjust command as needed + services.cage = { + enable = true; + user = "kiosk"; + extraArguments = [ "-d" "-s" ]; + program = "${pkgs.writeScriptBin "start-cage-app" '' + #!/usr/bin/env bash + export CHROMIUM_FLAGS="--touch-devices=10 --enable-pinch" + exec ${pkgs.chromium}/bin/chromium --force-dark-mode --kiosk http://127.0.0.1:8123 + ''}/bin/start-cage-app"; + }; + users.users.kiosk = { + isNormalUser = true; + }; + +} diff --git a/nixos/zerotier.nix b/nixos/zerotier.nix index d695271..5c33581 100644 --- a/nixos/zerotier.nix +++ b/nixos/zerotier.nix @@ -15,5 +15,8 @@ in { services.avahi.publish.workstation = true; # ADDED TO DESKTOP MACHINES services.zerotierone.enable = true; - services.zerotierone.joinNetworks = [ "e04fa485ed2a4dc4" ]; # ZT NETWORK ID + + #Don't join zerotier if I'm testing in a VM + if !(options.virtualisation ? qemu) then + services.zerotierone.joinNetworks = [ "e04fa485ed2a4dc4" ]; }