From 9a14034e942cb824146923f2514dccff18fd17e3 Mon Sep 17 00:00:00 2001 From: pazpi Date: Wed, 17 Jul 2024 16:28:52 +0200 Subject: [PATCH] Configurazione base senza niente --- lxc-nix/configuration-empty.nix | 88 +++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 lxc-nix/configuration-empty.nix diff --git a/lxc-nix/configuration-empty.nix b/lxc-nix/configuration-empty.nix new file mode 100644 index 0000000..be178f4 --- /dev/null +++ b/lxc-nix/configuration-empty.nix @@ -0,0 +1,88 @@ +{ config, pkgs, ... }: + +let + + parameters = import ./parameters.nix { }; + + # GID = 888; + # user = "rtorrent"; + # passwordHash = "$y$j9T$dA94KVg1/jYLqclQQbTDk.$cnfxBWUN8P4shr8Kkipv5bU/RCtQNoAwYFDZ0X/BYs5"; + + timeZone = "Europe/Rome"; + defaultLocale = "en_US.UTF-8"; +in +{ + imports = [ + + # Need to load some defaults for running in an lxc container. + # This is explained in: + # https://github.com/nix-community/nixos-generators/issues/79 + # "${modulesPath}/virtualisation/lxc-container.nix" + ]; + + # This doesn't do _everything_ we need, because `boot.isContainer` is + # specifically talking about light-weight NixOS containers, not LXC. But it + # does at least gives us something to start with. + boot.isContainer = true; + + networking = { + hostName = parameters.containerName; + }; + + nixpkgs.config.allowUnfree = true; + + # Extra packages + # environment.systemPackages = with pkgs; [ ]; + + services = { + openssh.enable = true; + }; + + time.timeZone = parameters.timeZone; + + i18n = { + defaultLocale = defaultLocale; + extraLocaleSettings = { + LC_ADDRESS = defaultLocale; + LC_IDENTIFICATION = defaultLocale; + LC_MEASUREMENT = defaultLocale; + LC_MONETARY = defaultLocale; + LC_NAME = defaultLocale; + LC_PAPER = defaultLocale; + LC_TELEPHONE = defaultLocale; + # LC_NUMERIC = defaultLocale; + # LC_TIME = defaultLocale; + }; + }; + + users = { + + # If set to false, the contents of the user and group files will simply + # be replaced on system activation. + # This also holds for the user passwords. + # All changed passwords will be reset according + # to the `users.users` configuration on activation. + mutableUsers = false; + + users.root = { + hashedPassword = "$6$gir1YD6tNdC9xAj0$zLr1yt/ea9PvwygjHfQVnPmeCd1.2zrAKWiN80duidwOkZF6hwm06ta6J3O9uw6F3uUHC0N7iiKYhCgXXR.Q7/"; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhiGLc/whCY3lCmDiRlYnMJOLiO/gvcRj/sKVEFVAhQ pazpi@deadbeef" +"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILrVYJrU6Ys2o/QYfI6Es5yqVVyjUyDYj6Fglvz63ywP krzo@pazpi.top" + ]; + }; + + }; + + # Supress systemd units that don't work because of LXC. + # https://blog.xirion.net/posts/nixos-proxmox-lxc/#configurationnix-tweak + systemd.suppressedSystemUnits = [ + "dev-mqueue.mount" + "sys-kernel-debug.mount" + "sys-fs-fuse-connections.mount" + ]; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + system.stateVersion = "24.05"; +}