add pinson

This commit is contained in:
root 2024-05-27 22:54:44 +02:00
parent 2ab2998e68
commit f73651bc32
4 changed files with 148 additions and 1 deletions

View file

@ -3,7 +3,7 @@
{
# Enable the OpenSSH daemon
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "no";
services.openssh.settings.PermitRootLogin = lib.mkDefault "no";
# Activate nix flakes.
nix.settings.experimental-features = [ "nix-command" "flakes" ];
@ -26,6 +26,7 @@
jnettop
iperf3
ncdu
git
tig
];

View file

@ -19,5 +19,11 @@
specialArgs = attrs;
modules = [ ./mesange/configuration.nix ];
};
nixosConfigurations."pinson" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = attrs;
modules = [ ./pinson/configuration.nix ];
};
};
}

99
pinson/configuration.nix Normal file
View file

@ -0,0 +1,99 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
../common/configuration.nix
];
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";
# use the latest kernel compatible with zfs
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
# workaround because we are in a vm
boot.zfs.devNodes = "/dev/disk/by-partuuid";
# setup automatic snapshots (~short term: retain no more than 1 month)
services.zfs.autoSnapshot = {
enable = true;
frequent = 0;
monthly = 0;
};
# automatic scrub, 20th of each month at 3AM
services.zfs.autoScrub = {
enable = true;
interval = "*-*-20 03:00:00";
};
networking.hostName = "pinson";
# required by zfs
networking.hostId = "8425e349";
services.openssh.settings.PasswordAuthentication = false;
services.openssh.settings.PermitRootLogin = "yes";
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDiT41LuYEluLxyyWR+zM1cOhcp6cC0DosCi1VivJCv8 armael@teabox"
];
users.users."music" = {
isNormalUser = true;
uid = 1001;
};
users.users."macaron" = {
isNormalUser = true;
uid = 1002;
};
users.groups = {
music = {
gid = 1001;
members = [ "music" "macaron" ];
};
};
users.users."macaron".openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHrUE40cFRIcnVI8rtopNlC1BVb58jS27/K2PQq5oZPd armael@macaron.isomorphis.me"
];
environment.systemPackages = with pkgs; [
zfs
beets
];
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment?
}

View file

@ -0,0 +1,41 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/200637c3-22c6-4ae1-9715-a89802cfc72c";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/5933-ABB0";
fsType = "vfat";
};
fileSystems."/piscine/musique" =
{ device = "piscine/musique";
fsType = "zfs";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}