From 8b2ea66132d09c55b62c09ca8079d60158854086 Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Thu, 6 Apr 2023 22:31:45 +0200 Subject: [PATCH] cleanup and restructuring --- flake.lock | 54 ++++++++++----------- flake.nix | 11 ++--- hosts/nuc/default.nix | 5 +- hosts/nuc/hardware-configuration.nix | 7 --- hosts/nuc/modules/networks/default.nix | 3 +- hosts/thinkpad/default.nix | 7 +-- hosts/thinkpad/hardware-configuration.nix | 8 --- hosts/thinkpad/modules/networks/default.nix | 3 -- shared/caches.nix | 7 +++ shared/default.nix | 9 ++++ shared/gpg.nix | 2 +- users/rouven/modules/default.nix | 37 +++++++------- users/rouven/modules/foot/default.nix | 1 - users/rouven/modules/git/default.nix | 5 +- users/rouven/modules/ssh/default.nix | 18 ++++--- users/rouven/modules/theme/default.nix | 4 +- users/rouven/modules/zsh/default.nix | 1 - 17 files changed, 85 insertions(+), 97 deletions(-) create mode 100644 shared/caches.nix create mode 100644 shared/default.nix diff --git a/flake.lock b/flake.lock index a1968f1..ffcda94 100644 --- a/flake.lock +++ b/flake.lock @@ -26,11 +26,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1669854260, - "narHash": "sha256-Z8NAL3g4i5LAhxveNGJhrVDHxIBbUf1lVIy/Thr2RMU=", + "lastModified": 1680308980, + "narHash": "sha256-aUEHV0jk2qIFP3jlsWYWhBbm+w/N9gzH3e4I5DcdB5s=", "owner": "lovesegfault", "repo": "beautysh", - "rev": "d616eb8d9d05ee4fb33de9c5521d99c3f0695d52", + "rev": "9845efc3ea3e86cc0d41465d720a47f521b2799c", "type": "github" }, "original": { @@ -57,11 +57,11 @@ }, "flake-utils": { "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "lastModified": 1680776469, + "narHash": "sha256-3CXUDK/3q/kieWtdsYpDOBJw3Gw4Af6x+2EiSnIkNQw=", "owner": "numtide", "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "rev": "411e8764155aa9354dbcd6d5faaeb97e9e3dce24", "type": "github" }, "original": { @@ -140,11 +140,11 @@ ] }, "locked": { - "lastModified": 1680704389, - "narHash": "sha256-MWtk097S2e1NNvAkMhI/hViUGb/oRd1GhjMSeJzWHYo=", + "lastModified": 1680811741, + "narHash": "sha256-5xwGfqYaefn2JnPWqFsS9cda4ItFb26UR8pqKuGV+JU=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "110f3fd6585c8b92d3bc2dbaabbd2c1a1f76de7a", + "rev": "801a17194c426abe406c2ced47874855e64031e1", "type": "github" }, "original": { @@ -256,11 +256,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1680070330, - "narHash": "sha256-aoT2YZCd9LEtiEULFLIF0ykKydgE72X8gw/k9/pRS5I=", + "lastModified": 1680780295, + "narHash": "sha256-lpPh5EXqnAFyioHfiDxnyIH/gETjjp29p/YJ17MHNUE=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "a6aa8174fa61e55bd7e62d35464d3092aefe0421", + "rev": "148fee317058fad8159619e9d6ccc8c0aa6d0fce", "type": "github" }, "original": { @@ -271,11 +271,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1680487167, - "narHash": "sha256-9FNIqrxDZgSliGGN2XJJSvcDYmQbgOANaZA4UWnTdg4=", + "lastModified": 1680669251, + "narHash": "sha256-AVNE+0u4HlI3v96KCXE9risH7NKqj0QDLLfSckYXIbA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "53dad94e874c9586e71decf82d972dfb640ef044", + "rev": "9c8ff8b426a8b07b9e0a131ac3218740dc85ba1e", "type": "github" }, "original": { @@ -376,11 +376,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1680694805, - "narHash": "sha256-gd5iBzK7nWHhnw8BZ23yJSPTIpJWdIs1TUcLqLQzeVE=", + "lastModified": 1680789869, + "narHash": "sha256-jaBMVG7lVrddtQhKSib/QxoTOGLud7u63GJq7Z+HAoI=", "owner": "pta2002", "repo": "nixvim", - "rev": "d40db46d7fa842db812b1f037200c70447801108", + "rev": "f79dccdc2ea114ac2b5b2bd4d96d1a8311f442f8", "type": "github" }, "original": { @@ -428,11 +428,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1678976941, - "narHash": "sha256-skNr08frCwN9NO+7I77MjOHHAw+L410/37JknNld+W4=", + "lastModified": 1680769543, + "narHash": "sha256-b+aLX7w2cVsHtTTs1wgKsYeNw3SKyMn9Qkb42RK5Yx8=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "32b1dbedfd77892a6e375737ef04d8efba634e9e", + "rev": "bb9e597b33641a8df00f17334db55fa10981c94f", "type": "github" }, "original": { @@ -479,11 +479,11 @@ }, "utils": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", "type": "github" }, "original": { @@ -496,11 +496,11 @@ "flake": false, "locked": { "host": "gitlab.freedesktop.org", - "lastModified": 1680629978, - "narHash": "sha256-2iVx5zqU2CpMgmtVadsHSkhkAsoxAWKQp6RQqt2OgQY=", + "lastModified": 1680810405, + "narHash": "sha256-LmI/4Yp/pOOoI4RxLRx9I90NBsiqdRLVOfbATKlgpkg=", "owner": "wlroots", "repo": "wlroots", - "rev": "835208db98a29431fa687c9506f4b43fe645ff65", + "rev": "7abda952d0000b72d240fe1d41457b9288f0b6e5", "type": "gitlab" }, "original": { diff --git a/flake.nix b/flake.nix index 82772a1..1f61282 100644 --- a/flake.nix +++ b/flake.nix @@ -75,18 +75,15 @@ nixosConfigurations = { thinkpad = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - specialArgs.inputs = attrs; + specialArgs = attrs; modules = [ ./hosts/thinkpad + ./shared ./users/rouven nixos-hardware.nixosModules.common-pc-laptop-ssd home-manager.nixosModules.home-manager sops-nix.nixosModules.sops { - nix.settings = { - substituters = [ "https://hyprland.cachix.org" ]; - trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; - }; home-manager.extraSpecialArgs = attrs; home-manager.users.rouven = { imports = [ @@ -96,9 +93,6 @@ sops-nix.homeManagerModules.sops nix-index-database.hmModules.nix-index ]; - config = { - colorScheme = nix-colors.colorSchemes.dracula; - }; }; } ]; @@ -109,6 +103,7 @@ modules = [ nixos-hardware.nixosModules.intel-nuc-8i7beh ./hosts/nuc + ./shared sops-nix.nixosModules.sops ]; }; diff --git a/hosts/nuc/default.nix b/hosts/nuc/default.nix index a04672c..8e64c7c 100644 --- a/hosts/nuc/default.nix +++ b/hosts/nuc/default.nix @@ -9,8 +9,6 @@ ./modules/nextcloud ./modules/vaultwarden ./modules/nginx - ../../shared/vim.nix - ../../shared/sops.nix ]; boot = { @@ -22,7 +20,6 @@ time.timeZone = "Europe/Berlin"; - # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; console = { font = "Lat2-Terminus16"; @@ -50,7 +47,7 @@ # ../../keys/ssh/rouven-smartcard ]; - system.stateVersion = "22.11"; # Did you read the comment? + system.stateVersion = "22.11"; } diff --git a/hosts/nuc/hardware-configuration.nix b/hosts/nuc/hardware-configuration.nix index c945c2c..8cdcbdf 100644 --- a/hosts/nuc/hardware-configuration.nix +++ b/hosts/nuc/hardware-configuration.nix @@ -51,13 +51,6 @@ swapDevices = [{ device = "/dev/disk/by-uuid/fdedb47c-a370-4005-ac37-1c186e667de0"; }]; - # 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.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/nuc/modules/networks/default.nix b/hosts/nuc/modules/networks/default.nix index 86359f2..bf04a5f 100644 --- a/hosts/nuc/modules/networks/default.nix +++ b/hosts/nuc/modules/networks/default.nix @@ -1,8 +1,7 @@ { config, ... }: { networking = { - hostName = "nuc"; # Define your hostname. - hostId = "795a4952"; + hostName = "nuc"; useNetworkd = true; }; systemd.network = { diff --git a/hosts/thinkpad/default.nix b/hosts/thinkpad/default.nix index ae655c1..0302aff 100755 --- a/hosts/thinkpad/default.nix +++ b/hosts/thinkpad/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, inputs, ... }: +{ config, pkgs, lib, xdph, ... }: { nix.settings.experimental-features = [ "nix-command" "flakes" ]; @@ -8,9 +8,6 @@ ./modules/networks ./modules/greetd ./modules/snapper - ../../shared/vim.nix - ../../shared/sops.nix - ../../shared/gpg.nix ]; # Use the systemd-boot EFI boot loader. @@ -75,7 +72,7 @@ xdg.portal = { enable = true; extraPortals = [ - inputs.xdph.packages.x86_64-linux.default + xdph.packages.x86_64-linux.default ]; }; diff --git a/hosts/thinkpad/hardware-configuration.nix b/hosts/thinkpad/hardware-configuration.nix index 97c0efa..b115b58 100644 --- a/hosts/thinkpad/hardware-configuration.nix +++ b/hosts/thinkpad/hardware-configuration.nix @@ -68,14 +68,6 @@ [{ device = "/dev/disk/by-uuid/1dd20f07-877c-4ee5-bef5-5e8c6ebe7927"; }]; boot.resumeDevice = "/dev/disk/by-uuid/1dd20f07-877c-4ee5-bef5-5e8c6ebe7927"; - # 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.enp0s31f6.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp9s0.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; diff --git a/hosts/thinkpad/modules/networks/default.nix b/hosts/thinkpad/modules/networks/default.nix index ca3ef3d..da7fa4c 100644 --- a/hosts/thinkpad/modules/networks/default.nix +++ b/hosts/thinkpad/modules/networks/default.nix @@ -13,9 +13,6 @@ }; networking = { useNetworkd = true; hostName = "thinkpad"; - hostId = "79353b92"; # Define your hostname. - firewall.allowedTCPPortRanges = [{ from = 1714; to = 1764; }]; # open ports for kde connect - firewall.allowedUDPPortRanges = [{ from = 1714; to = 1764; }]; wireless = { enable = true; userControlled.enable = true; diff --git a/shared/caches.nix b/shared/caches.nix new file mode 100644 index 0000000..98b5154 --- /dev/null +++ b/shared/caches.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + nix.settings = { + substituters = [ "https://hyprland.cachix.org" ]; + trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; + }; +} diff --git a/shared/default.nix b/shared/default.nix new file mode 100644 index 0000000..0f1bb04 --- /dev/null +++ b/shared/default.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + imports = [ + ./caches.nix + ./gpg.nix + ./sops.nix + ./vim.nix + ]; +} diff --git a/shared/gpg.nix b/shared/gpg.nix index 2f557ea..339b674 100644 --- a/shared/gpg.nix +++ b/shared/gpg.nix @@ -1,4 +1,4 @@ -{ config, ... }: +{ ... }: { programs.gnupg.agent = { enable = true; diff --git a/users/rouven/modules/default.nix b/users/rouven/modules/default.nix index b8c3324..4be8b73 100644 --- a/users/rouven/modules/default.nix +++ b/users/rouven/modules/default.nix @@ -1,22 +1,21 @@ { config, pkgs, ... }: { - imports = - [ - ./accounts - ./foot - ./fzf - ./git - ./gpg - ./hyprland - ./neovim - ./qutebrowser - ./sops - ./spotify - ./ssh - ./tmux - ./vifm - ./theme - ./zsh - ./packages.nix - ]; + imports = [ + ./accounts + ./foot + ./fzf + ./git + ./gpg + ./hyprland + ./neovim + ./qutebrowser + ./sops + ./spotify + ./ssh + ./tmux + ./vifm + ./theme + ./zsh + ./packages.nix + ]; } diff --git a/users/rouven/modules/foot/default.nix b/users/rouven/modules/foot/default.nix index 904e74e..fdbf99e 100644 --- a/users/rouven/modules/foot/default.nix +++ b/users/rouven/modules/foot/default.nix @@ -16,7 +16,6 @@ bell = { urgent = true; notify = true; - #command = "${pkgs.notify-desktop}/bin/notify-desktop a"; }; colors = let diff --git a/users/rouven/modules/git/default.nix b/users/rouven/modules/git/default.nix index 9924dbb..e3c6e26 100644 --- a/users/rouven/modules/git/default.nix +++ b/users/rouven/modules/git/default.nix @@ -1,13 +1,12 @@ { config, pkgs, ... }: { - home.packages = with pkgs; [ delta ]; programs.git = { enable = true; userName = "Rouven Seifert"; userEmail = "rouven@rfive.de"; extraConfig = { - core.pager = "delta"; - interactive.diffFilter = "delta --color-only"; + core.pager = "${pkgs.delta}/bin/delta"; + interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only"; delta = { navigate = true; light = false; diff --git a/users/rouven/modules/ssh/default.nix b/users/rouven/modules/ssh/default.nix index e7b7733..e23ef57 100644 --- a/users/rouven/modules/ssh/default.nix +++ b/users/rouven/modules/ssh/default.nix @@ -1,13 +1,16 @@ { config, ... }: +let + git = "~/.ssh/git"; +in { - programs.ssh = { + programs.ssh = rec { enable = true; matchBlocks = { "se-gitlab.inf.tu-dresden.de" = { - identityFile = "~/.ssh/git"; + identityFile = git; }; "github.com" = { - identityFile = "~/.ssh/git"; + identityFile = git; }; "rfive.de" = { user = "debian"; @@ -16,10 +19,11 @@ hostname = "kaki.ifsr.de"; user = "root"; }; - "fsr" = { + "ifsr" = { hostname = "ifsr.de"; user = "rouven.seifert"; }; + "fsr" = matchBlocks."ifsr"; "quitte" = { hostname = "quitte.ifsr.de"; user = "root"; @@ -30,15 +34,15 @@ }; "git@rfive.de" = { match = "Host rfive.de User git"; - identityFile = "~/.ssh/git"; + identityFile = git; }; "git@raspi" = { match = "Host raspi User git"; - identityFile = "~/.ssh/git"; + identityFile = git; }; "git@ifsr.de" = { match = "Host ifsr.de User git"; - identityFile = "~/.ssh/git"; + identityFile = git; }; }; extraConfig = '' diff --git a/users/rouven/modules/theme/default.nix b/users/rouven/modules/theme/default.nix index 8bb6f47..479221e 100644 --- a/users/rouven/modules/theme/default.nix +++ b/users/rouven/modules/theme/default.nix @@ -1,5 +1,7 @@ -{ config, pkgs, ... }: +{ pkgs, nix-colors, ... }: { + colorScheme = nix-colors.colorSchemes.dracula; + # theme hardcoded to dracula, too lazy to make all this base16 home.sessionVariables.GTK_THEME = "Dracula"; gtk = { diff --git a/users/rouven/modules/zsh/default.nix b/users/rouven/modules/zsh/default.nix index 162a574..c3b0738 100644 --- a/users/rouven/modules/zsh/default.nix +++ b/users/rouven/modules/zsh/default.nix @@ -48,7 +48,6 @@ localVariables = { COMPLETION_WAITING_DOTS = "true"; ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=#00bbbb,bold"; - # ZSH_AUTOSUGGEST_STRATEGY="(history completion)"; }; initExtra =