init minipc

This commit is contained in:
Kopatz
2024-04-29 21:41:20 +02:00
parent f1ca177e3d
commit 9c1d4fc667
13 changed files with 297 additions and 33 deletions

View File

@@ -104,6 +104,22 @@
home-manager-unstable.nixosModules.home-manager home-manager-unstable.nixosModules.home-manager
]; ];
}; };
nixosConfigurations."mini-pc" = nixpkgs-unstable.lib.nixosSystem {
inherit system;
specialArgs = {
vars = import ./systems/userdata-default.nix;
pkgsVersion = nixpkgs-unstable;
inherit inputs outputs;
};
modules = [
./modules
./users/anon
./systems/mini-pc/configuration.nix
({ config, pkgs, ... }: { nixpkgs.overlays = with outputs.overlays; [additions modifications unstable-packages nur.overlay]; })
agenix.nixosModules.default
home-manager-unstable.nixosModules.home-manager
];
};
# build vm -> nixos-rebuild build-vm --flake .#vm # build vm -> nixos-rebuild build-vm --flake .#vm
nixosConfigurations."vm" = nixpkgs-unstable.lib.nixosSystem { nixosConfigurations."vm" = nixpkgs-unstable.lib.nixosSystem {
inherit system; inherit system;

View File

@@ -34,6 +34,12 @@
custom = { custom = {
cli-tools.enable = true; cli-tools.enable = true;
tmpfs.enable = true; tmpfs.enable = true;
static-ip = {
enable = true;
interface = "enp0s31f6";
ip = "192.168.0.6";
dns = "127.0.0.1";
};
nix = { nix = {
settings.enable = true; settings.enable = true;
}; };

View File

@@ -6,5 +6,6 @@
./nftables.nix ./nftables.nix
./cli-tools.nix ./cli-tools.nix
./tmpfs.nix ./tmpfs.nix
./static-ip.nix
]; ];
} }

View File

@@ -0,0 +1,41 @@
{config, lib, ...}:
with lib;
let
cfg = config.custom.static-ip;
in
{
options.custom.static-ip = {
enable = mkEnableOption "Enables static-ip";
ip = lib.mkOption {
type = types.str;
description = "ipv4 address";
};
dns = lib.mkOption {
default = types.str;
description = "ip of the dns server";
};
interface = lib.mkOption {
default = types.str;
description = "interface to apply the change to";
};
};
config = mkIf cfg.enable {
networking = {
defaultGateway = "192.168.0.1";
useDHCP = false;
nameservers = [
cfg.dns
"1.1.1.1"
];
interfaces = {
${cfg.interface} = {
name = "eth0";
ipv4.addresses = [{
address = cfg.ip;
prefixLength = 24;
}];
};
};
};
};
}

View File

@@ -1,25 +0,0 @@
{ config, vars, ...}:
let
ip = vars.ipv4;
dns = vars.dns;
interface = vars.interface;
in
{
networking = {
defaultGateway = "192.168.0.1";
useDHCP = false;
nameservers = [
dns
"1.1.1.1"
];
interfaces = {
${interface} = {
name = "eth0";
ipv4.addresses = [{
address = ip;
prefixLength = 24;
}];
};
};
};
}

View File

@@ -0,0 +1,72 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
../../modules/services/ssh.nix
];
mainUser.layout = "de";
mainUser.variant = "us";
custom = {
static-ip = {
enable = true;
ip = "192.168.0.11";
interface = "enp5s0f0";
dns = "192.168.0.6";
};
user = {
name = "vm";
layout = "de";
variant = "us";
};
hardware = {
firmware.enable = true;
ssd.enable = true;
};
cli-tools.enable = true;
nix = {
index.enable = true;
ld.enable = true;
settings.enable = true;
};
};
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "mini-pc"; # Define your hostname.
# Set your time zone.
time.timeZone = "Europe/Vienna";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "de_AT.UTF-8";
LC_IDENTIFICATION = "de_AT.UTF-8";
LC_MEASUREMENT = "de_AT.UTF-8";
LC_MONETARY = "de_AT.UTF-8";
LC_NAME = "de_AT.UTF-8";
LC_NUMERIC = "de_AT.UTF-8";
LC_PAPER = "de_AT.UTF-8";
LC_TELEPHONE = "de_AT.UTF-8";
LC_TIME = "de_AT.UTF-8";
};
# Configure console keymap
console.keyMap = "de";
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
system.stateVersion = "23.11"; # Did you read the comment?
}

View File

@@ -0,0 +1,40 @@
# 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 + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "ehci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/193dfa08-bf89-4a8b-a159-592c0a0b4d6e";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/EEC1-C78B";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/af6bf3d5-07a4-4139-9464-ffc1c4e23549"; }
];
# 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.eno1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

38
users/anon/.gitconfig Normal file
View File

@@ -0,0 +1,38 @@
[user]
name = Lukas
email = lukas.kopatz11@gmail.com
[alias]
pushfwl = push --force-with-lease
last = log -1 --stat
now = commit --amend --date="now" --no-edit
cp = cherry-pick
co = checkout
cl = clone
ci = commit
st = status -sb
br = branch
unstage = reset HEAD --
dc = diff --cached
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
[color]
ui = true
[mergetool]
keeptemporaries = false
keepbackups = false
prompt = false
trustexitcode = false
[pull]
ff = true
[includeIf "gitdir/i:~/projects/github/**"]
path = .gitconfig-github
[includeIf "gitdir/i:~/projects/gitea/**"]
path = .gitconfig-gitea
[includeIf "gitdir/i:~/projects/fh/**"]
path = .gitconfig-gitlabfh
[includeIf "gitdir/i:~/projects/evolit/**"]
path = .gitconfig-evolit
[includeIf "gitdir/i:~/projects/selfhosted/**"]
path = .gitconfig-selfhosted

View File

@@ -0,0 +1,3 @@
[user]
name = Lukas Kopatz
email = lukas.kopatz@evolit.com

View File

@@ -0,0 +1,18 @@
[push]
default = upstream
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[mergetool]
keeptemporaries = false
keepbackups = false
prompt = false
trustexitcode = false
[user]
name = Kopatz
email = 7265381+Kropatz@users.noreply.github.com

View File

@@ -0,0 +1,18 @@
[push]
default = upstream
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[mergetool]
keeptemporaries = false
keepbackups = false
prompt = false
trustexitcode = false
[user]
name = Kopatz
email = is221015@fhstp.ac.at

View File

@@ -0,0 +1,18 @@
[push]
default = upstream
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[mergetool]
keeptemporaries = false
keepbackups = false
prompt = false
trustexitcode = false
[user]
name = Kopatz
email = lukas.kopatz11@gmail.com

View File

@@ -10,14 +10,6 @@
# the Home Manager release notes for a list of state version # the Home Manager release notes for a list of state version
# changes in each release. # changes in each release.
stateVersion = "23.05"; stateVersion = "23.05";
};
programs.kitty = {
enable = true;
settings = {
foreground = "#${config.colorScheme.colors.base05}";
background = "#${config.colorScheme.colors.base00}";
# ...
};
}; };
imports = [ imports = [
@@ -27,5 +19,31 @@
inputs.nix-colors.homeManagerModule inputs.nix-colors.homeManagerModule
]; ];
home.file.".gitconfig" = {
enable = true;
source = ./.gitconfig;
target = ".gitconfig";
};
home.file.".gitconfig-github" = {
enable = true;
source = ./.gitconfig-github;
target = ".gitconfig-github";
};
home.file.".gitconfig-selfhosted" = {
enable = true;
source = ./.gitconfig-selfhosted;
target = ".gitconfig-selfhosted";
};
home.file.".gitconfig-gitlabfh" = {
enable = true;
source = ./.gitconfig-gitlabfh;
target = ".gitconfig-gitlabfh";
};
home.file.".gitconfig-evolit" = {
enable = true;
source = ./.gitconfig-evolit;
target = ".gitconfig-evolit";
};
colorScheme = inputs.nix-colors.colorSchemes.tokyo-night-dark; colorScheme = inputs.nix-colors.colorSchemes.tokyo-night-dark;
} }