From b1167e8ad49f8b8acff9dc5bbc0df8f95676fee6 Mon Sep 17 00:00:00 2001 From: s-prechtl Date: Thu, 4 Sep 2025 18:43:02 +0200 Subject: [PATCH] feat: use homemanager for saberofxebec --- flake.lock | 159 ++++++++++++++++++++++++++- flake.nix | 5 + hosts/saberofxebec/configuration.nix | 13 ++- hosts/saberofxebec/home.nix | 81 ++++++++++++++ 4 files changed, 256 insertions(+), 2 deletions(-) create mode 100644 hosts/saberofxebec/home.nix diff --git a/flake.lock b/flake.lock index 806a408..1fd89bb 100644 --- a/flake.lock +++ b/flake.lock @@ -21,6 +21,22 @@ "type": "github" } }, + "blobs": { + "flake": false, + "locked": { + "lastModified": 1604995301, + "narHash": "sha256-wcLzgLec6SGJA8fx1OEN1yV/Py5b+U5iyYpksUY/yLw=", + "owner": "simple-nixos-mailserver", + "repo": "blobs", + "rev": "2cccdf1ca48316f2cfd1c9a0017e8de5a7156265", + "type": "gitlab" + }, + "original": { + "owner": "simple-nixos-mailserver", + "repo": "blobs", + "type": "gitlab" + } + }, "brew-src": { "flake": false, "locked": { @@ -76,6 +92,22 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1667395993, @@ -91,6 +123,54 @@ "type": "github" } }, + "git-hooks": { + "inputs": { + "flake-compat": [ + "simple-nixos-mailserver", + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "simple-nixos-mailserver", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1742649964, + "narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "simple-nixos-mailserver", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -112,6 +192,26 @@ "type": "github" } }, + "home-manager-stable": { + "inputs": { + "nixpkgs": [ + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1756991914, + "narHash": "sha256-4ve/3ah5H/SpL2m3qmZ9GU+VinQYp2MN1G7GamimTds=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "b08f8737776f10920c330657bee8b95834b7a70f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "home-manager_2": { "inputs": { "nixpkgs": [ @@ -281,6 +381,22 @@ "type": "github" } }, + "nixpkgs-25_05": { + "locked": { + "lastModified": 1747610100, + "narHash": "sha256-rpR5ZPMkWzcnCcYYo3lScqfuzEw5Uyfh+R0EKZfroAc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ca49c4304acf0973078db0a9d200fd2bae75676d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-regression": { "locked": { "lastModified": 1643052045, @@ -362,6 +478,22 @@ } }, "nixpkgs_5": { + "locked": { + "lastModified": 1747179050, + "narHash": "sha256-qhFMmDkeJX9KJwr5H32f1r7Prs7XbQWtO0h3V0a0rFY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "adaa24fbf46737f3f1b5497bf64bae750f82942e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { "locked": { "lastModified": 1752480373, "narHash": "sha256-JHQbm+OcGp32wAsXTE/FLYGNpb+4GLi5oTvCxwSoBOA=", @@ -381,15 +513,40 @@ "inputs": { "agenix": "agenix", "home-manager": "home-manager_2", + "home-manager-stable": "home-manager-stable", "mms": "mms", "nix-darwin": "nix-darwin", "nix-homebrew": "nix-homebrew", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_4", "nixpkgs-stable": "nixpkgs-stable", + "simple-nixos-mailserver": "simple-nixos-mailserver", "zen-browser": "zen-browser" } }, + "simple-nixos-mailserver": { + "inputs": { + "blobs": "blobs", + "flake-compat": "flake-compat_2", + "git-hooks": "git-hooks", + "nixpkgs": "nixpkgs_5", + "nixpkgs-25_05": "nixpkgs-25_05" + }, + "locked": { + "lastModified": 1755110674, + "narHash": "sha256-PigqTAGkdBYXVFWsJnqcirrLeFqRFN4PFigLA8FzxeI=", + "owner": "simple-nixos-mailserver", + "repo": "nixos-mailserver", + "rev": "f5936247dbdb8501221978562ab0b302dd75456c", + "type": "gitlab" + }, + "original": { + "owner": "simple-nixos-mailserver", + "ref": "nixos-25.05", + "repo": "nixos-mailserver", + "type": "gitlab" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -408,7 +565,7 @@ "zen-browser": { "inputs": { "home-manager": "home-manager_3", - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_6" }, "locked": { "lastModified": 1754739276, diff --git a/flake.nix b/flake.nix index 76aee31..53df7f2 100644 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,10 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + home-manager-stable = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs-stable"; + }; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; }; @@ -49,6 +53,7 @@ specialArgs = {inherit inputs;}; modules = [ ./hosts/saberofxebec/configuration.nix + inputs.home-manager-stable.nixosModules.default inputs.agenix.nixosModules.default ]; }; diff --git a/hosts/saberofxebec/configuration.nix b/hosts/saberofxebec/configuration.nix index 401cc12..323227f 100644 --- a/hosts/saberofxebec/configuration.nix +++ b/hosts/saberofxebec/configuration.nix @@ -28,6 +28,14 @@ in { # Set your time zone. time.timeZone = "Europe/Vienna"; + home-manager = { + backupFileExtension = "backup"; + extraSpecialArgs = {inherit inputs;}; + users = { + "root" = import ./home.nix; + }; + }; + # Configure network proxy if necessary # networking.proxy.default = "http://user:password@proxy:port/"; # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; @@ -43,11 +51,13 @@ in { # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ - vim wget git btop vt-cli + gcc + tmuxinator + fzf ]; users.groups.media = {}; @@ -65,6 +75,7 @@ in { AllowHybridSleep=no AllowSuspendThenHibernate=no ''; + programs.neovim.enable = true; nix.settings.experimental-features = ["nix-command" "flakes"]; diff --git a/hosts/saberofxebec/home.nix b/hosts/saberofxebec/home.nix new file mode 100644 index 0000000..19d690c --- /dev/null +++ b/hosts/saberofxebec/home.nix @@ -0,0 +1,81 @@ +{ + pkgs, + inputs, + ... +}: { + imports = [ + ../../modules/home-manager/alacritty.nix + ../../modules/home-manager/btop.nix + ../../modules/home-manager/fastfetch.nix + ../../modules/home-manager/git.nix + ../../modules/home-manager/tmux.nix + ../../modules/home-manager/zsh.nix + ]; + home.username = "root"; + home.homeDirectory = "/root"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "25.05"; # Please read the comment before changing. + nixpkgs.config.allowUnfree = true; + home.packages = with pkgs; [ + zsh-autosuggestions + zsh-syntax-highlighting + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + (pkgs.writeShellScriptBin "mux-sessionizer" '' + session=$(tmuxinator list | tail -n +2 | tr -s '[:space:]' '\n' | fzf) + + if [ -n "$session" ]; then + tmuxinator start "$session" + else + echo "No session selected" + fi + '') + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. These will be explicitly sourced when using a + # shell provided by Home Manager. If you don't want to manage your shell + # through Home Manager then you have to manually source 'hm-session-vars.sh' + # located at either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/sprechtl/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + EDITOR = "nvim"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +}