diff options
| author | Skullheadx <andrew.montgomery@warpengine.ai> | 2026-06-29 14:38:08 -0400 |
|---|---|---|
| committer | Skullheadx <andrew.montgomery@warpengine.ai> | 2026-06-29 14:38:08 -0400 |
| commit | a00086f63df186181c254a164c77b974cc7a5c7c (patch) | |
| tree | f7d6ac98ab49166250a1635059ae032b3719a5be | |
| parent | remove work legacy, move more pkgs to common for darwin (diff) | |
| download | nixos-a00086f63df186181c254a164c77b974cc7a5c7c.tar.gz nixos-a00086f63df186181c254a164c77b974cc7a5c7c.tar.bz2 nixos-a00086f63df186181c254a164c77b974cc7a5c7c.zip | |
DRY for username
Diffstat (limited to '')
| -rw-r--r-- | audio.nix | 5 | ||||
| -rw-r--r-- | darwin-common.nix | 10 | ||||
| -rw-r--r-- | flake.lock | 33 | ||||
| -rw-r--r-- | flake.nix | 86 | ||||
| -rw-r--r-- | hjem-darwin.nix | 20 | ||||
| -rw-r--r-- | hjem-linux.nix (renamed from hjem.nix) | 7 | ||||
| -rw-r--r-- | home.nix | 96 | ||||
| -rw-r--r-- | hosts/bear/configuration.nix | 9 | ||||
| -rw-r--r-- | hosts/icon/configuration.nix | 3 | ||||
| -rw-r--r-- | hosts/kenosis/configuration.nix | 8 | ||||
| -rw-r--r-- | hosts/kenosis/legacy.nix | 3 | ||||
| -rw-r--r-- | hosts/nepsis/configuration.nix | 2 | ||||
| -rwxr-xr-x | rebuild-darwin.sh (renamed from rebuild.sh) | 0 | ||||
| -rwxr-xr-x | rebuild-linux.sh | 1 | ||||
| -rw-r--r-- | setup-darwin.sh (renamed from setup.sh) | 0 | ||||
| -rw-r--r-- | x11.nix | 7 |
16 files changed, 108 insertions, 182 deletions
@@ -1,6 +1,7 @@ { config, pkgs, + username, ... }: { services.pipewire = { @@ -17,7 +18,7 @@ }; }; - hjem.users.andrew = { + hjem.users.${username} = { files = { ".config/mpd/mpd.conf".source = ./dotfiles/mpd/mpd.conf; @@ -34,7 +35,7 @@ description = "Music Player Daemon"; wantedBy = ["default.target"]; serviceConfig = { - ExecStart = "${pkgs.mpd}/bin/mpd --no-daemon /home/andrew/.config/mpd/mpd.conf"; + ExecStart = "${pkgs.mpd}/bin/mpd --no-daemon /home/${username}/.config/mpd/mpd.conf"; Restart = "on-failure"; }; }; diff --git a/darwin-common.nix b/darwin-common.nix index c03c055..82b4c85 100644 --- a/darwin-common.nix +++ b/darwin-common.nix @@ -2,6 +2,7 @@ config, pkgs, inputs, + username, ... }: { imports = [ @@ -17,7 +18,6 @@ lazygit fastfetch git - senpai wget curl direnv @@ -70,10 +70,10 @@ _FXSortFoldersFirst = true; }; - # screencapture = { - # location = "/Users/andrew/Documents/Screenshots"; - # type = "jpg"; - # }; + screencapture = { + location = "/Users/${username}/Documents/Screenshots"; + type = "jpg"; + }; }; keyboard = { @@ -59,22 +59,19 @@ }, "home-manager": { "inputs": { - "nixpkgs": [ - "nixpkgs" - ] + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1782702263, - "narHash": "sha256-8/MG4Su7PhnynrmsVO61IeAfrK7GuUEu+E+gwbhy1QQ=", + "lastModified": 1782749631, + "narHash": "sha256-slFTUgDy0KTPA4LBAmC/9SngDq8GCPdX+ZR0yQHHN1E=", "owner": "nix-community", "repo": "home-manager", - "rev": "789a35fbdeb3c46b260096daa0b321c11be527ea", + "rev": "5d72a29fc36ac21adae6ae35568fe5ee6700850f", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" + "id": "home-manager", + "type": "indirect" } }, "mnw": { @@ -215,6 +212,22 @@ }, "nixpkgs": { "locked": { + "lastModified": 1782175435, + "narHash": "sha256-EMzXKmnOtBQ2MnvpiNOm7E+kOMvdPrIKaeg52Tip2Uk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "89570f24e97e614aa34aa9ab1c927b6578a43775", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { "lastModified": 1782467914, "narHash": "sha256-pGvFkM8N0xEkIIXDe5YYfbEAvHrk4IxBrjB/x8OomhE=", "owner": "nixos", @@ -263,7 +276,7 @@ "my-st": "my-st", "my-surf": "my-surf", "nix-darwin": "nix-darwin", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nvf": "nvf" } }, @@ -36,10 +36,6 @@ url = "github:notashelf/nvf"; inputs.nixpkgs.follows = "nixpkgs"; }; - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; hjem = { url = "github:feel-co/hjem"; inputs.nixpkgs.follows = "nixpkgs"; @@ -72,81 +68,61 @@ modules = [./nvf/nvf.nix]; }; in { - nixosConfigurations.nepsis = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs nvim;}; - modules = [ - hjem.nixosModules.default - ./linux-common.nix - ./hosts/nepsis/configuration.nix - ./overlays.nix - ]; - }; - nixosConfigurations.icon = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs nvim;}; - modules = [ - hjem.nixosModules.default - ./linux-common.nix - ./hosts/icon/configuration.nix - ./overlays.nix - ]; - }; - packages.${system}.nvim = nvim.neovim; packages.${system-darwin}.nvim = nvim-darwin.neovim; + nixosConfigurations = { + nepsis = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs nvim; + username = "andrew"; + }; + modules = [ + hjem.nixosModules.default + ./linux-common.nix + ./hosts/nepsis/configuration.nix + ./overlays.nix + ]; + }; + icon = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs nvim; + username = "andrew"; + }; + modules = [ + hjem.nixosModules.default + ./linux-common.nix + ./hosts/icon/configuration.nix + ./overlays.nix + ]; + }; + }; + darwinConfigurations = { kenosis = nix-darwin.lib.darwinSystem { specialArgs = { inherit inputs; nvim = nvim-darwin; + username = "andrew"; }; modules = [ ./darwin-common.nix ./hosts/kenosis/configuration.nix ./overlays.nix - home-manager.darwinModules.home-manager - { - users.users.andrew = { - home = /Users/andrew; - }; - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = { - inherit inputs; - }; - home-manager.users.andrew = { - imports = [./home.nix]; - home.username = "andrew"; - home.homeDirectory = /Users/andrew; - }; - } + hjem.darwinModules.default ]; }; bear = nix-darwin.lib.darwinSystem { specialArgs = { inherit inputs; nvim = nvim-darwin; + username = "andrewmontgomery"; }; modules = [ ./darwin-common.nix ./hosts/bear/configuration.nix ./overlays.nix - home-manager.darwinModules.home-manager - { - users.users.andrewmontgomery = { - home = /Users/andrewmontgomery; - }; - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = { - inherit inputs; - }; - home-manager.users.andrewmontgomery = { - imports = [./home.nix]; - home.username = "andrewmontgomery"; - home.homeDirectory = /Users/andrewmontgomery; - }; - } + hjem.darwinModules.default ]; }; }; diff --git a/hjem-darwin.nix b/hjem-darwin.nix new file mode 100644 index 0000000..9090d86 --- /dev/null +++ b/hjem-darwin.nix @@ -0,0 +1,20 @@ +{ + config, + pkgs, + username, + ... +}: { + imports = [ + ]; + + hjem.users.${username} = { + directory = "/home/${username}"; + files = { + ".config/senpai/senpai.scfg".source = ./dotfiles/senpai/senpai.scfg; + }; + + packages = with pkgs; [ + senpai + ]; + }; +} diff --git a/hjem.nix b/hjem-linux.nix index 1724568..df49b12 100644 --- a/hjem.nix +++ b/hjem-linux.nix @@ -1,13 +1,14 @@ { config, pkgs, + username, ... }: { imports = [ ]; # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.andrew = { + users.users.${username} = { isNormalUser = true; extraGroups = [ @@ -17,8 +18,8 @@ packages = with pkgs; []; }; - hjem.users.andrew = { - directory = "/home/andrew"; + hjem.users.${username} = { + directory = "/home/${username}"; files = { ".config/surf/styles/default.css".source = ./dotfiles/surf/styles/default.css; ".config/surf/script.js".source = ./dotfiles/surf/script.js; diff --git a/home.nix b/home.nix deleted file mode 100644 index ce48a66..0000000 --- a/home.nix +++ /dev/null @@ -1,96 +0,0 @@ -{ - config, - pkgs, - ... -}: { - # home.username = username; - # home.homeDirectory = homeDir; - # You can update Home Manager without changing this value. See - # the Home Manager release notes for a list of state version - # changes in each release. - home.stateVersion = "25.11"; - programs.home-manager.enable = true; - - programs.fzf = { - enable = true; - enableZshIntegration = true; - }; - programs.zoxide = { - enable = true; - enableZshIntegration = true; - }; - - home.file = { - ".config/senpai/senpai.scfg".source = ./dotfiles/senpai/senpai.scfg; - }; - - programs.emacs = { - enable = true; - extraConfig = '' - ;;; -*- lexical-binding: t -*- - (custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(custom-enabled-themes '(modus-vivendi-tinted)) - '(rcirc-default-nick "Skullheadx") - '(rcirc-server-alist - '(("irc.libera.chat" :port 6697 :channels ("#emacs" "#lobsters" "#openbsd") - :encryption tls)))) - (custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - ) - (global-set-key (kbd "C-c l") #'org-store-link) - (global-set-key (kbd "C-c a") #'org-agenda) - (global-set-key (kbd "C-c c") #'org-capture) - (setq org-agenda-files '("~/org")) - (setq org-todo-keywords - '((sequence - "TODO(t)" - "NEXT(n)" - "WAIT(w@)" - "|" - "DONE(d)" - "CANCELLED(c@)"))) - (setq org-capture-templates - '(("t" "Todo" entry - (file "~/org/inbox.org") - "* TODO %?\n%U"))) - (setq org-agenda-custom-commands - '(("n" "Next Actions" - todo "NEXT"))) - (setq org-log-done 'time) - - (fido-vertical-mode 1) - - ;; Nix syntax - (use-package nix-mode - :mode "\\.nix\\'") - - ;; LSP - (use-package lsp-mode - :hook (nix-mode . lsp-deferred)) - - ;; Optional UI helpers - (use-package lsp-ui - :commands lsp-ui-mode) - - ;; Formatting - (use-package apheleia - :config - (setf (alist-get 'nix-mode apheleia-mode-alist) 'alejandra) - (apheleia-global-mode +1)) - ''; - extraPackages = epkgs: - with epkgs; [ - nix-mode - lsp-mode - lsp-ui - apheleia - ]; - }; -} diff --git a/hosts/bear/configuration.nix b/hosts/bear/configuration.nix index dc96c7a..7b0eed3 100644 --- a/hosts/bear/configuration.nix +++ b/hosts/bear/configuration.nix @@ -3,15 +3,20 @@ pkgs, inputs, nvim, + username, ... }: { + imports = [ + ./../../hjem-darwin.nix + ]; + networking = { computerName = "bear"; hostName = "bear"; localHostName = "bear"; }; # Primary user for user-specific settings (dock, etc.) - system.primaryUser = "andrewmontgomery"; + system.primaryUser = username; # List packages installed in system profile. To search by name, run: # $ nix-env -qaP | grep wget environment.systemPackages = with pkgs; [ @@ -70,7 +75,7 @@ homebrew = { enable = true; - user = "andrewmontgomery"; + user = username; taps = [ ]; diff --git a/hosts/icon/configuration.nix b/hosts/icon/configuration.nix index 62c5bb8..f47a87f 100644 --- a/hosts/icon/configuration.nix +++ b/hosts/icon/configuration.nix @@ -2,6 +2,7 @@ config, pkgs, inputs, + username, ... }: { imports = [ @@ -63,7 +64,7 @@ # systemd.services.fcgiwrap.serviceConfig.ReadOnlyPaths = ["/srv/git"]; # Define a user account. Don't forget to set a password with ‘passwd’. users.users = { - andrew = { + ${username} = { isNormalUser = true; extraGroups = [ diff --git a/hosts/kenosis/configuration.nix b/hosts/kenosis/configuration.nix index be792e9..68498c5 100644 --- a/hosts/kenosis/configuration.nix +++ b/hosts/kenosis/configuration.nix @@ -3,10 +3,12 @@ pkgs, inputs, nvim, + username, ... }: { imports = [ # ./legacy.nix + ./../../hjem-darwin.nix ]; networking = { @@ -15,7 +17,7 @@ localHostName = "kenosis"; }; # Primary user for user-specific settings (dock, etc.) - system.primaryUser = "andrew"; + system.primaryUser = username; # List packages installed in system profile. To search by name, run: # $ nix-env -qaP | grep wget environment.systemPackages = with pkgs; [ @@ -48,7 +50,7 @@ homebrew = { enable = true; - user = "andrew"; + user = username; taps = [ ]; @@ -61,7 +63,7 @@ "firefox" "chatgpt" "capcut" - "docker" + "docker-desktop" "musicbrainz-picard" "gimp" ]; diff --git a/hosts/kenosis/legacy.nix b/hosts/kenosis/legacy.nix index 5d3ed93..9058952 100644 --- a/hosts/kenosis/legacy.nix +++ b/hosts/kenosis/legacy.nix @@ -1,6 +1,7 @@ { config, pkgs, + username, ... }: { environment.systemPackages = with pkgs; [ @@ -14,7 +15,7 @@ homebrew = { enable = true; - user = "andrew"; + user = username; taps = [ ]; diff --git a/hosts/nepsis/configuration.nix b/hosts/nepsis/configuration.nix index 0cf4c69..c7ef1f0 100644 --- a/hosts/nepsis/configuration.nix +++ b/hosts/nepsis/configuration.nix @@ -8,7 +8,7 @@ ./hardware-configuration.nix ./../../lockscreen.nix ./../../x11.nix - ./../../hjem.nix + ./../../hjem-linux.nix ./../../audio.nix ./../../vim.nix ]; diff --git a/rebuild.sh b/rebuild-darwin.sh index 57cebc7..57cebc7 100755 --- a/rebuild.sh +++ b/rebuild-darwin.sh diff --git a/rebuild-linux.sh b/rebuild-linux.sh new file mode 100755 index 0000000..5d19064 --- /dev/null +++ b/rebuild-linux.sh @@ -0,0 +1 @@ +sudo nixos-rebuild switch --flake . diff --git a/setup.sh b/setup-darwin.sh index 8c4e67c..8c4e67c 100644 --- a/setup.sh +++ b/setup-darwin.sh @@ -1,6 +1,7 @@ { config, pkgs, + username, ... }: { services.displayManager.ly = { @@ -31,7 +32,7 @@ sessionCommands = '' #!/bin/sh ${pkgs.xrandr}/bin/xrandr --output DP-3 --primary --mode 2560x1440 --rate 180 --pos 0x0 --output DP-2 --mode 1920x1080 --rate 160 --pos 2560x360 - ${pkgs.feh}/bin/feh --no-fehbg --bg-fill '/home/andrew/Wallpapers/Daniel_in_the_Lions_Den_by_Briton_Riviere.jpg' + ${pkgs.feh}/bin/feh --no-fehbg --bg-fill '/home/${username}/Wallpapers/Daniel_in_the_Lions_Den_by_Briton_Riviere.jpg' ''; }; xkb = { @@ -53,7 +54,7 @@ enable = true; }; - hjem.users.andrew = { + hjem.users.${username} = { files = { ".config/sxhkd/sxhkdrc".text = builtins.readFile ( pkgs.replaceVars ./dotfiles/sxhkd/sxhkdrc { @@ -101,7 +102,7 @@ environment = { SFEED_PLUMBER = "surf"; - SFEED_URL_FILE = "/home/andrew/.local/share/sfeed/sfeed_read_url_file"; + SFEED_URL_FILE = "/home/${username}/.local/share/sfeed/sfeed_read_url_file"; }; serviceConfig = { |
