Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. [root@sakura:/etc/nixos]# cat /etc/nixos/server.nix
  2. # Server configuration.
  3. { config, pkgs, ... }:
  4. {
  5. services = {
  6. lighttpd = {
  7. document-root = /srv/http;
  8. enableModules = [ "mod_simple_vhost" ];
  9. extraConfig = ''
  10. simple-vhost.server-root = "/srv/http"
  11. simple-vhost.default-host = "localhost"
  12. simple-vhost.document-root = "/htdocs"
  13. '';
  14. };
  15. gitea = {
  16. cookieSecure = true;
  17. repositoryRoot = "/srv/git";
  18. user = "git";
  19. appName = "Fireburn's Git";
  20. rootUrl = "https://git.fireburn.ru";
  21. };
  22. };
  23.  
  24. users = {
  25. users = if config.services.gitea.enable == true then {
  26. git = {
  27. name = config.services.gitea.user;
  28. description = "Gitea Service";
  29. home = config.services.gitea.stateDir;
  30. createHome = true;
  31. useDefaultShell = true;
  32. isNormalUser = false;
  33. isSystemUser = true;
  34. };
  35. } else {};
  36. };
  37. }
  38. # vim: ts=2 sts=2 sw=2 et
  39.  
  40. [root@sakura:/etc/nixos]# cat /etc/nixos/containers/web.nix
  41. { config, lib, pkgs, ... }:
  42.  
  43. with lib;
  44.  
  45. {
  46.  
  47. imports = [
  48. ../server.nix
  49. ];
  50.  
  51. boot.isContainer = true;
  52. networking = {
  53. hostName = mkDefault "web.fireburn.ru";
  54. useDHCP = false;
  55. firewall = {
  56. allowedTCPPorts = [ 80 443 ];
  57. };
  58. };
  59.  
  60. services = {
  61. lighttpd = {
  62. enable = true;
  63. };
  64. };
  65. }
  66.  
  67. [root@sakura:/etc/nixos]# cat /etc/nixos/configuration.nix
  68. # Site-specific configuration file.
  69. { config, pkgs, ... }:
  70. {
  71. imports =
  72. [
  73. # Common configuration
  74. ./common.nix
  75. # Uncomment for a server system
  76. #./server.nix
  77. # Uncomment for a desktop system
  78. ./desktop.nix
  79. ];
  80.  
  81. # <snip!>
  82.  
  83. containers = {
  84. gitea = (import containers/gitea.nix);
  85. };
  86. }
  87.  
  88. [root@sakura:/etc/nixos]# nixos-rebuild test
  89. building Nix...
  90. building the system configuration...
  91. error: The option `containers.gitea.services' defined in `/etc/nixos/server.nix' does not exist.
  92. (use '--show-trace' to show detailed location information)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement