diff --git a/apply.sh b/apply.sh new file mode 100755 index 0000000..5811bc5 --- /dev/null +++ b/apply.sh @@ -0,0 +1,7 @@ +name=$1 + +if [ -z "$name" ]; then + sudo nixos-rebuild switch --flake . +else + sudo nixos-rebuild switch --flake ".#$name" +fi diff --git a/flake.lock b/flake.lock index 459f9ca..0c9d554 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1694375657, - "narHash": "sha256-32X8dcty4vPXx+D4yJPQZBo5hJ1NQikALhevGv6elO4=", + "lastModified": 1694643239, + "narHash": "sha256-pv2k/5FvyirDE8g4TNehzwZ0T4UOMMmqWSQnM/luRtE=", "owner": "nix-community", "repo": "home-manager", - "rev": "f7848d3e5f15ed02e3f286029697e41ee31662d7", + "rev": "d9b88b43524db1591fb3d9410a21428198d75d49", "type": "github" }, "original": { @@ -20,11 +20,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1693718952, - "narHash": "sha256-+nGdJlgTk0MPN7NygopipmyylVuAVi7OItIwTlwtGnw=", + "lastModified": 1694710316, + "narHash": "sha256-uRh46iIC86D8BD1wCDA5gRrt+hslUXiD0kx/UjnjBcs=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "793de77d9f83418b428e8ba70d1e42c6507d0d35", + "rev": "570256327eb6ca6f7bebe8d93af49459092a0c43", "type": "github" }, "original": { @@ -35,11 +35,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1693663421, - "narHash": "sha256-ImMIlWE/idjcZAfxKK8sQA7A1Gi/O58u5/CJA+mxvl8=", + "lastModified": 1694422566, + "narHash": "sha256-lHJ+A9esOz9vln/3CJG23FV6Wd2OoOFbDeEs4cMGMqc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e56990880811a451abd32515698c712788be5720", + "rev": "3a2786eea085f040a66ecde1bc3ddc7099f6dbeb", "type": "github" }, "original": { @@ -51,11 +51,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1694183432, - "narHash": "sha256-YyPGNapgZNNj51ylQMw9lAgvxtM2ai1HZVUu3GS8Fng=", + "lastModified": 1694767346, + "narHash": "sha256-5uH27SiVFUwsTsqC5rs3kS7pBoNhtoy9QfTP9BmknGk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "db9208ab987cdeeedf78ad9b4cf3c55f5ebd269b", + "rev": "ace5093e36ab1e95cb9463863491bee90d5a4183", "type": "github" }, "original": { @@ -65,11 +65,27 @@ "type": "github" } }, + "nur": { + "locked": { + "lastModified": 1694814340, + "narHash": "sha256-eo9444JGI/G9jZF+X3xmS5TMRuIT4VYPKyZQ11iF65Q=", + "owner": "nix-community", + "repo": "NUR", + "rev": "9b70f21fd41d3b96580e7ca4a3d1c29e87bdab36", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_2", + "nur": "nur" } } }, diff --git a/flake.nix b/flake.nix index 67f1fe9..589ec52 100644 --- a/flake.nix +++ b/flake.nix @@ -12,13 +12,15 @@ home-manager = { url = "github:nix-community/home-manager"; }; + nur.url = "github:nix-community/NUR"; }; - outputs = { self, nixpkgs, nixos-hardware, home-manager }: { + outputs = { self, nixpkgs, nixos-hardware, home-manager, nur}: { nixosConfigurations = { alice-xps = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ + { nixpkgs.overlays = [ nur.overlay ]; } (import ./machines/xps/configuration.nix) ({ # Let 'nixos-version --json' know about the Git revision diff --git a/update.sh b/update.sh deleted file mode 100755 index 5d19064..0000000 --- a/update.sh +++ /dev/null @@ -1 +0,0 @@ -sudo nixos-rebuild switch --flake . diff --git a/user/default.nix b/user/default.nix index bf15fc2..45f6aac 100644 --- a/user/default.nix +++ b/user/default.nix @@ -1,21 +1,27 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { programs.zsh.enable = true; - users.users.alice = { isNormalUser = true; description = "Alice"; - extraGroups = [ "networkmanager" "wheel" "docker" ]; + extraGroups = [ "networkmanager" "wheel" ]; shell = pkgs.zsh; }; - programs.steam = { - enable = true; - remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play - dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server - }; + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "1password-gui" + "1password" + ]; + + programs._1password.enable = true; + programs._1password-gui = { + enable = true; + # Certain features, including CLI integration and system authentication support, + # require enabling PolKit integration on some desktop environments (e.g. Plasma). + polkitPolicyOwners = [ "alice" ]; + }; home-manager.useGlobalPkgs = true; home-manager.users.alice = import ./home.nix; } diff --git a/user/files/git/config b/user/files/git/config deleted file mode 100644 index 9432b98..0000000 --- a/user/files/git/config +++ /dev/null @@ -1,44 +0,0 @@ -[user] - email = fbtijfdq@void.black - name = Morten Olsen - signingkey = 0x4269430A8C3D09A8 - -[alias] - graph = log --graph --color --pretty=format:"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%C(blue)%x20(%ce)%x20%C(cyan)[gpg:%GK%x20%G?]%C(reset)%n%x20%s%n" - ll = log --oneline - st = status -sb - cm = commit -m - append = commit --amend --no-edit - sobmodules = submodule update --init --recursive - df = difftool -t nvimdiff -y - last = log -1 --stat - br = branch --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate - brr = branch --remote --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate - undo = reset HEAD~1 --mixed - unstage = reset HEAD -- - -[difftool "nvimdiff"] - cmd = "nvim -d \"$LOCAL\" \"$REMOTE\"" -[commit] - gpgsign = true -[url "git@gitlab.com:maersktankers/"] - insteadOf = https://gitlab.com/maersktankers/ -[url "git@github.com:morten-olsen/"] - insteadOf = https://github.com/morten-olsen/ -[url "git@github.com:0north/"] - insteadOf = https://github.com/0north/ -[url "https://"] - insteadOf = git:// - -[core] - pager = delta - hooksPath = /dev/null - -[interactive] - diffFilter = delta --color-only - -[pull] - ff = only -[init] - defaultBranch = main - diff --git a/user/files/kitty/kitty.conf b/user/files/kitty/kitty.conf deleted file mode 100644 index f8b290b..0000000 --- a/user/files/kitty/kitty.conf +++ /dev/null @@ -1,8 +0,0 @@ -font_family FiraCode Nerd Font Reg -bold_font FiraCode Nerd Font Bold -italic_font auto -bold_italic_font auto -disable_ligatures cursor -enable_audio_bell no -bell_on_tab no -background_opacity 0.8 diff --git a/user/home.nix b/user/home.nix index 7ba46d6..3545c62 100644 --- a/user/home.nix +++ b/user/home.nix @@ -1,164 +1,33 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib,... }: -let - astronvim = builtins.fetchGit { - url = "https://github.com/AstroNvim/AstroNvim"; - rev = "dad0bec1fef2833561d04ea446a544fbfde92539"; - }; - astronvimUser = builtins.fetchGit { - url = "https://foo:foo@github.com/morten-olsen/astrovim"; - rev = "44b38567fe3adedd972b5b07f5883d47600a9078"; - }; -in { +{ home.username = "alice"; home.homeDirectory = "/home/alice"; + imports = [ + ./programs/terminal + ./programs/kitty + ./programs/firefox + ]; + home.stateVersion = "23.11"; home.packages = [ - pkgs.kitty - pkgs.eza - pkgs.bat - pkgs.fzf - pkgs.fd - pkgs.curl - pkgs.jq pkgs.spotify pkgs.slack - pkgs.rustup pkgs.bitwarden - pkgs.bitwarden-cli - pkgs.silver-searcher pkgs.ncspot - pkgs.ripgrep - pkgs.thefuck - pkgs.unzip - pkgs.nodejs - pkgs.gnumake - pkgs.gcc pkgs.terraform pkgs.darktable pkgs.rawtherapee pkgs.signal-desktop - pkgs.nodePackages.pnpm - pkgs.nodePackages.yarn - pkgs.nodePackages.yo - pkgs.steam-run - pkgs.python3 pkgs.gimp pkgs.blender - pkgs.gh pkgs.discord - pkgs.binutils - pkgs.pkg-config ]; - programs.firefox.enable = true; - programs.zsh.enable = true; - programs.neovim.enable = true; - programs.tmux = { - enable = true; - extraConfig = builtins.readFile ./files/tmux/config; - }; - programs.git.enable = true; - home.file = { - ".gitconfig".source = ./files/git/config; - ".tmux.conf".source = ./files/tmux/config; - ".zshrc".source = ./files/zsh/config; - ".bashrc".source = ./files/bash/config; - - ".shellrc/rc.d" = { - source = ./files/shell/rc.d; - }; - - ".gnupg" = { - source = ./files/gpg; - recursive = true; - }; - - ".oh-my-zsh" = { - source = builtins.fetchGit { - url = "https://github.com/ohmyzsh/ohmyzsh"; - rev = "b07c8cfe692bc6c7702f0aef5d493b12dfb43392"; - }; - }; - ".config/zsh/custom/plugins/zsh-autosuggestions" = { - source = builtins.fetchGit { - url = "https://github.com/zsh-users/zsh-autosuggestions"; - rev = "c3d4e576c9c86eac62884bd47c01f6faed043fc5"; - }; - }; - ".config/zsh/custom/plugins/zsh-syntax-highlighting" = { - source = builtins.fetchGit { - url = "https://github.com/zsh-users/zsh-syntax-highlighting"; - rev = "143b25eb98aa3227af63bd7f04413e1b3e7888ec"; - }; - }; - - ".config/zsh/custom/zsh-vi-mode" = { - source = builtins.fetchGit { - url = "https://github.com/jeffreytse/zsh-vi-mode"; - rev = "1f28e1886dc8e49f41b817634d5c7695b6abb145"; - }; - }; - - ".config/ssh" = { - source = ./files/ssh; - recursive = true; - }; - - ".config/hypr" = { - source = ./files/hyprland; - recursive = true; - }; - ".config/kitty" = { - source = ./files/kitty; - recursive = true; - }; - ".config/eww" = { - source = ./files/eww; - recursive = true; - }; - ".config/wofi" = { - source = ./files/wofi; - recursive = true; - }; - ".config/nvim" = { - source = astronvim; - recursive = true; - }; - ".config/nvim/lua/user" = { - source = astronvimUser; - }; - }; - - home.sessionVariables = { - # EDITOR = "emacs"; - }; + home.sessionVariables = {}; programs.home-manager.enable = true; - nixpkgs = { - overlays = [ - (import ./overlays/steam.nix) - ]; - - }; - - - systemd.user.services.protonmail-bridge = { - Unit = { - Description = "Protonmail Bridge"; - After = [ "network.target" ]; - }; - - Service = { - Restart = "always"; - ExecStart = "${pkgs.protonmail-bridge}/bin/protonmail-bridge --no-window --noninteractive"; - }; - - Install = { - WantedBy = [ "default.target" ]; - }; - }; } diff --git a/user/programs/firefox/default.nix b/user/programs/firefox/default.nix new file mode 100644 index 0000000..c9859f2 --- /dev/null +++ b/user/programs/firefox/default.nix @@ -0,0 +1,44 @@ +{ config, pkgs, ... }: + +{ + programs.firefox = { + enable = true; + package = pkgs.wrapFirefox pkgs.firefox-unwrapped { + extraPolicies = { + CaptivePortal = false; + DisableFirefoxStudies = true; + DisablePocket = true; + DisableTelemetry = true; + DisableFirefoxAccounts = false; + NoDefaultBookmarks = true; + OfferToSaveLogins = false; + OfferToSaveLoginsDefault = false; + PasswordManagerEnabled = false; + FirefoxHome = { + Search = true; + Pocket = false; + Snippets = false; + TopSites = false; + Highlights = false; + }; + UserMessaging = { + ExtensionRecommendations = false; + SkipOnboarding = true; + }; + }; + }; + profiles = { + default = { + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + duckduckgo-privacy-essentials + react-devtools + reduxdevtools + hoppscotch + bitwarden + grammarly + vimium + ]; + }; + }; + }; +} diff --git a/user/programs/git/default.nix b/user/programs/git/default.nix new file mode 100644 index 0000000..426649e --- /dev/null +++ b/user/programs/git/default.nix @@ -0,0 +1,63 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../gnupg + ]; + programs.git = { + enable = true; + userName = "Morten Olsen"; + userEmail = "fbtijfdq@void.black"; + signing = { + key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFaIAP/ZJ7+7jeR44e1yIJjfQAB6MN351LDKJAXVF62P"; + signByDefault = true; + }; + aliases = { + graph = "log --graph --color --pretty=format:'%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%C(blue)%x20(%ce)%x20%C(cyan)[gpg:%GK%x20%G?]%C(reset)%n%x20%s%n'"; + ll = "log --oneline"; + st = "status -sb"; + cm = "commit -m"; + append = "commit --amend --no-edit"; + sobmodules = "submodule update --init --recursive"; + df = "difftool -t nvimdiff -y"; + last = "log -1 --stat2"; + br = "branch --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate"; + brr = "branch --remote --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate"; + undo = "reset HEAD~1 --mixed"; + unstage = "reset HEAD --"; + }; + extraConfig = { + interactive = { + diffFilter = "delta --color-only"; + }; + init = { + defaultBranch = "main"; + }; + pull = { + ff = "only"; + }; + core = { + pager = "delta"; + }; + difftool = { + nvimdiff = { + cmd = "nvim -d \"$LOCAL\" \"$REMOTE\""; + }; + }; + gpg = { + format = "ssh"; + ssh = { + program = "${pkgs._1password-gui}/share/1password/op-ssh-sign"; + }; + }; + url = { + "git@github.com:morten-olsen/" = { + insteadOf = "https://github.com/morten-olsen/"; + }; + "https://" = { + insteadOf = "git://"; + }; + }; + }; + }; +} diff --git a/user/programs/gnupg/default.nix b/user/programs/gnupg/default.nix new file mode 100644 index 0000000..56869f0 --- /dev/null +++ b/user/programs/gnupg/default.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + home.file = { + ".gnupg" = { + source = ./files; + recursive = true; + }; + }; +} diff --git a/user/files/gpg/gpg-agent.conf b/user/programs/gnupg/files/gpg-agent.conf similarity index 100% rename from user/files/gpg/gpg-agent.conf rename to user/programs/gnupg/files/gpg-agent.conf diff --git a/user/files/gpg/gpg.conf b/user/programs/gnupg/files/gpg.conf similarity index 100% rename from user/files/gpg/gpg.conf rename to user/programs/gnupg/files/gpg.conf diff --git a/user/programs/hyprland/default.nix b/user/programs/hyprland/default.nix new file mode 100644 index 0000000..32b649a --- /dev/null +++ b/user/programs/hyprland/default.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../kitty + ]; + home.packages = [ + pkgs.wl-clipboard + ]; + + home.file = { + ".config/hypr" = { + source = ./files/hypr; + recursive = true; + }; + ".config/eww" = { + source = ./files/eww; + recursive = true; + }; + ".config/wofi" = { + source = ./files/wofi; + recursive = true; + }; + }; +} diff --git a/user/files/eww/eww.scss b/user/programs/hyprland/files/eww/eww.scss similarity index 100% rename from user/files/eww/eww.scss rename to user/programs/hyprland/files/eww/eww.scss diff --git a/user/files/eww/eww.yuck b/user/programs/hyprland/files/eww/eww.yuck similarity index 100% rename from user/files/eww/eww.yuck rename to user/programs/hyprland/files/eww/eww.yuck diff --git a/user/files/eww/scripts/battery b/user/programs/hyprland/files/eww/scripts/battery similarity index 100% rename from user/files/eww/scripts/battery rename to user/programs/hyprland/files/eww/scripts/battery diff --git a/user/files/eww/scripts/change-active-workspace b/user/programs/hyprland/files/eww/scripts/change-active-workspace similarity index 100% rename from user/files/eww/scripts/change-active-workspace rename to user/programs/hyprland/files/eww/scripts/change-active-workspace diff --git a/user/files/eww/scripts/get-active-workspace b/user/programs/hyprland/files/eww/scripts/get-active-workspace similarity index 100% rename from user/files/eww/scripts/get-active-workspace rename to user/programs/hyprland/files/eww/scripts/get-active-workspace diff --git a/user/files/eww/scripts/get-workspaces b/user/programs/hyprland/files/eww/scripts/get-workspaces similarity index 100% rename from user/files/eww/scripts/get-workspaces rename to user/programs/hyprland/files/eww/scripts/get-workspaces diff --git a/user/files/eww/scripts/getram b/user/programs/hyprland/files/eww/scripts/getram similarity index 100% rename from user/files/eww/scripts/getram rename to user/programs/hyprland/files/eww/scripts/getram diff --git a/user/files/eww/scripts/getvol b/user/programs/hyprland/files/eww/scripts/getvol similarity index 100% rename from user/files/eww/scripts/getvol rename to user/programs/hyprland/files/eww/scripts/getvol diff --git a/user/files/eww/scripts/wifi b/user/programs/hyprland/files/eww/scripts/wifi similarity index 100% rename from user/files/eww/scripts/wifi rename to user/programs/hyprland/files/eww/scripts/wifi diff --git a/user/files/hyprland/binds.conf b/user/programs/hyprland/files/hypr/binds.conf similarity index 100% rename from user/files/hyprland/binds.conf rename to user/programs/hyprland/files/hypr/binds.conf diff --git a/user/files/hyprland/exec.conf b/user/programs/hyprland/files/hypr/exec.conf similarity index 100% rename from user/files/hyprland/exec.conf rename to user/programs/hyprland/files/hypr/exec.conf diff --git a/user/files/hyprland/general.conf b/user/programs/hyprland/files/hypr/general.conf similarity index 100% rename from user/files/hyprland/general.conf rename to user/programs/hyprland/files/hypr/general.conf diff --git a/user/files/hyprland/hyprland.conf b/user/programs/hyprland/files/hypr/hyprland.conf similarity index 100% rename from user/files/hyprland/hyprland.conf rename to user/programs/hyprland/files/hypr/hyprland.conf diff --git a/user/files/hyprland/hyprpaper.conf b/user/programs/hyprland/files/hypr/hyprpaper.conf similarity index 100% rename from user/files/hyprland/hyprpaper.conf rename to user/programs/hyprland/files/hypr/hyprpaper.conf diff --git a/user/files/hyprland/input.conf b/user/programs/hyprland/files/hypr/input.conf similarity index 100% rename from user/files/hyprland/input.conf rename to user/programs/hyprland/files/hypr/input.conf diff --git a/user/files/hyprland/scripts/brightness.sh b/user/programs/hyprland/files/hypr/scripts/brightness.sh similarity index 100% rename from user/files/hyprland/scripts/brightness.sh rename to user/programs/hyprland/files/hypr/scripts/brightness.sh diff --git a/user/files/hyprland/scripts/eww.sh b/user/programs/hyprland/files/hypr/scripts/eww.sh similarity index 100% rename from user/files/hyprland/scripts/eww.sh rename to user/programs/hyprland/files/hypr/scripts/eww.sh diff --git a/user/files/hyprland/scripts/idle.sh b/user/programs/hyprland/files/hypr/scripts/idle.sh similarity index 100% rename from user/files/hyprland/scripts/idle.sh rename to user/programs/hyprland/files/hypr/scripts/idle.sh diff --git a/user/files/hyprland/scripts/lock.sh b/user/programs/hyprland/files/hypr/scripts/lock.sh similarity index 100% rename from user/files/hyprland/scripts/lock.sh rename to user/programs/hyprland/files/hypr/scripts/lock.sh diff --git a/user/files/hyprland/scripts/screensharing.sh b/user/programs/hyprland/files/hypr/scripts/screensharing.sh similarity index 100% rename from user/files/hyprland/scripts/screensharing.sh rename to user/programs/hyprland/files/hypr/scripts/screensharing.sh diff --git a/user/files/hyprland/scripts/volume.sh b/user/programs/hyprland/files/hypr/scripts/volume.sh similarity index 100% rename from user/files/hyprland/scripts/volume.sh rename to user/programs/hyprland/files/hypr/scripts/volume.sh diff --git a/user/files/wofi/INSTALL.md b/user/programs/hyprland/files/wofi/INSTALL.md similarity index 100% rename from user/files/wofi/INSTALL.md rename to user/programs/hyprland/files/wofi/INSTALL.md diff --git a/user/files/wofi/LICENSE b/user/programs/hyprland/files/wofi/LICENSE similarity index 100% rename from user/files/wofi/LICENSE rename to user/programs/hyprland/files/wofi/LICENSE diff --git a/user/files/wofi/README.md b/user/programs/hyprland/files/wofi/README.md similarity index 100% rename from user/files/wofi/README.md rename to user/programs/hyprland/files/wofi/README.md diff --git a/user/files/wofi/screenshot.png b/user/programs/hyprland/files/wofi/screenshot.png similarity index 100% rename from user/files/wofi/screenshot.png rename to user/programs/hyprland/files/wofi/screenshot.png diff --git a/user/files/wofi/style.css b/user/programs/hyprland/files/wofi/style.css similarity index 100% rename from user/files/wofi/style.css rename to user/programs/hyprland/files/wofi/style.css diff --git a/user/programs/kitty/default.nix b/user/programs/kitty/default.nix new file mode 100644 index 0000000..1989163 --- /dev/null +++ b/user/programs/kitty/default.nix @@ -0,0 +1,23 @@ +{ config, pkgs, ... }: + +{ + programs.kitty = { + enable = true; + font = { + name = "FiraCode Nerd Font Mono Reg"; + size = 12; + package = (pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; }); + }; + settings = { + # Enable ligatures + draw_ligatures = true; + + italic_font = "auto"; + bold_italic_font = "auto"; + disable_ligatures = "cursor"; + enable_audio_bell = false; + bell_on_tab = false; + background_opacity = "0.8"; + }; + }; +} diff --git a/user/programs/neovim/default.nix b/user/programs/neovim/default.nix new file mode 100644 index 0000000..d1dd0ec --- /dev/null +++ b/user/programs/neovim/default.nix @@ -0,0 +1,23 @@ +{ config, pkgs, ... }: + +let + astronvim = builtins.fetchGit { + url = "https://github.com/AstroNvim/AstroNvim"; + rev = "dad0bec1fef2833561d04ea446a544fbfde92539"; + }; + astronvimUser = builtins.fetchGit { + url = "https://foo:foo@github.com/morten-olsen/astrovim"; + rev = "44b38567fe3adedd972b5b07f5883d47600a9078"; + }; +in { + programs.neovim.enable = true; + home.file = { + ".config/nvim" = { + source = astronvim; + recursive = true; + }; + ".config/nvim/lua/user" = { + source = astronvimUser; + }; + }; +} diff --git a/user/programs/ssh/default.nix b/user/programs/ssh/default.nix new file mode 100644 index 0000000..898ae4b --- /dev/null +++ b/user/programs/ssh/default.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + home.file = { + ".ssh" = { + source = ./files; + recursive = true; + }; + }; +} diff --git a/user/files/ssh/authorized_keys b/user/programs/ssh/files/authorized_keys similarity index 100% rename from user/files/ssh/authorized_keys rename to user/programs/ssh/files/authorized_keys diff --git a/user/files/ssh/config b/user/programs/ssh/files/config similarity index 70% rename from user/files/ssh/config rename to user/programs/ssh/files/config index a419e16..71fe870 100644 --- a/user/files/ssh/config +++ b/user/programs/ssh/files/config @@ -3,5 +3,6 @@ Include ~/.ssh/config.d/* Host * Controlmaster auto Controlpath ${TMPDIR}/ssh-%r@%h:%p + IdentityAgent ~/.1password/agent.sock diff --git a/user/files/ssh/config.d b/user/programs/ssh/files/config.d similarity index 100% rename from user/files/ssh/config.d rename to user/programs/ssh/files/config.d diff --git a/user/files/ssh/known_hosts b/user/programs/ssh/files/known_hosts similarity index 100% rename from user/files/ssh/known_hosts rename to user/programs/ssh/files/known_hosts diff --git a/user/programs/steam/default.nix b/user/programs/steam/default.nix new file mode 100644 index 0000000..98bb4d4 --- /dev/null +++ b/user/programs/steam/default.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: + +{ + home.packages = [ + pkgs.steam-run, + ]; + + programs.steam = { + enable = true; + remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play + dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server + }; + + nixpkgs = { + overlays = [ + (import ./overlays/steam.nix) + ]; + }; +} diff --git a/user/overlays/steam.nix b/user/programs/steam/overlays/steam.nix similarity index 100% rename from user/overlays/steam.nix rename to user/programs/steam/overlays/steam.nix diff --git a/user/programs/terminal/default.nix b/user/programs/terminal/default.nix new file mode 100644 index 0000000..7437343 --- /dev/null +++ b/user/programs/terminal/default.nix @@ -0,0 +1,69 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../tmux + ../ssh + ../git + ../neovim + ]; + home.packages = [ + pkgs.eza + pkgs.bat + pkgs.fzf + pkgs.fd + pkgs.curl + pkgs.jq + pkgs.rustup + pkgs.bitwarden-cli + pkgs.silver-searcher + pkgs.ripgrep + pkgs.thefuck + pkgs.unzip + pkgs.nodejs + pkgs.gnumake + pkgs.gcc + pkgs.nodePackages.pnpm + pkgs.nodePackages.yarn + pkgs.nodePackages.yo + pkgs.python3 + pkgs.gh + pkgs.binutils + pkgs.pkg-config + ]; + + programs.zsh.enable = true; + home.file = { + ".env".source = ./files/env; + ".zshrc".source = ./files/zshrc; + ".bashrc".source = ./files/bashrc; + ".shellrc/rc.d" = { + source = ./files/shell/rc.d; + }; + ".oh-my-zsh" = { + source = builtins.fetchGit { + url = "https://github.com/ohmyzsh/ohmyzsh"; + rev = "b07c8cfe692bc6c7702f0aef5d493b12dfb43392"; + }; + }; + ".config/zsh/custom/plugins/zsh-autosuggestions" = { + source = builtins.fetchGit { + url = "https://github.com/zsh-users/zsh-autosuggestions"; + rev = "c3d4e576c9c86eac62884bd47c01f6faed043fc5"; + }; + }; + ".config/zsh/custom/plugins/zsh-syntax-highlighting" = { + source = builtins.fetchGit { + url = "https://github.com/zsh-users/zsh-syntax-highlighting"; + rev = "143b25eb98aa3227af63bd7f04413e1b3e7888ec"; + }; + }; + + ".config/zsh/custom/zsh-vi-mode" = { + source = builtins.fetchGit { + url = "https://github.com/jeffreytse/zsh-vi-mode"; + rev = "1f28e1886dc8e49f41b817634d5c7695b6abb145"; + }; + }; + }; +} diff --git a/user/files/bash/config b/user/programs/terminal/files/bashrc similarity index 100% rename from user/files/bash/config rename to user/programs/terminal/files/bashrc diff --git a/user/programs/terminal/files/env b/user/programs/terminal/files/env new file mode 100644 index 0000000..af3ce9a --- /dev/null +++ b/user/programs/terminal/files/env @@ -0,0 +1 @@ +GH_TOKEN=op://2w4xwvwqj6r33yqeaxbwanup6q/olcqxk6mox3a5ytzslws3itf3m/GH_TOKEN diff --git a/user/files/shell/rc.d/00-vars.sh b/user/programs/terminal/files/shell/rc.d/00-vars.sh similarity index 100% rename from user/files/shell/rc.d/00-vars.sh rename to user/programs/terminal/files/shell/rc.d/00-vars.sh diff --git a/user/files/shell/rc.d/01-scripts.sh b/user/programs/terminal/files/shell/rc.d/01-scripts.sh similarity index 100% rename from user/files/shell/rc.d/01-scripts.sh rename to user/programs/terminal/files/shell/rc.d/01-scripts.sh diff --git a/user/files/shell/rc.d/02-alias.sh b/user/programs/terminal/files/shell/rc.d/02-alias.sh similarity index 100% rename from user/files/shell/rc.d/02-alias.sh rename to user/programs/terminal/files/shell/rc.d/02-alias.sh diff --git a/user/files/shell/rc.d/02-bat.sh b/user/programs/terminal/files/shell/rc.d/02-bat.sh similarity index 100% rename from user/files/shell/rc.d/02-bat.sh rename to user/programs/terminal/files/shell/rc.d/02-bat.sh diff --git a/user/files/shell/rc.d/03-ssh.sh b/user/programs/terminal/files/shell/rc.d/03-ssh.sh similarity index 100% rename from user/files/shell/rc.d/03-ssh.sh rename to user/programs/terminal/files/shell/rc.d/03-ssh.sh diff --git a/user/files/shell/rc.d/05-npm.sh b/user/programs/terminal/files/shell/rc.d/05-npm.sh similarity index 100% rename from user/files/shell/rc.d/05-npm.sh rename to user/programs/terminal/files/shell/rc.d/05-npm.sh diff --git a/user/files/shell/rc.d/07-fzf.sh b/user/programs/terminal/files/shell/rc.d/07-fzf.sh similarity index 100% rename from user/files/shell/rc.d/07-fzf.sh rename to user/programs/terminal/files/shell/rc.d/07-fzf.sh diff --git a/user/files/shell/rc.d/10-gpg-agent.sh b/user/programs/terminal/files/shell/rc.d/10-gpg-agent.sh similarity index 100% rename from user/files/shell/rc.d/10-gpg-agent.sh rename to user/programs/terminal/files/shell/rc.d/10-gpg-agent.sh diff --git a/user/files/shell/rc.d/10-nvim.sh b/user/programs/terminal/files/shell/rc.d/10-nvim.sh similarity index 100% rename from user/files/shell/rc.d/10-nvim.sh rename to user/programs/terminal/files/shell/rc.d/10-nvim.sh diff --git a/user/programs/terminal/files/shell/rc.d/10-vault.zsh b/user/programs/terminal/files/shell/rc.d/10-vault.zsh new file mode 100644 index 0000000..011a53b --- /dev/null +++ b/user/programs/terminal/files/shell/rc.d/10-vault.zsh @@ -0,0 +1,26 @@ +function _bw_replace_env() { + env | while IFS= read -r line; do + value=${line#*=} + name=${line%%=*} + if [[ $value = bw://* ]]; then; + item=${value:5} + secret=`bw get password $item` + export $name="$secret" + fi + done +} + +function clam-open() { + command=$1 + if [[ -z "$BW_SESSION" ]]; then; + export BW_SESSION=`bw unlock --raw` + fi + _bw_replace_env + if [[ ! -z "$command" ]]; then; + eval $command + fi +} + +function clam-close() { + unset BW_SESSION +} diff --git a/user/files/zsh/config b/user/programs/terminal/files/zshrc similarity index 85% rename from user/files/zsh/config rename to user/programs/terminal/files/zshrc index ba23b06..c8355fa 100644 --- a/user/files/zsh/config +++ b/user/programs/terminal/files/zshrc @@ -1,19 +1,6 @@ -# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. -# Initialization code that may require console input (password prompts, [y/n] -# confirmations, etc.) must go above this block; everything else may go below. -# if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then -# source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" -# fi -# POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true -# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. -# [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh - export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-$HOME/.cache} export ZSH="$HOME/.oh-my-zsh" export ZSH_CUSTOM="$HOME/.config/zsh/custom" - -#ZSH_THEME="powerlevel10k/powerlevel10k" -#ZSH_THEME="spaceship" ZSH_THEME="robbyrussell" plugins=( @@ -45,6 +32,9 @@ if [ -d $HOME/.shellrc/rc.d ]; then for file in $HOME/.shellrc/rc.d/*.sh; do source $file done + for file in $HOME/.shellrc/rc.d/*.zsh; do + source $file + done fi # Load all files from .shell/zshrc.d directory diff --git a/user/programs/tmux/default.nix b/user/programs/tmux/default.nix new file mode 100644 index 0000000..23ba04b --- /dev/null +++ b/user/programs/tmux/default.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + programs.tmux = { + enable = true; + extraConfig = builtins.readFile ./files/config; + }; +} diff --git a/user/files/tmux/config b/user/programs/tmux/files/config similarity index 100% rename from user/files/tmux/config rename to user/programs/tmux/files/config