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)
This commit is contained in:
reo101 2023-02-13 00:33:57 +02:00
parent 6a0898753d
commit df9ce2d4e2
Signed by: reo101
GPG key ID: 675AA7EF13964ACB
17 changed files with 194 additions and 158 deletions

View file

@ -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": {

View file

@ -125,7 +125,7 @@
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,13 +208,13 @@
createConfigurations =
pred: mkHost: machines:
nixpkgs.lib.foldAttrs
lib.foldAttrs
(acc: x: acc)
[ ]
(builtins.attrValues
(builtins.mapAttrs
(system: hosts:
nixpkgs.lib.attrsets.filterAttrs
lib.attrsets.filterAttrs
(host: config: config != null)
(builtins.mapAttrs
(host: config:
@ -236,7 +236,7 @@
system
host
(builtins.map
(nixpkgs.lib.strings.removeSuffix ".nix")
(lib.strings.removeSuffix ".nix")
(builtins.attrNames (config."home" or { }))))
nixosMachines;
@ -263,7 +263,7 @@
system
host
(builtins.map
(nixpkgs.lib.strings.removeSuffix ".nix")
(lib.strings.removeSuffix ".nix")
(builtins.attrNames (config."home" or { }))))
nixDarwinMachines;

View file

@ -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):

View file

@ -1,4 +1,4 @@
{ inputs, outputs, lib, config, pkgs, ... }:
{ inputs, outputs, lib, pkgs, config, ... }:
{
environment.systemPackages = with pkgs; [ ];

View file

@ -1,4 +1,4 @@
{ inputs, lib, config, pkgs, ... }:
{ inputs, outputs, lib, pkgs, config, ... }:
{
home = {

View file

@ -1,4 +1,4 @@
{ inputs, outputs, lib, config, pkgs, ... }:
{ inputs, outputs, lib, pkgs, config, ... }:
{
environment.packages = with pkgs; [ ];

View file

@ -1,4 +1,4 @@
{ inputs, lib, config, pkgs, ... }:
{ inputs, outputs, lib, pkgs, config, ... }:
{
# Home Manager needs a bit of information about you and the

View file

@ -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):

View file

@ -2,13 +2,12 @@
# 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.
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
inputs.home-manager.nixosModules.home-manager
];
### Set boot options
@ -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 = {
@ -169,7 +185,9 @@
};
### 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

View file

@ -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";
};

View file

@ -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

View file

@ -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 = {
@ -253,4 +255,8 @@ in {
};
};
};
meta = {
maintainers = with lib.maintainers; [ reo101 ];
};
}

View file

@ -4,4 +4,5 @@
{
# List your module files here
# my-module = import ./my-module.nix;
jellyfin = import ./jellyfin.nix;
}

View file

@ -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; };
# };
with lib;
let
cfg = config.reo101.jellyfin;
in
{
imports = [
];
# 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 = [
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"
];
ports = [ "8096:8096" ];
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
'';
};
};
};
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";
};
};
};
## 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"
## ];
## };
meta = {
maintainers = with lib.maintainers; [ reo101 ];
};
}

View file

@ -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 ];
};
}

View file

@ -1,6 +1,6 @@
# Shell for bootstrapping flake-enabled nix and other tooling
{ pkgs ?
# If pkgs is not defined, instanciate nixpkgs from locked commit
{ pkgs ?
(import ./nixpkgs.nix) { }
, ...
}: {