Compare commits

...

33 commits

Author SHA1 Message Date
7ebfaa1de8 WIP: flake: home-manager: export NixOS homes
All checks were successful
ci/woodpecker/push/check Pipeline was successful
WIP: this does not take into account the `profiles` which *also* setup
home-manager modules...

And here is what the last few commits were building up to.

This is neat, but won't be useful *very* often.
2024-01-03 17:56:53 +00:00
7bd06002de flake: home-manager: refactor 'mkHome'
This will allow making a similar function for NixOS homes.
2024-01-03 17:56:53 +00:00
d6e3f20208 flake: home-manager: use 'hosts' option 2024-01-03 17:55:36 +00:00
437b8b8b17 flake: nixos: use 'hosts' option 2024-01-03 17:55:35 +00:00
9b68905c26 flake: add hosts
This will allow other modules to cross-reference which hosts exist on
which system.

My main use-case is to automatically declare home-manager configuration
for the home configuration of NixOS hosts.

I also include Darwin in case I ever want to use that in the future,
though that is unlikely for the moment.
2024-01-03 17:55:35 +00:00
f5e24b5db8 hosts: nixos: porthos: add profiles 2024-01-03 17:55:35 +00:00
37cfcadfc6 fixup! nixos: home: forward profile configurations 2024-01-03 17:50:47 +00:00
fefd405e08 fixup! nixos: home: import common modules 2024-01-03 17:48:44 +00:00
2d3add3536 nixos: home: forward profile configurations
Now that we migrated them all
2024-01-03 17:48:44 +00:00
198b8e7e0a common: profiles: migrate X 2024-01-03 17:48:44 +00:00
e4b7d562a4 common: profiles: migrate wm 2024-01-03 17:36:19 +00:00
7884ef1047 common: profiles: migrate laptop 2024-01-03 17:29:18 +00:00
6088f85bec common: profiles: migrate gtk 2024-01-03 17:29:18 +00:00
1d888f68e3 common: profiles: migrate devices 2024-01-03 17:29:18 +00:00
42cbe79cae common: profiles: migrate bluetooth 2024-01-03 17:29:18 +00:00
ef55541337 common: add profiles
I will be migrating each sub-module one by one.
2024-01-03 17:28:01 +00:00
8dcbd6e850 flake: nixos: import common modules 2024-01-03 16:54:05 +00:00
e9abcb0307 flake: home-manager: import common modules 2024-01-03 16:54:05 +00:00
c27b83652a nixos: home: import common modules 2024-01-03 16:51:38 +00:00
aa1336bb8d modules: add common
This should define modules that are identical, or very similar.

The driving force is to be able to use `my.profiles` on home-manager and NixOS
without repeating myself.

In the future I might migrate other modules, such as `nixos/system/nix`...
2024-01-03 16:51:38 +00:00
bddcab110d pkgs: matrix-notifier: 0.3.0 -> 0.4.0
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2024-01-03 15:58:34 +00:00
e02da7ec69 flake: bump inputs
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2024-01-03 14:25:20 +00:00
a93dc2935b flake: add explicit 'systems' input 2024-01-03 14:25:20 +00:00
39eba647ac hosts: nixos: aramis: home: use 'pinentry-qt'
The GTK2 variant has been removed [1].

I may revise this in the future if [2] is merged (I'd like to try
`pinentry-rofi` [3]).

[1]: https://github.com/NixOS/nixpkgs/pull/270266
[2]: https://github.com/NixOS/nixpkgs/pull/277221
[3]: https://github.com/plattfot/pinentry-rofi
2024-01-03 14:25:20 +00:00
932717b754 nixos: services: jellyfin: loosen umask
All checks were successful
ci/woodpecker/push/check Pipeline was successful
I just noticed that all the metadata files Jellyfin stores have very
restrictive ACLs.

The whole point of the `media` group is to make my HTPC eco-system work
together. In particular this should allow Sonarr and friends to delete
folders without manual intervention.
2023-12-26 15:17:05 +01:00
71ee178510 nixos: services: nginx: fix SSO subdomain
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2023-12-25 20:23:55 +01:00
6948424b81 nixos: services: remove redundant subdomains
See previous commit for the defaults.
2023-12-25 20:23:55 +01:00
b7a4bc063f nixos: services: nginx: add default subdomain
In almost all cases, the subdomain should be the same as the attribute
name...
2023-12-25 20:23:55 +01:00
faa87743e5 nixos: services: nginx: use attrset for vhosts
Attribute sets compose better than lists, it was a mistake to use a list
in the first place...
2023-12-25 20:23:55 +01:00
26950332c7 home: keyboard: extract from X module
All checks were successful
ci/woodpecker/push/check Pipeline was successful
This deserves to be its own standalone module, as I would want to use it
in both X and Wayland, etc...
2023-12-23 14:56:55 +01:00
13d85c30f9 pkgs: remove 'wifi-qr'
Some checks are pending
ci/woodpecker/push/check Pipeline is pending
Now that I added it to upstream, I can get rid of it.
2023-12-19 19:08:25 +01:00
a657a7742e home: wm: i3bar: fix 'net' block when disconnected
Some checks are pending
ci/woodpecker/push/check Pipeline is pending
I still sometimes get the error message about not being able to format
the block, this should fix it.
2023-12-18 09:41:35 +00:00
066a33587d home: mpv: add uosc script
Some checks are pending
ci/woodpecker/push/check Pipeline is pending
2023-12-16 20:24:38 +00:00
55 changed files with 453 additions and 410 deletions

53
flake.lock generated
View file

@ -8,14 +8,17 @@
],
"nixpkgs": [
"nixpkgs"
],
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1701216516,
"narHash": "sha256-jKSeJn+7hZ1dZdiH1L+NWUGT2i/BGomKAJ54B9kT06Q=",
"lastModified": 1703433843,
"narHash": "sha256-nmtA4KqFboWxxoOAA6Y1okHbZh+HsXaMPFkYHsoDRDw=",
"owner": "ryantm",
"repo": "agenix",
"rev": "13ac9ac6d68b9a0896e3d43a082947233189e247",
"rev": "417caa847f9383e111d1397039c9d4337d024bf0",
"type": "github"
},
"original": {
@ -33,11 +36,11 @@
]
},
"locked": {
"lastModified": 1673295039,
"narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=",
"lastModified": 1700795494,
"narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "87b9d090ad39b25b2400029c64825fc2a8868943",
"rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d",
"type": "github"
},
"original": {
@ -70,11 +73,11 @@
]
},
"locked": {
"lastModified": 1701473968,
"narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=",
"lastModified": 1704152458,
"narHash": "sha256-DS+dGw7SKygIWf9w4eNBUZsK+4Ug27NwEWmn2tnbycg=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5",
"rev": "88a2cd8166694ba0b6cb374700799cec53aef527",
"type": "github"
},
"original": {
@ -86,7 +89,9 @@
},
"futils": {
"inputs": {
"systems": "systems"
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1701680307,
@ -131,11 +136,11 @@
]
},
"locked": {
"lastModified": 1702538064,
"narHash": "sha256-At5GwJPu2tzvS9dllhBoZmqK6lkkh/sOp2YefWRlaL8=",
"lastModified": 1704276313,
"narHash": "sha256-4eD4RaAKHLj0ztw5pQcNFs3hGpxrsYb0e9Qir+Ute+w=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "0e2e443ff24f9d75925e91b89d1da44b863734af",
"rev": "4d8f90205c6c90be2e81d94d0e5eedf71c1ba34e",
"type": "github"
},
"original": {
@ -147,11 +152,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1702312524,
"narHash": "sha256-gkZJRDBUCpTPBvQk25G0B7vfbpEYM5s5OZqghkjZsnE=",
"lastModified": 1703961334,
"narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a9bf124c46ef298113270b1f84a164865987a91c",
"rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9",
"type": "github"
},
"original": {
@ -163,11 +168,11 @@
},
"nur": {
"locked": {
"lastModified": 1702558663,
"narHash": "sha256-MHq/DdwsBwsTRqwFg1JuFtcoGArgvaH/XwbxgWQ4Zn0=",
"lastModified": 1704289500,
"narHash": "sha256-SMoojjdEMgf6GtPh5vzofdeev4nyM+vBi2J6Z/Sufco=",
"owner": "nix-community",
"repo": "NUR",
"rev": "b839a2bae27c0c14dd99dcc1f6d18f83b0af59bd",
"rev": "a18213c74e43dd6e941c41d77382377938c77caf",
"type": "github"
},
"original": {
@ -192,11 +197,11 @@
]
},
"locked": {
"lastModified": 1702456155,
"narHash": "sha256-I2XhXGAecdGlqi6hPWYT83AQtMgL+aa3ulA85RAEgOk=",
"lastModified": 1703939133,
"narHash": "sha256-Gxe+mfOT6bL7wLC/tuT2F+V+Sb44jNr8YsJ3cyIl4Mo=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "007a45d064c1c32d04e1b8a0de5ef00984c419bc",
"rev": "9d3d7e18c6bc4473d7520200d4ddab12f8402d38",
"type": "github"
},
"original": {
@ -214,7 +219,8 @@
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nur": "nur",
"pre-commit-hooks": "pre-commit-hooks"
"pre-commit-hooks": "pre-commit-hooks",
"systems": "systems"
}
},
"systems": {
@ -228,6 +234,7 @@
},
"original": {
"owner": "nix-systems",
"ref": "main",
"repo": "default",
"type": "github"
}

View file

@ -9,6 +9,7 @@
inputs = {
home-manager.follows = "home-manager";
nixpkgs.follows = "nixpkgs";
systems.follows = "systems";
};
};
@ -27,6 +28,9 @@
owner = "numtide";
repo = "flake-utils";
ref = "main";
inputs = {
systems.follows = "systems";
};
};
home-manager = {
@ -64,6 +68,13 @@
nixpkgs-stable.follows = "nixpkgs";
};
};
systems = {
type = "github";
owner = "nix-systems";
repo = "default";
ref = "main";
};
};
# Can't eta-reduce a flake outputs...

View file

@ -13,6 +13,7 @@ flake-parts.lib.mkFlake { inherit inputs; } {
./checks.nix
./dev-shells.nix
./home-manager.nix
./hosts.nix
./lib.nix
./nixos.nix
./overlays.nix

View file

@ -1,5 +1,7 @@
{ self, inputs, lib, ... }:
{ self, config, inputs, lib, ... }:
let
inherit (config) hosts;
defaultModules = [
# Include generic settings
"${self}/modules/home"
@ -14,9 +16,11 @@ let
# Enable home-manager
programs.home-manager.enable = true;
}
# Import common modules
"${self}/modules/common"
];
mkHome = name: system: inputs.home-manager.lib.homeManagerConfiguration {
mkHomeCommon = mainModules: system: inputs.home-manager.lib.homeManagerConfiguration {
# Work-around for home-manager
# * not letting me set `lib` as an extraSpecialArgs
# * not respecting `nixpkgs.overlays` [1]
@ -29,34 +33,51 @@ let
];
};
modules = defaultModules ++ [
"${self}/hosts/homes/${name}"
];
modules = defaultModules ++ mainModules;
extraSpecialArgs = {
# Inject inputs to use them in global registry
inherit inputs;
# For consumption by common modules
type = "home";
};
};
homes = {
mkHome = name: mkHomeCommon [ "${self}/hosts/homes/${name}" ];
mkNixosHome = name: mkHomeCommon [
"${self}/hosts/nixos/${name}/home.nix"
"${self}/hosts/nixos/${name}/profiles.nix"
];
in
{
hosts.homes = {
"ambroisie@bazin" = "x86_64-linux";
"ambroisie@mousqueton" = "x86_64-linux";
};
in
{
perSystem = { system, ... }: {
# Work-around for https://github.com/nix-community/home-manager/issues/3075
legacyPackages = {
homeConfigurations =
let
filteredHomes = lib.filterAttrs (_: v: v == system) homes;
filteredHomes = lib.filterAttrs (_: v: v == system) hosts.homes;
allHomes = filteredHomes // {
# Default configuration
ambroisie = system;
};
homeManagerHomes = lib.mapAttrs mkHome allHomes;
filteredNixosHosts = lib.filterAttrs (_: v: v == system) hosts.nixos;
nixosHomes' = lib.mapAttrs mkNixosHome filteredNixosHosts;
nixosHomeUsername = (host: self.nixosConfigurations.${host}.config.my.user.name);
nixosHomes = lib.mapAttrs' (host: lib.nameValuePair "${nixosHomeUsername host}@${host}") nixosHomes';
in
lib.mapAttrs mkHome allHomes;
lib.foldl' lib.mergeAttrs { }
[
homeManagerHomes
nixosHomes
];
};
};
}

21
flake/hosts.nix Normal file
View file

@ -0,0 +1,21 @@
# Define `hosts.{darwin,home,nixos}` options for consumption in other modules
{ lib, ... }:
let
mkHostsOption = description: lib.mkOption {
inherit description;
type = with lib.types; attrsOf str;
default = { };
example = { name = "x86_64-linux"; };
};
in
{
options = {
hosts = {
darwin = mkHostsOption "Darwin hosts";
homes = mkHostsOption "Home Manager hosts";
nixos = mkHostsOption "NixOS hosts";
};
};
}

View file

@ -1,4 +1,4 @@
{ self, inputs, lib, ... }:
{ self, config, inputs, lib, ... }:
let
defaultModules = [
{
@ -12,6 +12,8 @@ let
}
# Include generic settings
"${self}/modules/nixos"
# Import common modules
"${self}/modules/common"
];
buildHost = name: system: lib.nixosSystem {
@ -24,12 +26,18 @@ let
inherit (self) lib;
# Inject inputs to use them in global registry
inherit inputs;
# For consumption by common modules
type = "nixos";
};
};
in
{
flake.nixosConfigurations = lib.mapAttrs buildHost {
aramis = "x86_64-linux";
porthos = "x86_64-linux";
config = {
hosts.nixos = {
aramis = "x86_64-linux";
porthos = "x86_64-linux";
};
flake.nixosConfigurations = lib.mapAttrs buildHost config.hosts.nixos;
};
}

View file

@ -2,7 +2,7 @@
{
my.home = {
# Use graphical pinentry
bitwarden.pinentry = "gtk2";
bitwarden.pinentry = "qt";
# Ebook library
calibre.enable = true;
# Some amount of social life
@ -14,7 +14,7 @@
# Blue light filter
gammastep.enable = true;
# Use a small popup to enter passwords
gpg.pinentry = "gtk2";
gpg.pinentry = "qt";
# Machine specific packages
packages.additionalPackages = with pkgs; [
element-desktop # Matrix client

View file

@ -7,6 +7,7 @@
./hardware.nix
./home.nix
./networking.nix
./profiles.nix
./secrets
./services.nix
./system.nix

View file

@ -0,0 +1,4 @@
{ ... }:
{
# Nothing
}

View file

@ -0,0 +1,35 @@
# Modules that are common to various module systems
# Usually with very small differences, if any, between them.
{ lib, type ? null, ... }:
let
allowedTypes = [
"darwin"
"home"
"nixos"
];
allowedTypesString = lib.concatStringSep ", " (builtins.map lib.escapeNixString allowedTypes);
in
{
imports = [
./profiles
];
config = {
assertions = [
{
assertion = type != null;
message = ''
You must provide `type` as part of specialArgs to use the common modules.
It must be one of ${allowedTypesString}.
'';
}
{
assertion = type != null -> builtins.elem type allowedTypes;
message = ''
`type` specialArgs must be one of ${allowedTypesString}.
'';
}
];
};
}

View file

@ -0,0 +1,19 @@
{ config, lib, type, ... }:
let
cfg = config.my.profiles.bluetooth;
in
{
options.my.profiles.bluetooth = with lib; {
enable = mkEnableOption "bluetooth profile";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
(lib.optionalAttrs (type == "home") {
my.home.bluetooth.enable = true;
})
(lib.optionalAttrs (type == "nixos") {
my.hardware.bluetooth.enable = true;
})
]);
}

View file

@ -0,0 +1,22 @@
{ config, lib, type, ... }:
let
cfg = config.my.profiles.devices;
in
{
options.my.profiles.devices = with lib; {
enable = mkEnableOption "devices profile";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
(lib.optionalAttrs (type == "nixos") {
my.hardware = {
ergodox.enable = true;
mx-ergo.enable = true;
};
# MTP devices auto-mount via file explorers
services.gvfs.enable = true;
})
]);
}

View file

@ -0,0 +1,21 @@
{ config, lib, type, ... }:
let
cfg = config.my.profiles.gtk;
in
{
options.my.profiles.gtk = with lib; {
enable = mkEnableOption "gtk profile";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
(lib.optionalAttrs (type == "home") {
# GTK theme configuration
my.home.gtk.enable = true;
})
(lib.optionalAttrs (type == "nixos") {
# Allow setting GTK configuration using home-manager
programs.dconf.enable = true;
})
]);
}

View file

@ -0,0 +1,27 @@
{ config, lib, type, ... }:
let
cfg = config.my.profiles.laptop;
in
{
options.my.profiles.laptop = with lib; {
enable = mkEnableOption "laptop profile";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
(lib.optionalAttrs (type == "home") {
# Enable battery notifications
my.home.power-alert.enable = true;
})
(lib.optionalAttrs (type == "nixos") {
# Enable touchpad support
services.xserver.libinput.enable = true;
# Enable TLP power management
my.services.tlp.enable = true;
# Enable upower power management
my.hardware.upower.enable = true;
})
]);
}

View file

@ -0,0 +1,36 @@
{ config, lib, type, ... }:
let
cfg = config.my.profiles.wm;
applyWm = wm: configs: lib.mkIf (cfg.windowManager == wm) (lib.my.merge configs);
in
{
options.my.profiles.wm = with lib; {
windowManager = mkOption {
type = with types; nullOr (enum [ "i3" ]);
default = null;
example = "i3";
description = "Which window manager to use";
};
};
config = lib.mkMerge [
(applyWm "i3" [
(lib.optionalAttrs (type == "home") {
# i3 settings
my.home.wm.windowManager = "i3";
# Screenshot tool
my.home.flameshot.enable = true;
# Auto disk mounter
my.home.udiskie.enable = true;
})
(lib.optionalAttrs (type == "nixos") {
# Enable i3
services.xserver.windowManager.i3.enable = true;
# udiskie fails if it can't find this dbus service
services.udisks2.enable = true;
})
])
];
}

View file

@ -0,0 +1,27 @@
{ config, lib, pkgs, type, ... }:
let
cfg = config.my.profiles.x;
in
{
options.my.profiles.x = with lib; {
enable = mkEnableOption "X profile";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
(lib.optionalAttrs (type == "home") {
# X configuration
my.home.x.enable = true;
})
(lib.optionalAttrs (type == "nixos") {
# Enable the X11 windowing system.
services.xserver.enable = true;
# Nice wallpaper
services.xserver.displayManager.lightdm.background =
let
wallpapers = "${pkgs.plasma5Packages.plasma-workspace-wallpapers}/share/wallpapers";
in
"${wallpapers}/summer_1am/contents/images/2560x1600.jpg";
})
]);
}

View file

@ -23,6 +23,7 @@
./gtk
./htop
./jq
./keyboard
./mail
./mpv
./nix

View file

@ -1,8 +1,12 @@
{ config, lib, ... }:
let
cfg = config.my.home.x;
cfg = config.my.home.keyboard;
in
{
options.my.home.keyboard = with lib; {
enable = my.mkDisableOption "keyboard configuration";
};
config = lib.mkIf cfg.enable {
home.keyboard = {
layout = "fr";

View file

@ -13,6 +13,7 @@ in
scripts = [
pkgs.mpvScripts.mpris # Allow controlling using media keys
pkgs.mpvScripts.uosc # Nicer UI
];
};
};

View file

@ -74,7 +74,7 @@ in
)
{
block = "net";
format = " $icon{| $ssid|} $ip{| $signal_strength|} ";
format = " $icon{| $ssid|}{| $ip|}{| $signal_strength|} ";
}
{
block = "backlight";

View file

@ -3,10 +3,6 @@ let
cfg = config.my.home.x;
in
{
imports = [
./keyboard
];
options.my.home.x = with lib; {
enable = mkEnableOption "X server configuration";
};

View file

@ -5,7 +5,6 @@
imports = [
./hardware
./home
./profiles
./programs
./secrets
./services

View file

@ -14,7 +14,19 @@ in
config = lib.mkIf cfg.enable {
home-manager = {
# Not a fan of out-of-directory imports, but this is a good exception
users.${config.my.user.name} = import "${inputs.self}/modules/home";
users.${config.my.user.name} = {
imports = [
"${inputs.self}/modules/common"
"${inputs.self}/modules/home"
];
config = {
my = {
# Transparently enable home-manager profiles as well
inherit (config.my) profiles;
};
};
};
# Nix Flakes compatibility
useGlobalPkgs = true;
@ -23,6 +35,8 @@ in
# Forward inputs to home-manager configuration
extraSpecialArgs = {
inherit inputs;
# For consumption by common modules
type = "home";
};
};
};

View file

@ -1,15 +0,0 @@
{ config, lib, ... }:
let
cfg = config.my.profiles.bluetooth;
in
{
options.my.profiles.bluetooth = with lib; {
enable = mkEnableOption "bluetooth profile";
};
config = lib.mkIf cfg.enable {
my.hardware.bluetooth.enable = true;
my.home.bluetooth.enable = true;
};
}

View file

@ -1,20 +0,0 @@
{ config, lib, ... }:
let
cfg = config.my.profiles.devices;
in
{
options.my.profiles.devices = with lib; {
enable = mkEnableOption "devices profile";
};
config = lib.mkIf cfg.enable {
my.hardware = {
ergodox.enable = true;
mx-ergo.enable = true;
};
# MTP devices auto-mount via file explorers
services.gvfs.enable = true;
};
}

View file

@ -1,17 +0,0 @@
{ config, lib, ... }:
let
cfg = config.my.profiles.gtk;
in
{
options.my.profiles.gtk = with lib; {
enable = mkEnableOption "gtk profile";
};
config = lib.mkIf cfg.enable {
# Allow setting GTK configuration using home-manager
programs.dconf.enable = true;
# GTK theme configuration
my.home.gtk.enable = true;
};
}

View file

@ -1,23 +0,0 @@
{ config, lib, ... }:
let
cfg = config.my.profiles.laptop;
in
{
options.my.profiles.laptop = with lib; {
enable = mkEnableOption "laptop profile";
};
config = lib.mkIf cfg.enable {
# Enable touchpad support
services.xserver.libinput.enable = true;
# Enable TLP power management
my.services.tlp.enable = true;
# Enable upower power management
my.hardware.upower.enable = true;
# Enable battery notifications
my.home.power-alert.enable = true;
};
}

View file

@ -1,29 +0,0 @@
{ config, lib, ... }:
let
cfg = config.my.profiles.wm;
in
{
options.my.profiles.wm = with lib; {
windowManager = mkOption {
type = with types; nullOr (enum [ "i3" ]);
default = null;
example = "i3";
description = "Which window manager to use";
};
};
config = lib.mkMerge [
(lib.mkIf (cfg.windowManager == "i3") {
# Enable i3
services.xserver.windowManager.i3.enable = true;
# i3 settings
my.home.wm.windowManager = "i3";
# Screenshot tool
my.home.flameshot.enable = true;
# Auto disk mounter
my.home.udiskie.enable = true;
# udiskie fails if it can't find this dbus service
services.udisks2.enable = true;
})
];
}

View file

@ -1,23 +0,0 @@
{ config, lib, pkgs, ... }:
let
cfg = config.my.profiles.x;
in
{
options.my.profiles.x = with lib; {
enable = mkEnableOption "X profile";
};
config = lib.mkIf cfg.enable {
# Enable the X11 windowing system.
services.xserver.enable = true;
# Nice wallpaper
services.xserver.displayManager.lightdm.background =
let
wallpapers = "${pkgs.plasma5Packages.plasma-workspace-wallpapers}/share/wallpapers";
in
"${wallpapers}/summer_1am/contents/images/2560x1600.jpg";
# X configuration
my.home.x.enable = true;
};
}

View file

@ -5,11 +5,10 @@ let
domain = config.networking.domain;
makeHostInfo = subdomain: {
inherit subdomain;
root = "/var/www/${subdomain}";
};
hostsInfo = map makeHostInfo [ "cv" "dev" "key" ];
hostsInfo = lib.flip lib.genAttrs makeHostInfo [ "cv" "dev" "key" ];
in
{
options.my.services.blog = {

View file

@ -40,12 +40,11 @@ in
# Set-up media group
users.groups.media = { };
my.services.nginx.virtualHosts = [
{
subdomain = "library";
my.services.nginx.virtualHosts = {
library = {
inherit (cfg) port;
}
];
};
};
my.services.backup = {
paths = [

View file

@ -45,11 +45,10 @@ in
}];
};
my.services.nginx.virtualHosts = [
{
subdomain = "drone";
my.services.nginx.virtualHosts = {
drone = {
inherit (cfg) port;
}
];
};
};
};
}

View file

@ -40,11 +40,10 @@ in
};
};
my.services.nginx.virtualHosts = [
{
subdomain = "flood";
my.services.nginx.virtualHosts = {
flood = {
inherit (cfg) port;
}
];
};
};
};
}

View file

@ -116,18 +116,16 @@ in
};
users.groups.git = { };
my.services.nginx.virtualHosts = [
my.services.nginx.virtualHosts = {
# Proxy to Gitea
{
subdomain = "git";
git = {
inherit (cfg) port;
}
};
# Redirect `gitea.` to actual forge subdomain
{
subdomain = "gitea";
gitea = {
redirect = config.services.gitea.settings.server.ROOT_URL;
}
];
};
};
my.services.backup = {
paths = [

View file

@ -28,12 +28,11 @@ in
};
};
my.services.nginx.virtualHosts = [
{
subdomain = "jackett";
my.services.nginx.virtualHosts = {
jackett = {
port = jackettPort;
}
];
};
};
})
(lib.mkIf cfg.nzbhydra.enable {
@ -41,12 +40,11 @@ in
enable = true;
};
my.services.nginx.virtualHosts = [
{
subdomain = "nzbhydra";
my.services.nginx.virtualHosts = {
nzbhydra = {
port = nzbhydraPort;
}
];
};
};
})
(lib.mkIf cfg.prowlarr.enable {
@ -54,12 +52,11 @@ in
enable = true;
};
my.services.nginx.virtualHosts = [
{
subdomain = "prowlarr";
my.services.nginx.virtualHosts = {
prowlarr = {
port = prowlarrPort;
}
];
};
};
services.fail2ban.jails = {
prowlarr = ''

View file

@ -17,9 +17,15 @@ in
# Set-up media group
users.groups.media = { };
my.services.nginx.virtualHosts = [
{
subdomain = "jellyfin";
systemd.services.jellyfin = {
serviceConfig = {
# Loose umask to make Jellyfin metadata more broadly readable
UMask = lib.mkForce "0002";
};
};
my.services.nginx.virtualHosts = {
jellyfin = {
port = 8096;
extraConfig = {
locations."/" = {
@ -33,7 +39,7 @@ in
proxyWebsockets = true;
};
};
}
];
};
};
};
}

View file

@ -98,11 +98,10 @@ in
};
users.groups.lohr = { };
my.services.nginx.virtualHosts = [
{
subdomain = "lohr";
my.services.nginx.virtualHosts = {
lohr = {
inherit (cfg) port;
}
];
};
};
};
}

View file

@ -117,10 +117,9 @@ in
};
};
my.services.nginx.virtualHosts = [
my.services.nginx.virtualHosts = {
# Element Web app deployment
{
subdomain = "chat";
chat = {
root = pkgs.element-web.override {
conf = {
default_server_config = {
@ -145,22 +144,19 @@ in
};
};
};
}
};
# Dummy VHosts for port collision detection
{
subdomain = "matrix-federation";
matrix-federation = {
port = federationPort.private;
}
{
subdomain = "matrix-client";
};
matrix-client = {
port = clientPort.private;
}
};
# Sliding sync
{
subdomain = "matrix-sync";
matrix-sync = {
inherit (cfg.slidingSync) port;
}
];
};
};
# Those are too complicated to use my wrapper...
services.nginx.virtualHosts = {

View file

@ -43,11 +43,10 @@ in
};
};
my.services.nginx.virtualHosts = [
{
subdomain = "reader";
my.services.nginx.virtualHosts = {
reader = {
inherit (cfg) port;
}
];
};
};
};
}

View file

@ -125,11 +125,10 @@ in
];
};
my.services.nginx.virtualHosts = [
{
subdomain = "monitoring";
my.services.nginx.virtualHosts = {
monitoring = {
inherit (cfg.grafana) port;
}
];
};
};
};
}

View file

@ -47,11 +47,10 @@ in
};
};
my.services.nginx.virtualHosts = [
{
subdomain = "music";
my.services.nginx.virtualHosts = {
music = {
inherit (cfg) port;
}
];
};
};
};
}

View file

@ -5,10 +5,11 @@ let
domain = config.networking.domain;
virtualHostOption = with lib; types.submodule {
virtualHostOption = with lib; types.submodule ({ name, ... }: {
options = {
subdomain = mkOption {
type = types.str;
default = name;
example = "dev";
description = ''
Which subdomain, under config.networking.domain, to use
@ -72,7 +73,7 @@ let
'';
};
};
};
});
in
{
imports = [
@ -97,20 +98,18 @@ in
};
virtualHosts = mkOption {
type = types.listOf virtualHostOption;
default = [ ];
type = types.attrsOf virtualHostOption;
default = { };
example = litteralExample ''
[
{
subdomain = "gitea";
{
gitea = {
subdomain = "git";
port = 8080;
}
{
subdomain = "dev";
};
dev = {
root = "/var/www/dev";
}
{
subdomain = "jellyfin";
};
jellyfin = {
port = 8096;
extraConfig = {
locations."/socket" = {
@ -118,8 +117,8 @@ in
proxyWebsockets = true;
};
};
}
]
};
}
'';
description = ''
List of virtual hosts to set-up using default settings.
@ -190,7 +189,7 @@ in
config = lib.mkIf cfg.enable {
assertions = [ ]
++ (lib.flip builtins.map cfg.virtualHosts ({ subdomain, ... } @ args:
++ (lib.flip lib.mapAttrsToList cfg.virtualHosts (_: { subdomain, ... } @ args:
let
conflicts = [ "port" "root" "socket" "redirect" ];
optionsNotNull = builtins.map (v: args.${v} != null) conflicts;
@ -209,7 +208,7 @@ in
ports = lib.my.mapFilter
(v: v != null)
({ port, ... }: port)
cfg.virtualHosts;
(lib.attrValues cfg.virtualHosts);
portCounts = lib.my.countValues ports;
nonUniquesCounts = lib.filterAttrs (_: v: v != 1) portCounts;
nonUniques = builtins.attrNames nonUniquesCounts;
@ -221,7 +220,7 @@ in
map mkAssertion nonUniques
) ++ (
let
subs = map ({ subdomain, ... }: subdomain) cfg.virtualHosts;
subs = lib.mapAttrsToList (_: { subdomain, ... }: subdomain) cfg.virtualHosts;
subsCounts = lib.my.countValues subs;
nonUniquesCounts = lib.filterAttrs (_: v: v != 1) subsCounts;
nonUniques = builtins.attrNames nonUniquesCounts;
@ -325,7 +324,7 @@ in
])
);
in
lib.my.genAttrs' cfg.virtualHosts mkVHost;
lib.my.genAttrs' (lib.attrValues cfg.virtualHosts) mkVHost;
sso = {
enable = true;
@ -403,12 +402,11 @@ in
};
};
my.services.nginx.virtualHosts = [
{
subdomain = "login";
my.services.nginx.virtualHosts = {
${cfg.sso.subdomain} = {
inherit (cfg.sso) port;
}
];
};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];

View file

@ -43,11 +43,10 @@ in
signKeyPath = cfg.secretKeyFile;
};
my.services.nginx.virtualHosts = [
{
subdomain = "cache";
my.services.nginx.virtualHosts = {
cache = {
inherit (cfg) port;
}
];
};
};
};
}

View file

@ -143,9 +143,8 @@ in
extraGroups = [ "media" ];
};
my.services.nginx.virtualHosts = [
{
subdomain = "paperless";
my.services.nginx.virtualHosts = {
paperless = {
inherit (cfg) port;
sso = {
enable = true;
@ -155,8 +154,8 @@ in
extraConfig = {
locations."/".proxyWebsockets = true;
};
}
];
};
};
my.services.backup = {
paths = [

View file

@ -21,12 +21,11 @@ let
};
mkRedirection = service: {
my.services.nginx.virtualHosts = [
{
subdomain = service;
my.services.nginx.virtualHosts = {
${service} = {
port = ports.${service};
}
];
};
};
};
mkFail2Ban = service: lib.mkIf cfg.${service}.enable {

View file

@ -31,11 +31,10 @@ in
inherit (cfg) passwordFile port;
};
my.services.nginx.virtualHosts = [
{
subdomain = "podgrab";
my.services.nginx.virtualHosts = {
podgrab = {
inherit (cfg) port;
}
];
};
};
};
}

View file

@ -18,12 +18,11 @@ in
# Set-up media group
users.groups.media = { };
my.services.nginx.virtualHosts = [
{
subdomain = "sabnzbd";
my.services.nginx.virtualHosts = {
sabnzbd = {
inherit port;
}
];
};
};
services.fail2ban.jails = {
sabnzbd = ''

View file

@ -70,11 +70,10 @@ in
];
};
my.services.nginx.virtualHosts = [
{
subdomain = "recipes";
my.services.nginx.virtualHosts = {
recipes = {
inherit (cfg) port;
}
];
};
};
};
}

View file

@ -80,12 +80,11 @@ in
# Default transmission webui, I prefer combustion but its development
# seems to have stalled
my.services.nginx.virtualHosts = [
{
subdomain = "transmission";
my.services.nginx.virtualHosts = {
transmission = {
inherit (cfg) port;
}
];
};
};
networking.firewall = {
allowedTCPPorts = [ cfg.peerPort ];

View file

@ -59,9 +59,8 @@ in
};
# This is a weird setup
my.services.nginx.virtualHosts = [
{
inherit subdomain;
my.services.nginx.virtualHosts = {
${subdomain} = {
# Serve the root for the web-ui
root = config.services.vikunja.package-frontend;
@ -80,8 +79,8 @@ in
};
};
};
}
];
};
};
systemd.services.vikunja-api = {
serviceConfig = {

View file

@ -52,16 +52,14 @@ in
}];
};
my.services.nginx.virtualHosts = [
{
subdomain = "woodpecker";
my.services.nginx.virtualHosts = {
woodpecker = {
inherit (cfg) port;
}
};
# I might want to be able to RPC from other hosts in the future
{
subdomain = "woodpecker-rpc";
woodpecker-rpc = {
port = cfg.rpcPort;
}
];
};
};
};
}

View file

@ -28,7 +28,5 @@ pkgs.lib.makeScope pkgs.newScope (pkgs: {
unbound-zones-adblock = pkgs.callPackage ./unbound-zones-adblock { };
wifi-qr = pkgs.callPackage ./wifi-qr { };
zsh-done = pkgs.callPackage ./zsh-done { };
})

View file

@ -1,13 +1,13 @@
{ lib, curl, jq, fetchFromGitHub, makeWrapper, pandoc, stdenvNoCC }:
stdenvNoCC.mkDerivation rec {
pname = "matrix-notifier";
version = "0.3.0";
version = "0.4.0";
src = fetchFromGitHub {
owner = "ambroisie";
repo = "matrix-notifier";
rev = "v${version}";
hash = "sha256-NE9RO0ep2ibrT9EUPGTnUE3ofdNTCHwelxnX9tCflg0=";
hash = "sha256-6KHteQx0bHodpNp7cuUIGM7uBRPaj386n2t5yz6umpY=";
};
nativeBuildInputs = [

View file

@ -1,81 +0,0 @@
{ lib
, fetchFromGitHub
, gnome
, installShellFiles
, makeWrapper
, networkmanager
, qrencode
, stdenvNoCC
, xdg-utils
, zbar
}:
stdenvNoCC.mkDerivation rec {
pname = "wifi-qr";
version = "unstable-2023-04-19";
outputs = [ "out" "man" ];
src = fetchFromGitHub {
owner = "kokoye2007";
repo = "wifi-qr";
rev = "b81d4a44257252f07e745464879aa5618ae3d434";
hash = "sha256-oGTAr+raJGpK4PV4GdBxX8fIUE8gcbXw7W0SvQJAee0=";
};
nativeBuildInputs = [
installShellFiles
makeWrapper
];
dontBuild = true;
dontConfigure = true;
postPatch = ''
substituteInPlace wifi-qr.desktop \
--replace "Exec=sh -c 'wifi-qr g'" "Exec=$out/bin/wifi-qr g" \
--replace "Exec=sh -c 'wifi-qr q'" "Exec=$out/bin/wifi-qr q" \
--replace "Exec=sh -c 'wifi-qr p'" "Exec=$out/bin/wifi-qr p" \
--replace "Exec=sh -c 'wifi-qr c'" "Exec=$out/bin/wifi-qr c" \
--replace "Icon=wifi-qr.svg" "Icon=wifi-qr"
'';
installPhase = ''
runHook preInstall
install -Dm755 wifi-qr $out/bin/wifi-qr
install -Dm644 wifi-qr.desktop $out/share/applications/wifi-qr.desktop
install -Dm644 wifi-qr.svg $out/share/icons/hicolor/scalable/apps/wifi-qr.svg
installManPage wifi-qr.1
runHook postInstall
'';
wrapperPath = lib.makeBinPath [
gnome.zenity
networkmanager
qrencode
xdg-utils
zbar
];
fixupPhase = ''
runHook preFixup
patchShebangs $out/bin/wifi-qr
wrapProgram $out/bin/wifi-qr --suffix PATH : "${wrapperPath}"
runHook postFixup
'';
meta = with lib; {
description = "WiFi password sharing via QR codes";
homepage = "https://github.com/kokoye2007/wifi-qr";
license = with licenses; [ gpl3Plus ];
mainProgram = "wifi-qr";
maintainers = with maintainers; [ ambroisie ];
platforms = platforms.linux;
};
}