More refactoring

This commit is contained in:
Julien Malka 2021-12-05 23:29:51 +01:00
parent 18b7795c15
commit 91aea7e1e1
7 changed files with 117 additions and 218 deletions

View file

@ -1,64 +0,0 @@
# 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 + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/eaec3978-f462-4634-95e6-06d59512deb8";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/EAD2-51DB";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/c19ec918-ba8c-4bab-9ee0-831465cb432e"; }
];
nix.maxJobs = lib.mkDefault 8;
# Specific to lisa but not hardware
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
luj.mediaserver.enable = true;
networking.hostName = "lisa"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.ens18.useDHCP = true;
networking.interfaces.ens19.useDHCP = false;
networking.interfaces.ens19.ipv6.addresses = [ {
address = "2a01:e0a:5f9:9681:5880:c9ff:fe9f:3dfb";
prefixLength = 120;
} ];
networking.firewall.allowedTCPPorts = [22 80 443 8096 8920];
networking.firewall.allowedUDPPorts = [22 80 443 1900 7359];
networking.firewall.allowedUDPPortRanges = [ { from = 60000; to = 61000;}];
system.stateVersion = "20.09"; # Did you read the comment?
}

View file

@ -1,121 +0,0 @@
{ config, pkgs, ... }:
{
services.jellyfin = {
enable = true;
group = "tv";
package = pkgs.jellyfin;
};
services.sonarr = {
enable = true;
openFirewall = true;
group = "tv";
};
services.radarr = {
enable = true;
openFirewall = true;
group = "tv";
};
services.transmission = {
enable = true;
group = "tv";
downloadDirPermissions = "774";
settings = {
rpc-port = 9091;
download-dir = "/home/transmission/Downloads/";
incomplete-dir = "/home/transmission/Incomplete/";
incomplete-dir-enable = true;
};
};
services.jackett = {
enable = true;
openFirewall = true;
};
services.nginx = {
enable = true;
virtualHosts."julienmalka.me" = {
enableACME = true;
forceSSL = true;
root = "/var/www/julienmalka.me";
default = true;
};
virtualHosts."www.julienmalka.me" = {
enableACME = true;
forceSSL = true;
root = "/var/www/julienmalka.me";
};
virtualHosts."tv.julienmalka.me" = {
addSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:8096";
};
};
virtualHosts."series.julienmalka.me" = {
addSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:8989";
};
};
virtualHosts."downloads.julienmalka.me" = {
addSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:9091";
};
};
virtualHosts."jackett.julienmalka.me" = {
addSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:9117";
};
};
virtualHosts."films.julienmalka.me" = {
addSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:7878";
};
};
};
security.acme.certs = {
"www.julienmalka.me".email = "julien.malka@me.com";
"julienmalka.me".email = "julien.malka@me.com";
"tv.julienmalka.me".email = "julien.malka@me.com";
"series.julienmalka.me".email = "julien.malka@me.com";
"downloads.julienmalka.me".email = "julien.malka@me.com";
"jackett.julienmalka.me".email = "julien.malka@me.com";
"films.julienmalka.me".email = "julien.malka@me.com";
};
security.acme.acceptTerms = true;
}

View file

@ -1,43 +1,63 @@
{
description = "A flake for my personnal configurations";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11;
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
description = "A flake for my personnal configurations";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11;
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
neovim-nightly-overlay = {
url = "github:nix-community/neovim-nightly-overlay";
};
neovim-nightly-overlay = {
url = "github:nix-community/neovim-nightly-overlay";
};
};
};
outputs = { self, home-manager, nixpkgs, neovim-nightly-overlay, nur, ... }@inputs :
{
nixosModules = builtins.listToAttrs (map (x: {
name = x;
value = import (./modules + "/${x}");
}) (builtins.attrNames (builtins.readDir ./modules)));
nixosConfigurations = {
lisa = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = builtins.attrValues self.nixosModules ++ [./configuration.nix ./config/hosts/lisa.nix
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.julien = import ./config/home/home-lisa.nix;
nixpkgs.overlays = [
inputs.neovim-nightly-overlay.overlay
outputs = { self, home-manager, nixpkgs, neovim-nightly-overlay, nur, ... }@inputs:
let
importDir = dir: pipe dir [
builtins.readDir
(mapAttrsToList (name: type:
if type == "regular" && hasSuffix ".nix" name && name != "default.nix" then
[{ name = removeSuffix ".nix" name; value = import (dir + "/${name}"); }]
else if type == "directory" && pathExists (dir + "/${name}/default.nix") then
[{ inherit name; value = import (dir + "/${name}"); }]
else
[ ]
))
concatLists
listToAttrs
];
mkMachine = host: host-config: modules: {
lisa = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = builtins.attrValues modules ++ [
./configuration.nix
host-config
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.julien = import ./config/home/home-lisa.nix;
nixpkgs.overlays = [
inputs.neovim-nightly-overlay.overlay
];
}];
}
];
};
};
in
{
nixosModules = builtins.listToAttrs (map
(x: {
name = x;
value = import (./modules + "/${x}");
})
(builtins.attrNames (builtins.readDir ./modules)));
};
nixosConfigurations = mapAttrs (name: value: (mkMachine name value nixosModules)) (importDir ./machines);
};
};
};

View file

View file

@ -0,0 +1,64 @@
# 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 + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/eaec3978-f462-4634-95e6-06d59512deb8";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/EAD2-51DB";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/c19ec918-ba8c-4bab-9ee0-831465cb432e"; }
];
nix.maxJobs = lib.mkDefault 8;
# Specific to lisa but not hardware
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
luj.mediaserver.enable = true;
networking.hostName = "lisa"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.ens18.useDHCP = true;
networking.interfaces.ens19.useDHCP = false;
networking.interfaces.ens19.ipv6.addresses = [ {
address = "2a01:e0a:5f9:9681:5880:c9ff:fe9f:3dfb";
prefixLength = 120;
} ];
networking.firewall.allowedTCPPorts = [22 80 443 8096 8920];
networking.firewall.allowedUDPPorts = [22 80 443 1900 7359];
networking.firewall.allowedUDPPortRanges = [ { from = 60000; to = 61000;}];
system.stateVersion = "20.09"; # Did you read the comment?
}

View file

View file