Compare commits

...

9 commits

Author SHA1 Message Date
Casper V. Kristensen fe916fe9e3 deluge directory permissions 2024-05-01 22:12:37 +02:00
Casper V. Kristensen 887cedd40e fixup! forgejo on sigma 2024-05-01 01:14:29 +02:00
Casper V. Kristensen f3ae1b711f flake.lock: Update
Flake lock file updates:

• Updated input 'home-manager-unstable':
    'github:nix-community/home-manager/2af7c78b7bb9cf18406a193eba13ef9f99388f49' (2024-04-29)
  → 'github:nix-community/home-manager/6d3b6dc9222c12b951169becdf4b0592ee9576ef' (2024-04-30)
• Updated input 'nixos-hardware':
    'github:NixOS/nixos-hardware/53db5e1070d07e750030bf65f1b9963df8f0c678' (2024-04-27)
  → 'github:NixOS/nixos-hardware/68d680c1b7c0e67a9b2144d6776583ee83664ef4' (2024-04-30)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/12430e43bd9b81a6b4e79e64f87c624ade701eaf' (2024-04-28)
  → 'github:NixOS/nixpkgs/576ecd43d3b864966b4423a853412d6177775e8b' (2024-04-29)
• Updated input 'secrets':
    'git+ssh://git@git.caspervk.net/caspervk/nixos-secrets.git?ref=refs/heads/master&rev=6d65c05c19961bd0874240810446378cd04c0257' (2024-04-29)
  → 'git+ssh://git@git.caspervk.net/caspervk/nixos-secrets.git?ref=refs/heads/master&rev=e09d11dbc33eb854f64cfda0d153ca23aeec4035' (2024-04-30)
2024-05-01 01:08:24 +02:00
Casper V. Kristensen 1cec05270e flake.lock: Update
Flake lock file updates:

• Updated input 'secrets':
    'git+ssh://git@git.caspervk.net/caspervk/nixos-secrets.git?ref=refs/heads/master&rev=833bd4232b64b3cd84385f1e1faa058ac49db2b1' (2024-04-29)
  → 'git+ssh://git@git.caspervk.net/caspervk/nixos-secrets.git?ref=refs/heads/master&rev=6d65c05c19961bd0874240810446378cd04c0257' (2024-04-29)
2024-05-01 01:07:15 +02:00
Casper V. Kristensen 76e6e99460 sigma: memos 2024-05-01 01:07:15 +02:00
Casper V. Kristensen 24b13a61ab podman 2024-04-30 00:17:22 +02:00
Casper V. Kristensen 252127cd36 flake.lock: Update
Flake lock file updates:

• Updated input 'home-manager-unstable':
    'github:nix-community/home-manager/c1609d584a6b5e9e6a02010f51bd368cb4782f8e' (2024-04-27)
  → 'github:nix-community/home-manager/2af7c78b7bb9cf18406a193eba13ef9f99388f49' (2024-04-29)
• Updated input 'secrets':
    'git+ssh://git@git.caspervk.net/caspervk/nixos-secrets.git?ref=refs/heads/master&rev=09e0efc226b9bf2f4bd9b93769edf9d7e0a6a76e' (2024-04-28)
  → 'git+ssh://git@git.caspervk.net/caspervk/nixos-secrets.git?ref=refs/heads/master&rev=833bd4232b64b3cd84385f1e1faa058ac49db2b1' (2024-04-29)
2024-04-29 22:34:59 +02:00
Casper V. Kristensen 9acfc136d0 flake.lock: Update
Flake lock file updates:

• Updated input 'secrets':
    'git+ssh://git@git.caspervk.net/caspervk/nixos-secrets.git?ref=refs/heads/master&rev=3cb27fc185eceef3c6efc4e6084a275c153fe9ee' (2024-04-28)
  → 'git+ssh://git@git.caspervk.net/caspervk/nixos-secrets.git?ref=refs/heads/master&rev=09e0efc226b9bf2f4bd9b93769edf9d7e0a6a76e' (2024-04-28)
2024-04-28 18:21:28 +02:00
Casper V. Kristensen 984bf66b2d forgejo on sigma 2024-04-28 18:11:40 +02:00
8 changed files with 158 additions and 15 deletions

View file

@ -85,11 +85,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1714203603, "lastModified": 1714515075,
"narHash": "sha256-eT7DENhYy7EPLOqHI9zkIMD9RvMCXcqh6gGqOK5BWYQ=", "narHash": "sha256-azMK7aWH0eUc3IqU4Fg5rwZdB9WZBvimOGG3piqvtsY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "c1609d584a6b5e9e6a02010f51bd368cb4782f8e", "rev": "6d3b6dc9222c12b951169becdf4b0592ee9576ef",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -136,11 +136,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1714201532, "lastModified": 1714465198,
"narHash": "sha256-nk0W4rH7xYdDeS7k1SqqNtBaNrcgIBYNmOVc8P2puEY=", "narHash": "sha256-ySkEJvS0gPz2UhXm0H3P181T8fUxvDVcoUyGn0Kc5AI=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "53db5e1070d07e750030bf65f1b9963df8f0c678", "rev": "68d680c1b7c0e67a9b2144d6776583ee83664ef4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -152,11 +152,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1714272655, "lastModified": 1714409183,
"narHash": "sha256-3/ghIWCve93ngkx5eNPdHIKJP/pMzSr5Wc4rNKE1wOc=", "narHash": "sha256-Wacm/DrzLD7mjFGnSxxyGkJgg2unU/dNdNgdngBH+RU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "12430e43bd9b81a6b4e79e64f87c624ade701eaf", "rev": "576ecd43d3b864966b4423a853412d6177775e8b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -228,11 +228,11 @@
}, },
"secrets": { "secrets": {
"locked": { "locked": {
"lastModified": 1714320269, "lastModified": 1714518477,
"narHash": "sha256-hc1oeeIyhoSwz4uW1i6XbKyPrUmmjj/EwnqEjpLD1N8=", "narHash": "sha256-doZSxR7Aot5ZvcCSa/qiC9LbRXJr6XNuflWPS2skStk=",
"ref": "refs/heads/master", "ref": "refs/heads/master",
"rev": "3cb27fc185eceef3c6efc4e6084a275c153fe9ee", "rev": "e09d11dbc33eb854f64cfda0d153ca23aeec4035",
"revCount": 30, "revCount": 34,
"type": "git", "type": "git",
"url": "ssh://git@git.caspervk.net/caspervk/nixos-secrets.git" "url": "ssh://git@git.caspervk.net/caspervk/nixos-secrets.git"
}, },

View file

@ -11,6 +11,7 @@
./hardware.nix ./hardware.nix
./jellyfin.nix ./jellyfin.nix
./mail.nix ./mail.nix
./memos.nix
./network.nix ./network.nix
./sonarr.nix ./sonarr.nix
]; ];

View file

@ -54,6 +54,10 @@
}; };
}; };
# Add caspervk user to the 'torrent' group to allow viewing downloads
users.groups.torrent.members = ["caspervk"];
environment.persistence."/nix/persist" = { environment.persistence."/nix/persist" = {
directories = [ directories = [
# Deluge data directory. This is *NOT* where the downloads are saved # Deluge data directory. This is *NOT* where the downloads are saved
@ -70,7 +74,7 @@
# /srv/torrents/downloads/movies/ and /srv/torrents/tv/. # /srv/torrents/downloads/movies/ and /srv/torrents/tv/.
{ {
directory = "/srv/torrents"; directory = "/srv/torrents";
user = "caspervk"; user = "deluge";
group = "torrent"; group = "torrent";
mode = "0770"; mode = "0770";
} }

View file

@ -1,9 +1,83 @@
{ {
config, config,
nixpkgs-unstable,
pkgs, pkgs,
secrets, secrets,
... ...
}: { }: {
# Forgejo is a lightweight software forge (Git host), with a highlight on
# being completely free software. It's a fork of Gitea.
# https://wiki.nixos.org/wiki/Forgejo
services.forgejo = {
enable = true;
# TODO: remove package override in NixOS 24.04
package = nixpkgs-unstable.legacyPackages.x86_64-linux.forgejo;
# Run Forgejo under git:git for better ssh clone urls.
user = "git";
group = "git";
# https://forgejo.org/docs/latest/admin/config-cheat-sheet/
settings = {
DEFAULT = {
# Application name, used in the page title.
APP_NAME = "Git";
};
repository = {
# Default branch name of all repositories.
DEFAULT_BRANCH = "master";
# Comma separated list of globally disabled repo units.
DISABLED_REPO_UNITS = "repo.issues,repo.ext_issues,repo.pulls,repo.wiki,repo.ext_wiki,repo.projects,repo.packages";
};
ui = {
# Default theme.
DEFAULT_THEME = "gitea-light";
};
server = {
# Listen address. Defaults to '0.0.0.0'.
HTTP_ADDR = "localhost";
# Domain name of the server.
DOMAIN = "git.caspervk.net";
# Full public URL of Forgejo server.
ROOT_URL = "https://git.caspervk.net/";
# Landing page for unauthenticated users.
LANDING_PAGE = "/caspervk";
};
security = {
# Cookie lifetime, in days.
LOGIN_REMEMBER_DAYS = 365;
};
service = {
# Disable registration, after which only admin can create accounts for
# users.
DISABLE_REGISTRATION = true;
};
session = {
# Marks session cookies as “secure” as a hint for browsers to only send
# them via HTTPS. This option is recommend, if Forgejo is being served
# over HTTPS.
COOKIE_SECURE = true;
# Session engine provider.
PROVIDER = "db";
};
};
};
# The configured Forgejo user and group is only created automatically if it
# is left at the default "forgejo". The following is copied from
# https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/forgejo.nix
# but with the mkIf removed and "forgejo" substituted for "git".
users.users = {
git = {
home = config.services.forgejo.stateDir;
useDefaultShell = true;
group = "git";
isSystemUser = true;
};
};
users.groups = {
git = {};
};
# https://wiki.nixos.org/wiki/Forgejo
# https://forgejo.org/docs/latest/admin/actions/ # https://forgejo.org/docs/latest/admin/actions/
services.gitea-actions-runner = { services.gitea-actions-runner = {
package = pkgs.forgejo-actions-runner; package = pkgs.forgejo-actions-runner;
@ -31,6 +105,17 @@
}; };
}; };
environment.persistence."/nix/persist" = {
directories = [
{
directory = "/var/lib/forgejo";
user = "git";
group = "git";
mode = "0750";
}
];
};
age.secrets.forgejo-actions-runner-token-file = { age.secrets.forgejo-actions-runner-token-file = {
file = "${secrets}/secrets/forgejo-actions-runner-token-file.age"; file = "${secrets}/secrets/forgejo-actions-runner-token-file.age";
mode = "400"; mode = "400";

20
hosts/sigma/memos.nix Normal file
View file

@ -0,0 +1,20 @@
{...}: {
virtualisation.oci-containers.containers = {
memos = {
# https://www.usememos.com/docs/install/self-hosting
image = "docker.io/neosmemo/memos:stable";
environment = {
# https://github.com/usememos/memos/issues/2433#issuecomment-1797316081
MEMOS_METRIC = "false";
};
ports = [
# TODO: for some *very* weird reason, exposing the port does not work
# if we use the same port on the host and inside the container. Why??
"127.0.0.1:5231:5230"
];
volumes = [
"memos:/var/opt/memos"
];
};
};
}

View file

@ -11,6 +11,7 @@
./network.nix ./network.nix
./nix.nix ./nix.nix
./packages.nix ./packages.nix
./podman.nix
./ripgrep.nix ./ripgrep.nix
./ssh.nix ./ssh.nix
./sudo.nix ./sudo.nix

30
modules/base/podman.nix Normal file
View file

@ -0,0 +1,30 @@
{...}: {
# Podman can run rootless containers and be a drop-in replacement for Docker.
# It is used for systemd services containers defined using
# `virtualisation.oci-containers`.
# https://wiki.nixos.org/wiki/Podman
virtualisation.containers.enable = true;
virtualisation.podman = {
enable = true;
# Automatically `podman system prune` weekly
autoPrune.enable = true;
# Required for containers under podman-compose to be able to talk to each
# other.
defaultNetwork.settings = {
dns_enabled = true;
ipv6_enabled = true;
};
};
# Persist docker volumes
environment.persistence."/nix/persist" = {
directories = [
{
directory = "/var/lib/containers";
user = "root";
group = "root";
mode = "0700";
}
];
};
}

View file

@ -90,15 +90,17 @@
"! /**/found.000/*" "! /**/found.000/*"
"! /**/.cache" "! /**/.cache"
"! /**/Cache"
"! /**/cache" "! /**/cache"
"! /**/Cache"
"! /srv/torrents" "! /srv/torrents"
"! /var/lib/containers/overlay*"
"! /var/lib/docker/overlay2" "! /var/lib/docker/overlay2"
"- *.tmp" "- *.tmp"
"! /home/*/Android/Sdk" "! /home/*/Android/Sdk"
"! /home/*/Downloads" "! /home/*/Downloads"
"! /home/*/GOG Games" "! /home/*/GOG Games"
"! /home/*/.local/share/containers/storage/overlay*"
"! /home/*/.steam" "! /home/*/.steam"
]; ];