From c608eb1ab247e3abf0f800d03de4f8c78b8260e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B6ger?= Date: Sun, 7 Apr 2024 16:28:12 +0200 Subject: [PATCH] initial commit --- flake.lock | 49 ++++++++ flake.nix | 29 +++++ home/jonas.home.nix | 87 ++++++++++++++ hosts/comfy-station/configuration.nix | 112 ++++++++++++++++++ .../comfy-station/hardware-configuration.nix | 43 +++++++ modules/system/boot.nix | 9 ++ modules/system/localization.nix | 21 ++++ modules/system/network.nix | 13 ++ 8 files changed, 363 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 home/jonas.home.nix create mode 100644 hosts/comfy-station/configuration.nix create mode 100644 hosts/comfy-station/hardware-configuration.nix create mode 100644 modules/system/boot.nix create mode 100644 modules/system/localization.nix create mode 100644 modules/system/network.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..421eea6 --- /dev/null +++ b/flake.lock @@ -0,0 +1,49 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1712386041, + "narHash": "sha256-dA82pOMQNnCJMAsPG7AXG35VmCSMZsJHTFlTHizpKWQ=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "d6bb9f934f2870e5cbc5b94c79e9db22246141ff", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.11", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1712310679, + "narHash": "sha256-XgC/a/giEeNkhme/AV1ToipoZ/IVm1MV2ntiK4Tm+pw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "72da83d9515b43550436891f538ff41d68eecc7f", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e9faa13 --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + description = "Nixos config flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; + + home-manager = { + url = "github:nix-community/home-manager/release-23.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = inputs@{ self, nixpkgs, home-manager, ... }: { + nixosConfigurations = { + comfy-station = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = {inherit inputs;}; + modules = [ + ./hosts/comfy-station/configuration.nix + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.jonas = import ./home/jonas.home.nix; + } + ]; + }; + }; + }; +} diff --git a/home/jonas.home.nix b/home/jonas.home.nix new file mode 100644 index 0000000..ff54009 --- /dev/null +++ b/home/jonas.home.nix @@ -0,0 +1,87 @@ +{ config, pkgs, ... }: + +{ + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = "jonas"; + home.homeDirectory = "/home/jonas"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "23.11"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = [ + # # Adds the 'hello' command to your environment. It prints a friendly + # # "Hello, world!" when run. + # pkgs.hello + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + pkgs.firefox + pkgs.vscode + pkgs.chromium + pkgs.nil + pkgs.nixpkgs-fmt + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. If you don't want to manage your shell through Home + # Manager then you have to manually source 'hm-session-vars.sh' located at + # either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/jonas/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + # EDITOR = "emacs"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + # Git + programs.git = { + enable = true; + userName = "Jonas Röger"; + userEmail = "jonas.roeger@tu-dortmund.de"; + }; +} diff --git a/hosts/comfy-station/configuration.nix b/hosts/comfy-station/configuration.nix new file mode 100644 index 0000000..135c9fd --- /dev/null +++ b/hosts/comfy-station/configuration.nix @@ -0,0 +1,112 @@ +# 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, inputs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + inputs.home-manager.nixosModules.home-manager + ../../modules/system/boot.nix + ../../modules/system/network.nix + ../../modules/system/localization.nix + ]; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Enable the KDE Plasma Desktop Environment. + services.xserver.displayManager.sddm.enable = true; + services.xserver.desktopManager.plasma5.enable = true; + + # Configure keymap in X11 + services.xserver = { + layout = "de"; + xkbVariant = ""; + }; + + # Configure console keymap + console.keyMap = "de"; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + # Enable Bluetooth + hardware.bluetooth.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.jonas = { + isNormalUser = true; + description = "Jonas"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ ]; + }; + + # Enable automatic login for the user. + services.xserver.displayManager.autoLogin.enable = true; + services.xserver.displayManager.autoLogin.user = "jonas"; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + ranger + git + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.11"; # Did you read the comment? + +} diff --git a/hosts/comfy-station/hardware-configuration.nix b/hosts/comfy-station/hardware-configuration.nix new file mode 100644 index 0000000..b406715 --- /dev/null +++ b/hosts/comfy-station/hardware-configuration.nix @@ -0,0 +1,43 @@ +# 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 = [ "nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/cf300be9-a784-482b-8741-f226a9cd2605"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-4211196c-3ea0-4b55-bd01-214819f3b644".device = "/dev/disk/by-uuid/4211196c-3ea0-4b55-bd01-214819f3b644"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/D943-77A2"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/f2bec721-6ed8-4982-b59f-ff9b16771f25"; } + ]; + + # 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.enp2s0f0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/system/boot.nix b/modules/system/boot.nix new file mode 100644 index 0000000..b8a0fa4 --- /dev/null +++ b/modules/system/boot.nix @@ -0,0 +1,9 @@ +{config, ...}: +{ + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # initrd + boot.initrd.luks.devices."luks-39ff42bf-5f55-4cce-8928-bdc5b9f4d4d5".device = "/dev/disk/by-uuid/39ff42bf-5f55-4cce-8928-bdc5b9f4d4d5"; +} \ No newline at end of file diff --git a/modules/system/localization.nix b/modules/system/localization.nix new file mode 100644 index 0000000..80ce299 --- /dev/null +++ b/modules/system/localization.nix @@ -0,0 +1,21 @@ +{ config, ... }: + +{ + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; +} \ No newline at end of file diff --git a/modules/system/network.nix b/modules/system/network.nix new file mode 100644 index 0000000..1756aef --- /dev/null +++ b/modules/system/network.nix @@ -0,0 +1,13 @@ +{ config, ... }: + +{ + networking.hostName = "comfy-station"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; +} \ No newline at end of file