From 86e6bd6184f6eb98c8dc0b513223b9781e2f5d8b Mon Sep 17 00:00:00 2001 From: genofire Date: Wed, 13 Oct 2021 00:47:43 +0200 Subject: [PATCH] home->nixos: restructure sway --- home/default.nix | 4 -- home/sway.nix | 35 +++++++------- nixos/configuration.nix | 45 +++++++++--------- nixos/default-hardware.nix | 17 +++++++ nixos/default.nix | 94 ++++++++++++++++++++------------------ nixos/desktop-sway.nix | 55 ++++++++++++++++++++++ nixos/desktop.nix | 35 +++++--------- nixos/genofire.nix | 21 --------- nixos/users.nix | 17 +++++++ 9 files changed, 190 insertions(+), 133 deletions(-) create mode 100644 nixos/default-hardware.nix create mode 100644 nixos/desktop-sway.nix delete mode 100644 nixos/genofire.nix create mode 100644 nixos/users.nix diff --git a/home/default.nix b/home/default.nix index bd9ed22..216cc99 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,9 +1,5 @@ {pkgs, ...}: { - home.sessionVariables = { - EDITOR = "nvim"; - }; - home.packages = with pkgs; [ python3 killall diff --git a/home/sway.nix b/home/sway.nix index 37253f9..6116c03 100644 --- a/home/sway.nix +++ b/home/sway.nix @@ -7,23 +7,23 @@ }; home.packages = with pkgs; [ - sway - alacritty - swayidle - swaylock-effects - mako - wl-clipboard - xdg-desktop-portal-wlr - bemenu - i3blocks - acpi - lm_sensors - kdeconnect - ponymix - brightnessctl - #gammastep - grim - slurp + # sway + # alacritty + # swayidle + # swaylock-effects + # mako + # wl-clipboard + #- xdg-desktop-portal-wlr + # bemenu + # i3blocks + # acpi + # lm_sensors + # ponymix + # brightnessctl + # gammastep + # grim + # slurp + # kdeconnect ]; wayland.windowManager.sway = @@ -316,6 +316,7 @@ }; }; + # use nixos's .... # from programs.sway: # xdg.portal.enable = true; # xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-wlr ]; diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 700b7ac..3087a8a 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -3,33 +3,32 @@ # and in the NixOS manual (accessible by running ‘nixos-help’). { config, pkgs, ... }: - { - imports = - [ - ./hardware-configuration.nix - ./repo/default.nix - ./repo/desktop.nix - ./repo/genofire.nix - ]; + imports = [ + ./hardware-configuration.nix + ./repo/default-hardware.nix + ./repo/desktop-sway.nix + ./repo/users.nix + ]; - system.stateVersion = "21.05"; + system.stateVersion = "21.05"; + system.autoUpgrade.channel = "//nixos.org/channels/nixos-unstable"; - # boot - boot.zfs.requestEncryptionCredentials = []; # list -> default: true - always request for password + # boot + boot.zfs.requestEncryptionCredentials = []; # list -> default: true - always request for password - # -------- - # specifical this maschine: - # -------- + # -------- + # specifical this maschine: + # -------- - networking.hostId = "6a465f93"; # zfs needed - networking.hostName = "fireEmerald"; # Define your hostname. - # cryptsetup - # boot.initrd.luks.enable = true; - boot.initrd.luks.devices = { - "croot" = { - device = "/dev/disk/by-uuid/e75385e9-b733-49d4-91fd-6ac2fa821195" ; - }; - }; + networking.hostId = "/etc/machine-id"; # zfs needed + networking.hostName = "nixos"; # Define your hostname. + # cryptsetup + # boot.initrd.luks.enable = true; + boot.initrd.luks.devices = { + "croot" = { + device = "/dev/disk/by-uuid/e75385e9-b733-49d4-91fd-6ac2fa821195" ; + }; + }; } diff --git a/nixos/default-hardware.nix b/nixos/default-hardware.nix new file mode 100644 index 0000000..8c5acdb --- /dev/null +++ b/nixos/default-hardware.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: +{ + imports = [./default.nix]; + + # boot + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + # zfs + boot.initrd.supportedFilesystems = ["zfs"]; # boot from zfs + boot.supportedFilesystems = [ "zfs" ]; + #boot.kernelParams = [ "nohibernate" ]; + services.zfs.autoScrub.enable = true; + + networking.useNetworkd = true; + networking.useDHCP = false; +} + diff --git a/nixos/default.nix b/nixos/default.nix index 0b6a932..1ac4d6b 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -5,54 +5,60 @@ { config, pkgs, ... }: { - system.autoUpgrade.enable = true; + system.autoUpgrade.enable = true; - # boot - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - # zfs - boot.initrd.supportedFilesystems = ["zfs"]; # boot from zfs - boot.supportedFilesystems = [ "zfs" ]; - #boot.kernelParams = [ "nohibernate" ]; - services.zfs.autoScrub.enable = true; + networking.useDHCP = false; - networking.useNetworkd = true; - networking.useDHCP = false; - services.openssh.enable = true; + services.openssh = { + enable = true; + openFirewall = true; + ports = [ 1512 ]; + startWhenNeeded = true; + }; + users.users.root.openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDZm0TZPBzgXrY1vrLoYviNRb/oGZQDQk9vrppPK84sN55ZPlr9VvP+JYE7Qkx8teRuH9ulxqX40+dxKaiAXMUl4HU57KPLjwCb7SnBNIFTv6ZHGxPS8ZgUzKJr4Agph51oenNEO3RziEqAo3EwK67SGnjeIYQQKcjpfwd08+PYMOjv42zSYQ9umooj5LooOvbxoogZ3VpboXv6DeyA4rev1M9RgnMWaWVF2LxJjQ3jVr7xh1vZktVGKuVk/XXKD6WVAuwmGMVEouQzjtG9kepWd8FUYe+fgj5mtdqfeQP9CypxvOcb7jT20wO1Abpp5udS9iPDQHg+lafklIAeKG3qgxxhBDH3otXtnWcoeXUmDpBI8HU/8d/yrGaLHYRfy3HHiSGFq3lBgoxi83QIOl9ELeKWMJC0fWKBApm0NU0flgwfy2j7GRyXmlM7tVFyuj5RTAZNQfgD9g054di9WbtUs7sm/9r3/rQe2+3neE3Jskt4xvZK0xbc4dZSZGn4E2JDWjENqPBvQ2dU5lsjpUKTZWAnxVGPe//BErsDxNLIHWz8emG71r3Q2yud4KPdAR9CgeC8g1bwlCI6JDFZutKBzIlE3QQ4ryKJEioiUL89xi6G+nNB7W5ABsQN0ZtWvZl8TG4Wh00B+oBXzgRER5Y9SdAYcrwWxlGVxxQyElUNrw==" + ]; - time.timeZone = "Europe/Berlin"; - i18n.defaultLocale = "en_IE.UTF-8"; - console = { - font = "Lat2-Terminus16"; - keyMap = "de"; - }; + time.timeZone = "Europe/Berlin"; + i18n.defaultLocale = "en_IE.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "de"; + }; - environment.systemPackages = with pkgs; [ - python3 - killall - htop - mosh - git - git-lfs - tig - figlet - grml-zsh-config - tmux - neovim - xh - liboping - mtr - home-manager - ]; + environment.systemPackages = with pkgs; [ + python3 + killall + htop + mosh + git + git-lfs + tig + figlet + grml-zsh-config + tmux + neovim + xh + liboping + mtr + home-manager + ]; - # zsh - users.defaultUserShell = pkgs.zsh; - programs.zsh.enable = true; - programs.zsh.autosuggestions.enable = true; - programs.zsh.syntaxHighlighting.enable = true; - programs.zsh.interactiveShellInit = '' - source ${pkgs.grml-zsh-config}/etc/zsh/zshrc - ''; - programs.zsh.promptInit = ""; + programs.neovim = { + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + }; + + # zsh + users.defaultUserShell = pkgs.zsh; + programs.zsh.enable = true; + programs.zsh.autosuggestions.enable = true; + programs.zsh.syntaxHighlighting.enable = true; + programs.zsh.interactiveShellInit = '' + source ${pkgs.grml-zsh-config}/etc/zsh/zshrc + ''; + programs.zsh.promptInit = ""; } diff --git a/nixos/desktop-sway.nix b/nixos/desktop-sway.nix new file mode 100644 index 0000000..e1167b7 --- /dev/null +++ b/nixos/desktop-sway.nix @@ -0,0 +1,55 @@ +{ pkgs, ... }: +{ + imports = [./desktop.nix]; + + services.pipewire = { + enable = true; + alsa.enable = true; + # alsa.support32bit = true; + pulse.enable = true; + }; + + programs.sway = { + enable = true; + wrapperFeatures = { gtk = true; }; + extraPackages = with pkgs; [ + swaylock + alacritty + swayidle + swaylock-effects + mako + bemenu + # - bar + i3blocks + acpi + lm_sensors + # - tools + wl-clipboard + ponymix + brightnessctl + gammastep + grim + slurp + ]; + }; + # done my sway: + # security.pam.services.swaylock = {}; + # hardware.opengl.enable = true; + # fonts.enableDefaultFonts = true; + # programs.dconf.enable = true; # gtk theme + + programs.kdeconnect = { + enable = true; + # openFirewall = true; - by enable + }; + programs.browserpass.enable = true; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + pinentryFlavor = "gnome3"; + }; + + # services.acpid.enable = true; + + +} diff --git a/nixos/desktop.nix b/nixos/desktop.nix index 386b89b..b0d0868 100644 --- a/nixos/desktop.nix +++ b/nixos/desktop.nix @@ -1,30 +1,17 @@ { pkgs, ... }: - { - networking.wireless.iwd.enable = true; - systemd.network.networks.wifi.matchConfig = { Name = "wlan0";}; - systemd.network.networks.wifi.DHCP = "ipv4"; + networking.wireless.iwd.enable = true; + systemd.network.networks.wifi = { + matchConfig.Name = "wlan0"; + DHCP = "ipv4"; + }; - sound.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - #alsa.support32bit = true; - pulse.enable = true; - }; - #services.acpid.enable = true; + sound.enable = true; - environment.systemPackages = with pkgs; [ - iw - ]; - - # allow wayland / sway - hardware.opengl.enable = true; - # gtk config - programs.dconf.enable = true; - fonts.enableDefaultFonts = true; - - # smartcard - services.pcscd.enable = true; + environment.systemPackages = with pkgs; [ + iw + ]; + # smartcard + services.pcscd.enable = true; } diff --git a/nixos/genofire.nix b/nixos/genofire.nix deleted file mode 100644 index 188ba48..0000000 --- a/nixos/genofire.nix +++ /dev/null @@ -1,21 +0,0 @@ -{pkgs, config, ... }: -{ - - services.postgresql = { - enable = true; - package = pkgs.postgresql_14; - dataDir = "/var/lib/postgres/${config.services.postgresql.package.psqlSchema}"; - # dataDir = /var/lib/postgres/data; - }; - - users.users.genofire = { - uid = 1021; - home = "/home/genofire"; - extraGroups = ["wheel"]; - isNormalUser = true; - useDefaultShell = true; - }; - - # wayland - security.pam.services.swaylock = {}; -} diff --git a/nixos/users.nix b/nixos/users.nix new file mode 100644 index 0000000..05ccdd7 --- /dev/null +++ b/nixos/users.nix @@ -0,0 +1,17 @@ +{pkgs, config, ... }: +{ + users.groups.genofire = { + gid = 1021; + }; + users.users.genofire = { + uid = 1021; + home = "/home/genofire"; + group = "genofire"; + extraGroups = ["wheel"]; + isNormalUser = true; + useDefaultShell = true; + openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDZm0TZPBzgXrY1vrLoYviNRb/oGZQDQk9vrppPK84sN55ZPlr9VvP+JYE7Qkx8teRuH9ulxqX40+dxKaiAXMUl4HU57KPLjwCb7SnBNIFTv6ZHGxPS8ZgUzKJr4Agph51oenNEO3RziEqAo3EwK67SGnjeIYQQKcjpfwd08+PYMOjv42zSYQ9umooj5LooOvbxoogZ3VpboXv6DeyA4rev1M9RgnMWaWVF2LxJjQ3jVr7xh1vZktVGKuVk/XXKD6WVAuwmGMVEouQzjtG9kepWd8FUYe+fgj5mtdqfeQP9CypxvOcb7jT20wO1Abpp5udS9iPDQHg+lafklIAeKG3qgxxhBDH3otXtnWcoeXUmDpBI8HU/8d/yrGaLHYRfy3HHiSGFq3lBgoxi83QIOl9ELeKWMJC0fWKBApm0NU0flgwfy2j7GRyXmlM7tVFyuj5RTAZNQfgD9g054di9WbtUs7sm/9r3/rQe2+3neE3Jskt4xvZK0xbc4dZSZGn4E2JDWjENqPBvQ2dU5lsjpUKTZWAnxVGPe//BErsDxNLIHWz8emG71r3Q2yud4KPdAR9CgeC8g1bwlCI6JDFZutKBzIlE3QQ4ryKJEioiUL89xi6G+nNB7W5ABsQN0ZtWvZl8TG4Wh00B+oBXzgRER5Y9SdAYcrwWxlGVxxQyElUNrw==" + ]; + }; +}