From df9ce2d4e2d36a69f870c2fa0a657915e74e2ef0 Mon Sep 17 00:00:00 2001 From: reo101 Date: Mon, 13 Feb 2023 00:33:57 +0200 Subject: [PATCH] feat!(flake): update `homix` Update flake (`neovim-nightly-overlay` is fixed) Format all `.nix` files Unify package/module argument order: - `inputs`, `outputs`, `lib`, `pkgs`, `config`, ... Move Jellyfin config to a `NixOS` module (first one, yay) Add `direnv` to `reo101-shell` modules (was used, but not defined as wanted) - TODO: make it optional (module config options) --- flake.lock | 47 +++++--- flake.nix | 58 ++++----- lib/helpers.nix | 4 +- .../x86_64-linux/__template__/home.nix | 2 +- .../apavel-a01/configuration.nix | 6 +- .../x86_64-darwin/apavel-a01/home/apavel.nix | 2 +- .../aarch64-linux/cheetah/configuration.nix | 6 +- .../aarch64-linux/cheetah/home.nix | 22 ++-- .../__template__/configuration.nix | 2 +- .../x86_64-linux/homix/configuration.nix | 51 ++++---- .../homix/hardware-configuration.nix | 11 +- .../nixos/x86_64-linux/homix/home/reo101.nix | 7 +- modules/home-manager/reo101-shell.nix | 18 ++- modules/nixos/default.nix | 1 + modules/nixos/jellyfin.nix | 111 +++++++++--------- pkgs/swww/default.nix | 2 +- shell.nix | 2 +- 17 files changed, 194 insertions(+), 158 deletions(-) diff --git a/flake.lock b/flake.lock index b0e18c9..dc58c37 100644 --- a/flake.lock +++ b/flake.lock @@ -22,6 +22,22 @@ "type": "github" } }, + "diffz": { + "flake": false, + "locked": { + "lastModified": 1676154556, + "narHash": "sha256-foiZMt5GBbbLEZPPK/qgkjQ6FCj2rLPniaF8rC5Z56w=", + "owner": "ziglibs", + "repo": "diffz", + "rev": "f25b31c4f8d06bc134018133a2d57b6dcbb6941e", + "type": "github" + }, + "original": { + "owner": "ziglibs", + "repo": "diffz", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -215,11 +231,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1675657440, - "narHash": "sha256-UkEa4LKXLNglbn5U2o/zee9AePaVVzLkhe06rv6jtDg=", + "lastModified": 1676135764, + "narHash": "sha256-hsvokBMpst2PNY5s4kK5ioLUPgrZCFTmqzlAzWhg2tU=", "owner": "neovim", "repo": "neovim", - "rev": "6c39edaa7e5060cedfbbf61e88f4aad20fdff73d", + "rev": "3a5dddf24f9d4d8959194b0cd3c6a7dd0cbd73ae", "type": "github" }, "original": { @@ -236,11 +252,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1675671305, - "narHash": "sha256-AUcqYR+hZsGz0LCA+FNXejCEToLRceFXia4zMqxh2KE=", + "lastModified": 1676234956, + "narHash": "sha256-T9YgPMgos3N/2uOtJjnrcj6Q1EZMnB48DPXNGWJ53+c=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "3660ca973f7f9608855abc497626776745c701e3", + "rev": "00dbc7537c2012fabd1e414e2ca3314ce5281959", "type": "github" }, "original": { @@ -354,11 +370,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1675545634, - "narHash": "sha256-TbQeQcM5TA/wIho6xtzG+inUfiGzUXi8ewwttiQWYJE=", + "lastModified": 1676110339, + "narHash": "sha256-kOS/L8OOL2odpCOM11IevfHxcUeE0vnZUQ74EOiwXcs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0591d6b57bfeb55dfeec99a671843337bc2c3323", + "rev": "e5530aba13caff5a4f41713f1265b754dc2abfd8", "type": "github" }, "original": { @@ -505,11 +521,11 @@ ] }, "locked": { - "lastModified": 1675685322, - "narHash": "sha256-iQLyJcfDd5+mRF8b9sT4R/tLhwkTYOxKoaqgoAovlKo=", + "lastModified": 1676203669, + "narHash": "sha256-NfCgGW/7TtGo1zrqErLA6YfZ+Wp22VVZL4l0BdKDEeU=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "2c7f714a6c7fdc85289d3dc201510ea7396656b5", + "rev": "e833895bbdd7113885cbf4330601826cc17db8ab", "type": "github" }, "original": { @@ -543,6 +559,7 @@ }, "zls-overlay": { "inputs": { + "diffz": "diffz", "flake-utils": "flake-utils_3", "gitignore": "gitignore", "known-folders": "known-folders", @@ -553,11 +570,11 @@ "zig-overlay": "zig-overlay_2" }, "locked": { - "lastModified": 1675675529, - "narHash": "sha256-b9Pl7J46NR5SM7ZnNnOhHssJlJh1sAiz1jF5q/otso4=", + "lastModified": 1676154655, + "narHash": "sha256-6Qqjij5cgKkLyfnT0rFHhvSGu5NV1J+1eoTi6oI97kg=", "owner": "zigtools", "repo": "zls", - "rev": "1b3274aa9c4c79ece06427b1367d392b3849dfb0", + "rev": "7919da5054a6e6ac100097f762e7abe96628eef0", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 7a70915..d68e95d 100644 --- a/flake.nix +++ b/flake.nix @@ -64,8 +64,8 @@ , nix-on-droid , nix-darwin , home-manager - # , hardware - # , nix-colors + # , hardware + # , nix-colors , neovim-nightly-overlay , zig-overlay , zls-overlay @@ -93,7 +93,7 @@ ); # Apps (`nix run`) - apps = {}; + apps = { }; # Dev Shells (`nix develop`) devShells = forEachPkgs (pkgs: @@ -119,13 +119,13 @@ # Machines machines = recurseDir ./machines; - homeManagerMachines = machines.home-manager or {}; - nixDarwinMachines = machines.nix-darwin or {}; - nixOnDroidMachines = machines.nix-on-droid or {}; - nixosMachines = machines.nixos or {}; + homeManagerMachines = machines.home-manager or { }; + nixDarwinMachines = machines.nix-darwin or { }; + nixOnDroidMachines = machines.nix-on-droid or { }; + nixosMachines = machines.nixos or { }; # mkHost helpers - mkNixosHost = system: hostname: users: nixpkgs.lib.nixosSystem { + mkNixosHost = system: hostname: users: lib.nixosSystem { inherit system; modules = [ @@ -135,7 +135,7 @@ home-manager = { useGlobalPkgs = false; useUserPackages = true; - users = nixpkgs.lib.attrsets.genAttrs + users = lib.attrsets.genAttrs users (user: import ./machines/nixos/${system}/${hostname}/home/${user}.nix); @@ -183,7 +183,7 @@ home-manager = { useGlobalPkgs = false; useUserPackages = true; - users = nixpkgs.lib.attrsets.genAttrs + users = lib.attrsets.genAttrs users (user: import ./machines/nix-darwin/${system}/${hostname}/home/${user}.nix); @@ -208,21 +208,21 @@ createConfigurations = pred: mkHost: machines: - nixpkgs.lib.foldAttrs - (acc: x: acc) - [] - (builtins.attrValues - (builtins.mapAttrs - (system: hosts: - nixpkgs.lib.attrsets.filterAttrs - (host: config: config != null) - (builtins.mapAttrs - (host: config: - if (pred system host config) - then mkHost system host config - else null) - hosts)) - machines)); + lib.foldAttrs + (acc: x: acc) + [ ] + (builtins.attrValues + (builtins.mapAttrs + (system: hosts: + lib.attrsets.filterAttrs + (host: config: config != null) + (builtins.mapAttrs + (host: config: + if (pred system host config) + then mkHost system host config + else null) + hosts)) + machines)); # Final configurations nixosConfigurations = @@ -236,8 +236,8 @@ system host (builtins.map - (nixpkgs.lib.strings.removeSuffix ".nix") - (builtins.attrNames (config."home" or {})))) + (lib.strings.removeSuffix ".nix") + (builtins.attrNames (config."home" or { })))) nixosMachines; nixOnDroidConfigurations = @@ -263,8 +263,8 @@ system host (builtins.map - (nixpkgs.lib.strings.removeSuffix ".nix") - (builtins.attrNames (config."home" or {})))) + (lib.strings.removeSuffix ".nix") + (builtins.attrNames (config."home" or { })))) nixDarwinMachines; homeConfigurations = diff --git a/lib/helpers.nix b/lib/helpers.nix index f420c4b..8defe5b 100644 --- a/lib/helpers.nix +++ b/lib/helpers.nix @@ -9,8 +9,8 @@ rec { mapAttrs (file: type: if type == "directory" - then recurseDir "${dir}/${file}" - else type + then recurseDir "${dir}/${file}" + else type ) (builtins.readDir dir); diff --git a/machines/home-manager/x86_64-linux/__template__/home.nix b/machines/home-manager/x86_64-linux/__template__/home.nix index fbb947d..4df5ed4 100644 --- a/machines/home-manager/x86_64-linux/__template__/home.nix +++ b/machines/home-manager/x86_64-linux/__template__/home.nix @@ -1,7 +1,7 @@ # This is your home-manager configuration file # Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) -{ inputs, outputs, lib, config, pkgs, ... }: { +{ inputs, outputs, lib, pkgs, config, ... }: { # You can import other home-manager modules here imports = [ # If you want to use modules your own flake exports (from modules/home-manager): diff --git a/machines/nix-darwin/x86_64-darwin/apavel-a01/configuration.nix b/machines/nix-darwin/x86_64-darwin/apavel-a01/configuration.nix index 1e17424..d3ac5be 100644 --- a/machines/nix-darwin/x86_64-darwin/apavel-a01/configuration.nix +++ b/machines/nix-darwin/x86_64-darwin/apavel-a01/configuration.nix @@ -1,7 +1,7 @@ -{ inputs, outputs, lib, config, pkgs, ... }: +{ inputs, outputs, lib, pkgs, config, ... }: { - environment.systemPackages = with pkgs; []; + environment.systemPackages = with pkgs; [ ]; # environment.darwinConfig = builtins.toString ./configuration.nix; @@ -11,7 +11,7 @@ nix.package = pkgs.nix; # Create /etc/zshrc that loads the nix-darwin environment. - programs.zsh.enable = true; # default shell on catalina + programs.zsh.enable = true; # default shell on catalina # Fonts fonts.fontDir.enable = true; diff --git a/machines/nix-darwin/x86_64-darwin/apavel-a01/home/apavel.nix b/machines/nix-darwin/x86_64-darwin/apavel-a01/home/apavel.nix index 52b54fb..d68d336 100644 --- a/machines/nix-darwin/x86_64-darwin/apavel-a01/home/apavel.nix +++ b/machines/nix-darwin/x86_64-darwin/apavel-a01/home/apavel.nix @@ -1,4 +1,4 @@ -{ inputs, lib, config, pkgs, ... }: +{ inputs, outputs, lib, pkgs, config, ... }: { home = { diff --git a/machines/nix-on-droid/aarch64-linux/cheetah/configuration.nix b/machines/nix-on-droid/aarch64-linux/cheetah/configuration.nix index 08164e6..5cd85b2 100644 --- a/machines/nix-on-droid/aarch64-linux/cheetah/configuration.nix +++ b/machines/nix-on-droid/aarch64-linux/cheetah/configuration.nix @@ -1,7 +1,7 @@ -{ inputs, outputs, lib, config, pkgs, ... }: +{ inputs, outputs, lib, pkgs, config, ... }: { - environment.packages = with pkgs; []; + environment.packages = with pkgs; [ ]; # Backup etc files instead of failing to activate generation if a file already exists in /etc environment.etcBackupExtension = ".bak"; @@ -30,7 +30,7 @@ }; fontPath = "share/fonts/truetype/NerdFonts/Fira Code Regular Nerd Font Complete Mono.ttf"; in - "${firacode}/${fontPath}"; + "${firacode}/${fontPath}"; home-manager = { config = ./home.nix; diff --git a/machines/nix-on-droid/aarch64-linux/cheetah/home.nix b/machines/nix-on-droid/aarch64-linux/cheetah/home.nix index 6c95bed..d8f2bff 100644 --- a/machines/nix-on-droid/aarch64-linux/cheetah/home.nix +++ b/machines/nix-on-droid/aarch64-linux/cheetah/home.nix @@ -1,4 +1,4 @@ -{ inputs, lib, config, pkgs, ... }: +{ inputs, outputs, lib, pkgs, config, ... }: { # Home Manager needs a bit of information about you and the @@ -84,12 +84,12 @@ # neovimRcContent = ""; extraPackages = with pkgs; [ - tree-sitter - rnix-lsp - # sumneko-lua-language-server - # stylua - # texlab - # rust-analyzer + tree-sitter + rnix-lsp + # sumneko-lua-language-server + # stylua + # texlab + # rust-analyzer ]; }; @@ -279,7 +279,7 @@ }; custom.local = { - shell = ["zsh" "-d" "-f"]; + shell = [ "zsh" "-d" "-f" ]; when = ''[[ -z "$SSH_CLIENT" ]] && [[ `whoami` != "root" ]]''; format = "[$symbol$output]($style)[@](bold yellow)"; command = "whoami"; @@ -288,7 +288,7 @@ }; custom.local_root = { - shell = ["zsh" "-d" "-f"]; + shell = [ "zsh" "-d" "-f" ]; when = ''[[ -z "$SSH_CLIENT" ]] && [[ `whoami` == "root" ]]''; format = "[ $output ]($style)[@](bold yellow)"; command = "whoami"; @@ -296,7 +296,7 @@ }; custom.ssh = { - shell = ["zsh" "-d" "-f"]; + shell = [ "zsh" "-d" "-f" ]; when = ''[[ -n "$SSH_CLIENT" ]] && [[ `whoami` != "root" ]]''; format = "[ $symbol$output ]($style)[@](bold yellow)"; command = "whoami"; @@ -306,7 +306,7 @@ }; custom.ssh_root = { - shell = ["zsh" "-d" "-f"]; + shell = [ "zsh" "-d" "-f" ]; when = ''[[ -n "$SSH_CLIENT" ]] && [[ `whoami` == "root" ]]''; format = "[ $symbol$output ]($style)[@](bold yellow)"; command = "whoami"; diff --git a/machines/nixos/x86_64-linux/__template__/configuration.nix b/machines/nixos/x86_64-linux/__template__/configuration.nix index 536c1f5..30d18c8 100644 --- a/machines/nixos/x86_64-linux/__template__/configuration.nix +++ b/machines/nixos/x86_64-linux/__template__/configuration.nix @@ -1,7 +1,7 @@ # This is your system's configuration file. # Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) -{ inputs, outputs, lib, config, pkgs, ... }: { +{ inputs, outputs, lib, pkgs, config, ... }: { # You can import other NixOS modules here imports = [ # If you want to use modules your own flake exports (from modules/nixos): diff --git a/machines/nixos/x86_64-linux/homix/configuration.nix b/machines/nixos/x86_64-linux/homix/configuration.nix index 2aa53c2..81d55f0 100644 --- a/machines/nixos/x86_64-linux/homix/configuration.nix +++ b/machines/nixos/x86_64-linux/homix/configuration.nix @@ -2,14 +2,13 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ inputs, outputs, config, pkgs, ... }: +{ inputs, outputs, lib, pkgs, config, ... }: { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - inputs.home-manager.nixosModules.home-manager - ]; + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; ### Set boot options boot = { @@ -61,14 +60,27 @@ nix = { package = pkgs.nixFlakes; + + # Enable flakes, the new `nix` commands and better support for flakes in it extraOptions = '' experimental-features = nix-command flakes repl-flake ''; + + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + registry = lib.mapAttrs (_: value: { flake = value; }) inputs; + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + settings = { trusted-users = [ "root" "reo101" ]; + + # Add nix-community and rix101 cachix caches substituters = [ "https://rix101.cachix.org" "https://nix-community.cachix.org" @@ -80,7 +92,11 @@ }; }; - nixpkgs.config.allowUnfree = true; + nixpkgs = { + config = { + allowUnfree = true; + }; + }; ### NVIDIA services.xserver = { @@ -165,11 +181,13 @@ useUserPackages = true; useGlobalPkgs = false; - extraSpecialArgs = { inherit inputs outputs; } ; + extraSpecialArgs = { inherit inputs outputs; }; }; ### Enable plymouth (bootscreen customizations) - boot.plymouth.enable = true; + boot.plymouth = { + enable = true; + }; # List packages installed in system profile. To search, run: # $ nix search wget @@ -182,19 +200,8 @@ ]; ### Jellyfin - virtualisation.oci-containers.containers."jellyfin" = { - autoStart = true; - image = "docker.io/jellyfin/jellyfin:latest"; - volumes = [ - "/var/cache/jellyfin/config:/config" - "/var/cache/jellyfin/cache:/cache" - "/var/log/jellyfin:/log" - "/media:/media:ro" - ]; - ports = [ "8096:8096" ]; - environment = { - JELLYFIN_LOG_DIR = "/log"; - }; + reo101.jellyfin = { + enable = true; }; ### Transmission diff --git a/machines/nixos/x86_64-linux/homix/hardware-configuration.nix b/machines/nixos/x86_64-linux/homix/hardware-configuration.nix index 37b4356..44d6101 100644 --- a/machines/nixos/x86_64-linux/homix/hardware-configuration.nix +++ b/machines/nixos/x86_64-linux/homix/hardware-configuration.nix @@ -1,11 +1,12 @@ # 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, ... }: +{ lib, pkgs, config, modulesPath, ... }: { imports = - [ (modulesPath + "/installer/scan/not-detected.nix") + [ + (modulesPath + "/installer/scan/not-detected.nix") ]; boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; @@ -14,12 +15,14 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/7f720420-41d8-4efd-bdf2-f445e52db998"; + { + device = "/dev/disk/by-uuid/7f720420-41d8-4efd-bdf2-f445e52db998"; fsType = "ext4"; }; fileSystems."/boot" = - { device = "/dev/disk/by-uuid/5BF4-74EF"; + { + device = "/dev/disk/by-uuid/5BF4-74EF"; fsType = "vfat"; }; diff --git a/machines/nixos/x86_64-linux/homix/home/reo101.nix b/machines/nixos/x86_64-linux/homix/home/reo101.nix index c267646..f1bf9a6 100644 --- a/machines/nixos/x86_64-linux/homix/home/reo101.nix +++ b/machines/nixos/x86_64-linux/homix/home/reo101.nix @@ -1,4 +1,4 @@ -{ inputs, outputs, lib, config, pkgs, ... }: +{ inputs, outputs, lib, pkgs, config, ... }: { imports = builtins.attrValues outputs.homeManagerModules ++ [ @@ -7,7 +7,7 @@ nixpkgs = { overlays = builtins.attrValues outputs.overlays ++ [ - # inputs.neovim-nightly-overlay.overlay + inputs.neovim-nightly-overlay.overlay inputs.zig-overlay.overlays.default inputs.wired.overlays.default ]; @@ -29,6 +29,7 @@ river # window manager swww # wallpaper deamon # wired-notify # dunst on wayland + waybar # status bar ## Terminals wezterm @@ -99,7 +100,7 @@ RestartSec = 5; }; Install = { - WantedBy = ["graphical-session.target"]; + WantedBy = [ "graphical-session.target" ]; }; }; diff --git a/modules/home-manager/reo101-shell.nix b/modules/home-manager/reo101-shell.nix index d343e3d..f8f240e 100644 --- a/modules/home-manager/reo101-shell.nix +++ b/modules/home-manager/reo101-shell.nix @@ -1,8 +1,10 @@ { lib, pkgs, config, ... }: + with lib; let cfg = config.reo101.shell; -in { +in +{ imports = [ ]; @@ -15,10 +17,10 @@ in { config = mkIf cfg.enable { home.packages = with pkgs; [ - # Shell zsh starship zoxide + direnv ]; programs.zsh = { @@ -216,7 +218,7 @@ in { }; custom.local = { - shell = ["zsh" "-d" "-f"]; + shell = [ "zsh" "-d" "-f" ]; when = ''[[ -z "$SSH_CLIENT" ]] && [[ `whoami` != "root" ]]''; format = "[$symbol$output]($style)[@](bold yellow)"; command = "whoami"; @@ -225,7 +227,7 @@ in { }; custom.local_root = { - shell = ["zsh" "-d" "-f"]; + shell = [ "zsh" "-d" "-f" ]; when = ''[[ -z "$SSH_CLIENT" ]] && [[ `whoami` == "root" ]]''; format = "[ $output ]($style)[@](bold yellow)"; command = "whoami"; @@ -233,7 +235,7 @@ in { }; custom.ssh = { - shell = ["zsh" "-d" "-f"]; + shell = [ "zsh" "-d" "-f" ]; when = ''[[ -n "$SSH_CLIENT" ]] && [[ `whoami` != "root" ]]''; format = "[ $symbol$output ]($style)[@](bold yellow)"; command = "whoami"; @@ -243,7 +245,7 @@ in { }; custom.ssh_root = { - shell = ["zsh" "-d" "-f"]; + shell = [ "zsh" "-d" "-f" ]; when = ''[[ -n "$SSH_CLIENT" ]] && [[ `whoami` == "root" ]]''; format = "[ $symbol$output ]($style)[@](bold yellow)"; command = "whoami"; @@ -253,4 +255,8 @@ in { }; }; }; + + meta = { + maintainers = with lib.maintainers; [ reo101 ]; + }; } diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index bec6184..beb65ef 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -4,4 +4,5 @@ { # List your module files here # my-module = import ./my-module.nix; + jellyfin = import ./jellyfin.nix; } diff --git a/modules/nixos/jellyfin.nix b/modules/nixos/jellyfin.nix index db79b13..70505ee 100644 --- a/modules/nixos/jellyfin.nix +++ b/modules/nixos/jellyfin.nix @@ -1,60 +1,61 @@ -{ config, nixpkgs, ... }: +{ lib, pkgs, config, ... }: -### Jellyfin -# nixpkgs.config.packageOverrides = pkgs: { -# arc = import (builtins.fetchTarball { -# url = "https://github.com/arcnmx/nixexprs/archive/1a2ca1935e243383dfc8dc89f88f55678d33fcd4.tar.gz"; -# sha256 = "sha256:0zjy3916sxxk7ds763dmmbzfdc46wdlw10m5dg6kkpqi2i81109f"; -# }) { -# inherit pkgs; -# }; -# vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; -# }; - -# hardware.nvidia.package = pkgs.arc.packages.nvidia-patch.override { -# nvidia_x11 = config.boot.kernelPackages.nvidiaPackages.stable; -# }; - -# hardware.opengl = { -# enable = true; -# extraPackages = with pkgs; [ -# intel-media-driver -# vaapiIntel -# vaapiVdpau -# libvdpau-va-gl -# intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in) -# ]; -# }; - -virtualisation.oci-containers.containers."jellyfin" = { - autoStart = true; - image = "docker.io/jellyfin/jellyfin:latest"; - volumes = [ - "/var/cache/jellyfin/config:/config" - "/var/cache/jellyfin/cache:/cache" - "/var/log/jellyfin:/log" - "/media:/media:ro" +with lib; +let + cfg = config.reo101.jellyfin; +in +{ + imports = [ ]; - ports = [ "8096:8096" ]; - environment = { - JELLYFIN_LOG_DIR = "/log"; + + options = { + reo101.jellyfin = { + enable = mkEnableOption "reo101 Jellyfin config"; + image = mkOption { + type = types.strMatching ".+/.+:.+"; + default = "docker.io/jellyfin/jellyfin:latest"; + defaultText = "docker.io/jellyfin/jellyfin:latest"; + description = '' + The Docker image for Jellyfin + ''; + }; + volumes = mkOption { + type = types.listOf (types.strMatching ".+:.+"); + default = [ + "/var/cache/jellyfin/config:/config" + "/var/cache/jellyfin/cache:/cache" + "/var/log/jellyfin:/log" + "/media:/media:ro" + ]; + description = '' + The volumes the Jellyfin container should bind to + ''; + }; + ports = mkOption { + type = types.listOf (types.strMatching ".+:.+"); + default = [ + "8096:8096" + ]; + description = '' + The ports the Jellyfin container should bind to + ''; + }; + }; }; -}; -## services.jellyfin.enable = true; - -## systemd.services."jellyfin".serviceConfig = { -## DeviceAllow = pkgs.lib.mkForce [ -## "char-drm rw" -## "char-nvidia-frontend rw" -## "char-nvidia-uvm rw" -## ]; -## PrivateDevices = pkgs.lib.mkForce true; -## RestrictAddressFamilies = pkgs.lib.mkForce [ -## "AF_UNIX" -## "AF_NETLINK" -## "AF_INET" -## "AF_INET6" -## ]; -## }; + config = mkIf cfg.enable { + virtualisation.oci-containers.containers."jellyfin" = { + autoStart = true; + image = cfg.image; + volumes = cfg.volumes; + ports = cfg.ports; + environment = { + JELLYFIN_LOG_DIR = "/log"; + }; + }; + }; + meta = { + maintainers = with lib.maintainers; [ reo101 ]; + }; +} diff --git a/pkgs/swww/default.nix b/pkgs/swww/default.nix index bdc4734..64e9470 100644 --- a/pkgs/swww/default.nix +++ b/pkgs/swww/default.nix @@ -27,6 +27,6 @@ rustPlatform.buildRustPackage rec { description = "A Solution to your Wayland Wallpaper Woes"; homepage = "https://github.com/Horus645/swww"; license = licenses.gpl3; - maintainers = [ maintainers.reo101 ]; + maintainers = with maintainers; [ reo101 ]; }; } diff --git a/shell.nix b/shell.nix index 105a492..54e9d5a 100644 --- a/shell.nix +++ b/shell.nix @@ -1,6 +1,6 @@ # Shell for bootstrapping flake-enabled nix and other tooling +# If pkgs is not defined, instanciate nixpkgs from locked commit { pkgs ? - # If pkgs is not defined, instanciate nixpkgs from locked commit (import ./nixpkgs.nix) { } , ... }: {