mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-24 00:29:43 -04:00
initial server work
This commit is contained in:
parent
26e1521491
commit
036db0b3b9
53 changed files with 228 additions and 11 deletions
38
src/modules/system/corn/default.nix
Normal file
38
src/modules/system/corn/default.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.corn;
|
||||
|
||||
in
|
||||
{ options.modules.corn = { enable = mkEnableOption "corn"; };
|
||||
|
||||
imports = [
|
||||
./core-lightning
|
||||
./sparrow-cli
|
||||
];
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users = {
|
||||
users = {
|
||||
"bitcoind" = {
|
||||
description = "bitcoind system user";
|
||||
isSystemUser = true;
|
||||
group = "bitcoin";
|
||||
};
|
||||
};
|
||||
groups = {
|
||||
"bitcoin" = {
|
||||
members = [ "core-lightning" "electrs" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
services.bitcoind = {
|
||||
"main-net" = {
|
||||
enable = true;
|
||||
user = "bitcoind";
|
||||
group = "bitcoin";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
25
src/modules/system/corn/modules/core-lightning/default.nix
Normal file
25
src/modules/system/corn/modules/core-lightning/default.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
|
||||
with lib;
|
||||
let cfg = config.modules.corn.core-lightning;
|
||||
|
||||
in
|
||||
{ options.modules.corn.core-lightning = { enable = mkEnableOption "corn.core-lightning"; };
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
clightning
|
||||
];
|
||||
|
||||
systemd.services.clightning = {
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = ''
|
||||
${pkgs.clightning}/bin/lightningd --conf=...
|
||||
'';
|
||||
serviceConfig = {
|
||||
User = "core-lighting";
|
||||
Group = "bitcoin";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
src/modules/system/corn/modules/default.nix
Normal file
6
src/modules/system/corn/modules/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./core-lightning
|
||||
./sparrow-cli
|
||||
];
|
||||
}
|
||||
0
src/modules/system/corn/modules/electrs/default.nix
Normal file
0
src/modules/system/corn/modules/electrs/default.nix
Normal file
14
src/modules/system/corn/modules/sparrow-cli/default.nix
Normal file
14
src/modules/system/corn/modules/sparrow-cli/default.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.corn.sparrow-server;
|
||||
sparrow-server = import ./derivation.nix { inherit pkgs; };
|
||||
in
|
||||
{ options.modules.corn.sparrow-server = { enable = mkEnableOption "corn.sparrow-server"; };
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
sparrow-server
|
||||
];
|
||||
};
|
||||
}
|
||||
24
src/modules/system/corn/modules/sparrow-cli/derivation.nix
Normal file
24
src/modules/system/corn/modules/sparrow-cli/derivation.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
with pkgs;
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "sparrow-server";
|
||||
version = "1.8.2";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/sparrowwallet/sparrow/releases/download/${version}/sparrow-server-${version}-x86_64.tar.gz";
|
||||
sha256 = "16hyrf8j7mv3m1ry7r2k3w70yxbf6smgcm5d35xy2hjqfmahv65m";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp -r * $out/bin
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Sparrow Server";
|
||||
homepage = "https://sparrowwallet.com/";
|
||||
license = stdenv.lib.licenses.mit;
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
5
src/modules/system/default.nix
Normal file
5
src/modules/system/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./corn
|
||||
];
|
||||
}
|
||||
|
Before Width: | Height: | Size: 609 KiB After Width: | Height: | Size: 609 KiB |
|
|
@ -6,7 +6,7 @@
|
|||
home-manager.users.${config.user.name} = {
|
||||
imports = [
|
||||
../../user
|
||||
../../modules
|
||||
../../modules/user
|
||||
];
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
|
|
|
|||
|
|
@ -78,14 +78,6 @@
|
|||
execWheelOnly = true;
|
||||
};
|
||||
|
||||
# System Services
|
||||
services = {
|
||||
cron = {
|
||||
enable = true;
|
||||
systemCronJobs = [];
|
||||
};
|
||||
};
|
||||
|
||||
# Locale
|
||||
time = {
|
||||
timeZone = "America/New_York";
|
||||
|
|
|
|||
|
|
@ -1 +1,9 @@
|
|||
# TODO: nixify the server
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../user
|
||||
./hardware.nix
|
||||
./system.nix
|
||||
];
|
||||
}
|
||||
|
|
|
|||
104
src/systems/server/system.nix
Normal file
104
src/systems/server/system.nix
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
|
||||
{ system.stateVersion = "23.11";
|
||||
|
||||
imports = [
|
||||
../../modules/system
|
||||
];
|
||||
|
||||
# Users
|
||||
users.users = {
|
||||
${config.user.name} = {
|
||||
isNormalUser = true;
|
||||
extraGroups = config.user.groups;
|
||||
openssh.authorizedKeys.keys = config.user.sshKeys;
|
||||
};
|
||||
};
|
||||
|
||||
# Nix
|
||||
nix = {
|
||||
channel.enable = false;
|
||||
package = pkgs.nixFlakes;
|
||||
extraOptions = "experimental-features = nix-command flakes";
|
||||
settings = {
|
||||
auto-optimise-store = true;
|
||||
trusted-users = [ "${config.user.name}" ];
|
||||
};
|
||||
gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 30d";
|
||||
};
|
||||
};
|
||||
|
||||
# Bootloader
|
||||
boot.loader = {
|
||||
timeout = null;
|
||||
grub = {
|
||||
enable = true;
|
||||
useOSProber = true;
|
||||
devices = [ "nodev" ];
|
||||
efiSupport = true;
|
||||
configurationLimit = 5;
|
||||
};
|
||||
|
||||
efi = {
|
||||
canTouchEfiVariables = true;
|
||||
};
|
||||
};
|
||||
|
||||
# Fonts
|
||||
fonts.packages = with pkgs; [
|
||||
terminus_font
|
||||
terminus-nerdfont
|
||||
];
|
||||
|
||||
# Sudo Options
|
||||
security.sudo = {
|
||||
wheelNeedsPassword = false;
|
||||
execWheelOnly = true;
|
||||
};
|
||||
|
||||
# Locale
|
||||
time = {
|
||||
timeZone = "America/New_York";
|
||||
hardwareClockInLocalTime = true;
|
||||
};
|
||||
|
||||
services.timesyncd = {
|
||||
enable = true;
|
||||
servers = [
|
||||
"0.pool.ntp.org"
|
||||
"1.pool.ntp.org"
|
||||
"2.pool.ntp.org"
|
||||
"3.pool.ntp.org"
|
||||
];
|
||||
};
|
||||
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
console = {
|
||||
font = "Lat2-Terminus16";
|
||||
useXkbConfig = true;
|
||||
};
|
||||
|
||||
# Networking
|
||||
networking = {
|
||||
hostName = "archimedes";
|
||||
useDHCP = lib.mkDefault true;
|
||||
networkmanager.enable = true;
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [ 22 80 443 ];
|
||||
};
|
||||
};
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
startWhenNeeded = true;
|
||||
settings = {
|
||||
X11Forwarding = false;
|
||||
PasswordAuthentication = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
home-manager.users.${config.user.name} = {
|
||||
imports = [
|
||||
../../user
|
||||
../../modules
|
||||
../../modules/user
|
||||
];
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
options = "--delete-older-than 30d";
|
||||
};
|
||||
};
|
||||
|
||||
# Sudo Options
|
||||
security.sudo = {
|
||||
wheelNeedsPassword = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue