commit 78b46dfe8cf721bc282da5d95d1eef1008b6fbf9 Author: jalr Date: Thu Aug 27 13:03:34 2020 +0200 ich hab nix gemacht diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce3dce1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/configuration.nix diff --git a/autologin.nix b/autologin.nix new file mode 100644 index 0000000..f501412 --- /dev/null +++ b/autologin.nix @@ -0,0 +1,24 @@ +{ config, pkgs, ... }: + +let cfg = config.autologin; +in +{ + options = { + autologin.username = pkgs.lib.mkOption { + description = "Username of user to be automatically logged in at tty1"; + }; + }; + config = { + systemd.services."autovt@tty1".description = "Autologin at the TTY1"; + systemd.services."autovt@tty1".after = [ "systemd-logind.service" ]; # without it user session not started and xorg can't be run from this tty + systemd.services."autovt@tty1".wantedBy = [ "multi-user.target" ]; + systemd.services."autovt@tty1".serviceConfig = { + ExecStart = [ + "" # override upstream default with an empty ExecStart + "@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login --autologin '${cfg.username}' --noclear %I $TERM" + ]; + Restart = "always"; + Type = "idle"; + }; + }; +} diff --git a/fish.nix b/fish.nix new file mode 100644 index 0000000..79c14d9 --- /dev/null +++ b/fish.nix @@ -0,0 +1,9 @@ +{ config, lib, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + unstable.fish + ]; + programs.fish.enable = true; +} + diff --git a/hardware/t520.nix b/hardware/t520.nix new file mode 100644 index 0000000..f08b6ee --- /dev/null +++ b/hardware/t520.nix @@ -0,0 +1,7 @@ +{ config, lib, pkgs, ... }: + +{ + boot.initrd.availableKernelModules = [ + "i915" + ]; +} diff --git a/machines/t520/configuration.nix b/machines/t520/configuration.nix new file mode 100644 index 0000000..89a5977 --- /dev/null +++ b/machines/t520/configuration.nix @@ -0,0 +1,132 @@ +# 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 = + [ + ./hardware-configuration.nix + ../../hardware/t520.nix + ../../sway.nix + ../../unstable.nix + ../../fish.nix + ../../autologin.nix + ]; + + boot.loader.grub = { + enable = true; + version = 2; + device = "/dev/sda"; + }; + + boot.initrd.availableKernelModules = [ + "aes_x86_64" + "aesni_intel" + "cryptd" + ]; + + boot.initrd.luks.devices = { + pvcrypt = { + device = "/dev/disk/by-uuid/3a1a8fec-b028-45c0-8432-7fcbe4615f44"; + preLVM = true; + }; + }; + + networking = { + hostName = "jalr-t520"; + interfaces.eno0.useDHCP = true; + networkmanager.enable = true; + useDHCP = false; + }; + + i18n.defaultLocale = "de_DE.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "neo"; + }; + + time.timeZone = "Europe/Berlin"; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + file + firefox-wayland + fzf + git + htop + jq + neovim + pavucontrol + ripgrep + spice-gtk + virt-manager + ]; + + fonts.fonts = with pkgs; [ + powerline-fonts + roboto + font-awesome + ]; + + environment.variables.EDITOR = "nvim"; + + nixpkgs.overlays = [ + (self: super: { + neovim = super.neovim.override { + viAlias = true; + vimAlias = true; + }; + }) + ]; + + programs.mtr.enable = true; + + programs.gnupg.agent = { + enable = true; + pinentryFlavor = "qt"; + }; + + sound.enable = true; + hardware.pulseaudio.enable = true; + + services.udisks2.enable = true; + + + virtualisation = { + docker.enable = true; + libvirtd.enable = true; + }; + + # https://github.com/NixOS/nixpkgs/issues/60594 + security.wrappers.spice-client-glib-usb-acl-helper.source = "${pkgs.spice-gtk}/bin/spice-client-glib-usb-acl-helper"; + + security.polkit.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.jalr = { + isNormalUser = true; + extraGroups = [ + "dialout" + "docker" + "libvirtd" + "networkmanager" + "video" + "wheel" + ]; # Enable ‘sudo’ for the user. + shell = pkgs.fish; + }; + + autologin.username = "jalr"; + + # 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 = "20.03"; # Did you read the comment? + +} diff --git a/machines/t520/hardware-configuration.nix b/machines/t520/hardware-configuration.nix new file mode 100644 index 0000000..4b57438 --- /dev/null +++ b/machines/t520/hardware-configuration.nix @@ -0,0 +1,30 @@ +# 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, ... }: + +{ + imports = + [ + ]; + + boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "firewire_ohci" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/62e31097-dc6e-4f91-a043-1a6b8a154201"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/c4df83d7-8985-47df-b5cd-bf18bd490a50"; + fsType = "ext2"; + }; + + swapDevices = [ ]; + + nix.maxJobs = lib.mkDefault 4; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +} diff --git a/sway.nix b/sway.nix new file mode 100644 index 0000000..2582eb0 --- /dev/null +++ b/sway.nix @@ -0,0 +1,46 @@ +{ config, lib, pkgs, ... }: + +{ +# environment.systemPackages = with pkgs; [ +# sway +# ]; + +# nixpkgs.overlays = [ +# (self: super: { +# sway = super.neovim.override { +# extraOptions = [ +# "--unsupported-gpu" +# ]; +# }; +# }) +# ]; + programs.sway = { + enable = true; +# extraOptions = [ +# "--unsupported-gpu" +# ]; + extraPackages = with pkgs; [ + alacritty + grim + mako + redshift-wlr + slurp + swayidle + swaylock + waybar + wl-clipboard + wofi + xwayland + ]; + extraSessionCommands = + '' + export XKB_DEFAULT_LAYOUT=de + export XKB_DEFAULT_VARIANT=neo + export QT_QPA_PLATFORM=wayland + export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 + export ELM_ENGINE=wayland_shm + export GDK_BACKEND=wayland + export _JAVA_AWT_WM_NONREPARENTING=1 + ''; + }; +} diff --git a/unstable.nix b/unstable.nix new file mode 100644 index 0000000..744f0ff --- /dev/null +++ b/unstable.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: + +let + unstableTarball = + fetchTarball + https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz; +in +{ + nixpkgs.config = { + packageOverrides = pkgs: { + unstable = import unstableTarball { + config = config.nixpkgs.config; + }; + }; + }; +}