EVERYTHING WORKS!!!
now i have to set up a server and the refresh module to update poonam input
This commit is contained in:
parent
613d4447bf
commit
84d6809cc2
|
@ -32,11 +32,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1649667661,
|
"lastModified": 1650097359,
|
||||||
"narHash": "sha256-9cbstidkXdAC3ZzokV6clgCoeLSbbs2tis9KFsqCzTM=",
|
"narHash": "sha256-5yz+ws47yxpu2BOZr8+Ht9t44yPsb6kWz1r1eftLg0I=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "a48aeae76ad50bb15ad9bda2cf51d7ae5c621853",
|
"rev": "70d0e2456857dc10dd7d2654277fc1dd8d8cc216",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
84
flake.nix
84
flake.nix
|
@ -60,50 +60,48 @@
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
defaultPackage = self.packages.${system}.site;
|
defaultPackage = self.packages.${system}.site;
|
||||||
|
|
||||||
# also need a module that refreshes this flake.lock, but maybe that shouldn't live here?
|
|
||||||
nixosModule = { options, lib, config, pkgs, ... }:
|
|
||||||
let
|
|
||||||
serverName = "anish.lakhwara.com";
|
|
||||||
webRoot = "/var/www/${serverName}";
|
|
||||||
|
|
||||||
serviceConfig = config.services."${serverName}";
|
|
||||||
options = {
|
|
||||||
enable = lib.mkEnableOption "${serverName} service";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.services.${serverName} = options;
|
|
||||||
config = lib.mkIf serviceConfig.enable {
|
|
||||||
systemd.services."source-${serverName}" = {
|
|
||||||
description = ''
|
|
||||||
https://${serverName} source
|
|
||||||
'';
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
DynamicUser = "yes";
|
|
||||||
};
|
|
||||||
startAt = "*00:00:00";
|
|
||||||
path = with pkgs; [ nix gnutar gzip curl jq ] ++ [ self.packages.${system}.site ];
|
|
||||||
script = ''
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
ln -sfT ${self.packages.${system}.site} ${webRoot}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
# Allow nginx through the firewall
|
|
||||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
|
||||||
services.nginx.enable = true;
|
|
||||||
services.nginx.virtualHosts.${serverName} = {
|
|
||||||
forceSSL = true;
|
|
||||||
enableACME = true;
|
|
||||||
locations."/" = { root = "${webRoot}"; };
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}) // {
|
}) // {
|
||||||
|
# also need a module that refreshes this flake.lock, but maybe that shouldn't live here?
|
||||||
|
nixosModule = { options, lib, config, pkgs, ... }:
|
||||||
|
let
|
||||||
|
serverName = "anish.lakhwara.com";
|
||||||
|
webRoot = "/var/www/";
|
||||||
|
|
||||||
|
serviceConfig = config.services."${serverName}";
|
||||||
|
options = {
|
||||||
|
enable = lib.mkEnableOption "${serverName} service";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.${serverName} = options;
|
||||||
|
config = lib.mkIf serviceConfig.enable {
|
||||||
|
systemd.services."source-${serverName}" = {
|
||||||
|
description = ''
|
||||||
|
https://${serverName} source
|
||||||
|
'';
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
};
|
||||||
|
startAt = "*00:00:00";
|
||||||
|
path = with pkgs; [ nix ] ++ [ self.packages.${system}.site ];
|
||||||
|
script = ''
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
mkdir -p ${webRoot}
|
||||||
|
ln -sfT ${self.packages.${pkgs.system}.site} ${webRoot}${serverName}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
# Allow nginx through the firewall
|
||||||
|
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||||
|
services.nginx.enable = true;
|
||||||
|
services.nginx.virtualHosts.${serverName} = {
|
||||||
|
#forceSSL = true;
|
||||||
|
#enableACME = true;
|
||||||
|
locations."/" = { root = "${webRoot}${serverName}"; index = "/home.html"; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
# Test container
|
# Test container
|
||||||
nixosConfigurations."test" = nixpkgs.lib.nixosSystem {
|
nixosConfigurations."test" = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
Loading…
Reference in a new issue