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" "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-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -215,11 +231,11 @@
}, },
"locked": { "locked": {
"dir": "contrib", "dir": "contrib",
"lastModified": 1675657440, "lastModified": 1676135764,
"narHash": "sha256-UkEa4LKXLNglbn5U2o/zee9AePaVVzLkhe06rv6jtDg=", "narHash": "sha256-hsvokBMpst2PNY5s4kK5ioLUPgrZCFTmqzlAzWhg2tU=",
"owner": "neovim", "owner": "neovim",
"repo": "neovim", "repo": "neovim",
"rev": "6c39edaa7e5060cedfbbf61e88f4aad20fdff73d", "rev": "3a5dddf24f9d4d8959194b0cd3c6a7dd0cbd73ae",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -236,11 +252,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1675671305, "lastModified": 1676234956,
"narHash": "sha256-AUcqYR+hZsGz0LCA+FNXejCEToLRceFXia4zMqxh2KE=", "narHash": "sha256-T9YgPMgos3N/2uOtJjnrcj6Q1EZMnB48DPXNGWJ53+c=",
"owner": "nix-community", "owner": "nix-community",
"repo": "neovim-nightly-overlay", "repo": "neovim-nightly-overlay",
"rev": "3660ca973f7f9608855abc497626776745c701e3", "rev": "00dbc7537c2012fabd1e414e2ca3314ce5281959",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -354,11 +370,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1675545634, "lastModified": 1676110339,
"narHash": "sha256-TbQeQcM5TA/wIho6xtzG+inUfiGzUXi8ewwttiQWYJE=", "narHash": "sha256-kOS/L8OOL2odpCOM11IevfHxcUeE0vnZUQ74EOiwXcs=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0591d6b57bfeb55dfeec99a671843337bc2c3323", "rev": "e5530aba13caff5a4f41713f1265b754dc2abfd8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -505,11 +521,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1675685322, "lastModified": 1676203669,
"narHash": "sha256-iQLyJcfDd5+mRF8b9sT4R/tLhwkTYOxKoaqgoAovlKo=", "narHash": "sha256-NfCgGW/7TtGo1zrqErLA6YfZ+Wp22VVZL4l0BdKDEeU=",
"owner": "mitchellh", "owner": "mitchellh",
"repo": "zig-overlay", "repo": "zig-overlay",
"rev": "2c7f714a6c7fdc85289d3dc201510ea7396656b5", "rev": "e833895bbdd7113885cbf4330601826cc17db8ab",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -543,6 +559,7 @@
}, },
"zls-overlay": { "zls-overlay": {
"inputs": { "inputs": {
"diffz": "diffz",
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_3",
"gitignore": "gitignore", "gitignore": "gitignore",
"known-folders": "known-folders", "known-folders": "known-folders",
@ -553,11 +570,11 @@
"zig-overlay": "zig-overlay_2" "zig-overlay": "zig-overlay_2"
}, },
"locked": { "locked": {
"lastModified": 1675675529, "lastModified": 1676154655,
"narHash": "sha256-b9Pl7J46NR5SM7ZnNnOhHssJlJh1sAiz1jF5q/otso4=", "narHash": "sha256-6Qqjij5cgKkLyfnT0rFHhvSGu5NV1J+1eoTi6oI97kg=",
"owner": "zigtools", "owner": "zigtools",
"repo": "zls", "repo": "zls",
"rev": "1b3274aa9c4c79ece06427b1367d392b3849dfb0", "rev": "7919da5054a6e6ac100097f762e7abe96628eef0",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -125,7 +125,7 @@
nixosMachines = machines.nixos or { }; nixosMachines = machines.nixos or { };
# mkHost helpers # mkHost helpers
mkNixosHost = system: hostname: users: nixpkgs.lib.nixosSystem { mkNixosHost = system: hostname: users: lib.nixosSystem {
inherit system; inherit system;
modules = [ modules = [
@ -135,7 +135,7 @@
home-manager = { home-manager = {
useGlobalPkgs = false; useGlobalPkgs = false;
useUserPackages = true; useUserPackages = true;
users = nixpkgs.lib.attrsets.genAttrs users = lib.attrsets.genAttrs
users users
(user: import ./machines/nixos/${system}/${hostname}/home/${user}.nix); (user: import ./machines/nixos/${system}/${hostname}/home/${user}.nix);
@ -183,7 +183,7 @@
home-manager = { home-manager = {
useGlobalPkgs = false; useGlobalPkgs = false;
useUserPackages = true; useUserPackages = true;
users = nixpkgs.lib.attrsets.genAttrs users = lib.attrsets.genAttrs
users users
(user: import ./machines/nix-darwin/${system}/${hostname}/home/${user}.nix); (user: import ./machines/nix-darwin/${system}/${hostname}/home/${user}.nix);
@ -208,13 +208,13 @@
createConfigurations = createConfigurations =
pred: mkHost: machines: pred: mkHost: machines:
nixpkgs.lib.foldAttrs lib.foldAttrs
(acc: x: acc) (acc: x: acc)
[ ] [ ]
(builtins.attrValues (builtins.attrValues
(builtins.mapAttrs (builtins.mapAttrs
(system: hosts: (system: hosts:
nixpkgs.lib.attrsets.filterAttrs lib.attrsets.filterAttrs
(host: config: config != null) (host: config: config != null)
(builtins.mapAttrs (builtins.mapAttrs
(host: config: (host: config:
@ -236,7 +236,7 @@
system system
host host
(builtins.map (builtins.map
(nixpkgs.lib.strings.removeSuffix ".nix") (lib.strings.removeSuffix ".nix")
(builtins.attrNames (config."home" or { })))) (builtins.attrNames (config."home" or { }))))
nixosMachines; nixosMachines;
@ -263,7 +263,7 @@
system system
host host
(builtins.map (builtins.map
(nixpkgs.lib.strings.removeSuffix ".nix") (lib.strings.removeSuffix ".nix")
(builtins.attrNames (config."home" or { })))) (builtins.attrNames (config."home" or { }))))
nixDarwinMachines; nixDarwinMachines;

View file

@ -1,7 +1,7 @@
# This is your home-manager configuration file # This is your home-manager configuration file
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) # 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 # You can import other home-manager modules here
imports = [ imports = [
# If you want to use modules your own flake exports (from modules/home-manager): # 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; [ ]; environment.systemPackages = with pkgs; [ ];

View file

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

View file

@ -1,4 +1,4 @@
{ inputs, outputs, lib, config, pkgs, ... }: { inputs, outputs, lib, pkgs, config, ... }:
{ {
environment.packages = with pkgs; [ ]; 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 # Home Manager needs a bit of information about you and the

View file

@ -1,7 +1,7 @@
# This is your system's configuration file. # This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) # 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 # You can import other NixOS modules here
imports = [ imports = [
# If you want to use modules your own flake exports (from modules/nixos): # 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 # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ inputs, outputs, config, pkgs, ... }: { inputs, outputs, lib, pkgs, config, ... }:
{ {
imports = imports = [
[ # Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
inputs.home-manager.nixosModules.home-manager
]; ];
### Set boot options ### Set boot options
@ -61,14 +60,27 @@
nix = { nix = {
package = pkgs.nixFlakes; package = pkgs.nixFlakes;
# Enable flakes, the new `nix` commands and better support for flakes in it
extraOptions = '' extraOptions = ''
experimental-features = nix-command flakes repl-flake 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 = { settings = {
trusted-users = [ trusted-users = [
"root" "root"
"reo101" "reo101"
]; ];
# Add nix-community and rix101 cachix caches
substituters = [ substituters = [
"https://rix101.cachix.org" "https://rix101.cachix.org"
"https://nix-community.cachix.org" "https://nix-community.cachix.org"
@ -80,7 +92,11 @@
}; };
}; };
nixpkgs.config.allowUnfree = true; nixpkgs = {
config = {
allowUnfree = true;
};
};
### NVIDIA ### NVIDIA
services.xserver = { services.xserver = {
@ -169,7 +185,9 @@
}; };
### Enable plymouth (bootscreen customizations) ### Enable plymouth (bootscreen customizations)
boot.plymouth.enable = true; boot.plymouth = {
enable = true;
};
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
@ -182,19 +200,8 @@
]; ];
### Jellyfin ### Jellyfin
virtualisation.oci-containers.containers."jellyfin" = { reo101.jellyfin = {
autoStart = true; enable = 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";
};
}; };
### Transmission ### Transmission

View file

@ -1,11 +1,12 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: { lib, pkgs, config, modulesPath, ... }:
{ {
imports = 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" ]; boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
@ -14,12 +15,14 @@
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ device = "/dev/disk/by-uuid/7f720420-41d8-4efd-bdf2-f445e52db998"; {
device = "/dev/disk/by-uuid/7f720420-41d8-4efd-bdf2-f445e52db998";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/5BF4-74EF"; {
device = "/dev/disk/by-uuid/5BF4-74EF";
fsType = "vfat"; fsType = "vfat";
}; };

View file

@ -1,4 +1,4 @@
{ inputs, outputs, lib, config, pkgs, ... }: { inputs, outputs, lib, pkgs, config, ... }:
{ {
imports = builtins.attrValues outputs.homeManagerModules ++ [ imports = builtins.attrValues outputs.homeManagerModules ++ [
@ -7,7 +7,7 @@
nixpkgs = { nixpkgs = {
overlays = builtins.attrValues outputs.overlays ++ [ overlays = builtins.attrValues outputs.overlays ++ [
# inputs.neovim-nightly-overlay.overlay inputs.neovim-nightly-overlay.overlay
inputs.zig-overlay.overlays.default inputs.zig-overlay.overlays.default
inputs.wired.overlays.default inputs.wired.overlays.default
]; ];
@ -29,6 +29,7 @@
river # window manager river # window manager
swww # wallpaper deamon swww # wallpaper deamon
# wired-notify # dunst on wayland # wired-notify # dunst on wayland
waybar # status bar
## Terminals ## Terminals
wezterm wezterm

View file

@ -1,8 +1,10 @@
{ lib, pkgs, config, ... }: { lib, pkgs, config, ... }:
with lib; with lib;
let let
cfg = config.reo101.shell; cfg = config.reo101.shell;
in { in
{
imports = [ imports = [
]; ];
@ -15,10 +17,10 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
# Shell
zsh zsh
starship starship
zoxide zoxide
direnv
]; ];
programs.zsh = { programs.zsh = {
@ -253,4 +255,8 @@ in {
}; };
}; };
}; };
meta = {
maintainers = with lib.maintainers; [ reo101 ];
};
} }

View file

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

View file

@ -1,60 +1,61 @@
{ config, nixpkgs, ... }: { lib, pkgs, config, ... }:
### Jellyfin with lib;
# nixpkgs.config.packageOverrides = pkgs: { let
# arc = import (builtins.fetchTarball { cfg = config.reo101.jellyfin;
# url = "https://github.com/arcnmx/nixexprs/archive/1a2ca1935e243383dfc8dc89f88f55678d33fcd4.tar.gz"; in
# sha256 = "sha256:0zjy3916sxxk7ds763dmmbzfdc46wdlw10m5dg6kkpqi2i81109f"; {
# }) { imports = [
# inherit pkgs; ];
# };
# vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
# };
# hardware.nvidia.package = pkgs.arc.packages.nvidia-patch.override { options = {
# nvidia_x11 = config.boot.kernelPackages.nvidiaPackages.stable; reo101.jellyfin = {
# }; enable = mkEnableOption "reo101 Jellyfin config";
image = mkOption {
# hardware.opengl = { type = types.strMatching ".+/.+:.+";
# enable = true; default = "docker.io/jellyfin/jellyfin:latest";
# extraPackages = with pkgs; [ defaultText = "docker.io/jellyfin/jellyfin:latest";
# intel-media-driver description = ''
# vaapiIntel The Docker image for Jellyfin
# vaapiVdpau '';
# libvdpau-va-gl };
# intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in) volumes = mkOption {
# ]; type = types.listOf (types.strMatching ".+:.+");
# }; default = [
virtualisation.oci-containers.containers."jellyfin" = {
autoStart = true;
image = "docker.io/jellyfin/jellyfin:latest";
volumes = [
"/var/cache/jellyfin/config:/config" "/var/cache/jellyfin/config:/config"
"/var/cache/jellyfin/cache:/cache" "/var/cache/jellyfin/cache:/cache"
"/var/log/jellyfin:/log" "/var/log/jellyfin:/log"
"/media:/media:ro" "/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 = { environment = {
JELLYFIN_LOG_DIR = "/log"; JELLYFIN_LOG_DIR = "/log";
}; };
}; };
};
## services.jellyfin.enable = true; meta = {
maintainers = with lib.maintainers; [ reo101 ];
## 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"
## ];
## };

View file

@ -27,6 +27,6 @@ rustPlatform.buildRustPackage rec {
description = "A Solution to your Wayland Wallpaper Woes"; description = "A Solution to your Wayland Wallpaper Woes";
homepage = "https://github.com/Horus645/swww"; homepage = "https://github.com/Horus645/swww";
license = licenses.gpl3; 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 # Shell for bootstrapping flake-enabled nix and other tooling
{ pkgs ?
# If pkgs is not defined, instanciate nixpkgs from locked commit # If pkgs is not defined, instanciate nixpkgs from locked commit
{ pkgs ?
(import ./nixpkgs.nix) { } (import ./nixpkgs.nix) { }
, ... , ...
}: { }: {