From 8ffb196c0bb54e1c289cd89e4f5902c0a96909e2 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Thu, 22 Jun 2023 11:00:39 -0400 Subject: [PATCH] meta: Don't use variables The previous commit didn't actually work, and I shouldn't need to change the variables often, so it's much simpler to not have them. In the event that I do need to change something, rg and sd should get the job done well. --- default.nix | 10 +--------- home/git.nix | 4 ++-- home/hyprland.nix | 4 ++-- home/kitty.nix | 4 ++-- home/mime-apps.nix | 6 +++--- home/ncmpcpp.nix | 4 ++-- home/xdg-user-dirs.nix | 12 ++++++------ modules/fish.nix | 4 ++-- modules/greetd.nix | 6 ++++-- modules/home-manager.nix | 8 ++++---- modules/networking.nix | 4 ++-- modules/user.nix | 14 ++++++++------ src/main.nix | 4 ++-- 13 files changed, 40 insertions(+), 44 deletions(-) diff --git a/default.nix b/default.nix index 2eccc6f..fd87830 100644 --- a/default.nix +++ b/default.nix @@ -1,4 +1,4 @@ -{ home-manager, stylix, lib, ... }: +{ home-manager, stylix, ... }: { imports = [ @@ -12,12 +12,4 @@ ./specializations ./src/main.nix ]; - - options.variables = { - hostname = lib.mkOption { default = "nixos"; }; - hostHardwareConfiguration = lib.mkOption { default = ./hardware/laptop.nix; }; - stateVersion = lib.mkOption { default = "22.11"; }; - username = lib.mkOption { default = "user"; }; - defaultBrowser = lib.mkOption { default = "librewolf"; }; - }; } diff --git a/home/git.nix b/home/git.nix index 447de7d..cd9da30 100644 --- a/home/git.nix +++ b/home/git.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: +{ pkgs, ... }: { home.packages = with pkgs; [ tig ]; @@ -22,7 +22,7 @@ quotePath = false; }; - web.browser = config.variables.defaultBrowser; + web.browser = "librewolf"; push.default = "simple"; branch.autosetuprebase = "always"; init.defaultBranch = "master"; diff --git a/home/hyprland.nix b/home/hyprland.nix index 4724456..ee21930 100644 --- a/home/hyprland.nix +++ b/home/hyprland.nix @@ -1,9 +1,9 @@ -{ pkgs, config, ... }: +{ pkgs, ... }: { xdg.configFile."hypr/hyprland.conf".text = /* bash */ '' env=XCURSOR_SIZE,24 - env=BROWSER,${config.variables.defaultBrowser} + env=BROWSER,librewolf env=GTK_IM_MODULE,fcitx env=QT_IM_MODULE,fcitx env=XMODIFIERS,@im=fcitx diff --git a/home/kitty.nix b/home/kitty.nix index 0ba935b..e7e104a 100644 --- a/home/kitty.nix +++ b/home/kitty.nix @@ -1,4 +1,4 @@ -{ config, ... }: { +{ programs.kitty = { enable = true; @@ -7,7 +7,7 @@ close_on_child_death = true; cursor_blink_interval = 0; - open_url_with = config.variables.defaultBrowser; + open_url_with = "librewolf"; wayland_titlebar_color = "background"; allow_remote_control = true; diff --git a/home/mime-apps.nix b/home/mime-apps.nix index 6ba401c..6653193 100644 --- a/home/mime-apps.nix +++ b/home/mime-apps.nix @@ -1,4 +1,4 @@ -{ config, ... }: { +{ xdg.mimeApps = { enable = true; @@ -7,8 +7,8 @@ "image/jpeg" = "feh.desktop"; "image/gif" = "org.qutebrowser.qutebrowser.desktop"; "application/x-wine-extension-osz" = "osu-stable.desktop"; - "x-scheme-handler/http" = "${config.variables.defaultBrowser}.desktop"; - "x-scheme-handler/https" = "${config.variables.defaultBrowser}.desktop"; + "x-scheme-handler/http" = "librewolf.desktop"; + "x-scheme-handler/https" = "librewolf.desktop"; }; }; } diff --git a/home/ncmpcpp.nix b/home/ncmpcpp.nix index 7872aa1..a007b40 100644 --- a/home/ncmpcpp.nix +++ b/home/ncmpcpp.nix @@ -1,11 +1,11 @@ -{ pkgs, config, ... }: +{ pkgs, ... }: { home.packages = with pkgs; [ mpc-cli ]; services.mpd = { enable = true; - musicDirectory = "/home/${config.variables.username}/Music"; + musicDirectory = "/home/user/Music"; }; xdg.configFile = { diff --git a/home/xdg-user-dirs.nix b/home/xdg-user-dirs.nix index 3a51040..73886d1 100644 --- a/home/xdg-user-dirs.nix +++ b/home/xdg-user-dirs.nix @@ -1,4 +1,4 @@ -{ config, ... }: { +{ xdg.userDirs = { enable = true; @@ -6,11 +6,11 @@ templates = null; publicShare = null; - download = "/home/${config.variables.username}/ダウンロード"; - documents = "/home/${config.variables.username}/ドキュメント"; - music = "/home/${config.variables.username}/音楽"; - pictures = "/home/${config.variables.username}/画像"; - videos = "/home/${config.variables.username}/ビデオ"; + download = "/home/user/ダウンロード"; + documents = "/home/user/ドキュメント"; + music = "/home/user/音楽"; + pictures = "/home/user/画像"; + videos = "/home/user/ビデオ"; }; xdg.configFile."user-dirs.locale".text = "ja_JP"; diff --git a/modules/fish.nix b/modules/fish.nix index 875b16c..45a60e3 100644 --- a/modules/fish.nix +++ b/modules/fish.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: +{ pkgs, ... }: { users.defaultUserShell = pkgs.fish; @@ -76,7 +76,7 @@ jis = "recode shift_jis..utf8"; # Easily convert shift_jis-encoded files to utf8 utf16 = "recode utf16..utf8"; # Rarely, some files from Japan are utf16 instead jp = "LANG=ja_JP.UTF-8 LC_ALL=ja_JP.UTF-8"; - vm = /* fish */ ''cd ~/nix-config && crystal spec tests/main.cr --progress --verbose --tag local && nixos-rebuild build-vm --flake . --verbose && ./result/bin/run-${config.variables.hostname}-vm && trash put result ${config.variables.hostname}.qcow2''; + vm = /* fish */ ''cd ~/nix-config && crystal spec tests/main.cr --progress --verbose --tag local && nixos-rebuild build-vm --flake . --verbose && ./result/bin/run-nixos-vm && trash put result nixos.qcow2''; sw = "cd ~/nix-config && crystal spec tests/main.cr --progress --verbose --tag local && sudo nixos-rebuild switch --flake . --verbose"; st = "cd ~/nix-config && crystal spec tests/main.cr --progress --verbose --tag local"; tf = "treefmt"; diff --git a/modules/greetd.nix b/modules/greetd.nix index 887b2ce..2b40679 100644 --- a/modules/greetd.nix +++ b/modules/greetd.nix @@ -1,4 +1,6 @@ -{ pkgs, config, ... }: { +{ pkgs, ... }: + +{ services.greetd = { enable = true; restart = false; @@ -9,7 +11,7 @@ }; initial_session = { command = "${pkgs.hyprland}/bin/Hyprland"; - user = config.variables.username; + user = "user"; }; }; }; diff --git a/modules/home-manager.nix b/modules/home-manager.nix index 96edf18..39bca92 100644 --- a/modules/home-manager.nix +++ b/modules/home-manager.nix @@ -1,16 +1,16 @@ -{ config, ... }: { +{ home-manager = { useGlobalPkgs = true; useUserPackages = true; sharedModules = [{ - home.stateVersion = config.variables.stateVersion; + home.stateVersion = "22.11"; }]; users = { user = { - home.username = config.variables.username; - home.homeDirectory = "/home/${config.variables.username}"; + home.username = "user"; + home.homeDirectory = "/home/user"; }; }; }; diff --git a/modules/networking.nix b/modules/networking.nix index 6821cb5..72a262c 100644 --- a/modules/networking.nix +++ b/modules/networking.nix @@ -1,6 +1,6 @@ -{ config, ... }: { +{ networking = { - hostName = config.variables.hostname; + hostName = "nixos"; networkmanager = { enable = true; diff --git a/modules/user.nix b/modules/user.nix index 9615640..03ce787 100644 --- a/modules/user.nix +++ b/modules/user.nix @@ -1,12 +1,14 @@ -{ config, ... }: { +{ users = { mutableUsers = false; - users."${config.variables.username}" = { - isNormalUser = true; - uid = 1000; - password = "user"; - extraGroups = [ "wheel" "networkmanager" ]; + users = { + user = { + isNormalUser = true; + uid = 1000; + password = "user"; + extraGroups = [ "wheel" "networkmanager" ]; + }; }; }; } diff --git a/src/main.nix b/src/main.nix index dbbe0ba..d8a4a70 100644 --- a/src/main.nix +++ b/src/main.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, config, ... }: { +{ pkgs, lib, ... }: { environment.systemPackages = with pkgs; [ grimblast waycorner @@ -88,5 +88,5 @@ ]; environment.defaultPackages = [ ]; - system.stateVersion = config.varables.stateVersion; + system.stateVersion = "22.11"; }