This commit is contained in:
Rolf Martin Glomsrud 2025-02-12 21:40:04 +01:00
parent 8abd43791d
commit 66060b0b36
2 changed files with 37 additions and 14 deletions

View file

@ -5,10 +5,9 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
imports = imports = [ # Include the results of the hardware scan.
[ # Include the results of the hardware scan. ./hardware-configuration.nix
./hardware-configuration.nix ];
];
# Bootloader. # Bootloader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
@ -23,10 +22,12 @@
# Enable networking # Enable networking
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
networking.defaultGateway.address = "192.168.1.1";
networking.interfaces.enp3s0.ipv4.addresses = [{ networking.interfaces.enp3s0.ipv4.addresses = [{
address = "192.168.1.25"; address = "192.168.1.25";
prefixLength = 24; prefixLength = 24;
}]; }];
networking.nameservers = [ "192.168.1.69" "1.1.1.1" ];
# Set your time zone. # Set your time zone.
time.timeZone = "Europe/Oslo"; time.timeZone = "Europe/Oslo";
@ -47,31 +48,31 @@
isNormalUser = true; isNormalUser = true;
description = "Hephaestus"; description = "Hephaestus";
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; []; packages = with pkgs; [ ];
}; };
users.users.ansible= { users.users.ansible = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "sudo"]; extraGroups = [ "wheel" "networkmanager" "sudo" ];
packages = with pkgs; []; packages = with pkgs; [ ];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAGKOGZKJO31YZem1OTZtIg3fKaatbFmqmRNRD+K9GpX rgl002@student.uib.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAGKOGZKJO31YZem1OTZtIg3fKaatbFmqmRNRD+K9GpX rgl002@student.uib.no"
]; ];
}; };
security.sudo.wheelNeedsPassword = false;
# Allow unfree packages # Allow unfree packages
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget # wget
btop btop
vim vim
tailscale tailscale
python3 python3
]; ];
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# Some programs need SUID wrappers, can be configured further or are # Some programs need SUID wrappers, can be configured further or are
# started in user sessions. # started in user sessions.
@ -86,7 +87,9 @@
services.tailscale.enable = true; services.tailscale.enable = true;
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
services.openssh.enable = true; services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes"; services.openssh.settings.PermitRootLogin = "no";
nix.settings.trusted-users = [ "rolf" ];
# Open ports in the firewall. # Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ];

View file

@ -0,0 +1,20 @@
{
description = "A simple NixOS flake";
inputs = {
# NixOS official package source, using the nixos-24.11 branch here
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
};
outputs = { self, nixpkgs, ... }@inputs: {
# Please replace my-nixos with your hostname
nixosConfigurations.hephaestus = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
# Import the previous configuration.nix we used,
# so the old configuration file still takes effect
./configuration.nix
];
};
};
}