refact(modules) : better modules organisation + wip local-dev setup

This commit is contained in:
Florian Schmitt 2023-04-15 10:45:56 +03:00
parent 3d092d8dd9
commit 0f6f08997d
4 changed files with 131 additions and 40 deletions

View file

@ -1,11 +1,9 @@
# Generic NixOS config entry point
# point to the hardware and configuration files specific to your machine
# NixOS config entry point
# import the hardware and configuration files specific to your machine
{
imports =
[
./machines/MacBookPro12.1-hardware-configuration.nix
./machines/MacBookPro12.1-configuration.nix
];
}
}

View file

@ -1,30 +0,0 @@
# Configure the Chromium browser with various useful things.
{ pkgs, ... }:
{
environment.systemPackages = [
(pkgs.chromium.override {
enableWideVine = true; # DRM support (for Кинопоиск)
})
];
programs.chromium = {
enable = true;
homepageLocation = "about:blank";
extensions = [
"pejkokffkapolfffcgbmdmhdelanoaih" # Unsplash instant
"cjpalhdlnbpafiamejdnhcphjbkeiagm" # uBlock Origin
"gfapcejdoghpoidkfodoiiffaaibpaem" # Dracula theme
];
extraOpts = {
SpellcheckEnabled = true;
SpellcheckLanguage = [
"fr-FR"
"en-GB"
"ru"
];
};
};
}

View file

@ -45,11 +45,26 @@ in
programs = {
dconf.enable = true;
firefox.enable = true;
};
chromium = {
enable = true;
homepageLocation = "about:blank";
imports = [
./desktop-chromium.nix
];
extensions = [
"pejkokffkapolfffcgbmdmhdelanoaih" # Unsplash instant
"cjpalhdlnbpafiamejdnhcphjbkeiagm" # uBlock Origin
"gfapcejdoghpoidkfodoiiffaaibpaem" # Dracula theme
];
extraOpts = {
SpellcheckEnabled = true;
SpellcheckLanguage = [
"fr-FR"
"en-GB"
"ru"
];
};
};
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
@ -60,6 +75,7 @@ in
};
};
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
@ -79,6 +95,9 @@ in
}
];
})
(chromium.override {
enableWideVine = true; # DRM support
})
bitwarden
chromium
element-desktop

View file

@ -1,5 +1,108 @@
# Local developpement
{ lib, pkgs, ... }:
{ pkgs, config, lib, ... }:
# let
# # # using pkgs2 to avoid recursive loop with fetchFromGitHub
# # # see https://stackoverflow.com/questions/73097604/nixos-how-to-import-some-configuration-from-gitlab-infinite-recursion-encounte
# # pkgs2 = (import <nixpkgs> { });
# # nix-phps = pkgs2.fetchFromGitHub {
# # owner = "fossar";
# # repo = "nix-phps";
# # rev = "ac2bb3d416a10fc66d0148dddc63a19c6c5a907c";
# # hash = "sha256-74kQIFf3Cu1aeOsohCiLuA1aXNGYt2U9tTUP0yvm4EA=";
# # };
# # phps = import nix-phps;
# # phpfpm pools with php version from nix-phps
# mkPhpFpm = phpXX:
# {
# name = phpXX;
# value = {
# user = config.services.caddy.user;
# group = config.services.caddy.group;
# phpPackage = phps.packages.${builtins.currentSystem}.${phpXX}.buildEnv {
# extensions = ({ enabled, all }: enabled ++ (with all; [
# xdebug
# ]));
# extraConfig = ''
# '';
# };
# settings = {
# "listen.owner" = config.services.caddy.user;
# "pm" = "dynamic";
# "pm.max_children" = 75;
# "pm.start_servers" = 10;
# "pm.min_spare_servers" = 5;
# "pm.max_spare_servers" = 20;
# "pm.max_requests" = 500;
# };
# phpOptions = ''
# display_errors = on
# error_reporting = E_ALL
# '';
# };
# };
# phpfpmPools = builtins.listToAttrs (builtins.map mkPhpFpm [ "php73" "php74" "php80" "php81" ]);
# # caddy virtual hosts
# mkDot = list: (builtins.concatStringsSep "." list);
# mkVhost = { phpXX, root, sub }: rec {
# name = (mkDot [ sub phpXX "localhost" ]);
# value = {
# extraConfig =
# ''
# root * /var/www/${root}
# file_server browse
# php_fastcgi unix/${config.services.phpfpm.pools.${phpXX}.socket}
# '';
# };
# };
# caddyLocalRootCert = builtins.readFile ./../_local/caddy.root.cert.pem;
# localDevConfig = builtins.fromJSON (builtins.readFile ./../_local/devconfig.json);
# caddyVhosts = builtins.listToAttrs (builtins.map mkVhost localDevConfig.hosts);
# # hosts.json example
# # {
# # "hosts":
# # [
# # { "sub": "project1", "phpXX": "php73", "root": "/project1/public" },
# # { "sub": "project2", "phpXX": "php81", "root": "/project2/www" }
# # ],
# # "databases": [ "db1", "db2"]
# # }
# in
{
# mailhog
services.mailhog = {
enable = true;
};
# databases
services.mysql = {
enable = true;
package = pkgs.mariadb;
ensureDatabases = ["yeswiki"];
initialScript = pkgs.writeText "mysql-init.sql" ''
CREATE USER 'root'@'localhost' IDENTIFIED BY 'secret';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost';
FLUSH PRIVILEGES;
'';
};
# services.postgresql = {
# enable = true;
# };
# # phpfpm
# services.phpfpm.pools = phpfpmPools;
# # caddy webserver
# networking.firewall.allowedTCPPorts = [ 80 443 ];
# services.caddy = {
# enable = true;
# virtualHosts = caddyVhosts;
# };
# # caddy localhost root certificate
# security.pki.certificates = [ caddyLocalRootCert ];
}
{
virtualisation = {
docker.enable = true;
@ -16,6 +119,7 @@
environment.systemPackages = with pkgs; [
(import (fetchTarball https://github.com/cachix/devenv/archive/v0.6.2.tar.gz)).default
direnv
docker_compose
virt-manager
zola
];