diff options
| author | Tim Keller <tjk@tjkeller.xyz> | 2025-12-09 22:29:31 -0600 |
|---|---|---|
| committer | Tim Keller <tjk@tjkeller.xyz> | 2025-12-09 22:29:31 -0600 |
| commit | 4484d67427d620c0cf3e85897c6fc84b4898939a (patch) | |
| tree | e4bb76c1d4a87f4049b3c045263f8fc424f6e7b8 | |
| parent | 6d6a802a5fe7257718e2a748692fb17889b500db (diff) | |
| parent | 3a9347935a837a59bfe874f85b12c18e5fd697f9 (diff) | |
| download | nixos-4484d67427d620c0cf3e85897c6fc84b4898939a.tar.xz nixos-4484d67427d620c0cf3e85897c6fc84b4898939a.zip | |
| -rw-r--r-- | flake.nix | 84 | ||||
| -rw-r--r-- | hosts/piframe/configuration.nix | 34 | ||||
| -rw-r--r-- | hosts/piframe/hardware-configuration.nix | 24 | ||||
| -rw-r--r-- | pkgs/default.nix | 1 | ||||
| -rw-r--r-- | pkgs/immich-frame/default.nix | 46 | ||||
| -rwxr-xr-x | rebuild | 2 |
6 files changed, 152 insertions, 39 deletions
@@ -18,44 +18,48 @@ rec { }; }; - outputs = { nixpkgs, ... }@inputs : - let - system = "x86_64-linux"; - extLib = nixpkgs.lib.extend (final: prev: import ./lib); - mkNixosConfiguration = hostname: nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { - inherit inputs; - inherit hostname; - lib = extLib; - }; - modules = [ - ./hosts/${hostname}/configuration.nix - ./hosts/${hostname}/hardware-configuration.nix - ./archetypes - ./nixos - ./pkgs - ./users - inputs.sops-nix.nixosModules.sops - inputs.home-manager.nixosModules.home-manager { - home-manager = { - backupFileExtension = "backup"; # In case file is overwritten - useGlobalPkgs = true; - useUserPackages = true; - sharedModules = [ - inputs.arkenfox.hmModules.arkenfox - ./home-manager - ]; - }; - } - ]; + outputs = { nixpkgs, ... }@inputs: let + extLib = nixpkgs.lib.extend (final: prev: import ./lib); + mkNixosConfiguration = system: hostname: nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs; + inherit hostname; + lib = extLib; }; - in { - nixosConfigurations = builtins.listToAttrs (map (hostname: { - name = hostname; - value = mkNixosConfiguration hostname; - }) [ - # Configured system hostnames go here + modules = [ + ./hosts/${hostname}/configuration.nix + ./hosts/${hostname}/hardware-configuration.nix + ./archetypes + ./nixos + ./pkgs + ./users + inputs.sops-nix.nixosModules.sops + inputs.home-manager.nixosModules.home-manager { + home-manager = { + backupFileExtension = "backup"; # In case file is overwritten + useGlobalPkgs = true; + useUserPackages = true; + sharedModules = [ + inputs.arkenfox.hmModules.arkenfox + ./home-manager + ]; + }; + } + ]; + }; + mkNixosConfigurations = hostsBySystem: builtins.listToAttrs ( + builtins.concatMap (system: + map (host: { + name = host; + value = mkNixosConfiguration system host; + }) hostsBySystem.${system} + ) (builtins.attrNames hostsBySystem) + ); + in { + # Configured system hostnames go here under their respective system architecture + nixosConfigurations = mkNixosConfigurations { + x86_64-linux = [ "T495" "X230" "flex-wg-router" @@ -63,6 +67,10 @@ rec { "libreX60" "optiplex" "poweredge" - ]); + ]; + aarch64-linux = [ + "piframe" + ]; }; + }; } diff --git a/hosts/piframe/configuration.nix b/hosts/piframe/configuration.nix new file mode 100644 index 0000000..1572512 --- /dev/null +++ b/hosts/piframe/configuration.nix @@ -0,0 +1,34 @@ +{ config, lib, pkgs, ... }: { + # Use the extlinux boot loader. (NixOS wants to enable GRUB by default) + boot.loader.grub.enable = false; + # Enables the generation of /boot/extlinux/extlinux.conf + boot.loader.generic-extlinux-compatible.enable = true; + + # xserver + services.xserver = { + enable = true; + enableTearFree = true; + }; + + # Enable user timmy + _users.timmy = { + enable = true; + autologin.enable = true; + wifi.enable = true; + }; + + # Configure home + home-manager.users.timmy = { + home.file.".xinitrc" = { + text = '' + #!/bin/sh + exec pix.py + '' + }; + programs.zsh.profileExtra = '' + startx + ''; + }; + + system.stateVersion = "25.11"; +} diff --git a/hosts/piframe/hardware-configuration.nix b/hosts/piframe/hardware-configuration.nix new file mode 100644 index 0000000..ceb755a --- /dev/null +++ b/hosts/piframe/hardware-configuration.nix @@ -0,0 +1,24 @@ +# 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" "usbhid" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888"; + fsType = "ext4"; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index 5ac3a76..aae0751 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,6 +1,7 @@ { pkgs, ... }: { nixpkgs.overlays = with pkgs; [ (final: prev: { + immich-frame = (callPackage ./immich-frame {}); lowbat = (callPackage ./lowbat {}); workcentre-7800-series = (callPackage ./xerox-workcentre-7800-series-driver {}); unclutter-desktop-entry = (callPackage ./unclutter-desktop-entry {}); diff --git a/pkgs/immich-frame/default.nix b/pkgs/immich-frame/default.nix new file mode 100644 index 0000000..2343019 --- /dev/null +++ b/pkgs/immich-frame/default.nix @@ -0,0 +1,46 @@ +{ + fetchgit, + pkgs, + python3Packages, + buildNpmPackage, +}: + +let + version = "0.3.0"; + src = fetchgit { + url = "https://git.tjkeller.xyz/immich-frame"; + tag = "v${version}"; + hash = "sha256-zHpbjaa0PH82adsz1kXbJs2FZscbQQmoZTFw63ffuso="; + }; + + frontend = buildNpmPackage { + inherit version src; + pname = "immich-frame-frontend"; + + npmBuildScript = [ "build" ]; + npmDepsHash = "sha256-DGQlzgQoRCrYp6Y+WnDmG/QE92v6E3MT9y0bj8lBTfc="; + + installPhase = '' + mkdir -p $out + cp -R dist $out/ + ''; + }; +in python3Packages.buildPythonApplication { + inherit version src; + pname = "immich-frame"; + + makeWrapperArgs = [ "--set" "IMMICH_FRAME_STATIC_WEB_ASSETS" "${frontend}/dist" ]; + + pyproject = true; + build-system = with python3Packages; [ setuptools ]; + propagatedBuildInputs = with python3Packages; [ + flask + flask-cors # DEBUG + flask-socketio + numpy + pillow + pygame + pyopengl + requests + ]; +} @@ -1,2 +1,2 @@ #!/bin/sh -nixos-rebuild switch --use-remote-sudo --flake "$(dirname "$0")/#$(hostname)" $@ +nixos-rebuild switch --sudo --flake "$(dirname "$0")/#$(hostname)" $@ |
