From db635147fd239ca3a43b98933886629edde64d3d Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sat, 22 Jun 2024 19:56:27 +0530 Subject: [PATCH] =?UTF-8?q?beautiful=20=F0=9F=98=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/users.nix | 6 ++-- extra-packages/default.nix | 16 ++++----- flake.nix | 66 ++++++++++++++++-------------------- home/default.nix | 43 +++++++++++------------ home/gtk.nix | 3 +- home/programs/git.nix | 4 +-- home/programs/neovim.nix | 4 +-- home/wm/hyprland/default.nix | 9 +++-- home/xdg.nix | 20 +++++++++++ hosts/skipper/network.nix | 2 -- 10 files changed, 92 insertions(+), 81 deletions(-) create mode 100644 home/xdg.nix diff --git a/common/users.nix b/common/users.nix index 0fab721..335e4bf 100644 --- a/common/users.nix +++ b/common/users.nix @@ -1,12 +1,12 @@ -{ config, pkgs, ... }: { +{ config, pkgs, username, ... }: { users.mutableUsers = false; users.users = { root = { hashedPasswordFile = config.sops.secrets."passwd/root".path; }; - adtya = { + ${username} = { uid = 1000; - hashedPasswordFile = config.sops.secrets."passwd/adtya".path; + hashedPasswordFile = config.sops.secrets."passwd/${username}".path; description = "Adithya Nair"; isNormalUser = true; extraGroups = [ "docker" "libvirtd" "networkmanager" "wheel" ]; diff --git a/extra-packages/default.nix b/extra-packages/default.nix index 03ea5f2..ce1bd70 100644 --- a/extra-packages/default.nix +++ b/extra-packages/default.nix @@ -1,9 +1,9 @@ -pkgs: { - dracula-gtk = pkgs.callPackage ./dracula-gtk { }; - misc-scripts = pkgs.callPackage ./scripts/misc { }; - getpaper = pkgs.callPackage ./scripts/getpaper { }; - youtube = pkgs.callPackage ./scripts/youtube { }; - rofi-bluetooth = pkgs.callPackage ./rofi-bluetooth { }; - smc-manjari = pkgs.callPackage ./smc-manjari { }; - smc-nupuram = pkgs.callPackage ./smc-nupuram { }; +final: prev: { + dracula-gtk = prev.callPackage ./dracula-gtk { }; + misc-scripts = prev.callPackage ./scripts/misc { }; + getpaper = prev.callPackage ./scripts/getpaper { }; + youtube = prev.callPackage ./scripts/youtube { }; + rofi-bluetooth = prev.callPackage ./rofi-bluetooth { }; + smc-manjari = prev.callPackage ./smc-manjari { }; + smc-nupuram = prev.callPackage ./smc-nupuram { }; } diff --git a/flake.nix b/flake.nix index e351bd3..0a88899 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "NixOS Configuration"; + description = "NixOS Configuration for Skipper"; nixConfig = { extra-substituters = [ @@ -44,49 +44,43 @@ , } @ inputs: let + lib = nixpkgs.lib; packages = system: import nixpkgs { inherit system; config = { allowUnfree = true; }; - overlays = [ varnam-nix.overlays.default ]; + overlays = [ varnam-nix.overlays.default (import ./extra-packages) ]; }; - extra-packages = system: import ./extra-packages (packages system); in { nixosConfigurations = { - Skipper = nixpkgs.lib.nixosSystem rec { - system = "x86_64-linux"; - pkgs = packages system; - specialArgs = inputs // { extra-packages = (extra-packages system); }; - modules = [ - { - system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; - } - lix-module.nixosModules.default - home-manager.nixosModules.home-manager - impermanence.nixosModules.impermanence - lanzaboote.nixosModules.lanzaboote - sops-nix.nixosModules.sops - - ./common - ./hosts/skipper - - { - home-manager = { - useUserPackages = true; - useGlobalPkgs = true; - extraSpecialArgs = inputs // { extra-packages = (extra-packages system); }; - users.adtya = _: { - imports = [ - impermanence.nixosModules.home-manager.impermanence - ./home - ]; - }; - }; - } - ]; - }; + Skipper = + let + hostname = "Skipper"; + system = "x86_64-linux"; + username = "adtya"; + in + nixpkgs.lib.nixosSystem { + inherit system; + pkgs = packages system; + specialArgs = { inherit inputs username; }; + modules = [ + { + system.configurationRevision = lib.mkIf (self ? rev) self.rev; + networking.hostName = lib.mkDefault hostname; + nixpkgs.hostPlatform = lib.mkDefault system; + } + lix-module.nixosModules.default + sops-nix.nixosModules.sops + lanzaboote.nixosModules.lanzaboote + impermanence.nixosModules.impermanence + home-manager.nixosModules.home-manager + ./common + ./hosts/skipper + ./home + ]; + }; }; } // flake-utils.lib.eachDefaultSystem (system: @@ -105,7 +99,7 @@ age ]; }; - packages.getpaper = (import ./extra-packages pkgs).getpaper; + packages.getpaper = pkgs.callPackage ./extra-packages/scripts/getpaper; } ); } diff --git a/home/default.nix b/home/default.nix index 1ef2a8d..c84f583 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,24 +1,25 @@ -_: { - imports = [ ./programs ./services ./wm ./gtk.nix ./persistence.nix ./qt.nix ./secrets.nix ]; - - home.stateVersion = "23.11"; - - xdg = { - enable = true; - mime.enable = true; - mimeApps = { - enable = true; - defaultApplications = { - "x-scheme-handler/tg" = [ "org.telegram.desktop.desktop" ]; - "x-scheme-handler/magnet" = [ "io.github.TransmissionRemoteGtk.desktop" ]; - }; - }; - userDirs.enable = true; - - desktopEntries."nixos-manual" = { - name = "NixOS Manual"; - exec = "nixos-help"; - noDisplay = true; +{ inputs, username, ... }: { + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + extraSpecialArgs = { inherit inputs username; }; + users.${username} = _: { + imports = [ + inputs.impermanence.nixosModules.home-manager.impermanence + { + imports = [ + ./programs + ./services + ./wm + ./gtk.nix + ./persistence.nix + ./qt.nix + ./secrets.nix + ./xdg.nix + ]; + home.stateVersion = "23.11"; + } + ]; }; }; } diff --git a/home/gtk.nix b/home/gtk.nix index 76a55d9..4d0a5ff 100644 --- a/home/gtk.nix +++ b/home/gtk.nix @@ -1,11 +1,10 @@ { pkgs -, extra-packages , ... }: let gtkTheme = { name = "Dracula"; - package = extra-packages.dracula-gtk; + package = pkgs.dracula-gtk; }; iconTheme = { diff --git a/home/programs/git.nix b/home/programs/git.nix index 11ef9fb..1038192 100644 --- a/home/programs/git.nix +++ b/home/programs/git.nix @@ -1,4 +1,4 @@ -{ osConfig, ... }: { +{ osConfig, username, ... }: { programs.git = { enable = true; delta = { @@ -9,7 +9,7 @@ }; }; userEmail = "adtya@adtya.xyz"; - userName = osConfig.users.users.adtya.description; + userName = osConfig.users.users.${username}.description; signing = { key = "51E4F5AB1B82BE45B4229CC243A5E25AA5A27849"; signByDefault = true; diff --git a/home/programs/neovim.nix b/home/programs/neovim.nix index ef04891..f380a6d 100644 --- a/home/programs/neovim.nix +++ b/home/programs/neovim.nix @@ -1,4 +1,4 @@ -{ pkgs, neovim-nightly, ... }: { +{ pkgs, inputs, ... }: { xdg = { desktopEntries = { "nvim".name = "Neovim wrapper"; @@ -8,7 +8,7 @@ }; programs.neovim = { enable = true; - package = neovim-nightly.packages.${pkgs.system}.default; + package = inputs.neovim-nightly.packages.${pkgs.system}.default; withNodeJs = true; withPython3 = true; withRuby = true; diff --git a/home/wm/hyprland/default.nix b/home/wm/hyprland/default.nix index b8d1ffb..3ced180 100644 --- a/home/wm/hyprland/default.nix +++ b/home/wm/hyprland/default.nix @@ -1,6 +1,5 @@ { config , pkgs -, extra-packages , ... }: let @@ -18,7 +17,7 @@ let wpaperctl = "${config.programs.wpaperd.package}/bin/wpaperctl"; wpctl = "${pkgs.wireplumber}/bin/wpctl"; yazi = "${pkgs.yazi}/bin/yazi"; - youtube = "${extra-packages.youtube}/bin/youtube"; + youtube = "${pkgs.youtube}/bin/youtube"; pictures = "${config.xdg.userDirs.pictures}"; in @@ -173,10 +172,10 @@ in "SUPER,i, exec, ${firefox}" "SUPER_SHIFT,i, exec, ${librewolf}" - "SUPER_SHIFT,escape, exec, ${extra-packages.misc-scripts}/bin/power-menu" - "SUPER,f11, exec, ${extra-packages.misc-scripts}/bin/tmux-sessions" + "SUPER_SHIFT,escape, exec, ${pkgs.misc-scripts}/bin/power-menu" + "SUPER,f11, exec, ${pkgs.misc-scripts}/bin/tmux-sessions" "SUPER_SHIFT,y, exec, ${youtube}" - "SUPER_SHIFT,b, exec, ${extra-packages.rofi-bluetooth}/bin/rofi-bluetooth" + "SUPER_SHIFT,b, exec, ${pkgs.rofi-bluetooth}/bin/rofi-bluetooth" "SUPER,escape, exec, ${loginctl} lock-session" "SUPER_SHIFT,W, exec, ${wpaperctl} next" diff --git a/home/xdg.nix b/home/xdg.nix new file mode 100644 index 0000000..3a9202d --- /dev/null +++ b/home/xdg.nix @@ -0,0 +1,20 @@ +_: { + xdg = { + enable = true; + mime.enable = true; + mimeApps = { + enable = true; + defaultApplications = { + "x-scheme-handler/tg" = [ "org.telegram.desktop.desktop" ]; + "x-scheme-handler/magnet" = [ "io.github.TransmissionRemoteGtk.desktop" ]; + }; + }; + userDirs.enable = true; + + desktopEntries."nixos-manual" = { + name = "NixOS Manual"; + exec = "nixos-help"; + noDisplay = true; + }; + }; +} diff --git a/hosts/skipper/network.nix b/hosts/skipper/network.nix index 9f03dee..410f1db 100644 --- a/hosts/skipper/network.nix +++ b/hosts/skipper/network.nix @@ -16,8 +16,6 @@ ]; }; - hostName = "Skipper"; - nameservers = [ "2620:fe::fe#dns.quad9.net" "9.9.9.9#dns.quad9.net"