Initial commit

main
kalle 2024-11-17 20:28:14 +01:00
commit 66d38c26ec
7 changed files with 100 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.qcow2

27
flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1731676054,
"narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5e4fbfb6b3de1aa2872b76d49fafc942626e2add",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

19
flake.nix Normal file
View File

@ -0,0 +1,19 @@
{
description = "Homelab configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs =
{ self, nixpkgs, ... }@inputs:
let
outputs = self.outputs;
utils = import ./utils.nix { inherit nixpkgs inputs outputs; };
in
{
nixosConfigurations = {
"nix-test" = utils.mkSystem ./systems/nix-test.nix;
};
};
}

12
services/sonarr.nix Normal file
View File

@ -0,0 +1,12 @@
{ ... }:
{
# Enable the sonarr service
services.sonarr = {
enable = true;
openFirewall = true;
group = "media";
};
# Ensure that the media group exists
users.groups.media = { };
}

14
systems/base.nix Normal file
View File

@ -0,0 +1,14 @@
{ ... }:
{
nix.settings = {
# Enable flakes and new 'nix' command
experimental-features = "nix-command flakes";
# Deduplicate and optimize nix store
auto-optimise-store = true;
};
services.openssh.enable = true;
time.timeZone = "Europe/Amsterdam";
i18n.defaultLocale = "en_US.UTF-8";
}

7
systems/nix-test.nix Normal file
View File

@ -0,0 +1,7 @@
{ ... }:
{
imports = [ ../services/sonarr.nix ];
networking.hostName = "nix-test";
system.stateVersion = "24.05";
}

20
utils.nix Normal file
View File

@ -0,0 +1,20 @@
{
nixpkgs,
inputs,
outputs,
...
}:
{
mkSystem =
config:
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs outputs;
};
modules = [
./systems/base.nix
config
];
};
}