diff --git a/flake.nix b/flake.nix index 25182ef..81bb04e 100644 --- a/flake.nix +++ b/flake.nix @@ -104,6 +104,22 @@ 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 nixosConfigurations."vm" = nixpkgs-unstable.lib.nixosSystem { inherit system; diff --git a/modules/collections/server.nix b/modules/collections/server.nix index 8fc48f5..750c417 100644 --- a/modules/collections/server.nix +++ b/modules/collections/server.nix @@ -34,6 +34,12 @@ custom = { cli-tools.enable = true; tmpfs.enable = true; + static-ip = { + enable = true; + interface = "enp0s31f6"; + ip = "192.168.0.6"; + dns = "127.0.0.1"; + }; nix = { settings.enable = true; }; diff --git a/modules/misc/default.nix b/modules/misc/default.nix index b9a7c18..90c9d33 100644 --- a/modules/misc/default.nix +++ b/modules/misc/default.nix @@ -6,5 +6,6 @@ ./nftables.nix ./cli-tools.nix ./tmpfs.nix + ./static-ip.nix ]; } diff --git a/modules/misc/static-ip.nix b/modules/misc/static-ip.nix new file mode 100644 index 0000000..e67a83e --- /dev/null +++ b/modules/misc/static-ip.nix @@ -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; + }]; + }; + }; + }; + }; +} diff --git a/modules/static-ip.nix b/modules/static-ip.nix deleted file mode 100644 index d650448..0000000 --- a/modules/static-ip.nix +++ /dev/null @@ -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; - }]; - }; - }; - }; -} diff --git a/systems/mini-pc/configuration.nix b/systems/mini-pc/configuration.nix new file mode 100644 index 0000000..f5376f7 --- /dev/null +++ b/systems/mini-pc/configuration.nix @@ -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? +} diff --git a/systems/mini-pc/hardware-configuration.nix b/systems/mini-pc/hardware-configuration.nix new file mode 100644 index 0000000..83d5734 --- /dev/null +++ b/systems/mini-pc/hardware-configuration.nix @@ -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..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; +} diff --git a/users/anon/.gitconfig b/users/anon/.gitconfig new file mode 100644 index 0000000..d671eb3 --- /dev/null +++ b/users/anon/.gitconfig @@ -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 diff --git a/users/anon/.gitconfig-evolit b/users/anon/.gitconfig-evolit new file mode 100644 index 0000000..2bfd72e --- /dev/null +++ b/users/anon/.gitconfig-evolit @@ -0,0 +1,3 @@ +[user] + name = Lukas Kopatz + email = lukas.kopatz@evolit.com diff --git a/users/anon/.gitconfig-github b/users/anon/.gitconfig-github new file mode 100644 index 0000000..bebae03 --- /dev/null +++ b/users/anon/.gitconfig-github @@ -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 diff --git a/users/anon/.gitconfig-gitlabfh b/users/anon/.gitconfig-gitlabfh new file mode 100644 index 0000000..ca25c0b --- /dev/null +++ b/users/anon/.gitconfig-gitlabfh @@ -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 diff --git a/users/anon/.gitconfig-selfhosted b/users/anon/.gitconfig-selfhosted new file mode 100644 index 0000000..5b233ff --- /dev/null +++ b/users/anon/.gitconfig-selfhosted @@ -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 diff --git a/users/anon/home.nix b/users/anon/home.nix index 48a87d7..88001ad 100644 --- a/users/anon/home.nix +++ b/users/anon/home.nix @@ -11,14 +11,6 @@ # changes in each release. stateVersion = "23.05"; }; - programs.kitty = { - enable = true; - settings = { - foreground = "#${config.colorScheme.colors.base05}"; - background = "#${config.colorScheme.colors.base00}"; - # ... - }; - }; imports = [ ../../home-manager/nvim.nix @@ -27,5 +19,31 @@ 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; }