diff --git a/nix/configurations/hetzner_benchmark.nix b/nix/configurations/hetzner_benchmark.nix index eb06224e..e858d3c9 100644 --- a/nix/configurations/hetzner_benchmark.nix +++ b/nix/configurations/hetzner_benchmark.nix @@ -3,37 +3,114 @@ let sources = import ../../npins; hostname = "hetzner_benchmark"; + username = "leana"; +in +{ + pkgs, + config, + lib, + ... +}: +let + inherit (lib.modules) mkAliasOptionModule; in -{ lib, ... }: { imports = [ + # + # Shorthands + # + (mkAliasOptionModule [ "me" ] [ "users" "users" username ]) + (mkAliasOptionModule [ "hm" ] [ "home-manager" "users" username ]) + # # hostname # { _module.args = { inherit hostname; }; } - { system.nixos.version = lib.substring 0 8 sources.nixpkgs.revision; } + # + # nixpkgs + # + { + nixpkgs = { + overlays = map import [ + ../packages/overlay.nix - ./hetzner_benchmark/hardware-configuration.nix + # use lix everywhere and wrap it with nom + ../overlays/lix.nix + ../overlays/nix-monitored.nix + ]; + # Set NIX_PATH and flake registry at the same time + # https://github.com/NixOS/nixpkgs/pull/254405 + flake.source = sources.nixpkgs; + }; + + nix.package = pkgs.nix-monitored; + + system.nixos.version = lib.substring 0 8 sources.nixpkgs.revision; + } + + ./hetzner_benchmark/nixos/hardware-configuration.nix + ./hetzner_benchmark/nixos/misc.nix + + ../nixosModules/common/fish.nix + ../nixosModules/common/disable-command-not-found.nix + ../nixosModules/common/network.nix + ../nixosModules/common/sudo-conf.nix + ../nixosModules/common/system-nixconf.nix + + ../nixosModules/extra/leana.nix + + # + # Extern modules + # (sources.disko + "/module.nix") ../disko/hetzner_benchmark/ext4.nix - ../nixosModules/common/system-nixconf.nix - ../nixosModules/extra/leana.nix + # + # home-manager + # + (sources.home-manager + "/nixos") + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + sharedModules = [ { home.stateVersion = lib.mkDefault config.system.stateVersion; } ]; + }; - # TODO: install my user configuration + hm.imports = [ + # + # hostname + # + { _module.args = { inherit hostname; }; } + + # + # home modules + # + ./hetzner_benchmark/home/programs.nix + ./hetzner_benchmark/home/dev.nix + + ../homeModules/common/btop + ../homeModules/common/fish + ../homeModules/common/starship + ../homeModules/common/fzf.nix + ../homeModules/common/tmux + ../homeModules/common/vim + ../homeModules/common/direnv.nix + ../homeModules/common/git.nix + ../homeModules/common/gpg.nix + ../homeModules/common/leana.nix + ../homeModules/common/locale.nix + ../homeModules/common/packages.nix + ../homeModules/common/tealdeer.nix + + ../homeModules/extra/tmux-fish-integration.nix + + # + # Extern modules + # + (sources.agenix + "/modules/age-home.nix") + ]; + } ]; - - boot.loader.grub.enable = true; - - services.openssh.enable = true; - - users.users = { - "root".openssh.authorizedKeys.keys = import ../identities.nix ++ [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFza3UN1gWQqh//FkJBzmssQ4lxHdllQGfqPHzG4LQI8 benchmark-machine" - ]; - }; - - system.stateVersion = "25.05"; } diff --git a/nix/configurations/hetzner_benchmark/home/dev.nix b/nix/configurations/hetzner_benchmark/home/dev.nix new file mode 100644 index 00000000..28a2d449 --- /dev/null +++ b/nix/configurations/hetzner_benchmark/home/dev.nix @@ -0,0 +1,29 @@ +{ pkgs, ... }: +{ + home.packages = [ + pkgs.nil # nix + pkgs.pyright # python + ]; + + programs.git = { + enable = true; + signing.signByDefault = false; # no need to setup the key + }; + + programs.gpg.enable = true; + + nix = { + settings = { + extra-substituters = [ + "https://ghc-nix.cachix.org" + "https://haskell-language-server.cachix.org" + "https://cache.iog.io" + ]; + extra-trusted-public-keys = [ + "ghc-nix.cachix.org-1:ziC/I4BPqeA4VbtOFpFpu6D1t6ymFvRWke/lc2+qjcg=" + "haskell-language-server.cachix.org-1:juFfHrwkOxqIOZShtC4YC1uT1bBcq2RSvC7OMKx0Nz8=" + "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" + ]; + }; + }; +} diff --git a/nix/configurations/hetzner_benchmark/home/programs.nix b/nix/configurations/hetzner_benchmark/home/programs.nix new file mode 100644 index 00000000..f11d501f --- /dev/null +++ b/nix/configurations/hetzner_benchmark/home/programs.nix @@ -0,0 +1,65 @@ +# TODO: remove some packages for this machine +{ + pkgs, + lib, + config, + ... +}: +{ + home.sessionVariables = + let + fishCfg = config.programs.fish; + in + { + "SHELL" = lib.mkIf fishCfg.enable (lib.getExe fishCfg.package); + }; + + home.packages = [ + pkgs.nmap + pkgs.stow + pkgs.zip + pkgs.unzip + pkgs.gnutar + pkgs.p7zip + pkgs.bc + pkgs.dig + pkgs.hutils + pkgs.miniserve + # pkgs.agenix + pkgs.nix-which + + # pretty tui tools + pkgs.du-dust + pkgs.tokei + pkgs.hyperfine + pkgs.watchexec + pkgs.onefetch + pkgs.just + + # nix tools + pkgs.alejandra + pkgs.nurl + pkgs.npins + pkgs.nix-tree + pkgs.nh + ]; + + programs = { + neovim = { + enable = true; + defaultEditor = true; + }; + lazygit.enable = true; + fish.enable = true; + starship.enable = true; + tmux.enable = true; + direnv.enable = true; + ripgrep.enable = true; + + btop.enable = true; + }; + + services = { + gpg-agent.enable = true; + }; +} diff --git a/nix/configurations/hetzner_benchmark/hardware-configuration.nix b/nix/configurations/hetzner_benchmark/nixos/hardware-configuration.nix similarity index 100% rename from nix/configurations/hetzner_benchmark/hardware-configuration.nix rename to nix/configurations/hetzner_benchmark/nixos/hardware-configuration.nix diff --git a/nix/configurations/hetzner_benchmark/nixos/misc.nix b/nix/configurations/hetzner_benchmark/nixos/misc.nix new file mode 100644 index 00000000..d83a0e7b --- /dev/null +++ b/nix/configurations/hetzner_benchmark/nixos/misc.nix @@ -0,0 +1,13 @@ +{ + boot.loader.grub.enable = true; + + services.openssh.enable = true; + + users.users = { + "root".openssh.authorizedKeys.keys = import ../../../identities.nix ++ [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFza3UN1gWQqh//FkJBzmssQ4lxHdllQGfqPHzG4LQI8 benchmark-machine" + ]; + }; + + system.stateVersion = "25.05"; +}