1
0
mirror of https://github.com/ellmau/nixos.git synced 2025-12-19 09:29:36 +01:00

Add base config for the server

This commit is contained in:
Stefan Ellmauthaler 2022-03-30 14:23:52 +02:00
parent d4d5f4e69e
commit 791c2a6915
Failed to extract signature
12 changed files with 183 additions and 9 deletions

View File

@ -43,6 +43,6 @@ flakes.nixpkgs.lib.listToAttrs (map mkMachine [
} }
{ {
name = "ellmauthaler"; name = "ellmauthaler";
extraModules = [ flakes.home-manager.nixosModules.home-manager ]; extraModules = [ flakes.home-manager.nixosModules.home-manager flakes.simple-nixos-mailserver.nixosModule flakes.sops-nix.nixosModules.sops ];
} }
]) ])

136
flake.lock generated
View File

@ -1,12 +1,28 @@
{ {
"nodes": { "nodes": {
"blobs": {
"flake": false,
"locked": {
"lastModified": 1604995301,
"narHash": "sha256-wcLzgLec6SGJA8fx1OEN1yV/Py5b+U5iyYpksUY/yLw=",
"owner": "simple-nixos-mailserver",
"repo": "blobs",
"rev": "2cccdf1ca48316f2cfd1c9a0017e8de5a7156265",
"type": "gitlab"
},
"original": {
"owner": "simple-nixos-mailserver",
"repo": "blobs",
"type": "gitlab"
}
},
"emacs-overlay": { "emacs-overlay": {
"locked": { "locked": {
"lastModified": 1648610035, "lastModified": 1648636019,
"narHash": "sha256-eQ3/YRbabEJbmRKvo48NHZ2MtgyqnlQfjBXLkBcyqGk=", "narHash": "sha256-+ouEG2bFGttFe9xDgTJ6EQx6MbfZ8Mwvp+K1+CZJNGg=",
"owner": "nix-community", "owner": "nix-community",
"repo": "emacs-overlay", "repo": "emacs-overlay",
"rev": "26da73dd9129d267f0c8c26b591ab91050c4cdc9", "rev": "af2208c42bca9e11703fd4d3853a56213e88cbb8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -54,11 +70,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1648383610, "lastModified": 1648553562,
"narHash": "sha256-egKvd+S5FEpjwK2aCoJ+NrBG2m+9Njl4I1OXrDTZHvE=", "narHash": "sha256-xQhRKu6h0phd56oCzGjkhHkY4eDI1XKedGqkFtlXapk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "7a3f9d626c8a88141077ab99d8352469aa6feeb7", "rev": "9b168e5e62406fa2e55e132f390379a6ba22b402",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -68,6 +84,36 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-21_05": {
"locked": {
"lastModified": 1625692408,
"narHash": "sha256-e9L3TLLDVIJpMnHtiNHJE62oOh6emRtSZ244bgYJUZs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c06613c25df3fe1dd26243847a3c105cf6770627",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-21.05",
"type": "indirect"
}
},
"nixpkgs-21_11": {
"locked": {
"lastModified": 1638371214,
"narHash": "sha256-0kE6KhgH7n0vyuX4aUoGsGIQOqjIx2fJavpCWtn73rc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a640d8394f34714578f3e6335fc767d0755d78f9",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-21.11",
"type": "indirect"
}
},
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1648390671, "lastModified": 1648390671,
@ -84,13 +130,89 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": {
"locked": {
"lastModified": 1626852498,
"narHash": "sha256-lOXUJvi0FJUXHTVSiC5qsMRtEUgqM4mGZpMESLuGhmo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "16105403bdd843540cbef9c63fc0f16c1c6eaa70",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"root": { "root": {
"inputs": { "inputs": {
"emacs-overlay": "emacs-overlay", "emacs-overlay": "emacs-overlay",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable" "nixpkgs-unstable": "nixpkgs-unstable",
"simple-nixos-mailserver": "simple-nixos-mailserver",
"sops-nix": "sops-nix"
}
},
"simple-nixos-mailserver": {
"inputs": {
"blobs": "blobs",
"nixpkgs": "nixpkgs_2",
"nixpkgs-21_05": "nixpkgs-21_05",
"nixpkgs-21_11": "nixpkgs-21_11",
"utils": "utils"
},
"locked": {
"lastModified": 1638911354,
"narHash": "sha256-hNhzLOp+dApEY15vwLAQZu+sjEQbJcOXCaSfAT6lpsQ=",
"owner": "simple-nixos-mailserver",
"repo": "nixos-mailserver",
"rev": "6e3a7b2ea6f0d68b82027b988aa25d3423787303",
"type": "gitlab"
},
"original": {
"owner": "simple-nixos-mailserver",
"ref": "nixos-21.11",
"repo": "nixos-mailserver",
"type": "gitlab"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1647279403,
"narHash": "sha256-ZsHfMah9+TElcjaENsaOIFHBNNtSbXmyLFVbiJiAECs=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "c01f48b055ac776f9831c9d4a0fff83e3b74dbe3",
"type": "github"
},
"original": {
"owner": "Mic92",
"ref": "master",
"repo": "sops-nix",
"type": "github"
}
},
"utils": {
"locked": {
"lastModified": 1605370193,
"narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5021eac20303a61fafe17224c087f5519baed54d",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
} }
} }
}, },

View File

@ -19,6 +19,13 @@
emacs-overlay = { emacs-overlay = {
url = "github:nix-community/emacs-overlay"; url = "github:nix-community/emacs-overlay";
}; };
simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-21.11";
sops-nix = {
url = "github:Mic92/sops-nix/master";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = {self, ...}@inputs: outputs = {self, ...}@inputs:

View File

@ -1,3 +1,10 @@
{ config, pkgs, ...}: { config, pkgs, lib, ...}:
{ {
config = lib.mkIf config.variables.server {
services.sshd.enable = true;
imports = [
../services
../secrets
];
};
} }

View File

@ -3,6 +3,7 @@
variables = { variables = {
hostName = "ellmauthaler"; hostName = "ellmauthaler";
server = true;
}; };
networking = { networking = {

4
secrets/default.nix Normal file
View File

@ -0,0 +1,4 @@
{ config, pkgs, ... }:
{
sops.defaultSopsFile = ./secrets.yaml;
}

0
secrets/secrets.yaml Normal file
View File

9
services/default.nix Normal file
View File

@ -0,0 +1,9 @@
{ config, pkgs, lib, ...}:
{
imports = [
./nginx.nix
./smailserver.nix
./mariadb.nix
./nextcloud.nix
];
}

7
services/mariadb.nix Normal file
View File

@ -0,0 +1,7 @@
{ config, pkgs, lib, ...}:
{
services.mysql = {
enable = true;
package = pkgs.mariadb;
};
}

4
services/nextcloud.nix Normal file
View File

@ -0,0 +1,4 @@
{ config, pkgs, lib, ...}:
{
mailserver.enable = true;
}

9
services/nginx.nix Normal file
View File

@ -0,0 +1,9 @@
{ config, pkgs, lib, ...}:
{
services.nginx.enable = true;
services.nginx.virtualHosts."localhost" = {
addSSL = false;
enableACME = false;
root = "/var/www/localhost";
};
}

4
services/smailserver.nix Normal file
View File

@ -0,0 +1,4 @@
{ config, pkgs, lib, ...}:
{
mailserver.enable = true;
}