commit 83c6bae43ca23c6ad783d6901f491051f4387f86 Author: Daniel Meiburg Date: Fri Mar 10 09:58:25 2023 +0100 Initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..942ab82 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +Build and switch to new system config with: + +```sh +sudo nixos-rebuild switch --flake .# +``` diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..6b5a938 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,100 @@ +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot/efi"; + + boot.initrd.secrets = { + "/crypto_keyfile.bin" = null; + }; + + boot.initrd.luks.devices."luks-cb43fd1f-80f7-47e1-851a-88a2771eab1b".device = "/dev/disk/by-uuid/cb43fd1f-80f7-47e1-851a-88a2771eab1b"; + boot.initrd.luks.devices."luks-cb43fd1f-80f7-47e1-851a-88a2771eab1b".keyFile = "/crypto_keyfile.bin"; + + hardware.opengl.enable = true; + + networking.hostName = "firefly"; # Define your hostname. + + networking.networkmanager.enable = true; + + time.timeZone = "Europe/Berlin"; + + 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"; + }; + fonts.fonts = with pkgs; [ + noto-fonts + font-awesome + ]; + + security.polkit.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; + }; + + services.openssh = { + enable = true; + settings = { + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + }; + }; + + users.users.dm = { + isNormalUser = true; + description = "Daniel Meiburg"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + ]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJipJtCrYUPokjppDdz97XHo2vEDBUzgvUU33Wst6AWt openpgp:0xF3D173A6" + ]; + }; + + nixpkgs.config.allowUnfree = true; + + environment.systemPackages = with pkgs; [ + ]; + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + defaultEditor = true; + }; + programs.fish.enable = true; + services.getty.autologinUser = "dm"; + + # 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 = "22.11"; # Did you read the comment? + +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c2a7242 --- /dev/null +++ b/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1678006026, + "narHash": "sha256-cGOfrU7JsKHAWXbPVDTOu2yyMb7GeWdUtJQNQSqht+w=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "68ba59578352815ac372b17fb3df9db39afb1407", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1677932085, + "narHash": "sha256-+AB4dYllWig8iO6vAiGGYl0NEgmMgGHpy9gzWJ3322g=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "3c5319ad3aa51551182ac82ea17ab1c6b0f0df89", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + }, + "utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6a42b11 --- /dev/null +++ b/flake.nix @@ -0,0 +1,37 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = github:nixos/nixpkgs/nixos-unstable; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, home-manager }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + lib = nixpkgs.lib; + in { + nixosConfigurations = { + firefly = lib.nixosSystem { + inherit system; + modules = [ + ./configuration.nix + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.dm = { + imports = [ ./home.nix ]; + }; + } + ]; + }; + }; + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..c6b214f --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,44 @@ +# 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" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/5c6e0435-ae74-4cb6-90aa-7b5a008ef37b"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-9ef1fc25-39dd-41dd-8a01-1756b2a653b0".device = "/dev/disk/by-uuid/9ef1fc25-39dd-41dd-8a01-1756b2a653b0"; + + fileSystems."/boot/efi" = + { device = "/dev/disk/by-uuid/CADA-6538"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/47c76843-e4ff-4c21-bc4b-60ef7c356ed4"; } + ]; + + # 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.enp5s0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp6s0f3u4u1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + # high-resolution display + hardware.video.hidpi.enable = lib.mkDefault true; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..fc1f4e4 --- /dev/null +++ b/home.nix @@ -0,0 +1,44 @@ +{ pkgs, ...}: + +{ + home.packages = with pkgs; [ + firefox + gnupg + # All of the below is for sway + wl-clipboard + mako + bemenu + ]; + home.stateVersion = "22.11"; + programs.home-manager = { + enable = true; + }; + programs.git = { + enable = true; + userName = "Daniel Meiburg"; + userEmail = "key@dmeiburg.de"; + signing.key = "782C4A83DD7B9E4A64B12EDEE5827ECFFE0AA4F2"; + signing.signByDefault = true; + }; + programs.kitty = { + enable = true; + theme = "Solarized Dark"; + }; + wayland.windowManager.sway = { + enable = true; + wrapperFeatures.gtk = true; + config = rec { + modifier = "Mod4"; + terminal = "kitty"; + bars = [{ + command = "waybar"; + }]; + output = { + HDMI-A-1 = { + scale = "2"; + }; + }; + }; + }; + programs.waybar.enable = true; +}