From 3925cf2bb704645de9d00d2131ddb08712d4f620 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Mon, 3 Nov 2025 22:16:55 +0100 Subject: primo commit --- odino/home-manager/default.nix | 5 ++++ odino/home-manager/leo/home.nix | 13 +++++++++ odino/home-manager/leo/programs/default.nix | 7 +++++ odino/home-manager/leo/programs/zsh.nix | 43 +++++++++++++++++++++++++++++ odino/nixos/boot.nix | 8 ++++++ odino/nixos/default.nix | 28 +++++++++++++++++++ odino/nixos/locales.nix | 20 ++++++++++++++ odino/nixos/networking.nix | 30 ++++++++++++++++++++ odino/nixos/programs/default.nix | 33 ++++++++++++++++++++++ odino/nixos/services/default.nix | 12 ++++++++ 10 files changed, 199 insertions(+) create mode 100644 odino/home-manager/default.nix create mode 100644 odino/home-manager/leo/home.nix create mode 100644 odino/home-manager/leo/programs/default.nix create mode 100644 odino/home-manager/leo/programs/zsh.nix create mode 100644 odino/nixos/boot.nix create mode 100644 odino/nixos/default.nix create mode 100644 odino/nixos/locales.nix create mode 100644 odino/nixos/networking.nix create mode 100644 odino/nixos/programs/default.nix create mode 100644 odino/nixos/services/default.nix (limited to 'odino') diff --git a/odino/home-manager/default.nix b/odino/home-manager/default.nix new file mode 100644 index 0000000..bb6ef28 --- /dev/null +++ b/odino/home-manager/default.nix @@ -0,0 +1,5 @@ +{...}: { + imports = [ + ./leo/home.nix + ]; +} diff --git a/odino/home-manager/leo/home.nix b/odino/home-manager/leo/home.nix new file mode 100644 index 0000000..332cb6e --- /dev/null +++ b/odino/home-manager/leo/home.nix @@ -0,0 +1,13 @@ +{...}: { + imports = [ + ./programs + ]; + + home = { + username = "leo"; + homeDirectory = "/home/leo"; + }; + + # Version + home.stateVersion = "25.05"; +} diff --git a/odino/home-manager/leo/programs/default.nix b/odino/home-manager/leo/programs/default.nix new file mode 100644 index 0000000..e97a99a --- /dev/null +++ b/odino/home-manager/leo/programs/default.nix @@ -0,0 +1,7 @@ +{...}: { + imports = [ + ./zsh.nix + ]; + + zsh.enable = true; +} diff --git a/odino/home-manager/leo/programs/zsh.nix b/odino/home-manager/leo/programs/zsh.nix new file mode 100644 index 0000000..87dd335 --- /dev/null +++ b/odino/home-manager/leo/programs/zsh.nix @@ -0,0 +1,43 @@ +{lib, config, ...}: { + options.zsh.enable = lib.mkEnableOption "zsh config"; + + config = lib.mkIf config.zsh.enable { + programs.zsh = { + enable = true; + enableCompletion = true; + enableVteIntegration = true; + syntaxHighlighting.enable = true; + + history.size = 10000; + + oh-my-zsh = { + enable = true; + theme = "fishy"; + plugins = [ "git" "ssh" ]; + }; + + shellAliases = { + ls = "ls -lh --color=auto"; + l = "ls"; + ll = "ls -a"; + ssh = "TERM=xterm-256color ssh"; + + update-system = "sudo nixos-rebuild switch --flake ~/nixos#odino"; + update-home = "home-manager switch --flake ~/nixos#odino"; + }; + + initContent = '' + # Ctrl + arrow keys + bindkey '^[Oc' forward-word + bindkey '^[Od' backward-word + bindkey '^[[1;5D' backward-word + bindkey '^[[1;5C' forward-word + bindkey '^H' backward-kill-word + + # Theme + autoload -U colors + colors + ''; + }; + }; +} diff --git a/odino/nixos/boot.nix b/odino/nixos/boot.nix new file mode 100644 index 0000000..dbd0ed6 --- /dev/null +++ b/odino/nixos/boot.nix @@ -0,0 +1,8 @@ +{...}: { + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + }; +} diff --git a/odino/nixos/default.nix b/odino/nixos/default.nix new file mode 100644 index 0000000..7a96d5e --- /dev/null +++ b/odino/nixos/default.nix @@ -0,0 +1,28 @@ +{ inputs, pkgs, ... }: { + imports = [ + ./hardware-configuration.nix + ./boot.nix + ./networking.nix + ./locales.nix + + ./services + ./programs + + inputs.home-manager.nixosModules.home-manager + ]; + + # Experimental features + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Users + users.users.leo = { + isNormalUser = true; + description = "Leonardo"; + shell = pkgs.zsh; + + extraGroups = [ "wheel" "networkmanager" ]; + }; + + # Version + system.stateVersion = "25.05"; +} diff --git a/odino/nixos/locales.nix b/odino/nixos/locales.nix new file mode 100644 index 0000000..2d2363d --- /dev/null +++ b/odino/nixos/locales.nix @@ -0,0 +1,20 @@ +{...}: { + time.timeZone = "Europe/Rome"; + console.keyMap = "it"; + + i18n = { + defaultLocale = "en_US.UTF-8"; + + extraLocaleSettings = { + LC_ADDRESS = "it_IT.UTF-8"; + LC_IDENTIFICATION = "it_IT.UTF-8"; + LC_MEASUREMENT = "it_IT.UTF-8"; + LC_MONETARY = "it_IT.UTF-8"; + LC_NAME = "it_IT.UTF-8"; + LC_NUMERIC = "it_IT.UTF-8"; + LC_PAPER = "it_IT.UTF-8"; + LC_TELEPHONE = "it_IT.UTF-8"; + LC_TIME = "it_IT.UTF-8"; + }; + }; +} diff --git a/odino/nixos/networking.nix b/odino/nixos/networking.nix new file mode 100644 index 0000000..8f9f45c --- /dev/null +++ b/odino/nixos/networking.nix @@ -0,0 +1,30 @@ +{...}: { + networking = { + hostName = "odino"; + + nameservers = [ "208.67.222.222" "208.67.220.220" ]; + networkmanager.enable = true; + + firewall = { + enable = true; + + allowedTCPPorts = [ 22 ]; + allowedUDPPorts = [ 51820 ]; + }; + + wireguard.interfaces."tunnel" = { + ips = [ "10.69.0.2/24" ]; + + privateKeyFile = "/home/leo/.wireguard/private.key"; + + peers = [ + { + publicKey = "rwUMCdhjQbQt9uGjljfdABj4DSJFgL62bzT13sg8LmU="; + allowedIPs = [ "10.69.0.0/24" ]; + endpoint = "leoflo.me:51820"; + persistentKeepalive = 25; + } + ]; + }; + }; +} diff --git a/odino/nixos/programs/default.nix b/odino/nixos/programs/default.nix new file mode 100644 index 0000000..9da2ef4 --- /dev/null +++ b/odino/nixos/programs/default.nix @@ -0,0 +1,33 @@ +{inputs, pkgs, ...}: { + nixpkgs.config.allowUnfree = true; + + # Packages + environment.systemPackages = with pkgs; [ + rsync wireguard-tools + vim htop file + + # Home manager + inputs.home-manager.packages.${pkgs.stdenv.hostPlatform.system}.home-manager + ]; + + # Zsh + programs.zsh.enable = true; + + # Git + programs.git = { + enable = true; + + config = { + init = { + defaultBranch = "master"; + }; + core = { + editor = "vim"; + }; + }; + }; + + # Docker + virtualisation.docker.enable = true; + users.extraGroups."docker".members = [ "leo" ]; +} diff --git a/odino/nixos/services/default.nix b/odino/nixos/services/default.nix new file mode 100644 index 0000000..eeabc7c --- /dev/null +++ b/odino/nixos/services/default.nix @@ -0,0 +1,12 @@ +{...}: { + # OpenSSH + services.openssh = { + enable = true; + + settings = { + PermitRootLogin = "no"; + PasswordAuthentication = false; + PrintMotd = false; + }; + }; +} -- cgit v1.3